Skip to content

Commit a47bc0f

Browse files
authored
Merge pull request #5 from AbstractSDK/adair/abstract2.0
Abstract 0.24.0 generation
2 parents 7655135 + 4cecf93 commit a47bc0f

File tree

83 files changed

+3220
-2299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3220
-2299
lines changed

__fixtures__/abstract/apps/betting.json

Lines changed: 1112 additions & 0 deletions
Large diffs are not rendered by default.

__fixtures__/issues/98/out/98.client.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface 98Interface extends 98ReadOnlyInterface {
7575
}: {
7676
id: number;
7777
instantiateMsg: Binary;
78-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
78+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
7979
registerPlugin: ({
8080
checksum,
8181
codeId,
@@ -90,12 +90,12 @@ export interface 98Interface extends 98ReadOnlyInterface {
9090
ipfsHash: string;
9191
name: string;
9292
version: string;
93-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
93+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
9494
unregisterPlugin: ({
9595
id
9696
}: {
9797
id: number;
98-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
98+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
9999
updatePlugin: ({
100100
checksum,
101101
codeId,
@@ -112,17 +112,17 @@ export interface 98Interface extends 98ReadOnlyInterface {
112112
ipfsHash?: string;
113113
name?: string;
114114
version?: string;
115-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
115+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
116116
updateRegistryFee: ({
117117
newFee
118118
}: {
119119
newFee: Coin;
120-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
120+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
121121
updateDaoAddr: ({
122122
newAddr
123123
}: {
124124
newAddr: string;
125-
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
125+
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
126126
}
127127
export class 98Client extends 98QueryClient implements 98Interface {
128128
client: SigningCosmWasmClient;
@@ -148,13 +148,13 @@ export class 98Client extends 98QueryClient implements 98Interface {
148148
}: {
149149
id: number;
150150
instantiateMsg: Binary;
151-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
151+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
152152
return await this.client.execute(this.sender, this.contractAddress, {
153153
proxy_install_plugin: {
154154
id,
155155
instantiate_msg: instantiateMsg
156156
}
157-
}, fee, memo, _funds);
157+
}, fee_, memo_, funds_);
158158
};
159159
registerPlugin = async ({
160160
checksum,
@@ -170,7 +170,7 @@ export class 98Client extends 98QueryClient implements 98Interface {
170170
ipfsHash: string;
171171
name: string;
172172
version: string;
173-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
173+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
174174
return await this.client.execute(this.sender, this.contractAddress, {
175175
register_plugin: {
176176
checksum,
@@ -180,18 +180,18 @@ export class 98Client extends 98QueryClient implements 98Interface {
180180
name,
181181
version
182182
}
183-
}, fee, memo, _funds);
183+
}, fee_, memo_, funds_);
184184
};
185185
unregisterPlugin = async ({
186186
id
187187
}: {
188188
id: number;
189-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
189+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
190190
return await this.client.execute(this.sender, this.contractAddress, {
191191
unregister_plugin: {
192192
id
193193
}
194-
}, fee, memo, _funds);
194+
}, fee_, memo_, funds_);
195195
};
196196
updatePlugin = async ({
197197
checksum,
@@ -209,7 +209,7 @@ export class 98Client extends 98QueryClient implements 98Interface {
209209
ipfsHash?: string;
210210
name?: string;
211211
version?: string;
212-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
212+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
213213
return await this.client.execute(this.sender, this.contractAddress, {
214214
update_plugin: {
215215
checksum,
@@ -220,28 +220,28 @@ export class 98Client extends 98QueryClient implements 98Interface {
220220
name,
221221
version
222222
}
223-
}, fee, memo, _funds);
223+
}, fee_, memo_, funds_);
224224
};
225225
updateRegistryFee = async ({
226226
newFee
227227
}: {
228228
newFee: Coin;
229-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
229+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
230230
return await this.client.execute(this.sender, this.contractAddress, {
231231
update_registry_fee: {
232232
new_fee: newFee
233233
}
234-
}, fee, memo, _funds);
234+
}, fee_, memo_, funds_);
235235
};
236236
updateDaoAddr = async ({
237237
newAddr
238238
}: {
239239
newAddr: string;
240-
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
240+
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
241241
return await this.client.execute(this.sender, this.contractAddress, {
242242
update_dao_addr: {
243243
new_addr: newAddr
244244
}
245-
}, fee, memo, _funds);
245+
}, fee_, memo_, funds_);
246246
};
247247
}

__output__/abstract/apps/autocompounder/Autocompounder.client.ts

Lines changed: 37 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
import { CamelCasedProperties } from "type-fest";
88
import { SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
9-
import { AbstractQueryClient, AbstractAccountQueryClient, AbstractAccountClient, AppExecuteMsg, AppExecuteMsgFactory, AdapterExecuteMsg, AdapterExecuteMsgFactory, AbstractClient, AbstractAccountId } from "@abstract-money/abstract.js";
9+
import { AccountPublicClient, AccountWalletClient, AppExecuteMsg, AppExecuteMsgFactory, AdapterExecuteMsg, AdapterExecuteMsgFactory } from "@abstract-money/core";
1010
import { StdFee, Coin } from "@cosmjs/amino";
1111
import { Decimal, AssetEntry, BondingPeriodSelector, Duration, InstantiateMsg, ExecuteMsg, Uint128, AnsAsset, QueryMsg, MigrateMsg, Expiration, Timestamp, Uint64, ArrayOfTupleOfStringAndArrayOfClaim, Claim, ArrayOfClaim, Addr, PoolAddressBaseForAddr, AssetInfoBaseForAddr, PoolType, Config, PoolMetadata } from "./Autocompounder.types";
1212
import { AutocompounderQueryMsgBuilder, AutocompounderExecuteMsgBuilder } from "./Autocompounder.message-builder";
1313
export interface IAutocompounderAppQueryClient {
1414
moduleId: string;
15-
accountQueryClient: AbstractAccountQueryClient;
15+
accountPublicClient: AccountPublicClient;
1616
_moduleAddress: string | undefined;
1717
config: () => Promise<Config>;
1818
pendingClaims: (params: CamelCasedProperties<Extract<QueryMsg, {
@@ -29,33 +29,21 @@ export interface IAutocompounderAppQueryClient {
2929
balance: (params: CamelCasedProperties<Extract<QueryMsg, {
3030
balance: unknown;
3131
}>["balance"]>) => Promise<Uint128>;
32-
connectSigningClient: (signingClient: SigningCosmWasmClient, address: string) => AutocompounderAppClient;
3332
getAddress: () => Promise<string>;
3433
}
3534
export class AutocompounderAppQueryClient implements IAutocompounderAppQueryClient {
36-
accountQueryClient: AbstractAccountQueryClient;
35+
accountPublicClient: AccountPublicClient;
3736
moduleId: string;
3837
_moduleAddress: string | undefined;
3938

4039
constructor({
41-
abstractQueryClient,
42-
accountId,
43-
managerAddress,
44-
proxyAddress,
40+
accountPublicClient,
4541
moduleId
4642
}: {
47-
abstractQueryClient: AbstractQueryClient;
48-
accountId: AbstractAccountId;
49-
managerAddress: string;
50-
proxyAddress: string;
43+
accountPublicClient: AccountPublicClient;
5144
moduleId: string;
5245
}) {
53-
this.accountQueryClient = new AbstractAccountQueryClient({
54-
abstract: abstractQueryClient,
55-
accountId,
56-
managerAddress,
57-
proxyAddress
58-
});
46+
this.accountPublicClient = accountPublicClient;
5947
this.moduleId = moduleId;
6048
this.config = this.config.bind(this);
6149
this.pendingClaims = this.pendingClaims.bind(this);
@@ -97,7 +85,9 @@ export class AutocompounderAppQueryClient implements IAutocompounderAppQueryClie
9785
};
9886
getAddress = async (): Promise<string> => {
9987
if (!this._moduleAddress) {
100-
const address = await this.accountQueryClient.getModuleAddress(this.moduleId);
88+
const address = await this.accountPublicClient.getModuleAddress({
89+
id: this.moduleId
90+
});
10191

10292
if (address === null) {
10393
throw new Error(`Module ${this.moduleId} not installed`);
@@ -108,59 +98,43 @@ export class AutocompounderAppQueryClient implements IAutocompounderAppQueryClie
10898

10999
return this._moduleAddress!;
110100
};
111-
connectSigningClient = (signingClient: SigningCosmWasmClient, address: string): AutocompounderAppClient => {
112-
return new AutocompounderAppClient({
113-
accountId: this.accountQueryClient.accountId,
114-
managerAddress: this.accountQueryClient.managerAddress,
115-
proxyAddress: this.accountQueryClient.proxyAddress,
116-
moduleId: this.moduleId,
117-
abstractClient: this.accountQueryClient.abstract.connectSigningClient(signingClient, address)
118-
});
119-
};
120101
_query = async (queryMsg: QueryMsg): Promise<any> => {
121-
return this.accountQueryClient.queryModule({
102+
return this.accountPublicClient.queryModule({
122103
moduleId: this.moduleId,
123104
moduleType: "app",
124105
queryMsg
125106
});
126107
};
127108
}
128109
export interface IAutocompounderAppClient extends IAutocompounderAppQueryClient {
129-
accountClient: AbstractAccountClient;
110+
accountWalletClient: AccountWalletClient;
130111
updateFeeConfig: (params: CamelCasedProperties<Extract<ExecuteMsg, {
131112
update_fee_config: unknown;
132-
}>["update_fee_config"]>, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
113+
}>["update_fee_config"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
133114
deposit: (params: CamelCasedProperties<Extract<ExecuteMsg, {
134115
deposit: unknown;
135-
}>["deposit"]>, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
136-
withdraw: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
137-
compound: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
138-
batchUnbond: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
116+
}>["deposit"]>, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
117+
withdraw: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
118+
compound: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
119+
batchUnbond: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<ExecuteResult>;
139120
}
140121
export class AutocompounderAppClient extends AutocompounderAppQueryClient implements IAutocompounderAppClient {
141-
accountClient: AbstractAccountClient;
122+
accountWalletClient: AccountWalletClient;
142123

143124
constructor({
144-
abstractClient,
145-
accountId,
146-
managerAddress,
147-
proxyAddress,
125+
accountPublicClient,
126+
accountWalletClient,
148127
moduleId
149128
}: {
150-
abstractClient: AbstractClient;
151-
accountId: AbstractAccountId;
152-
managerAddress: string;
153-
proxyAddress: string;
129+
accountPublicClient: AccountPublicClient;
130+
accountWalletClient: AccountWalletClient;
154131
moduleId: string;
155132
}) {
156133
super({
157-
abstractQueryClient: abstractClient,
158-
accountId,
159-
managerAddress,
160-
proxyAddress,
134+
accountPublicClient,
161135
moduleId
162136
});
163-
this.accountClient = AbstractAccountClient.fromQueryClient(this.accountQueryClient, abstractClient);
137+
this.accountWalletClient = accountWalletClient;
164138
this.updateFeeConfig = this.updateFeeConfig.bind(this);
165139
this.deposit = this.deposit.bind(this);
166140
this.withdraw = this.withdraw.bind(this);
@@ -170,25 +144,27 @@ export class AutocompounderAppClient extends AutocompounderAppQueryClient implem
170144

171145
updateFeeConfig = async (params: CamelCasedProperties<Extract<ExecuteMsg, {
172146
update_fee_config: unknown;
173-
}>["update_fee_config"]>, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
174-
return this._execute(AutocompounderExecuteMsgBuilder.updateFeeConfig(params), fee, memo, _funds);
147+
}>["update_fee_config"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
148+
return this._execute(AutocompounderExecuteMsgBuilder.updateFeeConfig(params), fee_, memo_, funds_);
175149
};
176150
deposit = async (params: CamelCasedProperties<Extract<ExecuteMsg, {
177151
deposit: unknown;
178-
}>["deposit"]>, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
179-
return this._execute(AutocompounderExecuteMsgBuilder.deposit(params), fee, memo, _funds);
152+
}>["deposit"]>, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
153+
return this._execute(AutocompounderExecuteMsgBuilder.deposit(params), fee_, memo_, funds_);
180154
};
181-
withdraw = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
182-
return this._execute(AutocompounderExecuteMsgBuilder.withdraw(), fee, memo, _funds);
155+
withdraw = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
156+
return this._execute(AutocompounderExecuteMsgBuilder.withdraw(), fee_, memo_, funds_);
183157
};
184-
compound = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
185-
return this._execute(AutocompounderExecuteMsgBuilder.compound(), fee, memo, _funds);
158+
compound = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
159+
return this._execute(AutocompounderExecuteMsgBuilder.compound(), fee_, memo_, funds_);
186160
};
187-
batchUnbond = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
188-
return this._execute(AutocompounderExecuteMsgBuilder.batchUnbond(), fee, memo, _funds);
161+
batchUnbond = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
162+
return this._execute(AutocompounderExecuteMsgBuilder.batchUnbond(), fee_, memo_, funds_);
189163
};
190-
_execute = async (msg: ExecuteMsg, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
164+
_execute = async (msg: ExecuteMsg, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<ExecuteResult> => {
165+
const signingCwClient = await this.accountWalletClient.getSigningCosmWasmClient();
166+
const sender = await this.accountWalletClient.getSenderAddress();
191167
const moduleMsg: AppExecuteMsg<ExecuteMsg> = AppExecuteMsgFactory.executeApp(msg);
192-
return await this.accountClient.abstract.client.execute(this.accountClient.sender, await this.getAddress(), moduleMsg, fee, memo, _funds);
168+
return await signingCwClient.execute(sender, await this.getAddress(), moduleMsg, fee_, memo_, funds_);
193169
};
194170
}

0 commit comments

Comments
 (0)