File tree Expand file tree Collapse file tree 7 files changed +91
-14
lines changed
__fixtures__/issues/98/out
packages/ts-codegen/src/helpers Expand file tree Collapse file tree 7 files changed +91
-14
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface ICosmWasmClient {
103
103
queryContractSmart ( contractAddr : string , query : any ) : Promise < any > ;
104
104
}
105
105
106
- export interface ISigningCosmWasmClient {
106
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
107
107
execute (
108
108
sender : string ,
109
109
contractAddress : string ,
@@ -143,8 +143,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
143
143
} ;
144
144
}
145
145
146
- export function getSigningCosmWasmClient ( signingClient : DirectSigner ) : ISigningCosmWasmClient {
146
+ export function getSigningCosmWasmClient ( signingClient : DirectSigner , rpcEndpoint ?: string ) : ISigningCosmWasmClient {
147
147
return {
148
+ queryContractSmart : async ( contractAddr : string , query : any ) => {
149
+ if ( ! rpcEndpoint ) {
150
+ throw new Error ( 'rpcEndpoint is required for queryContractSmart in signing client' ) ;
151
+ }
152
+ const request : QuerySmartContractStateRequest = {
153
+ address : contractAddr ,
154
+ queryData : toUint8Array ( query )
155
+ } ;
156
+ const response : QuerySmartContractStateResponse = await getSmartContractState ( rpcEndpoint , request ) ;
157
+ return fromUint8Array ( response . data ) ;
158
+ } ,
148
159
execute : async (
149
160
sender : string ,
150
161
contractAddress : string ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export interface ICosmWasmClient {
97
97
queryContractSmart(contractAddr: string, query: any): Promise<any>;
98
98
}
99
99
100
- export interface ISigningCosmWasmClient {
100
+ export interface ISigningCosmWasmClient extends ICosmWasmClient {
101
101
execute(
102
102
sender: string,
103
103
contractAddress: string,
@@ -137,8 +137,19 @@ export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
137
137
};
138
138
}
139
139
140
- export function getSigningCosmWasmClient(signingClient: DirectSigner): ISigningCosmWasmClient {
140
+ export function getSigningCosmWasmClient(signingClient: DirectSigner, rpcEndpoint?: string ): ISigningCosmWasmClient {
141
141
return {
142
+ queryContractSmart: async (contractAddr: string, query: any) => {
143
+ if (!rpcEndpoint) {
144
+ throw new Error('rpcEndpoint is required for queryContractSmart in signing client');
145
+ }
146
+ const request: QuerySmartContractStateRequest = {
147
+ address: contractAddr,
148
+ queryData: toUint8Array(query)
149
+ };
150
+ const response: QuerySmartContractStateResponse = await getSmartContractState(rpcEndpoint, request);
151
+ return fromUint8Array(response.data);
152
+ },
142
153
execute: async (
143
154
sender: string,
144
155
contractAddress: string,
You can’t perform that action at this time.
0 commit comments