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 {
524524 "# ,
525525 ) ;
526526 }
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+ }
527549}
Original file line number Diff line number Diff line change @@ -259,9 +259,9 @@ pub fn documentation(schema: &SchemaObject) -> Option<String> {
259259/// If the given type is not a special type, returns `None`.
260260pub fn custom_type_of ( ty : & str ) -> Option < & str > {
261261 match ty {
262- "Uint64" => Some ( "string " ) ,
262+ "Uint64" => Some ( "Uint64 " ) ,
263263 "Uint128" => Some ( "string" ) ,
264- "Int64" => Some ( "string " ) ,
264+ "Int64" => Some ( "Int64 " ) ,
265265 "Int128" => Some ( "string" ) ,
266266 "Binary" => Some ( "[]byte" ) ,
267267 "HexBinary" => Some ( "Checksum" ) ,
@@ -270,7 +270,7 @@ pub fn custom_type_of(ty: &str) -> Option<&str> {
270270 "Decimal256" => Some ( "string" ) ,
271271 "SignedDecimal" => Some ( "string" ) ,
272272 "SignedDecimal256" => Some ( "string" ) ,
273- "Timestamp" => Some ( "uint64 " ) ,
273+ "Timestamp" => Some ( "Uint64 " ) ,
274274 _ => None ,
275275 }
276276}
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ type Coin struct {
3030type IBCTimeout struct {
3131 Block * IBCTimeoutBlock `json:"block,omitempty"` // in wasmvm, this does not have "omitempty"
3232 // Nanoseconds since UNIX epoch
33- Timestamp uint64 `json:"timestamp,omitempty"` // wasmvm has a "string" in here too
33+ Timestamp * Uint64 `json:"timestamp,omitempty"`
3434}
3535
3636// IBCTimeoutBlock Height is a monotonically increasing data type
You can’t perform that action at this time.
0 commit comments