@aspan/sdk 0.4.9 → 0.5.0
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/index.d.mts +11 -30
- package/dist/index.d.ts +11 -30
- package/dist/index.js +10 -16
- package/dist/index.mjs +10 -16
- package/package.json +1 -1
- package/src/__tests__/risk.test.ts +2 -2
- package/src/abi/diamond.ts +4 -10
- package/src/client.ts +7 -7
- package/src/index.ts +1 -1
- package/src/types.ts +3 -6
package/dist/index.d.mts
CHANGED
|
@@ -97,14 +97,11 @@ interface RedeemXBNBParams {
|
|
|
97
97
|
}
|
|
98
98
|
/** Parameters for depositing to stability pool */
|
|
99
99
|
interface DepositParams {
|
|
100
|
-
|
|
101
|
-
receiver: Address;
|
|
100
|
+
apUSDAmount: bigint;
|
|
102
101
|
}
|
|
103
|
-
/** Parameters for
|
|
104
|
-
interface
|
|
102
|
+
/** Parameters for withdrawing from stability pool */
|
|
103
|
+
interface WithdrawParams {
|
|
105
104
|
shares: bigint;
|
|
106
|
-
receiver: Address;
|
|
107
|
-
owner: Address;
|
|
108
105
|
}
|
|
109
106
|
/** Overall protocol statistics */
|
|
110
107
|
interface ProtocolStats {
|
|
@@ -580,11 +577,11 @@ declare class AspanClient extends AspanReadClient {
|
|
|
580
577
|
*/
|
|
581
578
|
deposit(params: DepositParams): Promise<Hash>;
|
|
582
579
|
/**
|
|
583
|
-
*
|
|
584
|
-
* @param params
|
|
580
|
+
* Withdraw from stability pool by shares
|
|
581
|
+
* @param params Withdraw parameters
|
|
585
582
|
* @returns Transaction hash
|
|
586
583
|
*/
|
|
587
|
-
|
|
584
|
+
withdraw(params: WithdrawParams): Promise<Hash>;
|
|
588
585
|
/**
|
|
589
586
|
* Harvest yield from LSTs
|
|
590
587
|
* @returns Transaction hash
|
|
@@ -1334,13 +1331,9 @@ declare const DiamondABI: readonly [{
|
|
|
1334
1331
|
readonly type: "function";
|
|
1335
1332
|
readonly name: "deposit";
|
|
1336
1333
|
readonly inputs: readonly [{
|
|
1337
|
-
readonly name: "
|
|
1334
|
+
readonly name: "_amount";
|
|
1338
1335
|
readonly type: "uint256";
|
|
1339
1336
|
readonly internalType: "uint256";
|
|
1340
|
-
}, {
|
|
1341
|
-
readonly name: "receiver";
|
|
1342
|
-
readonly type: "address";
|
|
1343
|
-
readonly internalType: "address";
|
|
1344
1337
|
}];
|
|
1345
1338
|
readonly outputs: readonly [{
|
|
1346
1339
|
readonly name: "shares";
|
|
@@ -1350,26 +1343,14 @@ declare const DiamondABI: readonly [{
|
|
|
1350
1343
|
readonly stateMutability: "nonpayable";
|
|
1351
1344
|
}, {
|
|
1352
1345
|
readonly type: "function";
|
|
1353
|
-
readonly name: "
|
|
1346
|
+
readonly name: "withdraw";
|
|
1354
1347
|
readonly inputs: readonly [{
|
|
1355
|
-
readonly name: "
|
|
1348
|
+
readonly name: "_shares";
|
|
1356
1349
|
readonly type: "uint256";
|
|
1357
1350
|
readonly internalType: "uint256";
|
|
1358
|
-
}, {
|
|
1359
|
-
readonly name: "receiver";
|
|
1360
|
-
readonly type: "address";
|
|
1361
|
-
readonly internalType: "address";
|
|
1362
|
-
}, {
|
|
1363
|
-
readonly name: "owner";
|
|
1364
|
-
readonly type: "address";
|
|
1365
|
-
readonly internalType: "address";
|
|
1366
1351
|
}];
|
|
1367
1352
|
readonly outputs: readonly [{
|
|
1368
|
-
readonly name: "
|
|
1369
|
-
readonly type: "uint256";
|
|
1370
|
-
readonly internalType: "uint256";
|
|
1371
|
-
}, {
|
|
1372
|
-
readonly name: "xBNBOut";
|
|
1353
|
+
readonly name: "assets";
|
|
1373
1354
|
readonly type: "uint256";
|
|
1374
1355
|
readonly internalType: "uint256";
|
|
1375
1356
|
}];
|
|
@@ -2888,4 +2869,4 @@ declare function formatPriceUSD(price: bigint): string;
|
|
|
2888
2869
|
*/
|
|
2889
2870
|
declare function calculateAPY(previousRate: bigint, currentRate: bigint, periodDays: number): number;
|
|
2890
2871
|
|
|
2891
|
-
export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type
|
|
2872
|
+
export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };
|
package/dist/index.d.ts
CHANGED
|
@@ -97,14 +97,11 @@ interface RedeemXBNBParams {
|
|
|
97
97
|
}
|
|
98
98
|
/** Parameters for depositing to stability pool */
|
|
99
99
|
interface DepositParams {
|
|
100
|
-
|
|
101
|
-
receiver: Address;
|
|
100
|
+
apUSDAmount: bigint;
|
|
102
101
|
}
|
|
103
|
-
/** Parameters for
|
|
104
|
-
interface
|
|
102
|
+
/** Parameters for withdrawing from stability pool */
|
|
103
|
+
interface WithdrawParams {
|
|
105
104
|
shares: bigint;
|
|
106
|
-
receiver: Address;
|
|
107
|
-
owner: Address;
|
|
108
105
|
}
|
|
109
106
|
/** Overall protocol statistics */
|
|
110
107
|
interface ProtocolStats {
|
|
@@ -580,11 +577,11 @@ declare class AspanClient extends AspanReadClient {
|
|
|
580
577
|
*/
|
|
581
578
|
deposit(params: DepositParams): Promise<Hash>;
|
|
582
579
|
/**
|
|
583
|
-
*
|
|
584
|
-
* @param params
|
|
580
|
+
* Withdraw from stability pool by shares
|
|
581
|
+
* @param params Withdraw parameters
|
|
585
582
|
* @returns Transaction hash
|
|
586
583
|
*/
|
|
587
|
-
|
|
584
|
+
withdraw(params: WithdrawParams): Promise<Hash>;
|
|
588
585
|
/**
|
|
589
586
|
* Harvest yield from LSTs
|
|
590
587
|
* @returns Transaction hash
|
|
@@ -1334,13 +1331,9 @@ declare const DiamondABI: readonly [{
|
|
|
1334
1331
|
readonly type: "function";
|
|
1335
1332
|
readonly name: "deposit";
|
|
1336
1333
|
readonly inputs: readonly [{
|
|
1337
|
-
readonly name: "
|
|
1334
|
+
readonly name: "_amount";
|
|
1338
1335
|
readonly type: "uint256";
|
|
1339
1336
|
readonly internalType: "uint256";
|
|
1340
|
-
}, {
|
|
1341
|
-
readonly name: "receiver";
|
|
1342
|
-
readonly type: "address";
|
|
1343
|
-
readonly internalType: "address";
|
|
1344
1337
|
}];
|
|
1345
1338
|
readonly outputs: readonly [{
|
|
1346
1339
|
readonly name: "shares";
|
|
@@ -1350,26 +1343,14 @@ declare const DiamondABI: readonly [{
|
|
|
1350
1343
|
readonly stateMutability: "nonpayable";
|
|
1351
1344
|
}, {
|
|
1352
1345
|
readonly type: "function";
|
|
1353
|
-
readonly name: "
|
|
1346
|
+
readonly name: "withdraw";
|
|
1354
1347
|
readonly inputs: readonly [{
|
|
1355
|
-
readonly name: "
|
|
1348
|
+
readonly name: "_shares";
|
|
1356
1349
|
readonly type: "uint256";
|
|
1357
1350
|
readonly internalType: "uint256";
|
|
1358
|
-
}, {
|
|
1359
|
-
readonly name: "receiver";
|
|
1360
|
-
readonly type: "address";
|
|
1361
|
-
readonly internalType: "address";
|
|
1362
|
-
}, {
|
|
1363
|
-
readonly name: "owner";
|
|
1364
|
-
readonly type: "address";
|
|
1365
|
-
readonly internalType: "address";
|
|
1366
1351
|
}];
|
|
1367
1352
|
readonly outputs: readonly [{
|
|
1368
|
-
readonly name: "
|
|
1369
|
-
readonly type: "uint256";
|
|
1370
|
-
readonly internalType: "uint256";
|
|
1371
|
-
}, {
|
|
1372
|
-
readonly name: "xBNBOut";
|
|
1353
|
+
readonly name: "assets";
|
|
1373
1354
|
readonly type: "uint256";
|
|
1374
1355
|
readonly internalType: "uint256";
|
|
1375
1356
|
}];
|
|
@@ -2888,4 +2869,4 @@ declare function formatPriceUSD(price: bigint): string;
|
|
|
2888
2869
|
*/
|
|
2889
2870
|
declare function calculateAPY(previousRate: bigint, currentRate: bigint, periodDays: number): number;
|
|
2890
2871
|
|
|
2891
|
-
export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type
|
|
2872
|
+
export { type ApUSDMintedEvent, type ApUSDRedeemedEvent, AspanClient, type AspanClientConfig, AspanReadClient, AspanRouterClient, type AspanRouterClientConfig, AspanRouterReadClient, type AspanRouterWriteClientConfig, type AspanWriteClientConfig, BPS_PRECISION, BSC_ADDRESSES, type BigIntString, CHAIN_IDS, type CurrentFeeTier, type CurrentFees, type DepositParams, type DepositedEvent, DiamondABI, type ExpectedOutput, type FeeTier, type LSTInfo, type LSTYieldInfo, type MintApUSDParams, type MintXBNBParams, type OracleBounds, PHAROS_ADDRESSES, PRECISION, PRICE_PRECISION, type ProtocolStats, type RedeemAndSwapEvent, type RedeemApUSDParams, type RedeemXBNBParams, RouterABI, type RouterMintEvent, type RouterMintParams, type RouterMintParams2, type RouterRedeemAndSwapParams, type RouterRedeemAndUnstakeParams, type RouterRedeemEvent, type RouterRedeemParams, type RouterSwapParams, type StabilityMode2Info, type StabilityModeInfo, type StabilityPoolStats, type StakeAndMintEvent, type StakeAndMintParams, type SwapAndMintDefaultParams, type SwapAndMintEvent, type SwapAndMintParams, type TokenAddresses, type TransactionReceipt, type TransactionResult, type UnstakeClaimedEvent, type UnstakeRequestedEvent, type UserStabilityPoolPosition, type WithdrawParams, type WithdrawalRequestInfo, type WithdrawnEvent, type XBNBMintedEvent, type XBNBRedeemedEvent, type YieldHarvestedEvent, type YieldStats, calculateAPY, createAspanClient, createAspanPharosClient, createAspanPharosReadClient, createAspanReadClient, createAspanReadClientForChain, createAspanTestnetClient, createAspanTestnetReadClient, createAspanWriteClientForChain, createRouterClient, createRouterPharosClient, createRouterPharosReadClient, createRouterReadClient, createRouterReadClientForChain, createRouterTestnetClient, createRouterTestnetReadClient, createRouterWriteClientForChain, encodeV3Path, formatAmount, formatCR, formatFeeBPS, formatPriceUSD, getChainById, parseAmount, pharosTestnet };
|
package/dist/index.js
CHANGED
|
@@ -303,24 +303,18 @@ var DiamondABI = [
|
|
|
303
303
|
{
|
|
304
304
|
type: "function",
|
|
305
305
|
name: "deposit",
|
|
306
|
-
inputs: [
|
|
307
|
-
{ name: "assets", type: "uint256", internalType: "uint256" },
|
|
308
|
-
{ name: "receiver", type: "address", internalType: "address" }
|
|
309
|
-
],
|
|
306
|
+
inputs: [{ name: "_amount", type: "uint256", internalType: "uint256" }],
|
|
310
307
|
outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
|
|
311
308
|
stateMutability: "nonpayable"
|
|
312
309
|
},
|
|
313
310
|
{
|
|
314
311
|
type: "function",
|
|
315
|
-
name: "
|
|
312
|
+
name: "withdraw",
|
|
316
313
|
inputs: [
|
|
317
|
-
{ name: "
|
|
318
|
-
{ name: "receiver", type: "address", internalType: "address" },
|
|
319
|
-
{ name: "owner", type: "address", internalType: "address" }
|
|
314
|
+
{ name: "_shares", type: "uint256", internalType: "uint256" }
|
|
320
315
|
],
|
|
321
316
|
outputs: [
|
|
322
|
-
{ name: "
|
|
323
|
-
{ name: "xBNBOut", type: "uint256", internalType: "uint256" }
|
|
317
|
+
{ name: "assets", type: "uint256", internalType: "uint256" }
|
|
324
318
|
],
|
|
325
319
|
stateMutability: "nonpayable"
|
|
326
320
|
},
|
|
@@ -1812,22 +1806,22 @@ var AspanClient = class extends AspanReadClient {
|
|
|
1812
1806
|
address: this.diamondAddress,
|
|
1813
1807
|
abi: DiamondABI,
|
|
1814
1808
|
functionName: "deposit",
|
|
1815
|
-
args: [params.
|
|
1809
|
+
args: [params.apUSDAmount]
|
|
1816
1810
|
});
|
|
1817
1811
|
}
|
|
1818
1812
|
/**
|
|
1819
|
-
*
|
|
1820
|
-
* @param params
|
|
1813
|
+
* Withdraw from stability pool by shares
|
|
1814
|
+
* @param params Withdraw parameters
|
|
1821
1815
|
* @returns Transaction hash
|
|
1822
1816
|
*/
|
|
1823
|
-
async
|
|
1817
|
+
async withdraw(params) {
|
|
1824
1818
|
return this.walletClient.writeContract({
|
|
1825
1819
|
chain: this.chain,
|
|
1826
1820
|
account: this.walletClient.account,
|
|
1827
1821
|
address: this.diamondAddress,
|
|
1828
1822
|
abi: DiamondABI,
|
|
1829
|
-
functionName: "
|
|
1830
|
-
args: [params.shares
|
|
1823
|
+
functionName: "withdraw",
|
|
1824
|
+
args: [params.shares]
|
|
1831
1825
|
});
|
|
1832
1826
|
}
|
|
1833
1827
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -245,24 +245,18 @@ var DiamondABI = [
|
|
|
245
245
|
{
|
|
246
246
|
type: "function",
|
|
247
247
|
name: "deposit",
|
|
248
|
-
inputs: [
|
|
249
|
-
{ name: "assets", type: "uint256", internalType: "uint256" },
|
|
250
|
-
{ name: "receiver", type: "address", internalType: "address" }
|
|
251
|
-
],
|
|
248
|
+
inputs: [{ name: "_amount", type: "uint256", internalType: "uint256" }],
|
|
252
249
|
outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
|
|
253
250
|
stateMutability: "nonpayable"
|
|
254
251
|
},
|
|
255
252
|
{
|
|
256
253
|
type: "function",
|
|
257
|
-
name: "
|
|
254
|
+
name: "withdraw",
|
|
258
255
|
inputs: [
|
|
259
|
-
{ name: "
|
|
260
|
-
{ name: "receiver", type: "address", internalType: "address" },
|
|
261
|
-
{ name: "owner", type: "address", internalType: "address" }
|
|
256
|
+
{ name: "_shares", type: "uint256", internalType: "uint256" }
|
|
262
257
|
],
|
|
263
258
|
outputs: [
|
|
264
|
-
{ name: "
|
|
265
|
-
{ name: "xBNBOut", type: "uint256", internalType: "uint256" }
|
|
259
|
+
{ name: "assets", type: "uint256", internalType: "uint256" }
|
|
266
260
|
],
|
|
267
261
|
stateMutability: "nonpayable"
|
|
268
262
|
},
|
|
@@ -1754,22 +1748,22 @@ var AspanClient = class extends AspanReadClient {
|
|
|
1754
1748
|
address: this.diamondAddress,
|
|
1755
1749
|
abi: DiamondABI,
|
|
1756
1750
|
functionName: "deposit",
|
|
1757
|
-
args: [params.
|
|
1751
|
+
args: [params.apUSDAmount]
|
|
1758
1752
|
});
|
|
1759
1753
|
}
|
|
1760
1754
|
/**
|
|
1761
|
-
*
|
|
1762
|
-
* @param params
|
|
1755
|
+
* Withdraw from stability pool by shares
|
|
1756
|
+
* @param params Withdraw parameters
|
|
1763
1757
|
* @returns Transaction hash
|
|
1764
1758
|
*/
|
|
1765
|
-
async
|
|
1759
|
+
async withdraw(params) {
|
|
1766
1760
|
return this.walletClient.writeContract({
|
|
1767
1761
|
chain: this.chain,
|
|
1768
1762
|
account: this.walletClient.account,
|
|
1769
1763
|
address: this.diamondAddress,
|
|
1770
1764
|
abi: DiamondABI,
|
|
1771
|
-
functionName: "
|
|
1772
|
-
args: [params.shares
|
|
1765
|
+
functionName: "withdraw",
|
|
1766
|
+
args: [params.shares]
|
|
1773
1767
|
});
|
|
1774
1768
|
}
|
|
1775
1769
|
/**
|
package/package.json
CHANGED
|
@@ -1224,7 +1224,7 @@ describe.skipIf(!IS_FORK && !IS_LIVE)("Risk Control Tests", () => {
|
|
|
1224
1224
|
|
|
1225
1225
|
await approve(TOKENS.apUSD, DIAMOND, depositedApUSD);
|
|
1226
1226
|
try {
|
|
1227
|
-
await waitTx(await diamondWrite.deposit({
|
|
1227
|
+
await waitTx(await diamondWrite.deposit({ apUSDAmount: depositedApUSD }));
|
|
1228
1228
|
} catch (err: any) {
|
|
1229
1229
|
console.log(` ⚠️ Deposit failed (AccessControl or not configured): ${err.shortMessage || err.message?.slice(0, 100)}`);
|
|
1230
1230
|
console.log(` Skipping remaining FC-02 tests`);
|
|
@@ -1351,7 +1351,7 @@ describe.skipIf(!IS_FORK && !IS_LIVE)("Risk Control Tests", () => {
|
|
|
1351
1351
|
|
|
1352
1352
|
console.log(` Withdrawing ${formatAmount(currentShares)} shares...`);
|
|
1353
1353
|
try {
|
|
1354
|
-
await waitTx(await diamondWrite.
|
|
1354
|
+
await waitTx(await diamondWrite.withdraw({ shares: currentShares }));
|
|
1355
1355
|
} catch (err: any) {
|
|
1356
1356
|
console.log(` ⚠️ Withdraw failed: ${err.shortMessage || err.message?.slice(0, 100)}`);
|
|
1357
1357
|
return;
|
package/src/abi/diamond.ts
CHANGED
|
@@ -243,24 +243,18 @@ export const DiamondABI = [
|
|
|
243
243
|
{
|
|
244
244
|
type: "function",
|
|
245
245
|
name: "deposit",
|
|
246
|
-
inputs: [
|
|
247
|
-
{ name: "assets", type: "uint256", internalType: "uint256" },
|
|
248
|
-
{ name: "receiver", type: "address", internalType: "address" }
|
|
249
|
-
],
|
|
246
|
+
inputs: [{ name: "_amount", type: "uint256", internalType: "uint256" }],
|
|
250
247
|
outputs: [{ name: "shares", type: "uint256", internalType: "uint256" }],
|
|
251
248
|
stateMutability: "nonpayable"
|
|
252
249
|
},
|
|
253
250
|
{
|
|
254
251
|
type: "function",
|
|
255
|
-
name: "
|
|
252
|
+
name: "withdraw",
|
|
256
253
|
inputs: [
|
|
257
|
-
{ name: "
|
|
258
|
-
{ name: "receiver", type: "address", internalType: "address" },
|
|
259
|
-
{ name: "owner", type: "address", internalType: "address" }
|
|
254
|
+
{ name: "_shares", type: "uint256", internalType: "uint256" }
|
|
260
255
|
],
|
|
261
256
|
outputs: [
|
|
262
|
-
{ name: "
|
|
263
|
-
{ name: "xBNBOut", type: "uint256", internalType: "uint256" }
|
|
257
|
+
{ name: "assets", type: "uint256", internalType: "uint256" }
|
|
264
258
|
],
|
|
265
259
|
stateMutability: "nonpayable"
|
|
266
260
|
},
|
package/src/client.ts
CHANGED
|
@@ -74,7 +74,7 @@ import type {
|
|
|
74
74
|
MintXBNBParams,
|
|
75
75
|
RedeemXBNBParams,
|
|
76
76
|
DepositParams,
|
|
77
|
-
|
|
77
|
+
WithdrawParams,
|
|
78
78
|
} from "./types";
|
|
79
79
|
|
|
80
80
|
// ============ Configuration ============
|
|
@@ -1190,23 +1190,23 @@ export class AspanClient extends AspanReadClient {
|
|
|
1190
1190
|
address: this.diamondAddress,
|
|
1191
1191
|
abi: DiamondABI,
|
|
1192
1192
|
functionName: "deposit",
|
|
1193
|
-
args: [params.
|
|
1193
|
+
args: [params.apUSDAmount],
|
|
1194
1194
|
});
|
|
1195
1195
|
}
|
|
1196
1196
|
|
|
1197
1197
|
/**
|
|
1198
|
-
*
|
|
1199
|
-
* @param params
|
|
1198
|
+
* Withdraw from stability pool by shares
|
|
1199
|
+
* @param params Withdraw parameters
|
|
1200
1200
|
* @returns Transaction hash
|
|
1201
1201
|
*/
|
|
1202
|
-
async
|
|
1202
|
+
async withdraw(params: WithdrawParams): Promise<Hash> {
|
|
1203
1203
|
return this.walletClient.writeContract({
|
|
1204
1204
|
chain: this.chain,
|
|
1205
1205
|
account: this.walletClient.account!,
|
|
1206
1206
|
address: this.diamondAddress,
|
|
1207
1207
|
abi: DiamondABI,
|
|
1208
|
-
functionName: "
|
|
1209
|
-
args: [params.shares
|
|
1208
|
+
functionName: "withdraw",
|
|
1209
|
+
args: [params.shares],
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
1212
|
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -120,15 +120,12 @@ export interface RedeemXBNBParams {
|
|
|
120
120
|
|
|
121
121
|
/** Parameters for depositing to stability pool */
|
|
122
122
|
export interface DepositParams {
|
|
123
|
-
|
|
124
|
-
receiver: Address;
|
|
123
|
+
apUSDAmount: bigint;
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
/** Parameters for
|
|
128
|
-
export interface
|
|
126
|
+
/** Parameters for withdrawing from stability pool */
|
|
127
|
+
export interface WithdrawParams {
|
|
129
128
|
shares: bigint;
|
|
130
|
-
receiver: Address;
|
|
131
|
-
owner: Address;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
// ============ Protocol Stats ============
|