Skip to content

Commit a629325

Browse files
authored
Merge pull request #5 from neutron-org/feat/regeneration-for-lp-migration
Feat: regenerated files for LP migration
2 parents 75e64e4 + 9ac8f50 commit a629325

36 files changed

+4914
-338
lines changed

lib/astroportOracle.d.ts

+93-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
1+
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult, InstantiateResult } from "@cosmjs/cosmwasm-stargate";
22
import { StdFee } from "@cosmjs/amino";
33
import { Coin } from "@cosmjs/amino";
44
/**
@@ -23,6 +23,18 @@ export type AssetInfo = {
2323
* This type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.
2424
*/
2525
export type Addr = string;
26+
/**
27+
* This enum describes available pair types. ## Available pool types ``` # use astroport::factory::PairType::{Custom, Stable, Xyk}; Xyk {}; Stable {}; Custom(String::from("Custom")); ```
28+
*/
29+
export type PairType = {
30+
xyk: {};
31+
} | {
32+
stable: {};
33+
} | {
34+
concentrated: {};
35+
} | {
36+
custom: string;
37+
};
2638
/**
2739
* An implementation of u256 that is using strings for JSON encoding/decoding, such that the full u256 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.
2840
*
@@ -33,14 +45,15 @@ export type Addr = string;
3345
* ``` # use cosmwasm_std::Uint256; let a = Uint256::from(258u128); let b = Uint256::new([ 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 1u8, 2u8, ]); assert_eq!(a, b); ```
3446
*/
3547
export type Uint256 = string;
36-
export type TupleOf_AssetInfoAnd_Uint256 = [AssetInfo, Uint256][];
48+
export type ArrayOfTupleOf_AssetInfoAnd_Uint256 = [AssetInfo, Uint256][];
49+
export type Uint64 = number;
3750
/**
3851
* A fixed-point decimal value with 18 fractional digits, i.e. Decimal256(1_000_000_000_000_000_000) == 1.0
3952
*
4053
* The greatest possible value that can be represented is 115792089237316195423570985008687907853269984665640564039457.584007913129639935 (which is (2^256 - 1) / 10^18)
4154
*/
4255
export type Decimal256 = string;
43-
export type TupleOf_AssetInfoAnd_Decimal256 = [AssetInfo, Decimal256][];
56+
export type ArrayOfTupleOf_AssetInfoAnd_Decimal256 = [AssetInfo, Decimal256][];
4457
/**
4558
* A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.
4659
*
@@ -66,13 +79,64 @@ export type Uint128 = string;
6679
*
6780
* let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```
6881
*/
69-
export type Uint64 = string;
82+
export type Uint641 = string;
7083
export interface AstroportOracleSchema {
71-
responses: TupleOf_AssetInfoAnd_Uint256 | TupleOf_AssetInfoAnd_Decimal256;
84+
responses: Config | ArrayOfTupleOf_AssetInfoAnd_Uint256 | Uint64 | ArrayOfTupleOf_AssetInfoAnd_Decimal256;
7285
query: ConsultArgs | TWAPAtHeightArgs;
7386
execute: UpdatePeriodArgs | UpdateManagerArgs;
87+
instantiate?: InstantiateMsg;
7488
[k: string]: unknown;
7589
}
90+
/**
91+
* Global configuration for the contract
92+
*/
93+
export interface Config {
94+
/**
95+
* The assets in the pool. Each asset is described using a [`AssetInfo`]
96+
*/
97+
asset_infos?: AssetInfo[] | null;
98+
/**
99+
* The factory contract address
100+
*/
101+
factory: Addr;
102+
/**
103+
* Manager is the only one who can set pair info, if not set already
104+
*/
105+
manager: Addr;
106+
/**
107+
* The address that's allowed to change contract parameters
108+
*/
109+
owner: Addr;
110+
/**
111+
* Information about the pair (LP token address, pair type etc)
112+
*/
113+
pair?: PairInfo | null;
114+
/**
115+
* Time between two consecutive TWAP updates.
116+
*/
117+
period: number;
118+
}
119+
/**
120+
* This structure stores the main parameters for an Astroport pair
121+
*/
122+
export interface PairInfo {
123+
/**
124+
* Asset information for the assets in the pool
125+
*/
126+
asset_infos: AssetInfo[];
127+
/**
128+
* Pair contract address
129+
*/
130+
contract_addr: Addr;
131+
/**
132+
* Pair LP token address
133+
*/
134+
liquidity_token: Addr;
135+
/**
136+
* The pool type (xyk, stableswap etc) available in [`PairType`]
137+
*/
138+
pair_type: PairType;
139+
}
76140
export interface ConsultArgs {
77141
/**
78142
* The amount of tokens for which to compute the token price
@@ -87,7 +151,7 @@ export interface TWAPAtHeightArgs {
87151
/**
88152
* The amount of tokens for which to compute the token price
89153
*/
90-
height: Uint64;
154+
height: Uint641;
91155
/**
92156
* The asset for which to compute a new TWAP value
93157
*/
@@ -99,13 +163,34 @@ export interface UpdatePeriodArgs {
99163
export interface UpdateManagerArgs {
100164
new_manager: string;
101165
}
166+
/**
167+
* This structure stores general parameters for the contract. Modified by us
168+
*/
169+
export interface InstantiateMsg {
170+
/**
171+
* The factory contract address
172+
*/
173+
factory_contract: string;
174+
/**
175+
* Manager is the only one who can set pair info, if not set already
176+
*/
177+
manager: string;
178+
/**
179+
* Minimal interval between Update{}'s
180+
*/
181+
period: number;
182+
}
102183
export declare class Client {
103184
private readonly client;
104185
contractAddress: string;
105186
constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string);
106187
mustBeSigningClient(): Error;
107-
queryConsult: (args: ConsultArgs) => Promise<TupleOf_AssetInfoAnd_Uint256[]>;
108-
queryTWAPAtHeight: (args: TWAPAtHeightArgs) => Promise<TupleOf_AssetInfoAnd_Decimal256[]>;
188+
static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise<InstantiateResult>;
189+
static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise<InstantiateResult>;
190+
queryConsult: (args: ConsultArgs) => Promise<ArrayOfTupleOf_AssetInfoAnd_Uint256>;
191+
queryTWAPAtHeight: (args: TWAPAtHeightArgs) => Promise<ArrayOfTupleOf_AssetInfoAnd_Decimal256>;
192+
queryConfig: () => Promise<Config>;
193+
queryLastUpdateTimestamp: () => Promise<Uint64>;
109194
update: (sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
110195
updatePeriod: (sender: string, args: UpdatePeriodArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
111196
updateManager: (sender: string, args: UpdateManagerArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;

lib/astroportOracle.js

+18
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,30 @@ class Client {
1414
mustBeSigningClient() {
1515
return new Error("This client is not a SigningCosmWasmClient");
1616
}
17+
static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) {
18+
const res = await client.instantiate(sender, codeId, initMsg, label, fees, {
19+
...(initCoins && initCoins.length && { funds: initCoins }),
20+
});
21+
return res;
22+
}
23+
static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) {
24+
const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, {
25+
...(initCoins && initCoins.length && { funds: initCoins }),
26+
});
27+
return res;
28+
}
1729
queryConsult = async (args) => {
1830
return this.client.queryContractSmart(this.contractAddress, { consult: args });
1931
};
2032
queryTWAPAtHeight = async (args) => {
2133
return this.client.queryContractSmart(this.contractAddress, { t_w_a_p_at_height: args });
2234
};
35+
queryConfig = async () => {
36+
return this.client.queryContractSmart(this.contractAddress, { config: {} });
37+
};
38+
queryLastUpdateTimestamp = async () => {
39+
return this.client.queryContractSmart(this.contractAddress, { last_update_timestamp: {} });
40+
};
2341
update = async (sender, fee, memo, funds) => {
2442
if (!isSigningCosmWasmClient(this.client)) {
2543
throw this.mustBeSigningClient();

lib/credits.d.ts

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
1+
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult, InstantiateResult } from "@cosmjs/cosmwasm-stargate";
22
import { StdFee } from "@cosmjs/amino";
33
import { Coin } from "@cosmjs/amino";
44
/**
@@ -23,9 +23,7 @@ export type Expiration = {
2323
} | {
2424
at_time: Timestamp;
2525
} | {
26-
never: {
27-
[k: string]: unknown;
28-
};
26+
never: {};
2927
};
3028
/**
3129
* A point in time in nanosecond precision.
@@ -64,8 +62,9 @@ export type Addr = string;
6462
export type Nullable_MinterResponse = MinterResponse | null;
6563
export interface CreditsSchema {
6664
responses: AllAccountsResponse | AllAllowancesResponse | Allocation | AllowanceResponse | BalanceResponse | BalanceResponse1 | Config | Nullable_MinterResponse | TokenInfoResponse | TotalSupplyResponse | VestedAmountResponse | WithdrawableAmountResponse;
67-
query: WithdrawableAmountArgs | VestedAmountArgs | AllocationArgs | BalanceArgs | BalanceAtHeightArgs | AllowanceArgs | AllAllowancesArgs;
65+
query: WithdrawableAmountArgs | VestedAmountArgs | AllocationArgs | BalanceArgs | TotalSupplyAtHeightArgs | BalanceAtHeightArgs | AllowanceArgs | AllAllowancesArgs | AllAccountsArgs;
6866
execute: UpdateConfigArgs | AddVestingArgs | TransferArgs | BurnArgs | BurnFromArgs;
67+
instantiate?: InstantiateMsg;
6968
[k: string]: unknown;
7069
}
7170
export interface AllAccountsResponse {
@@ -80,7 +79,6 @@ export interface AllowanceInfo {
8079
allowance: Uint128;
8180
expires: Expiration;
8281
spender: string;
83-
[k: string]: unknown;
8482
}
8583
export interface Allocation {
8684
/**
@@ -119,11 +117,9 @@ export interface AllowanceResponse {
119117
}
120118
export interface BalanceResponse {
121119
balance: Uint128;
122-
[k: string]: unknown;
123120
}
124121
export interface BalanceResponse1 {
125122
balance: Uint128;
126-
[k: string]: unknown;
127123
}
128124
export interface Config {
129125
/**
@@ -150,14 +146,12 @@ export interface MinterResponse {
150146
*/
151147
cap?: Uint128 | null;
152148
minter: string;
153-
[k: string]: unknown;
154149
}
155150
export interface TokenInfoResponse {
156151
decimals: number;
157152
name: string;
158153
symbol: string;
159154
total_supply: Uint128;
160-
[k: string]: unknown;
161155
}
162156
export interface TotalSupplyResponse {
163157
total_supply: Uint128;
@@ -189,6 +183,9 @@ export interface AllocationArgs {
189183
export interface BalanceArgs {
190184
address: string;
191185
}
186+
export interface TotalSupplyAtHeightArgs {
187+
height?: number | null;
188+
}
192189
export interface BalanceAtHeightArgs {
193190
address: string;
194191
height?: number | null;
@@ -202,6 +199,10 @@ export interface AllAllowancesArgs {
202199
owner: string;
203200
start_after?: string | null;
204201
}
202+
export interface AllAccountsArgs {
203+
limit?: number | null;
204+
start_after?: string | null;
205+
}
205206
export interface UpdateConfigArgs {
206207
config: UpdateConfigMsg;
207208
[k: string]: unknown;
@@ -242,22 +243,28 @@ export interface BurnFromArgs {
242243
owner: string;
243244
[k: string]: unknown;
244245
}
246+
export interface InstantiateMsg {
247+
dao_address: string;
248+
[k: string]: unknown;
249+
}
245250
export declare class Client {
246251
private readonly client;
247252
contractAddress: string;
248253
constructor(client: CosmWasmClient | SigningCosmWasmClient, contractAddress: string);
249254
mustBeSigningClient(): Error;
255+
static instantiate(client: SigningCosmWasmClient, sender: string, codeId: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise<InstantiateResult>;
256+
static instantiate2(client: SigningCosmWasmClient, sender: string, codeId: number, salt: number, initMsg: InstantiateMsg, label: string, fees: StdFee | 'auto' | number, initCoins?: readonly Coin[]): Promise<InstantiateResult>;
250257
queryWithdrawableAmount: (args: WithdrawableAmountArgs) => Promise<WithdrawableAmountResponse>;
251258
queryVestedAmount: (args: VestedAmountArgs) => Promise<VestedAmountResponse>;
252259
queryAllocation: (args: AllocationArgs) => Promise<Allocation>;
253260
queryBalance: (args: BalanceArgs) => Promise<BalanceResponse>;
254-
queryTotalSupplyAtHeight: () => Promise<TotalSupplyResponse>;
261+
queryTotalSupplyAtHeight: (args: TotalSupplyAtHeightArgs) => Promise<TotalSupplyResponse>;
255262
queryBalanceAtHeight: (args: BalanceAtHeightArgs) => Promise<BalanceResponse>;
256263
queryTokenInfo: () => Promise<TokenInfoResponse>;
257264
queryMinter: () => Promise<Nullable_MinterResponse>;
258265
queryAllowance: (args: AllowanceArgs) => Promise<AllowanceResponse>;
259266
queryAllAllowances: (args: AllAllowancesArgs) => Promise<AllAllowancesResponse>;
260-
queryAllAccounts: () => Promise<AllAccountsResponse>;
267+
queryAllAccounts: (args: AllAccountsArgs) => Promise<AllAccountsResponse>;
261268
queryConfig: () => Promise<Config>;
262269
updateConfig: (sender: string, args: UpdateConfigArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
263270
addVesting: (sender: string, args: AddVestingArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;

lib/credits.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ class Client {
1414
mustBeSigningClient() {
1515
return new Error("This client is not a SigningCosmWasmClient");
1616
}
17+
static async instantiate(client, sender, codeId, initMsg, label, fees, initCoins) {
18+
const res = await client.instantiate(sender, codeId, initMsg, label, fees, {
19+
...(initCoins && initCoins.length && { funds: initCoins }),
20+
});
21+
return res;
22+
}
23+
static async instantiate2(client, sender, codeId, salt, initMsg, label, fees, initCoins) {
24+
const res = await client.instantiate2(sender, codeId, new Uint8Array([salt]), initMsg, label, fees, {
25+
...(initCoins && initCoins.length && { funds: initCoins }),
26+
});
27+
return res;
28+
}
1729
queryWithdrawableAmount = async (args) => {
1830
return this.client.queryContractSmart(this.contractAddress, { withdrawable_amount: args });
1931
};
@@ -26,8 +38,8 @@ class Client {
2638
queryBalance = async (args) => {
2739
return this.client.queryContractSmart(this.contractAddress, { balance: args });
2840
};
29-
queryTotalSupplyAtHeight = async () => {
30-
return this.client.queryContractSmart(this.contractAddress, { total_supply_at_height: {} });
41+
queryTotalSupplyAtHeight = async (args) => {
42+
return this.client.queryContractSmart(this.contractAddress, { total_supply_at_height: args });
3143
};
3244
queryBalanceAtHeight = async (args) => {
3345
return this.client.queryContractSmart(this.contractAddress, { balance_at_height: args });
@@ -44,8 +56,8 @@ class Client {
4456
queryAllAllowances = async (args) => {
4557
return this.client.queryContractSmart(this.contractAddress, { all_allowances: args });
4658
};
47-
queryAllAccounts = async () => {
48-
return this.client.queryContractSmart(this.contractAddress, { all_accounts: {} });
59+
queryAllAccounts = async (args) => {
60+
return this.client.queryContractSmart(this.contractAddress, { all_accounts: args });
4961
};
5062
queryConfig = async () => {
5163
return this.client.queryContractSmart(this.contractAddress, { config: {} });

0 commit comments

Comments
 (0)