File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -524,4 +524,26 @@ mod tests {
524
524
"# ,
525
525
) ;
526
526
}
527
+
528
+ #[ test]
529
+ fn timestamp_works ( ) {
530
+ use cosmwasm_std:: Timestamp ;
531
+
532
+ #[ cw_serde]
533
+ struct A {
534
+ a : Timestamp ,
535
+ b : Option < Timestamp > ,
536
+ }
537
+
538
+ let code = generate_go ( cosmwasm_schema:: schema_for!( A ) ) . unwrap ( ) ;
539
+ assert_code_eq (
540
+ code,
541
+ r#"
542
+ type A struct {
543
+ A Uint64 `json:"a"`
544
+ B *Uint64 `json:"b,omitempty"`
545
+ }
546
+ "# ,
547
+ ) ;
548
+ }
527
549
}
Original file line number Diff line number Diff line change @@ -259,9 +259,9 @@ pub fn documentation(schema: &SchemaObject) -> Option<String> {
259
259
/// If the given type is not a special type, returns `None`.
260
260
pub fn custom_type_of ( ty : & str ) -> Option < & str > {
261
261
match ty {
262
- "Uint64" => Some ( "string " ) ,
262
+ "Uint64" => Some ( "Uint64 " ) ,
263
263
"Uint128" => Some ( "string" ) ,
264
- "Int64" => Some ( "string " ) ,
264
+ "Int64" => Some ( "Int64 " ) ,
265
265
"Int128" => Some ( "string" ) ,
266
266
"Binary" => Some ( "[]byte" ) ,
267
267
"HexBinary" => Some ( "Checksum" ) ,
@@ -270,7 +270,7 @@ pub fn custom_type_of(ty: &str) -> Option<&str> {
270
270
"Decimal256" => Some ( "string" ) ,
271
271
"SignedDecimal" => Some ( "string" ) ,
272
272
"SignedDecimal256" => Some ( "string" ) ,
273
- "Timestamp" => Some ( "uint64 " ) ,
273
+ "Timestamp" => Some ( "Uint64 " ) ,
274
274
_ => None ,
275
275
}
276
276
}
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ type Coin struct {
30
30
type IBCTimeout struct {
31
31
Block * IBCTimeoutBlock `json:"block,omitempty"` // in wasmvm, this does not have "omitempty"
32
32
// Nanoseconds since UNIX epoch
33
- Timestamp uint64 `json:"timestamp,omitempty"` // wasmvm has a "string" in here too
33
+ Timestamp * Uint64 `json:"timestamp,omitempty"`
34
34
}
35
35
36
36
// IBCTimeoutBlock Height is a monotonically increasing data type
You can’t perform that action at this time.
0 commit comments