@gearbox-protocol/sdk 12.6.3 → 12.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sdk/GearboxSDK.js +1 -0
- package/dist/cjs/sdk/base/ChainContractsRegister.js +8 -0
- package/dist/cjs/sdk/base/TokensMeta.js +4 -0
- package/dist/cjs/sdk/sdk-legacy/core/transactions.js +4 -0
- package/dist/esm/sdk/GearboxSDK.js +1 -0
- package/dist/esm/sdk/base/ChainContractsRegister.js +8 -0
- package/dist/esm/sdk/base/TokensMeta.js +4 -0
- package/dist/esm/sdk/sdk-legacy/core/transactions.js +4 -0
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +1 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -0
- package/dist/types/sdk/sdk-legacy/core/transactions.d.ts +4 -0
- package/package.json +1 -1
|
@@ -154,6 +154,7 @@ class GearboxSDK extends import_base.ChainContractsRegister {
|
|
|
154
154
|
this.gasLimit = options.gasLimit || 550000000n;
|
|
155
155
|
}
|
|
156
156
|
Object.assign(this, import_base.ChainContractsRegister.for(this.client, this.logger));
|
|
157
|
+
this.resetContracts();
|
|
157
158
|
}
|
|
158
159
|
async #attach(opts) {
|
|
159
160
|
const {
|
|
@@ -51,6 +51,14 @@ class ChainContractsRegister {
|
|
|
51
51
|
this.tokensMeta = new import_TokensMeta.TokensMeta(client);
|
|
52
52
|
this.logger = logger;
|
|
53
53
|
}
|
|
54
|
+
resetContracts() {
|
|
55
|
+
this.logger?.debug(
|
|
56
|
+
`resetting contacts register with ${this.contracts.size} contracts`
|
|
57
|
+
);
|
|
58
|
+
this.labels.clear();
|
|
59
|
+
this.contracts.clear();
|
|
60
|
+
this.tokensMeta.reset();
|
|
61
|
+
}
|
|
54
62
|
getContract(address) {
|
|
55
63
|
return this.contracts.get(address);
|
|
56
64
|
}
|
|
@@ -124,11 +124,13 @@ class TxAddLiquidity extends import_eventOrTx.EVMTx {
|
|
|
124
124
|
amount;
|
|
125
125
|
token;
|
|
126
126
|
poolName;
|
|
127
|
+
address;
|
|
127
128
|
constructor(opts) {
|
|
128
129
|
super(opts);
|
|
129
130
|
this.amount = opts.amount;
|
|
130
131
|
this.token = opts.tokensList[opts.token];
|
|
131
132
|
this.poolName = opts.poolName;
|
|
133
|
+
this.address = opts.address;
|
|
132
134
|
}
|
|
133
135
|
_toString() {
|
|
134
136
|
const { title, decimals = 18 } = this.token;
|
|
@@ -148,11 +150,13 @@ class TxRemoveLiquidity extends import_eventOrTx.EVMTx {
|
|
|
148
150
|
amount;
|
|
149
151
|
token;
|
|
150
152
|
poolName;
|
|
153
|
+
address;
|
|
151
154
|
constructor(opts) {
|
|
152
155
|
super(opts);
|
|
153
156
|
this.amount = opts.amount;
|
|
154
157
|
this.token = opts.tokensList[opts.token];
|
|
155
158
|
this.poolName = opts.poolName;
|
|
159
|
+
this.address = opts.address;
|
|
156
160
|
}
|
|
157
161
|
_toString() {
|
|
158
162
|
const { title, decimals = 18 } = this.token;
|
|
@@ -153,6 +153,7 @@ class GearboxSDK extends ChainContractsRegister {
|
|
|
153
153
|
this.gasLimit = options.gasLimit || 550000000n;
|
|
154
154
|
}
|
|
155
155
|
Object.assign(this, ChainContractsRegister.for(this.client, this.logger));
|
|
156
|
+
this.resetContracts();
|
|
156
157
|
}
|
|
157
158
|
async #attach(opts) {
|
|
158
159
|
const {
|
|
@@ -28,6 +28,14 @@ class ChainContractsRegister {
|
|
|
28
28
|
this.tokensMeta = new TokensMeta(client);
|
|
29
29
|
this.logger = logger;
|
|
30
30
|
}
|
|
31
|
+
resetContracts() {
|
|
32
|
+
this.logger?.debug(
|
|
33
|
+
`resetting contacts register with ${this.contracts.size} contracts`
|
|
34
|
+
);
|
|
35
|
+
this.labels.clear();
|
|
36
|
+
this.contracts.clear();
|
|
37
|
+
this.tokensMeta.reset();
|
|
38
|
+
}
|
|
31
39
|
getContract(address) {
|
|
32
40
|
return this.contracts.get(address);
|
|
33
41
|
}
|
|
@@ -74,11 +74,13 @@ class TxAddLiquidity extends EVMTx {
|
|
|
74
74
|
amount;
|
|
75
75
|
token;
|
|
76
76
|
poolName;
|
|
77
|
+
address;
|
|
77
78
|
constructor(opts) {
|
|
78
79
|
super(opts);
|
|
79
80
|
this.amount = opts.amount;
|
|
80
81
|
this.token = opts.tokensList[opts.token];
|
|
81
82
|
this.poolName = opts.poolName;
|
|
83
|
+
this.address = opts.address;
|
|
82
84
|
}
|
|
83
85
|
_toString() {
|
|
84
86
|
const { title, decimals = 18 } = this.token;
|
|
@@ -98,11 +100,13 @@ class TxRemoveLiquidity extends EVMTx {
|
|
|
98
100
|
amount;
|
|
99
101
|
token;
|
|
100
102
|
poolName;
|
|
103
|
+
address;
|
|
101
104
|
constructor(opts) {
|
|
102
105
|
super(opts);
|
|
103
106
|
this.amount = opts.amount;
|
|
104
107
|
this.token = opts.tokensList[opts.token];
|
|
105
108
|
this.poolName = opts.poolName;
|
|
109
|
+
this.address = opts.address;
|
|
106
110
|
}
|
|
107
111
|
_toString() {
|
|
108
112
|
const { title, decimals = 18 } = this.token;
|
|
@@ -17,6 +17,7 @@ export declare class ChainContractsRegister {
|
|
|
17
17
|
readonly tokensMeta: TokensMeta;
|
|
18
18
|
readonly logger?: ILogger;
|
|
19
19
|
constructor(client: PublicClient<Transport, Chain>, logger?: ILogger);
|
|
20
|
+
resetContracts(): void;
|
|
20
21
|
getContract<T = unknown[]>(address: Address): ContractOrInterface<T> | undefined;
|
|
21
22
|
mustGetContract<T = unknown[]>(address: Address): ContractOrInterface<T>;
|
|
22
23
|
setContract(address: Address, contract: BaseContract<any>): void;
|
|
@@ -16,6 +16,7 @@ export interface TokenMetaDataExtended extends TokenMetaData {
|
|
|
16
16
|
export declare class TokensMeta extends AddressMap<TokenMetaDataExtended> {
|
|
17
17
|
#private;
|
|
18
18
|
constructor(client: PublicClient<Transport, Chain>);
|
|
19
|
+
reset(): void;
|
|
19
20
|
symbol(token: Address): string;
|
|
20
21
|
decimals(token: Address): number;
|
|
21
22
|
/**
|
|
@@ -16,12 +16,14 @@ interface AddLiquidityProps extends EVMTxProps {
|
|
|
16
16
|
amount: bigint;
|
|
17
17
|
token: Address;
|
|
18
18
|
poolName: string;
|
|
19
|
+
address: Address;
|
|
19
20
|
tokensList: Record<Address, TokenData>;
|
|
20
21
|
}
|
|
21
22
|
export declare class TxAddLiquidity extends EVMTx {
|
|
22
23
|
readonly amount: bigint;
|
|
23
24
|
readonly token: TokenData;
|
|
24
25
|
readonly poolName: string;
|
|
26
|
+
readonly address: Address;
|
|
25
27
|
constructor(opts: AddLiquidityProps);
|
|
26
28
|
_toString(): string;
|
|
27
29
|
serialize(): TxSerialized;
|
|
@@ -30,12 +32,14 @@ interface RemoveLiquidityProps extends EVMTxProps {
|
|
|
30
32
|
amount: bigint;
|
|
31
33
|
token: Address;
|
|
32
34
|
poolName: string;
|
|
35
|
+
address: Address;
|
|
33
36
|
tokensList: Record<Address, TokenData>;
|
|
34
37
|
}
|
|
35
38
|
export declare class TxRemoveLiquidity extends EVMTx {
|
|
36
39
|
readonly amount: bigint;
|
|
37
40
|
readonly token: TokenData;
|
|
38
41
|
readonly poolName: string;
|
|
42
|
+
readonly address: Address;
|
|
39
43
|
constructor(opts: RemoveLiquidityProps);
|
|
40
44
|
_toString(): string;
|
|
41
45
|
serialize(): TxSerialized;
|