Skip to content

Commit 3f32736

Browse files
Update client related code
1 parent 125e76b commit 3f32736

File tree

8 files changed

+10899
-7968
lines changed

8 files changed

+10899
-7968
lines changed

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

packages/ast/src/client/client.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const createQueryClass = (
107107
implementsClassName: string,
108108
queryMsg: QueryMsg
109109
) => {
110-
context.addUtil('CosmWasmClient');
110+
context.addUtil('ICosmWasmClient');
111111

112112
const propertyNames = getMessageProperties(queryMsg)
113113
.map((method) => Object.keys(method.properties)?.[0])
@@ -126,7 +126,7 @@ export const createQueryClass = (
126126
// client
127127
classProperty(
128128
'client',
129-
t.tsTypeAnnotation(t.tsTypeReference(t.identifier('CosmWasmClient')))
129+
t.tsTypeAnnotation(t.tsTypeReference(t.identifier('ICosmWasmClient')))
130130
),
131131

132132
// contractAddress
@@ -143,7 +143,7 @@ export const createQueryClass = (
143143
typedIdentifier(
144144
'client',
145145
t.tsTypeAnnotation(
146-
t.tsTypeReference(t.identifier('CosmWasmClient'))
146+
t.tsTypeReference(t.identifier('ICosmWasmClient'))
147147
)
148148
),
149149
typedIdentifier(
@@ -296,7 +296,7 @@ export const createExecuteClass = (
296296
extendsClassName: string | null,
297297
execMsg: ExecuteMsg
298298
) => {
299-
context.addUtil('SigningCosmWasmClient');
299+
context.addUtil('ISigningCosmWasmClient');
300300

301301
const propertyNames = getMessageProperties(execMsg)
302302
.map((method) => Object.keys(method.properties)?.[0])
@@ -371,7 +371,7 @@ export const createExecuteClass = (
371371
classProperty(
372372
'client',
373373
t.tsTypeAnnotation(
374-
t.tsTypeReference(t.identifier('SigningCosmWasmClient'))
374+
t.tsTypeReference(t.identifier('ISigningCosmWasmClient'))
375375
),
376376
false,
377377
false,
@@ -400,7 +400,7 @@ export const createExecuteClass = (
400400
typedIdentifier(
401401
'client',
402402
t.tsTypeAnnotation(
403-
t.tsTypeReference(t.identifier('SigningCosmWasmClient'))
403+
t.tsTypeReference(t.identifier('ISigningCosmWasmClient'))
404404
)
405405
),
406406
typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())),

packages/ast/src/context/imports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ export const UTILS = {
4545
Coin: '@interchainjs/amino',
4646
toUtf8: '@interchainjs/encoding',
4747
StdFee: '@interchainjs/amino',
48-
CosmWasmClient: '__contractContextBase__',
48+
ICosmWasmClient: '__contractContextBase__',
4949
ExecuteResult: '@interchainjs/cosmos/signing-client',
50-
SigningCosmWasmClient: '__contractContextBase__',
50+
ISigningCosmWasmClient: '__contractContextBase__',
5151

5252
// react-query
5353
useQuery: makeReactQuerySwitch('useQuery'),

packages/ast/src/provider/provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ export const createGettingProviders = (providerInfos: {
224224
identifier(
225225
'cosmWasmClient?',
226226
t.tsTypeAnnotation(
227-
t.tsTypeReference(t.identifier('CosmWasmClient'))
227+
t.tsTypeReference(t.identifier('ICosmWasmClient'))
228228
)
229229
),
230230
identifier(
231231
'signingCosmWasmClient?',
232232
t.tsTypeAnnotation(
233-
t.tsTypeReference(t.identifier('SigningCosmWasmClient'))
233+
t.tsTypeReference(t.identifier('ISigningCosmWasmClient'))
234234
)
235235
),
236236
],

packages/ts-codegen/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,25 @@
3636
"bugs": {
3737
"url": "https://github.com/hyperweb-io/ts-codegen/issues"
3838
},
39-
"devDependencies": {
40-
},
4139
"dependencies": {
4240
"@babel/generator": "7.24.4",
4341
"@babel/traverse": "7.24.1",
4442
"@babel/types": "7.24.0",
4543
"@cosmwasm/ts-codegen-ast": "^1.8.1",
4644
"@cosmwasm/ts-codegen-types": "^1.3.1",
47-
"@pyramation/json-schema-to-typescript": " 11.0.4",
48-
"@types/rimraf": "3.0.2",
49-
"@types/shelljs": "0.8.15",
5045
"@interchainjs/amino": "^1.11.18",
5146
"@interchainjs/cosmos": "^1.11.18",
5247
"@interchainjs/types": "^1.11.18",
53-
"interchainjs": "^1.11.18",
48+
"@pyramation/json-schema-to-typescript": " 11.0.4",
49+
"@types/rimraf": "3.0.2",
50+
"@types/shelljs": "0.8.15",
5451
"case": "1.6.3",
5552
"dargs": "7.0.0",
5653
"deepmerge": "4.2.2",
5754
"fuzzy": "0.1.3",
5855
"glob": "^10",
5956
"inquirerer": "0.1.3",
57+
"interchainjs": "^1.11.18",
6058
"minimist": "1.2.6",
6159
"mkdirp": "1.0.4",
6260
"nested-obj": "0.0.1",

packages/ts-codegen/src/helpers/contractContextBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ICosmWasmClient {
1212
queryContractSmart(contractAddr: string, query: any): Promise<any>;
1313
}
1414
15-
export interface ISigningCosmWasmClient {
15+
export interface ISigningCosmWasmClient extends ICosmWasmClient {
1616
execute(sender: string, contractAddress: string, msg: any, fee?: any, memo?: string, funds?: any[]): Promise<any>;
1717
}
1818

packages/ts-codegen/src/helpers/contractContextBaseShortHandCtor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ICosmWasmClient {
1212
queryContractSmart(contractAddr: string, query: any): Promise<any>;
1313
}
1414
15-
export interface ISigningCosmWasmClient {
15+
export interface ISigningCosmWasmClient extends ICosmWasmClient {
1616
execute(sender: string, contractAddress: string, msg: any, fee?: any, memo?: string, funds?: any[]): Promise<any>;
1717
}
1818

0 commit comments

Comments
 (0)