@paxoslabs/amplify-sdk 0.4.2 → 0.4.3-alpha.1
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/CHANGELOG.md +79 -64
- package/dist/{chain-utils-CRMbWzu7.d.mts → chain-utils-CpOJcWig.d.mts} +48 -29
- package/dist/{chain-utils-CRMbWzu7.d.ts → chain-utils-CpOJcWig.d.ts} +48 -29
- package/dist/{chunk-RW7PZETN.mjs → chunk-7JMQWERX.mjs} +238 -254
- package/dist/chunk-7JMQWERX.mjs.map +1 -0
- package/dist/{chunk-TPU2HZAX.mjs → chunk-HV2LE2M6.mjs} +86 -169
- package/dist/chunk-HV2LE2M6.mjs.map +1 -0
- package/dist/{chunk-WZXCJAKM.js → chunk-JTURYJHV.js} +12 -12
- package/dist/{chunk-WZXCJAKM.js.map → chunk-JTURYJHV.js.map} +1 -1
- package/dist/{chunk-5CV25BTQ.js → chunk-KXU3GSF4.mjs} +87 -4
- package/dist/chunk-KXU3GSF4.mjs.map +1 -0
- package/dist/{chunk-CQZCGPZK.mjs → chunk-MB6HYA7R.js} +96 -3
- package/dist/chunk-MB6HYA7R.js.map +1 -0
- package/dist/{chunk-BQG3XKTU.js → chunk-PKGFLHZA.js} +239 -253
- package/dist/chunk-PKGFLHZA.js.map +1 -0
- package/dist/{chunk-2YPKHXFJ.js → chunk-R35K46S5.js} +180 -263
- package/dist/chunk-R35K46S5.js.map +1 -0
- package/dist/{chunk-GMMBJB4B.mjs → chunk-UM7S7U45.mjs} +71 -46
- package/dist/chunk-UM7S7U45.mjs.map +1 -0
- package/dist/{chunk-VZED4E3L.mjs → chunk-USF4CU2K.mjs} +3 -3
- package/dist/{chunk-VZED4E3L.mjs.map → chunk-USF4CU2K.mjs.map} +1 -1
- package/dist/{chunk-OZJNKGW6.js → chunk-YEAWQB72.js} +120 -95
- package/dist/chunk-YEAWQB72.js.map +1 -0
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +16 -16
- package/dist/core.mjs +4 -4
- package/dist/display.d.mts +23 -11
- package/dist/display.d.ts +23 -11
- package/dist/display.js +10 -10
- package/dist/display.mjs +4 -4
- package/dist/index.d.mts +107 -7
- package/dist/index.d.ts +107 -7
- package/dist/index.js +75 -51
- package/dist/index.mjs +5 -5
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +7 -7
- package/dist/utils.mjs +2 -2
- package/dist/vaults.d.mts +107 -94
- package/dist/vaults.d.ts +107 -94
- package/dist/vaults.js +25 -25
- package/dist/vaults.mjs +4 -4
- package/package.json +18 -11
- package/dist/chunk-2YPKHXFJ.js.map +0 -1
- package/dist/chunk-5CV25BTQ.js.map +0 -1
- package/dist/chunk-BQG3XKTU.js.map +0 -1
- package/dist/chunk-CQZCGPZK.mjs.map +0 -1
- package/dist/chunk-GMMBJB4B.mjs.map +0 -1
- package/dist/chunk-OZJNKGW6.js.map +0 -1
- package/dist/chunk-RW7PZETN.mjs.map +0 -1
- package/dist/chunk-TPU2HZAX.mjs.map +0 -1
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkJTURYJHV_js = require('./chunk-JTURYJHV.js');
|
|
4
|
+
var chunkPKGFLHZA_js = require('./chunk-PKGFLHZA.js');
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
|
|
7
7
|
async function getVaultAllowance({
|
|
@@ -10,7 +10,7 @@ async function getVaultAllowance({
|
|
|
10
10
|
recipientAddress,
|
|
11
11
|
chainId
|
|
12
12
|
}) {
|
|
13
|
-
const client = await
|
|
13
|
+
const client = await chunkPKGFLHZA_js.getClient(chainId);
|
|
14
14
|
const allowance = await client.readContract({
|
|
15
15
|
abi: viem.erc20Abi,
|
|
16
16
|
address: tokenAddress,
|
|
@@ -23,7 +23,7 @@ async function getTotalSupply({
|
|
|
23
23
|
tokenAddress,
|
|
24
24
|
chainId
|
|
25
25
|
}) {
|
|
26
|
-
const client = await
|
|
26
|
+
const client = await chunkPKGFLHZA_js.getClient(chainId);
|
|
27
27
|
const totalSupply = await client.readContract({
|
|
28
28
|
abi: viem.erc20Abi,
|
|
29
29
|
address: tokenAddress,
|
|
@@ -73,10 +73,10 @@ var ChainlinkAbi = [
|
|
|
73
73
|
async function getEthPrice({
|
|
74
74
|
chainId
|
|
75
75
|
}) {
|
|
76
|
-
const client = await
|
|
76
|
+
const client = await chunkPKGFLHZA_js.getClient(chainId);
|
|
77
77
|
const priceData = await client.readContract({
|
|
78
78
|
abi: ChainlinkAbi,
|
|
79
|
-
address:
|
|
79
|
+
address: chunkPKGFLHZA_js.CHAINLINK_ADDRESS,
|
|
80
80
|
functionName: "latestRoundData",
|
|
81
81
|
args: []
|
|
82
82
|
});
|
|
@@ -1097,7 +1097,7 @@ var getPausedStates = async ({
|
|
|
1097
1097
|
tellerAddress,
|
|
1098
1098
|
chainId
|
|
1099
1099
|
}) => {
|
|
1100
|
-
const client = await
|
|
1100
|
+
const client = await chunkPKGFLHZA_js.getClient(chainId);
|
|
1101
1101
|
const results = await client.multicall({
|
|
1102
1102
|
contracts: [
|
|
1103
1103
|
{
|
|
@@ -1106,7 +1106,7 @@ var getPausedStates = async ({
|
|
|
1106
1106
|
functionName: "isPaused"
|
|
1107
1107
|
},
|
|
1108
1108
|
{
|
|
1109
|
-
abi:
|
|
1109
|
+
abi: chunkJTURYJHV_js.AccountantAbi,
|
|
1110
1110
|
address: accountantAddress,
|
|
1111
1111
|
functionName: "accountantState"
|
|
1112
1112
|
}
|
|
@@ -1118,7 +1118,7 @@ var getPausedStates = async ({
|
|
|
1118
1118
|
// src/api/withdraw-assets.ts
|
|
1119
1119
|
var assetsCache = null;
|
|
1120
1120
|
function constructUrl(params) {
|
|
1121
|
-
const withdrawAssetsUrl = `${
|
|
1121
|
+
const withdrawAssetsUrl = `${chunkPKGFLHZA_js.API_BASE_URL}/v1/protocol/withdraw-assets`;
|
|
1122
1122
|
if (!params) return withdrawAssetsUrl;
|
|
1123
1123
|
const queryParams = new URLSearchParams();
|
|
1124
1124
|
if (params.chainId) queryParams.append("chainId", params.chainId.toString());
|
|
@@ -1149,7 +1149,7 @@ async function fetchWithdrawAssets(params) {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
1151
|
// src/api/solver-slippage.ts
|
|
1152
|
-
async function getAssetSlippage(chainId, vaultAddress, tokenAddress, defaultSlippage =
|
|
1152
|
+
async function getAssetSlippage(chainId, vaultAddress, tokenAddress, defaultSlippage = chunkPKGFLHZA_js.DEFAULT_SLIPPAGE_BPS) {
|
|
1153
1153
|
try {
|
|
1154
1154
|
const withdrawAssets = await fetchWithdrawAssets();
|
|
1155
1155
|
if (!withdrawAssets) {
|
|
@@ -1179,7 +1179,7 @@ var getPreviewFee = async ({
|
|
|
1179
1179
|
contractAddress,
|
|
1180
1180
|
chainId
|
|
1181
1181
|
}) => {
|
|
1182
|
-
const client = await
|
|
1182
|
+
const client = await chunkPKGFLHZA_js.getClient(chainId);
|
|
1183
1183
|
const rate = await client.readContract({
|
|
1184
1184
|
abi: TellerAbi,
|
|
1185
1185
|
address: contractAddress,
|
|
@@ -1191,23 +1191,23 @@ var getPreviewFee = async ({
|
|
|
1191
1191
|
|
|
1192
1192
|
Object.defineProperty(exports, "getErc20Allowance", {
|
|
1193
1193
|
enumerable: true,
|
|
1194
|
-
get: function () { return
|
|
1194
|
+
get: function () { return chunkJTURYJHV_js.getErc20Allowance; }
|
|
1195
1195
|
});
|
|
1196
1196
|
Object.defineProperty(exports, "getErc20Balance", {
|
|
1197
1197
|
enumerable: true,
|
|
1198
|
-
get: function () { return
|
|
1198
|
+
get: function () { return chunkJTURYJHV_js.getErc20Balance; }
|
|
1199
1199
|
});
|
|
1200
1200
|
Object.defineProperty(exports, "getErc20Decimals", {
|
|
1201
1201
|
enumerable: true,
|
|
1202
|
-
get: function () { return
|
|
1202
|
+
get: function () { return chunkJTURYJHV_js.getErc20Decimals; }
|
|
1203
1203
|
});
|
|
1204
1204
|
Object.defineProperty(exports, "getRateInQuoteWithAssetDecimals", {
|
|
1205
1205
|
enumerable: true,
|
|
1206
|
-
get: function () { return
|
|
1206
|
+
get: function () { return chunkJTURYJHV_js.getRateInQuoteWithAssetDecimals; }
|
|
1207
1207
|
});
|
|
1208
1208
|
Object.defineProperty(exports, "toChainId", {
|
|
1209
1209
|
enumerable: true,
|
|
1210
|
-
get: function () { return
|
|
1210
|
+
get: function () { return chunkPKGFLHZA_js.toChainId; }
|
|
1211
1211
|
});
|
|
1212
1212
|
exports.fetchWithdrawAssets = fetchWithdrawAssets;
|
|
1213
1213
|
exports.getAssetSlippage = getAssetSlippage;
|
package/dist/core.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AccountantAbi } from './chunk-
|
|
2
|
-
export { getErc20Allowance, getErc20Balance, getErc20Decimals, getRateInQuoteWithAssetDecimals } from './chunk-
|
|
3
|
-
import { DEFAULT_SLIPPAGE_BPS, getClient, CHAINLINK_ADDRESS, API_BASE_URL } from './chunk-
|
|
4
|
-
export { toChainId } from './chunk-
|
|
1
|
+
import { AccountantAbi } from './chunk-USF4CU2K.mjs';
|
|
2
|
+
export { getErc20Allowance, getErc20Balance, getErc20Decimals, getRateInQuoteWithAssetDecimals } from './chunk-USF4CU2K.mjs';
|
|
3
|
+
import { DEFAULT_SLIPPAGE_BPS, getClient, CHAINLINK_ADDRESS, API_BASE_URL } from './chunk-7JMQWERX.mjs';
|
|
4
|
+
export { toChainId } from './chunk-7JMQWERX.mjs';
|
|
5
5
|
import { erc20Abi } from 'viem';
|
|
6
6
|
|
|
7
7
|
async function getVaultAllowance({
|
package/dist/display.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { C as ChainId } from './chain-utils-CpOJcWig.mjs';
|
|
3
3
|
import 'viem/chains';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -33,6 +33,7 @@ interface GetWithdrawalRequestsParams {
|
|
|
33
33
|
userAddress: Address;
|
|
34
34
|
chainId?: number;
|
|
35
35
|
vaultAddress?: Address;
|
|
36
|
+
vaultName?: string;
|
|
36
37
|
status?: WithdrawalRequestStatus;
|
|
37
38
|
pageSize?: number;
|
|
38
39
|
pageToken?: string;
|
|
@@ -44,8 +45,11 @@ interface WithdrawalRequestsResult {
|
|
|
44
45
|
}
|
|
45
46
|
/** Parameters for getWithdrawalFee */
|
|
46
47
|
interface GetWithdrawalFeeParams {
|
|
47
|
-
|
|
48
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
49
|
+
vaultName: string;
|
|
50
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
48
51
|
chainId: ChainId;
|
|
52
|
+
/** Token contract address used to validate the vault (should match the vault's supported asset) */
|
|
49
53
|
assetAddress: Address;
|
|
50
54
|
amount: string;
|
|
51
55
|
offerAsset: Address;
|
|
@@ -59,8 +63,11 @@ interface WithdrawalFeeResult {
|
|
|
59
63
|
}
|
|
60
64
|
/** Parameters for getMinimumWithdrawalOrderSize */
|
|
61
65
|
interface GetMinimumWithdrawalOrderSizeParams {
|
|
62
|
-
|
|
66
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
67
|
+
vaultName: string;
|
|
68
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
63
69
|
chainId: ChainId;
|
|
70
|
+
/** Token contract address used to validate the vault (should match the vault's supported asset) */
|
|
64
71
|
assetAddress: Address;
|
|
65
72
|
}
|
|
66
73
|
/** Return type for getMinimumWithdrawalOrderSize */
|
|
@@ -70,8 +77,11 @@ interface MinimumWithdrawalOrderSizeResult {
|
|
|
70
77
|
}
|
|
71
78
|
/** Parameters for getMinimumMint */
|
|
72
79
|
interface GetMinimumMintParams {
|
|
73
|
-
|
|
80
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
81
|
+
vaultName: string;
|
|
82
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
74
83
|
chainId: ChainId;
|
|
84
|
+
/** Token contract address to deposit. Must match the vault's supported asset. */
|
|
75
85
|
depositAssetAddress: Address;
|
|
76
86
|
depositAmount: string;
|
|
77
87
|
}
|
|
@@ -84,7 +94,8 @@ interface MinimumMintResult {
|
|
|
84
94
|
}
|
|
85
95
|
/** Parameters for getVaultAPY */
|
|
86
96
|
interface GetVaultAPYParams {
|
|
87
|
-
vaultAddress
|
|
97
|
+
vaultAddress?: Address;
|
|
98
|
+
vaultName?: string;
|
|
88
99
|
chainId?: number;
|
|
89
100
|
}
|
|
90
101
|
/** Return type for getVaultAPY */
|
|
@@ -96,7 +107,8 @@ interface VaultAPYResult {
|
|
|
96
107
|
}
|
|
97
108
|
/** Parameters for getVaultTVL */
|
|
98
109
|
interface GetVaultTVLParams {
|
|
99
|
-
vaultAddress
|
|
110
|
+
vaultAddress?: Address;
|
|
111
|
+
vaultName?: string;
|
|
100
112
|
chainId?: number;
|
|
101
113
|
}
|
|
102
114
|
/** Return type for getVaultTVL */
|
|
@@ -126,7 +138,7 @@ interface VaultTVLResult {
|
|
|
126
138
|
* @example
|
|
127
139
|
* ```typescript
|
|
128
140
|
* const result = await getMinimumMint({
|
|
129
|
-
*
|
|
141
|
+
* vaultName: "Amplify USDC Core",
|
|
130
142
|
* chainId: 1,
|
|
131
143
|
* depositAssetAddress: "0xA0b8...", // USDC
|
|
132
144
|
* depositAmount: "1000.0",
|
|
@@ -147,7 +159,7 @@ declare function getMinimumMint(params: GetMinimumMintParams): Promise<MinimumMi
|
|
|
147
159
|
* Requests the most recent APY data point by using
|
|
148
160
|
* orderByTimestamp=desc with pageSize=1.
|
|
149
161
|
*
|
|
150
|
-
* @param params - Vault identifier parameters
|
|
162
|
+
* @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
|
|
151
163
|
* @returns Latest APY value and metadata
|
|
152
164
|
* @throws {APIError} If the API request fails or no data found
|
|
153
165
|
*
|
|
@@ -166,7 +178,7 @@ declare function getVaultAPY(params: GetVaultAPYParams): Promise<VaultAPYResult>
|
|
|
166
178
|
* Requests the most recent TVL data point by using
|
|
167
179
|
* includeCurrent=true, orderByTimestamp=desc with pageSize=1.
|
|
168
180
|
*
|
|
169
|
-
* @param params - Vault identifier parameters
|
|
181
|
+
* @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
|
|
170
182
|
* @returns Current TVL value and metadata
|
|
171
183
|
* @throws {APIError} If the API request fails or no data found
|
|
172
184
|
*
|
|
@@ -217,7 +229,7 @@ declare function getWithdrawalRequests(params: GetWithdrawalRequestsParams): Pro
|
|
|
217
229
|
* @example
|
|
218
230
|
* ```typescript
|
|
219
231
|
* const fee = await getWithdrawalFee({
|
|
220
|
-
*
|
|
232
|
+
* vaultName: "Amplify USDC Core",
|
|
221
233
|
* chainId: 1,
|
|
222
234
|
* assetAddress: "0xA0b8...", // USDC
|
|
223
235
|
* amount: "1.0",
|
|
@@ -239,7 +251,7 @@ declare function getWithdrawalFee(params: GetWithdrawalFeeParams): Promise<Withd
|
|
|
239
251
|
* @example
|
|
240
252
|
* ```typescript
|
|
241
253
|
* const result = await getMinimumWithdrawalOrderSize({
|
|
242
|
-
*
|
|
254
|
+
* vaultName: "Amplify USDC Core",
|
|
243
255
|
* chainId: 1,
|
|
244
256
|
* assetAddress: "0xA0b8...",
|
|
245
257
|
* });
|
package/dist/display.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
|
-
import {
|
|
2
|
+
import { C as ChainId } from './chain-utils-CpOJcWig.js';
|
|
3
3
|
import 'viem/chains';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -33,6 +33,7 @@ interface GetWithdrawalRequestsParams {
|
|
|
33
33
|
userAddress: Address;
|
|
34
34
|
chainId?: number;
|
|
35
35
|
vaultAddress?: Address;
|
|
36
|
+
vaultName?: string;
|
|
36
37
|
status?: WithdrawalRequestStatus;
|
|
37
38
|
pageSize?: number;
|
|
38
39
|
pageToken?: string;
|
|
@@ -44,8 +45,11 @@ interface WithdrawalRequestsResult {
|
|
|
44
45
|
}
|
|
45
46
|
/** Parameters for getWithdrawalFee */
|
|
46
47
|
interface GetWithdrawalFeeParams {
|
|
47
|
-
|
|
48
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
49
|
+
vaultName: string;
|
|
50
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
48
51
|
chainId: ChainId;
|
|
52
|
+
/** Token contract address used to validate the vault (should match the vault's supported asset) */
|
|
49
53
|
assetAddress: Address;
|
|
50
54
|
amount: string;
|
|
51
55
|
offerAsset: Address;
|
|
@@ -59,8 +63,11 @@ interface WithdrawalFeeResult {
|
|
|
59
63
|
}
|
|
60
64
|
/** Parameters for getMinimumWithdrawalOrderSize */
|
|
61
65
|
interface GetMinimumWithdrawalOrderSizeParams {
|
|
62
|
-
|
|
66
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
67
|
+
vaultName: string;
|
|
68
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
63
69
|
chainId: ChainId;
|
|
70
|
+
/** Token contract address used to validate the vault (should match the vault's supported asset) */
|
|
64
71
|
assetAddress: Address;
|
|
65
72
|
}
|
|
66
73
|
/** Return type for getMinimumWithdrawalOrderSize */
|
|
@@ -70,8 +77,11 @@ interface MinimumWithdrawalOrderSizeResult {
|
|
|
70
77
|
}
|
|
71
78
|
/** Parameters for getMinimumMint */
|
|
72
79
|
interface GetMinimumMintParams {
|
|
73
|
-
|
|
80
|
+
/** Human-readable vault name (e.g. "Amplify USDC Core") */
|
|
81
|
+
vaultName: string;
|
|
82
|
+
/** Chain ID where the vault is deployed. Must match the vault's chain. */
|
|
74
83
|
chainId: ChainId;
|
|
84
|
+
/** Token contract address to deposit. Must match the vault's supported asset. */
|
|
75
85
|
depositAssetAddress: Address;
|
|
76
86
|
depositAmount: string;
|
|
77
87
|
}
|
|
@@ -84,7 +94,8 @@ interface MinimumMintResult {
|
|
|
84
94
|
}
|
|
85
95
|
/** Parameters for getVaultAPY */
|
|
86
96
|
interface GetVaultAPYParams {
|
|
87
|
-
vaultAddress
|
|
97
|
+
vaultAddress?: Address;
|
|
98
|
+
vaultName?: string;
|
|
88
99
|
chainId?: number;
|
|
89
100
|
}
|
|
90
101
|
/** Return type for getVaultAPY */
|
|
@@ -96,7 +107,8 @@ interface VaultAPYResult {
|
|
|
96
107
|
}
|
|
97
108
|
/** Parameters for getVaultTVL */
|
|
98
109
|
interface GetVaultTVLParams {
|
|
99
|
-
vaultAddress
|
|
110
|
+
vaultAddress?: Address;
|
|
111
|
+
vaultName?: string;
|
|
100
112
|
chainId?: number;
|
|
101
113
|
}
|
|
102
114
|
/** Return type for getVaultTVL */
|
|
@@ -126,7 +138,7 @@ interface VaultTVLResult {
|
|
|
126
138
|
* @example
|
|
127
139
|
* ```typescript
|
|
128
140
|
* const result = await getMinimumMint({
|
|
129
|
-
*
|
|
141
|
+
* vaultName: "Amplify USDC Core",
|
|
130
142
|
* chainId: 1,
|
|
131
143
|
* depositAssetAddress: "0xA0b8...", // USDC
|
|
132
144
|
* depositAmount: "1000.0",
|
|
@@ -147,7 +159,7 @@ declare function getMinimumMint(params: GetMinimumMintParams): Promise<MinimumMi
|
|
|
147
159
|
* Requests the most recent APY data point by using
|
|
148
160
|
* orderByTimestamp=desc with pageSize=1.
|
|
149
161
|
*
|
|
150
|
-
* @param params - Vault identifier parameters
|
|
162
|
+
* @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
|
|
151
163
|
* @returns Latest APY value and metadata
|
|
152
164
|
* @throws {APIError} If the API request fails or no data found
|
|
153
165
|
*
|
|
@@ -166,7 +178,7 @@ declare function getVaultAPY(params: GetVaultAPYParams): Promise<VaultAPYResult>
|
|
|
166
178
|
* Requests the most recent TVL data point by using
|
|
167
179
|
* includeCurrent=true, orderByTimestamp=desc with pageSize=1.
|
|
168
180
|
*
|
|
169
|
-
* @param params - Vault identifier parameters
|
|
181
|
+
* @param params - Vault identifier parameters (vaultAddress, vaultName, or both)
|
|
170
182
|
* @returns Current TVL value and metadata
|
|
171
183
|
* @throws {APIError} If the API request fails or no data found
|
|
172
184
|
*
|
|
@@ -217,7 +229,7 @@ declare function getWithdrawalRequests(params: GetWithdrawalRequestsParams): Pro
|
|
|
217
229
|
* @example
|
|
218
230
|
* ```typescript
|
|
219
231
|
* const fee = await getWithdrawalFee({
|
|
220
|
-
*
|
|
232
|
+
* vaultName: "Amplify USDC Core",
|
|
221
233
|
* chainId: 1,
|
|
222
234
|
* assetAddress: "0xA0b8...", // USDC
|
|
223
235
|
* amount: "1.0",
|
|
@@ -239,7 +251,7 @@ declare function getWithdrawalFee(params: GetWithdrawalFeeParams): Promise<Withd
|
|
|
239
251
|
* @example
|
|
240
252
|
* ```typescript
|
|
241
253
|
* const result = await getMinimumWithdrawalOrderSize({
|
|
242
|
-
*
|
|
254
|
+
* vaultName: "Amplify USDC Core",
|
|
243
255
|
* chainId: 1,
|
|
244
256
|
* assetAddress: "0xA0b8...",
|
|
245
257
|
* });
|
package/dist/display.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkYEAWQB72_js = require('./chunk-YEAWQB72.js');
|
|
4
|
+
require('./chunk-MB6HYA7R.js');
|
|
5
|
+
require('./chunk-JTURYJHV.js');
|
|
6
6
|
require('./chunk-3I3PYX2F.js');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-PKGFLHZA.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "getMinimumMint", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkYEAWQB72_js.getMinimumMint; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getMinimumWithdrawalOrderSize", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkYEAWQB72_js.getMinimumWithdrawalOrderSize; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getVaultAPY", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkYEAWQB72_js.getVaultAPY; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getVaultTVL", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkYEAWQB72_js.getVaultTVL; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getWithdrawalFee", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkYEAWQB72_js.getWithdrawalFee; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getWithdrawalRequests", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkYEAWQB72_js.getWithdrawalRequests; }
|
|
34
34
|
});
|
|
35
35
|
//# sourceMappingURL=display.js.map
|
|
36
36
|
//# sourceMappingURL=display.js.map
|
package/dist/display.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './chunk-UM7S7U45.mjs';
|
|
2
|
+
import './chunk-KXU3GSF4.mjs';
|
|
3
|
+
import './chunk-USF4CU2K.mjs';
|
|
4
4
|
import './chunk-7RWWVUHP.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-7JMQWERX.mjs';
|
|
6
6
|
//# sourceMappingURL=display.mjs.map
|
|
7
7
|
//# sourceMappingURL=display.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { GetMinimumMintParams, GetMinimumWithdrawalOrderSizeParams, GetVaultAPYParams, GetVaultTVLParams, GetWithdrawalFeeParams, GetWithdrawalRequestsParams, MinimumMintResult, MinimumWithdrawalOrderSizeResult, VaultAPYResult, VaultTVLResult, WithdrawalFeeResult, WithdrawalRequest, WithdrawalRequestStatus, WithdrawalRequestsResult, getMinimumMint, getMinimumWithdrawalOrderSize, getVaultAPY, getVaultTVL, getWithdrawalFee, getWithdrawalRequests } from './display.mjs';
|
|
2
2
|
import { Address } from 'viem';
|
|
3
|
-
import { A as AmplifyVault, S as SupportedAsset, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset,
|
|
4
|
-
export { b as APIError } from './chain-utils-
|
|
3
|
+
import { A as AmplifyVault, S as SupportedAsset, Y as YieldType, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset, C as ChainId } from './chain-utils-CpOJcWig.mjs';
|
|
4
|
+
export { b as APIError, d as VaultSLA, e as VaultSupportedAsset } from './chain-utils-CpOJcWig.mjs';
|
|
5
5
|
export { AlreadyApprovedAuthorizationResult, ApprovalAuthorizationResult, ApproveDepositTokenTxData, ApproveWithdrawOrderTxData, CancelWithdrawOrderTxData, DepositAuthMethod, DepositAuthorizationResult, DepositTxData, EIP712Domain, PERMIT_TYPES, ParsedPermitSignature, PermitAuthorizationResult, PermitDepositResult, PermitSignatureData, PrepareCancelWithdrawOrderTxDataParams, PrepareDepositAuthorizationParams, PrepareDepositParams, PrepareDepositPermitSignatureParams, PrepareDepositResult, PrepareDepositWithPermitTxDataParams, PrepareWithdrawOrderTxDataParams, PrepareWithdrawalAuthorizationParams, PrepareWithdrawalParams, PrepareWithdrawalResult, StandardDepositResult, UnencodedDepositWithPermitData, WithdrawAlreadyApprovedAuthorizationResult, WithdrawApprovalAuthorizationResult, WithdrawAuthMethod, WithdrawAuthorizationResult, WithdrawOrderTxData, isAlreadyApprovedAuth, isApprovalAuth, isPermitAuth, isWithdrawAlreadyApprovedAuth, isWithdrawApprovalAuth, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawOrderTxData, prepareCancelWithdrawOrderTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawOrderTxData, prepareWithdrawal, prepareWithdrawalAuthorization, toEthSignTypedDataV4 } from './vaults.mjs';
|
|
6
6
|
import 'viem/chains';
|
|
7
7
|
|
|
@@ -54,6 +54,14 @@ declare class VaultCache {
|
|
|
54
54
|
* Assets keyed by token address
|
|
55
55
|
*/
|
|
56
56
|
private assets;
|
|
57
|
+
/**
|
|
58
|
+
* Vaults keyed by boringVaultAddress (lowercase, for case-insensitive lookup)
|
|
59
|
+
*/
|
|
60
|
+
private vaultsByAddress;
|
|
61
|
+
/**
|
|
62
|
+
* Vaults keyed by vault name (lowercase, for case-insensitive lookup)
|
|
63
|
+
*/
|
|
64
|
+
private vaultsByName;
|
|
57
65
|
/**
|
|
58
66
|
* Unix timestamp (milliseconds) of last successful fetch
|
|
59
67
|
*/
|
|
@@ -83,6 +91,16 @@ declare class VaultCache {
|
|
|
83
91
|
* @returns Array of AmplifyVault objects, or undefined if not found
|
|
84
92
|
*/
|
|
85
93
|
getVault(tokenAddress: string): AmplifyVault[] | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Gets a vault by its boringVaultAddress (on-chain vault contract).
|
|
96
|
+
* Case-insensitive lookup.
|
|
97
|
+
*/
|
|
98
|
+
getVaultByAddress(address: string): AmplifyVault | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Gets a vault by its human-readable name.
|
|
101
|
+
* Case-insensitive lookup.
|
|
102
|
+
*/
|
|
103
|
+
getVaultByName(name: string): AmplifyVault | undefined;
|
|
86
104
|
/**
|
|
87
105
|
* Gets asset by token address
|
|
88
106
|
*
|
|
@@ -344,6 +362,24 @@ declare function findVaultByConfig(params: {
|
|
|
344
362
|
yieldType: string;
|
|
345
363
|
chainId: number;
|
|
346
364
|
}): Promise<AmplifyVault | null>;
|
|
365
|
+
/**
|
|
366
|
+
* Filter options for getVaultsByConfig
|
|
367
|
+
*/
|
|
368
|
+
interface GetVaultsByConfigParams {
|
|
369
|
+
yieldType?: YieldType;
|
|
370
|
+
chainId?: number;
|
|
371
|
+
depositAssetAddress?: Address;
|
|
372
|
+
withdrawAssetAddress?: Address;
|
|
373
|
+
settlementAssetAddress?: Address;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Returns vaults matching the provided configuration filters.
|
|
377
|
+
*
|
|
378
|
+
* Results are automatically scoped to the organization associated with
|
|
379
|
+
* the API key the SDK was initialized with (enterprise filtering is
|
|
380
|
+
* handled server-side by the amplifySdkConfigs resolver).
|
|
381
|
+
*/
|
|
382
|
+
declare function getVaultsByConfig(params?: GetVaultsByConfigParams): Promise<AmplifyVault[]>;
|
|
347
383
|
/**
|
|
348
384
|
* Gets supported assets grouped by token with available vaults
|
|
349
385
|
*
|
|
@@ -724,8 +760,59 @@ declare function waitForCacheReady(): Promise<void>;
|
|
|
724
760
|
*/
|
|
725
761
|
declare function initAmplifySDK(apiKey: string, options?: SDKInitOptions): Promise<void>;
|
|
726
762
|
|
|
727
|
-
|
|
728
|
-
|
|
763
|
+
/**
|
|
764
|
+
* Withdraw operation error types
|
|
765
|
+
*
|
|
766
|
+
* Defines all error classes and error scenarios specific to the withdraw flow.
|
|
767
|
+
* Provides type-safe error handling with clear error messages for different failure modes.
|
|
768
|
+
*
|
|
769
|
+
* @module types/withdraw-errors
|
|
770
|
+
*/
|
|
771
|
+
/**
|
|
772
|
+
* Base class for all withdraw-related errors
|
|
773
|
+
*
|
|
774
|
+
* Extends Error with additional context information for better error handling
|
|
775
|
+
* and debugging in consuming applications.
|
|
776
|
+
*/
|
|
777
|
+
declare class WithdrawError extends Error {
|
|
778
|
+
/**
|
|
779
|
+
* Error code for programmatic handling
|
|
780
|
+
* @example "VAULT_NOT_FOUND", "INVALID_ADDRESS", "INSUFFICIENT_BALANCE"
|
|
781
|
+
*/
|
|
782
|
+
readonly code: string;
|
|
783
|
+
/**
|
|
784
|
+
* Additional context data for debugging
|
|
785
|
+
*/
|
|
786
|
+
readonly context?: Record<string, unknown>;
|
|
787
|
+
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
788
|
+
}
|
|
789
|
+
declare class VaultNotFoundByAddressError extends WithdrawError {
|
|
790
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
791
|
+
}
|
|
792
|
+
declare class VaultNotFoundByNameError extends WithdrawError {
|
|
793
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
794
|
+
}
|
|
795
|
+
declare class UnauthorizedVaultAccessError extends WithdrawError {
|
|
796
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
797
|
+
}
|
|
798
|
+
declare function isVaultNotFoundByAddressError(error: unknown): error is VaultNotFoundByAddressError;
|
|
799
|
+
declare function isVaultNotFoundByNameError(error: unknown): error is VaultNotFoundByNameError;
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Checks whether a deposit spend has been approved for the CommunityCodeDepositor contract.
|
|
803
|
+
*
|
|
804
|
+
* Resolves the vault by `vaultName` + `chainId` + `depositAssetAddress`, then reads the
|
|
805
|
+
* current ERC20 allowance and permit support via a single multicall.
|
|
806
|
+
*
|
|
807
|
+
* @param vaultName - Human-readable vault name
|
|
808
|
+
* @param chainId - Chain ID where the vault is deployed
|
|
809
|
+
* @param depositAssetAddress - Token contract address being deposited
|
|
810
|
+
* @param recipientAddress - Wallet address that owns the tokens (permit owner / approval sender)
|
|
811
|
+
* @returns Allowance, permit support info, and token metadata
|
|
812
|
+
* @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
|
|
813
|
+
*/
|
|
814
|
+
declare const isDepositSpendApproved: ({ vaultName, chainId, depositAssetAddress, recipientAddress, }: {
|
|
815
|
+
vaultName: string;
|
|
729
816
|
chainId: ChainId;
|
|
730
817
|
depositAssetAddress: Address;
|
|
731
818
|
recipientAddress: Address;
|
|
@@ -741,8 +828,21 @@ declare const isDepositSpendApproved: ({ yieldType, chainId, depositAssetAddress
|
|
|
741
828
|
tokenVersion: string;
|
|
742
829
|
error: null;
|
|
743
830
|
}>;
|
|
744
|
-
|
|
745
|
-
|
|
831
|
+
/**
|
|
832
|
+
* Checks whether a withdrawal spend has been approved for the WithdrawQueue contract.
|
|
833
|
+
*
|
|
834
|
+
* Resolves the vault by `vaultName` + `chainId` + `wantAssetAddress`, then reads the
|
|
835
|
+
* current vault-share allowance via a multicall.
|
|
836
|
+
*
|
|
837
|
+
* @param vaultName - Human-readable vault name
|
|
838
|
+
* @param chainId - Chain ID where the vault is deployed
|
|
839
|
+
* @param wantAssetAddress - Token contract address the user wants to receive upon withdrawal
|
|
840
|
+
* @param recipientAddress - Wallet address that owns the vault shares
|
|
841
|
+
* @returns Allowance info
|
|
842
|
+
* @throws {APIError} If vault not found, chain/asset mismatch, or contract read fails
|
|
843
|
+
*/
|
|
844
|
+
declare const isWithdrawalSpendApproved: ({ vaultName, chainId, wantAssetAddress, recipientAddress, }: {
|
|
845
|
+
vaultName: string;
|
|
746
846
|
chainId: ChainId;
|
|
747
847
|
wantAssetAddress: Address;
|
|
748
848
|
recipientAddress: Address;
|
|
@@ -760,4 +860,4 @@ declare const isWithdrawalSpendApproved: ({ yieldType, chainId, wantAssetAddress
|
|
|
760
860
|
error: null;
|
|
761
861
|
}>;
|
|
762
862
|
|
|
763
|
-
export { AmplifyVault, AssetFilterOptions, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, VaultFilterOptions, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };
|
|
863
|
+
export { AmplifyVault, AssetFilterOptions, type GetVaultsByConfigParams, type InitErrorCode, LogLevel, type Logger, type RequestHeaders, type SDKConfig, type SDKInitOptions, SupportedAsset, UnauthorizedVaultAccessError, VaultFilterOptions, VaultNotFoundByAddressError, VaultNotFoundByNameError, WithdrawSupportedAsset, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getVaultsByConfig, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, isCacheReady, isDepositSpendApproved, isVaultNotFoundByAddressError, isVaultNotFoundByNameError, isWithdrawalSpendApproved, refreshVaultCache, setLogLevel, setLogger, waitForCacheReady };
|