@paxoslabs/amplify-sdk 0.5.3 → 1.0.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 +3157 -759
- package/dist/index.d.ts +3157 -759
- package/dist/index.js +15008 -186
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15067 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -86
- package/CHANGELOG.md +0 -320
- package/LICENSE +0 -28
- package/README.md +0 -119
- package/dist/chain-utils-5r2UnCDS.d.mts +0 -380
- package/dist/chain-utils-5r2UnCDS.d.ts +0 -380
- package/dist/chunk-4NQPS3JC.js +0 -2101
- package/dist/chunk-4NQPS3JC.js.map +0 -1
- package/dist/chunk-6CU533DM.mjs +0 -39
- package/dist/chunk-6CU533DM.mjs.map +0 -1
- package/dist/chunk-6JLKHV6O.js +0 -128
- package/dist/chunk-6JLKHV6O.js.map +0 -1
- package/dist/chunk-FHE43NKY.js +0 -1143
- package/dist/chunk-FHE43NKY.js.map +0 -1
- package/dist/chunk-GOJQYEJQ.js +0 -3212
- package/dist/chunk-GOJQYEJQ.js.map +0 -1
- package/dist/chunk-LMNADWTH.mjs +0 -2073
- package/dist/chunk-LMNADWTH.mjs.map +0 -1
- package/dist/chunk-ODXJYXUH.mjs +0 -3168
- package/dist/chunk-ODXJYXUH.mjs.map +0 -1
- package/dist/chunk-QMFYPHX5.mjs +0 -690
- package/dist/chunk-QMFYPHX5.mjs.map +0 -1
- package/dist/chunk-TNL23CO2.js +0 -45
- package/dist/chunk-TNL23CO2.js.map +0 -1
- package/dist/chunk-UY2WD7MF.mjs +0 -1133
- package/dist/chunk-UY2WD7MF.mjs.map +0 -1
- package/dist/chunk-WD6QFSXZ.js +0 -701
- package/dist/chunk-WD6QFSXZ.js.map +0 -1
- package/dist/chunk-Y5LBT2WT.mjs +0 -118
- package/dist/chunk-Y5LBT2WT.mjs.map +0 -1
- package/dist/core.d.mts +0 -195
- package/dist/core.d.ts +0 -195
- package/dist/core.js +0 -1236
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -1194
- package/dist/core.mjs.map +0 -1
- package/dist/display.d.mts +0 -472
- package/dist/display.d.ts +0 -472
- package/dist/display.js +0 -52
- package/dist/display.js.map +0 -1
- package/dist/display.mjs +0 -7
- package/dist/display.mjs.map +0 -1
- package/dist/index-D8RtV9cB.d.mts +0 -5114
- package/dist/index-ev_V5sjt.d.ts +0 -5114
- package/dist/utils.d.mts +0 -112
- package/dist/utils.d.ts +0 -112
- package/dist/utils.js +0 -67
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -25
- package/dist/utils.mjs.map +0 -1
- package/dist/vaults.d.mts +0 -4
- package/dist/vaults.d.ts +0 -4
- package/dist/vaults.js +0 -96
- package/dist/vaults.js.map +0 -1
- package/dist/vaults.mjs +0 -7
- package/dist/vaults.mjs.map +0 -1
package/dist/core.d.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { Address } from 'viem';
|
|
2
|
-
export { Address } from 'viem';
|
|
3
|
-
import { C as ChainId, A as AmplifyVault } from './chain-utils-5r2UnCDS.js';
|
|
4
|
-
export { t as toChainId } from './chain-utils-5r2UnCDS.js';
|
|
5
|
-
import 'viem/chains';
|
|
6
|
-
|
|
7
|
-
type AccountantBaseProps = {
|
|
8
|
-
accountantAddress: Address;
|
|
9
|
-
chainId: ChainId;
|
|
10
|
-
};
|
|
11
|
-
type RateInQuoteWithAssetDecimalsProps = AccountantBaseProps & {
|
|
12
|
-
assetAddress: Address;
|
|
13
|
-
};
|
|
14
|
-
declare const getRateInQuoteWithAssetDecimals: ({ assetAddress, accountantAddress, chainId, }: RateInQuoteWithAssetDecimalsProps) => Promise<[{
|
|
15
|
-
error: Error;
|
|
16
|
-
result?: undefined;
|
|
17
|
-
status: "failure";
|
|
18
|
-
} | {
|
|
19
|
-
error?: undefined;
|
|
20
|
-
result: number;
|
|
21
|
-
status: "success";
|
|
22
|
-
}, {
|
|
23
|
-
error: Error;
|
|
24
|
-
result?: undefined;
|
|
25
|
-
status: "failure";
|
|
26
|
-
} | {
|
|
27
|
-
error?: undefined;
|
|
28
|
-
result: bigint;
|
|
29
|
-
status: "success";
|
|
30
|
-
}]>;
|
|
31
|
-
|
|
32
|
-
type AllowanceProps = {
|
|
33
|
-
tokenAddress: Address;
|
|
34
|
-
spenderAddress: Address;
|
|
35
|
-
recipientAddress: Address;
|
|
36
|
-
chainId: ChainId;
|
|
37
|
-
};
|
|
38
|
-
declare function getVaultAllowance({ tokenAddress, spenderAddress, recipientAddress, chainId, }: AllowanceProps): Promise<bigint>;
|
|
39
|
-
type TotalSupplyProps = {
|
|
40
|
-
tokenAddress: Address;
|
|
41
|
-
chainId: ChainId;
|
|
42
|
-
};
|
|
43
|
-
declare function getTotalSupply({ tokenAddress, chainId, }: TotalSupplyProps): Promise<bigint>;
|
|
44
|
-
|
|
45
|
-
interface GetEthPriceProps {
|
|
46
|
-
chainId: ChainId;
|
|
47
|
-
}
|
|
48
|
-
declare function getEthPrice({ chainId, }: GetEthPriceProps): Promise<bigint>;
|
|
49
|
-
|
|
50
|
-
interface GetErc20BalanceParams {
|
|
51
|
-
chainId: ChainId;
|
|
52
|
-
tokenAddress: Address;
|
|
53
|
-
recipientAddress: Address;
|
|
54
|
-
}
|
|
55
|
-
declare const getErc20Balance: ({ chainId, tokenAddress, recipientAddress, }: GetErc20BalanceParams) => Promise<bigint>;
|
|
56
|
-
interface GetErc20DecimalsParams {
|
|
57
|
-
chainId: ChainId;
|
|
58
|
-
tokenAddress: Address;
|
|
59
|
-
}
|
|
60
|
-
declare const getErc20Decimals: ({ chainId, tokenAddress, }: GetErc20DecimalsParams) => Promise<number>;
|
|
61
|
-
interface GetErc20AllowanceParams {
|
|
62
|
-
chainId: ChainId;
|
|
63
|
-
tokenAddress: Address;
|
|
64
|
-
recipientAddress: Address;
|
|
65
|
-
spenderAddress: Address;
|
|
66
|
-
}
|
|
67
|
-
declare const getErc20Allowance: ({ chainId, tokenAddress, recipientAddress, spenderAddress, }: GetErc20AllowanceParams) => Promise<bigint>;
|
|
68
|
-
|
|
69
|
-
interface DepositFeeStructure {
|
|
70
|
-
feePercentage: bigint;
|
|
71
|
-
flatFee: bigint;
|
|
72
|
-
oneHundredPercent: bigint;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Reads the supply cap from a CommunityCodeDepositor contract.
|
|
76
|
-
*
|
|
77
|
-
* **Important:** Only DCD contracts paired with a deposit fee module support
|
|
78
|
-
* this function. Calling it against legacy DCDs (without `depositFeeModuleAddress`)
|
|
79
|
-
* will revert. Callers must check both `communityCodeDepositorAddress` and
|
|
80
|
-
* `depositFeeModuleAddress` before invoking.
|
|
81
|
-
*/
|
|
82
|
-
declare function readSupplyCapInBase(dcdAddress: Address, chainId: number): Promise<bigint>;
|
|
83
|
-
/**
|
|
84
|
-
* Reads the deposit fee structure from a DCD fee module contract for a given
|
|
85
|
-
* deposit asset. Null on-chain values are treated as zero rather than as
|
|
86
|
-
* errors, so callers always receive a usable fee structure.
|
|
87
|
-
*/
|
|
88
|
-
declare function readDepositFeeStructure(feeModuleAddress: Address, depositAsset: Address, chainId: number): Promise<DepositFeeStructure>;
|
|
89
|
-
/**
|
|
90
|
-
* Reads the withdraw fee percentage from on-chain contracts.
|
|
91
|
-
* First reads the feeModule address from the WithdrawQueue, then reads
|
|
92
|
-
* offerFeePercentage from the FeeModule. Returns null if either call fails.
|
|
93
|
-
*/
|
|
94
|
-
declare function readWithdrawFeePercentage(withdrawQueueAddress: Address, chainId: number): Promise<{
|
|
95
|
-
feeModuleAddress: string;
|
|
96
|
-
offerFeePercentage: bigint;
|
|
97
|
-
} | null>;
|
|
98
|
-
/**
|
|
99
|
-
* Enriches vaults with on-chain supply cap data and defaults missing fee
|
|
100
|
-
* values to zero. Fees are sourced from GraphQL (indexer); when the indexer
|
|
101
|
-
* returns null/empty fees for a vault that has a fee module configured, the
|
|
102
|
-
* fees are treated as zero rather than triggering RPC fallback reads.
|
|
103
|
-
*
|
|
104
|
-
* Supply cap enrichment only runs when both `communityCodeDepositorAddress`
|
|
105
|
-
* and `depositFeeModuleAddress` are present — legacy DCDs without a fee
|
|
106
|
-
* module do not support `supplyCapInBase`.
|
|
107
|
-
*
|
|
108
|
-
* Individual vault failures are silently ignored so the vault still loads.
|
|
109
|
-
*/
|
|
110
|
-
declare function enrichVaultsWithSupplyCapsAndFees(vaults: AmplifyVault[]): Promise<AmplifyVault[]>;
|
|
111
|
-
|
|
112
|
-
type PausedStatusProps = {
|
|
113
|
-
accountantAddress: Address;
|
|
114
|
-
tellerAddress: Address;
|
|
115
|
-
chainId: ChainId;
|
|
116
|
-
};
|
|
117
|
-
declare const getPausedStates: ({ accountantAddress, tellerAddress, chainId, }: PausedStatusProps) => Promise<[{
|
|
118
|
-
error: Error;
|
|
119
|
-
result?: undefined;
|
|
120
|
-
status: "failure";
|
|
121
|
-
} | {
|
|
122
|
-
error?: undefined;
|
|
123
|
-
result: boolean;
|
|
124
|
-
status: "success";
|
|
125
|
-
}, {
|
|
126
|
-
error: Error;
|
|
127
|
-
result?: undefined;
|
|
128
|
-
status: "failure";
|
|
129
|
-
} | {
|
|
130
|
-
error?: undefined;
|
|
131
|
-
result: readonly [`0x${string}`, bigint, bigint, bigint, number, number, bigint, isPaused: boolean, number, number];
|
|
132
|
-
status: "success";
|
|
133
|
-
}]>;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Gets the slippage value for a specific asset in a vault
|
|
137
|
-
* @param chainId The chain ID
|
|
138
|
-
* @param vaultAddress The boring vault address
|
|
139
|
-
* @param tokenAddress The token address
|
|
140
|
-
* @param defaultSlippage Optional default slippage value if none is found (defaults to 0)
|
|
141
|
-
* @returns Promise<number> The slippage value
|
|
142
|
-
* @throws {AssetSlippageError} If there's an error fetching or processing the slippage data
|
|
143
|
-
*/
|
|
144
|
-
declare function getAssetSlippage(chainId: ChainId, vaultAddress: Address, tokenAddress: Address, defaultSlippage?: number): Promise<number>;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @fileoverview Functions for interacting with the Teller contract
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Arguments required by the bridge contract for cross-chain transfers
|
|
152
|
-
* @interface BridgeData
|
|
153
|
-
* @property {number} chainSelector - Unique identifier for the destination chain
|
|
154
|
-
* @property {Address} destinationChainReceiver - Address that will receive the bridged tokens
|
|
155
|
-
* @property {Address} bridgeFeeToken - Token used to pay the bridge fee
|
|
156
|
-
* @property {bigint} messageGas - Amount of gas allocated for the cross-chain message
|
|
157
|
-
* @property {`0x${string}`} data - Additional data required for the bridge operation (hex encoded)
|
|
158
|
-
*/
|
|
159
|
-
type BridgeData = {
|
|
160
|
-
chainSelector: number;
|
|
161
|
-
destinationChainReceiver: Address;
|
|
162
|
-
bridgeFeeToken: Address;
|
|
163
|
-
messageGas: bigint;
|
|
164
|
-
data: `0x${string}`;
|
|
165
|
-
};
|
|
166
|
-
type GetPreviewFeeProps = {
|
|
167
|
-
shareAmount: bigint;
|
|
168
|
-
bridgeData: BridgeData;
|
|
169
|
-
contractAddress: Address;
|
|
170
|
-
chainId: ChainId;
|
|
171
|
-
};
|
|
172
|
-
declare const getPreviewFee: ({ shareAmount, bridgeData, contractAddress, chainId, }: GetPreviewFeeProps) => Promise<bigint>;
|
|
173
|
-
|
|
174
|
-
interface WithdrawAssetsResponse {
|
|
175
|
-
[chainId: string]: {
|
|
176
|
-
[vaultAddress: string]: {
|
|
177
|
-
[tokenAddress: string]: number;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Interface for optional parameters when fetching withdraw assets
|
|
183
|
-
*/
|
|
184
|
-
interface FetchWithdrawAssetsParams {
|
|
185
|
-
chainId?: ChainId;
|
|
186
|
-
vaultAddress?: Address;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Fetches withdraw assets configuration from the API
|
|
190
|
-
* @param params Optional parameters for chainId and vaultAddress
|
|
191
|
-
* @returns Promise<WithdrawAssetsResponse>
|
|
192
|
-
*/
|
|
193
|
-
declare function fetchWithdrawAssets(params?: FetchWithdrawAssetsParams): Promise<WithdrawAssetsResponse>;
|
|
194
|
-
|
|
195
|
-
export { type BridgeData, ChainId, type DepositFeeStructure, enrichVaultsWithSupplyCapsAndFees, fetchWithdrawAssets, getAssetSlippage, getErc20Allowance, getErc20Balance, getErc20Decimals, getEthPrice, getPausedStates, getPreviewFee, getRateInQuoteWithAssetDecimals, getTotalSupply, getVaultAllowance, readDepositFeeStructure, readSupplyCapInBase, readWithdrawFeePercentage };
|