File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ export { RpcClient } from "./clients/RpcClient";
32
32
export { type Adapter } from "./models/Adapter" ;
33
33
export { MsgExecuteContract } from "./models/MsgExecuteContract" ;
34
34
export { MsgInstantiateContract } from "./models/MsgInstantiateContract" ;
35
+ export { MsgStoreCode } from "./models/MsgStoreCode" ;
36
+ export { MsgMigrateContract } from "./models/MsgMigrateContract" ;
35
37
export { MsgExecuteContractInjective } from "./models/MsgExecuteContractInjective" ;
36
38
export { MsgIbcTransfer } from "./models/MsgIbcTransfer" ;
37
39
export { MsgOsmosisSinglePoolSwap } from "./models/MsgOsmosisSinglePoolSwap" ;
Original file line number Diff line number Diff line change
1
+ import { PlainMessage } from "@bufbuild/protobuf" ;
2
+ import { utf8 } from "cosmes/codec" ;
3
+ import { CosmwasmWasmV1MsgMigrateContract as ProtoMsgMigrateContract } from "cosmes/protobufs" ;
4
+
5
+ import { DeepPrettify , Prettify } from "../../typeutils/prettify" ;
6
+ import { Adapter } from "./Adapter" ;
7
+
8
+ type Data < T > = Prettify <
9
+ DeepPrettify < Omit < PlainMessage < ProtoMsgMigrateContract > , "msg" > > & {
10
+ msg : T ;
11
+ }
12
+ > ;
13
+
14
+ export class MsgMigrateContract < T > implements Adapter {
15
+ private readonly data : Data < T > ;
16
+
17
+ constructor ( data : Data < T > ) {
18
+ this . data = data ;
19
+ }
20
+
21
+ public toProto ( ) {
22
+ return new ProtoMsgMigrateContract ( {
23
+ ...this . data ,
24
+ msg : utf8 . decode ( JSON . stringify ( this . data . msg ) ) ,
25
+ } ) ;
26
+ }
27
+
28
+ public toAmino ( ) {
29
+ return {
30
+ type : "wasm/MsgMigrateContract" ,
31
+ value : {
32
+ sender : this . data . sender ,
33
+ code_id : this . data . codeId ,
34
+ contract : this . data . contract ,
35
+ msg : this . data . msg ,
36
+ }
37
+ } ;
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ import { PlainMessage } from "@bufbuild/protobuf" ;
2
+ import { base64 } from "cosmes/codec" ;
3
+ import { CosmwasmWasmV1MsgStoreCode as ProtoMsgStoreCode } from "cosmes/protobufs" ;
4
+
5
+ import { DeepPrettify } from "../../typeutils/prettify" ;
6
+ import { Adapter } from "./Adapter" ;
7
+
8
+ type Data = DeepPrettify < PlainMessage < ProtoMsgStoreCode > > ;
9
+
10
+ export class MsgStoreCode implements Adapter {
11
+ private readonly data : Data ;
12
+
13
+ constructor ( data : Data ) {
14
+ this . data = data ;
15
+ }
16
+
17
+ public toProto ( ) {
18
+ return new ProtoMsgStoreCode ( {
19
+ ...this . data ,
20
+ } ) ;
21
+ }
22
+
23
+ public toAmino ( ) {
24
+ return {
25
+ type : "wasm/MsgStoreCode" ,
26
+ value : {
27
+ sender : this . data . sender ,
28
+ wasm_byte_code : base64 . encode ( this . data . wasmByteCode ) ,
29
+ instantiate_permission : this . data . instantiatePermission ,
30
+ }
31
+ } ;
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments