@gearbox-protocol/sdk 13.0.0-next.7 → 13.0.0-next.8
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.
|
@@ -59,17 +59,24 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
59
59
|
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
60
60
|
switch (underlying.contractType) {
|
|
61
61
|
case import_base.KYC_UNDERLYING_DEFAULT: {
|
|
62
|
-
return this.#depositMetadata(
|
|
62
|
+
return this.#depositMetadata(
|
|
63
|
+
"kyc-default",
|
|
64
|
+
pool,
|
|
65
|
+
tokenIn,
|
|
66
|
+
tokenOut,
|
|
67
|
+
false
|
|
68
|
+
);
|
|
63
69
|
}
|
|
64
70
|
case import_base.KYC_UNDERLYING_ON_DEMAND:
|
|
65
71
|
return {
|
|
66
72
|
zapper: void 0,
|
|
67
73
|
approveTarget: underlying.liquidityProvider,
|
|
68
|
-
permissible: false
|
|
74
|
+
permissible: false,
|
|
75
|
+
type: "kyc-on-demand"
|
|
69
76
|
};
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
|
-
return this.#depositMetadata(pool, tokenIn, tokenOut, true);
|
|
79
|
+
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
73
80
|
}
|
|
74
81
|
addLiquidity(props) {
|
|
75
82
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
@@ -217,7 +224,7 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
217
224
|
}
|
|
218
225
|
return zappers?.[0];
|
|
219
226
|
}
|
|
220
|
-
#depositMetadata(poolAddr, tokenIn, tokenOut, allowDirectDeposit) {
|
|
227
|
+
#depositMetadata(type, poolAddr, tokenIn, tokenOut, allowDirectDeposit) {
|
|
221
228
|
if (!tokenOut) {
|
|
222
229
|
throw new Error("tokenOut is required for classic pool deposit");
|
|
223
230
|
}
|
|
@@ -238,7 +245,8 @@ class PoolService extends import_base.SDKConstruct {
|
|
|
238
245
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
239
246
|
// TODO: instead of permissible, return permitType зависимости от tokenIn
|
|
240
247
|
// "none" | "eip2612" | "dai_like";
|
|
241
|
-
permissible: !!zapper && tokenIn !== NATIVE_ADDRESS
|
|
248
|
+
permissible: !!zapper && tokenIn !== NATIVE_ADDRESS,
|
|
249
|
+
type
|
|
242
250
|
};
|
|
243
251
|
}
|
|
244
252
|
#describeUnderlying(pool) {
|
|
@@ -40,17 +40,24 @@ class PoolService extends SDKConstruct {
|
|
|
40
40
|
if (this.sdk.tokensMeta.isKYCUnderlying(underlying)) {
|
|
41
41
|
switch (underlying.contractType) {
|
|
42
42
|
case KYC_UNDERLYING_DEFAULT: {
|
|
43
|
-
return this.#depositMetadata(
|
|
43
|
+
return this.#depositMetadata(
|
|
44
|
+
"kyc-default",
|
|
45
|
+
pool,
|
|
46
|
+
tokenIn,
|
|
47
|
+
tokenOut,
|
|
48
|
+
false
|
|
49
|
+
);
|
|
44
50
|
}
|
|
45
51
|
case KYC_UNDERLYING_ON_DEMAND:
|
|
46
52
|
return {
|
|
47
53
|
zapper: void 0,
|
|
48
54
|
approveTarget: underlying.liquidityProvider,
|
|
49
|
-
permissible: false
|
|
55
|
+
permissible: false,
|
|
56
|
+
type: "kyc-on-demand"
|
|
50
57
|
};
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
return this.#depositMetadata(pool, tokenIn, tokenOut, true);
|
|
60
|
+
return this.#depositMetadata("classic", pool, tokenIn, tokenOut, true);
|
|
54
61
|
}
|
|
55
62
|
addLiquidity(props) {
|
|
56
63
|
const { collateral, meta, permit, referralCode, pool, wallet } = props;
|
|
@@ -198,7 +205,7 @@ class PoolService extends SDKConstruct {
|
|
|
198
205
|
}
|
|
199
206
|
return zappers?.[0];
|
|
200
207
|
}
|
|
201
|
-
#depositMetadata(poolAddr, tokenIn, tokenOut, allowDirectDeposit) {
|
|
208
|
+
#depositMetadata(type, poolAddr, tokenIn, tokenOut, allowDirectDeposit) {
|
|
202
209
|
if (!tokenOut) {
|
|
203
210
|
throw new Error("tokenOut is required for classic pool deposit");
|
|
204
211
|
}
|
|
@@ -219,7 +226,8 @@ class PoolService extends SDKConstruct {
|
|
|
219
226
|
approveTarget: zapper?.baseParams.addr ?? pool.pool.address,
|
|
220
227
|
// TODO: instead of permissible, return permitType зависимости от tokenIn
|
|
221
228
|
// "none" | "eip2612" | "dai_like";
|
|
222
|
-
permissible: !!zapper && tokenIn !== NATIVE_ADDRESS
|
|
229
|
+
permissible: !!zapper && tokenIn !== NATIVE_ADDRESS,
|
|
230
|
+
type
|
|
223
231
|
};
|
|
224
232
|
}
|
|
225
233
|
#describeUnderlying(pool) {
|
|
@@ -51,6 +51,10 @@ export interface DepositMetadata {
|
|
|
51
51
|
* If true, user can avoid approval step and deposit with permit
|
|
52
52
|
*/
|
|
53
53
|
permissible: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Type of deposit
|
|
56
|
+
*/
|
|
57
|
+
type: "kyc-on-demand" | "kyc-default" | "classic";
|
|
54
58
|
}
|
|
55
59
|
export interface IPoolsService {
|
|
56
60
|
/**
|