@paxoslabs/amplify-sdk 0.1.1 → 0.2.0-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 +0 -2
- package/README.md +42 -0
- package/dist/{chunk-REKEQLQA.mjs → chunk-4ORV7PFT.mjs} +3 -3
- package/dist/{chunk-REKEQLQA.mjs.map → chunk-4ORV7PFT.mjs.map} +1 -1
- package/dist/{chunk-GS7TDQXA.js → chunk-76SRRIGW.js} +8 -8
- package/dist/{chunk-GS7TDQXA.js.map → chunk-76SRRIGW.js.map} +1 -1
- package/dist/{chunk-XXHRCCZS.mjs → chunk-AQFFMJX7.mjs} +3 -3
- package/dist/chunk-AQFFMJX7.mjs.map +1 -0
- package/dist/{chunk-B2QCI6ET.js → chunk-EWJDKRSY.js} +308 -30
- package/dist/chunk-EWJDKRSY.js.map +1 -0
- package/dist/{chunk-HI44AMLC.mjs → chunk-LJPJWJ2Y.mjs} +24 -19
- package/dist/chunk-LJPJWJ2Y.mjs.map +1 -0
- package/dist/{chunk-ITB7FXG4.js → chunk-OJOKPBK7.js} +3 -3
- package/dist/chunk-OJOKPBK7.js.map +1 -0
- package/dist/{chunk-KYR6BFAE.js → chunk-SMIA4ULA.js} +38 -33
- package/dist/chunk-SMIA4ULA.js.map +1 -0
- package/dist/{chunk-DTFLXAZJ.js → chunk-TF3S7T6P.js} +147 -5
- package/dist/chunk-TF3S7T6P.js.map +1 -0
- package/dist/{chunk-VIULRHK6.mjs → chunk-UURNMLRT.mjs} +3 -3
- package/dist/{chunk-VIULRHK6.mjs.map → chunk-UURNMLRT.mjs.map} +1 -1
- package/dist/{chunk-LSNRG5Z2.js → chunk-WWTNCRXX.js} +4 -4
- package/dist/{chunk-LSNRG5Z2.js.map → chunk-WWTNCRXX.js.map} +1 -1
- package/dist/{chunk-ZILA73XN.mjs → chunk-Y3QNUDV6.mjs} +144 -4
- package/dist/chunk-Y3QNUDV6.mjs.map +1 -0
- package/dist/{chunk-CUGK4ZBJ.mjs → chunk-YDMFT2R7.mjs} +304 -30
- package/dist/chunk-YDMFT2R7.mjs.map +1 -0
- package/dist/core.js +16 -16
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +6 -6
- package/dist/core.mjs.map +1 -1
- package/dist/display.d.mts +1 -1
- package/dist/display.d.ts +1 -1
- package/dist/display.js +12 -12
- package/dist/display.mjs +4 -4
- package/dist/{exchange-rate-BfPH_fQt.d.mts → exchange-rate-DCB2CY9v.d.mts} +5 -0
- package/dist/{exchange-rate-Cp1ddpw4.d.ts → exchange-rate-DOmoqut9.d.ts} +5 -0
- package/dist/index.d.mts +456 -8
- package/dist/index.d.ts +456 -8
- package/dist/index.js +402 -215
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +292 -123
- package/dist/index.mjs.map +1 -1
- package/dist/utils.js +5 -5
- package/dist/utils.mjs +2 -2
- package/package.json +2 -1
- package/dist/chunk-B2QCI6ET.js.map +0 -1
- package/dist/chunk-CUGK4ZBJ.mjs.map +0 -1
- package/dist/chunk-DTFLXAZJ.js.map +0 -1
- package/dist/chunk-HI44AMLC.mjs.map +0 -1
- package/dist/chunk-ITB7FXG4.js.map +0 -1
- package/dist/chunk-KYR6BFAE.js.map +0 -1
- package/dist/chunk-XXHRCCZS.mjs.map +0 -1
- package/dist/chunk-ZILA73XN.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,8 +8,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
<!-- auto-changelog-above -->
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
## [0.1.1](///compare/v0.1.1-beta.1...v0.1.1) (2025-12-10)
|
|
12
|
-
|
|
13
11
|
## [0.1.1-beta.0](///compare/v0.1.1-alpha.5...v0.1.1-beta.0) (2025-12-10)
|
|
14
12
|
|
|
15
13
|
## [0.1.1-alpha.5](///compare/v0.1.1-alpha.4...v0.1.1-alpha.5) (2025-12-10)
|
package/README.md
CHANGED
|
@@ -41,6 +41,48 @@ pnpm add @paxoslabs/amplify-sdk viem
|
|
|
41
41
|
pnpm add wagmi @tanstack/react-query
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import {
|
|
48
|
+
initAmplifySDK,
|
|
49
|
+
prepareDepositAuthorization,
|
|
50
|
+
prepareDeposit,
|
|
51
|
+
DepositAuthMethod,
|
|
52
|
+
} from "@paxoslabs/amplify-sdk";
|
|
53
|
+
|
|
54
|
+
// Initialize SDK with your API key
|
|
55
|
+
await initAmplifySDK("pxl_your_api_key");
|
|
56
|
+
|
|
57
|
+
// Prepare deposit authorization (auto-detects permit vs approval)
|
|
58
|
+
const auth = await prepareDepositAuthorization({
|
|
59
|
+
yieldType: "PRIME",
|
|
60
|
+
depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
|
61
|
+
depositAmount: "1000.0",
|
|
62
|
+
recipientAddress: userAddress,
|
|
63
|
+
chainId: 1,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Handle based on authorization method
|
|
67
|
+
if (auth.method === DepositAuthMethod.PERMIT) {
|
|
68
|
+
const signature = await signTypedData(auth.permitData);
|
|
69
|
+
const tx = await prepareDeposit({
|
|
70
|
+
yieldType: "PRIME",
|
|
71
|
+
depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
72
|
+
depositAmount: "1000.0",
|
|
73
|
+
recipientAddress: userAddress,
|
|
74
|
+
chainId: 1,
|
|
75
|
+
signature,
|
|
76
|
+
deadline: auth.permitData.message.deadline,
|
|
77
|
+
});
|
|
78
|
+
await writeContract(tx.txData);
|
|
79
|
+
} else if (auth.method === DepositAuthMethod.APPROVAL) {
|
|
80
|
+
await writeContract(auth.txData); // Approve first
|
|
81
|
+
const tx = await prepareDeposit(/* params */);
|
|
82
|
+
await writeContract(tx.txData);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
44
86
|
## Documentation
|
|
45
87
|
|
|
46
88
|
Full documentation at https://developers.paxoslabs.com/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_DEADLINE } from './chunk-
|
|
1
|
+
import { DEFAULT_DEADLINE } from './chunk-YDMFT2R7.mjs';
|
|
2
2
|
|
|
3
3
|
// src/utils/time.ts
|
|
4
4
|
var calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {
|
|
@@ -9,5 +9,5 @@ var calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { calculateDeadline };
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-4ORV7PFT.mjs.map
|
|
13
|
+
//# sourceMappingURL=chunk-4ORV7PFT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/time.ts"],"names":[],"mappings":";;;AAoBO,IAAM,iBAAA,GAAoB,CAAC,WAAA,GAAc,gBAAA,KAAqB;AAEnE,EAAA,MAAM,aAAA,GAAgB,WAAA,GAAc,EAAA,GAAK,EAAA,GAAK,EAAA;AAG9C,EAAA,MAAM,mBAAmB,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,KAAQ,GAAI,CAAA;AAGrD,EAAA,MAAM,WAAW,gBAAA,GAAmB,aAAA;AAEpC,EAAA,OAAO,OAAO,QAAQ,CAAA;AACxB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/utils/time.ts"],"names":[],"mappings":";;;AAoBO,IAAM,iBAAA,GAAoB,CAAC,WAAA,GAAc,gBAAA,KAAqB;AAEnE,EAAA,MAAM,aAAA,GAAgB,WAAA,GAAc,EAAA,GAAK,EAAA,GAAK,EAAA;AAG9C,EAAA,MAAM,mBAAmB,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,KAAQ,GAAI,CAAA;AAGrD,EAAA,MAAM,WAAW,gBAAA,GAAmB,aAAA;AAEpC,EAAA,OAAO,OAAO,QAAQ,CAAA;AACxB","file":"chunk-4ORV7PFT.mjs","sourcesContent":["/**\n * @fileoverview Utility functions for time-related operations\n */\n\nimport { DEFAULT_DEADLINE } from \"../constants\";\n\n/**\n * Calculates a deadline timestamp in seconds from the current time\n *\n * @param {number} [daysFromNow=DEFAULT_DEADLINE] - Number of days from now to set the deadline\n * @returns {number} Unix timestamp in seconds representing the deadline\n *\n * @example\n * // Returns a timestamp 3 days from now (in seconds)\n * const threeDay = calculateDeadline();\n *\n * @example\n * // Returns a timestamp 7 days from now (in seconds)\n * const weekDeadline = calculateDeadline(7);\n */\nexport const calculateDeadline = (daysFromNow = DEFAULT_DEADLINE) => {\n // Get days in seconds\n const daysInSeconds = daysFromNow * 24 * 60 * 60;\n\n // Get current timestamp in seconds\n const currentTimeStamp = Math.floor(Date.now() / 1000);\n\n // Calculate deadline (current time + 3 days in seconds)\n const deadline = currentTimeStamp + daysInSeconds;\n\n return BigInt(deadline);\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTF3S7T6P_js = require('./chunk-TF3S7T6P.js');
|
|
4
4
|
require('viem');
|
|
5
5
|
|
|
6
6
|
var getPausedStates = async ({
|
|
@@ -8,16 +8,16 @@ var getPausedStates = async ({
|
|
|
8
8
|
tellerAddress,
|
|
9
9
|
chainId
|
|
10
10
|
}) => {
|
|
11
|
-
const client = await
|
|
11
|
+
const client = await chunkTF3S7T6P_js.getClient(chainId);
|
|
12
12
|
const results = await client.multicall({
|
|
13
13
|
contracts: [
|
|
14
14
|
{
|
|
15
|
-
abi:
|
|
15
|
+
abi: chunkTF3S7T6P_js.TellerAbi,
|
|
16
16
|
address: tellerAddress,
|
|
17
17
|
functionName: "isPaused"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
abi:
|
|
20
|
+
abi: chunkTF3S7T6P_js.AccountantAbi,
|
|
21
21
|
address: accountantAddress,
|
|
22
22
|
functionName: "accountantState"
|
|
23
23
|
}
|
|
@@ -33,9 +33,9 @@ var getPreviewFee = async ({
|
|
|
33
33
|
contractAddress,
|
|
34
34
|
chainId
|
|
35
35
|
}) => {
|
|
36
|
-
const client = await
|
|
36
|
+
const client = await chunkTF3S7T6P_js.getClient(chainId);
|
|
37
37
|
const rate = await client.readContract({
|
|
38
|
-
abi:
|
|
38
|
+
abi: chunkTF3S7T6P_js.TellerAbi,
|
|
39
39
|
address: contractAddress,
|
|
40
40
|
functionName: "previewFee",
|
|
41
41
|
args: [shareAmount, bridgeData]
|
|
@@ -45,5 +45,5 @@ var getPreviewFee = async ({
|
|
|
45
45
|
|
|
46
46
|
exports.getPausedStates = getPausedStates;
|
|
47
47
|
exports.getPreviewFee = getPreviewFee;
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-76SRRIGW.js.map
|
|
49
|
+
//# sourceMappingURL=chunk-76SRRIGW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/multi-call.ts","../src/api/teller.ts"],"names":["getClient","TellerAbi","AccountantAbi"],"mappings":";;;;;AA2CA,IAAM,kBAAkB,OAAO;AAAA,EAC7B,iBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAyB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAMA,0BAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,SAAA,CAAU;AAAA,IACrC,SAAA,EAAW;AAAA,MACT;AAAA,QACE,GAAA,EAAKC,0BAAA;AAAA,QACL,OAAA,EAAS,aAAA;AAAA,QACT,YAAA,EAAc;AAAA,OAChB;AAAA,MACA;AAAA,QACE,GAAA,EAAKC,8BAAA;AAAA,QACL,OAAA,EAAS,iBAAA;AAAA,QACT,YAAA,EAAc;AAAA;AAChB;AACF,GACD,CAAA;AACD,EAAA,OAAO,OAAA;AACT;;;ACjCA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,WAAA;AAAA,EACA,UAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA,KAA2C;AACzC,EAAA,MAAM,MAAA,GAAS,MAAMF,0BAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,IAAA,GAAO,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACrC,GAAA,EAAKC,0BAAA;AAAA,IACL,OAAA,EAAS,eAAA;AAAA,IACT,YAAA,EAAc,YAAA;AAAA,IACd,IAAA,EAAM,CAAC,WAAA,EAAa,UAAU;AAAA,GAC/B,CAAA;AAED,EAAA,OAAO,IAAA;AACT","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/api/multi-call.ts","../src/api/teller.ts"],"names":["getClient","TellerAbi","AccountantAbi"],"mappings":";;;;;AA2CA,IAAM,kBAAkB,OAAO;AAAA,EAC7B,iBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAyB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAMA,0BAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,SAAA,CAAU;AAAA,IACrC,SAAA,EAAW;AAAA,MACT;AAAA,QACE,GAAA,EAAKC,0BAAA;AAAA,QACL,OAAA,EAAS,aAAA;AAAA,QACT,YAAA,EAAc;AAAA,OAChB;AAAA,MACA;AAAA,QACE,GAAA,EAAKC,8BAAA;AAAA,QACL,OAAA,EAAS,iBAAA;AAAA,QACT,YAAA,EAAc;AAAA;AAChB;AACF,GACD,CAAA;AACD,EAAA,OAAO,OAAA;AACT;;;ACjCA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,WAAA;AAAA,EACA,UAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA,KAA2C;AACzC,EAAA,MAAM,MAAA,GAAS,MAAMF,0BAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,IAAA,GAAO,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACrC,GAAA,EAAKC,0BAAA;AAAA,IACL,OAAA,EAAS,eAAA;AAAA,IACT,YAAA,EAAc,YAAA;AAAA,IACd,IAAA,EAAM,CAAC,WAAA,EAAa,UAAU;AAAA,GAC/B,CAAA;AAED,EAAA,OAAO,IAAA;AACT","file":"chunk-76SRRIGW.js","sourcesContent":["import { type Address, erc20Abi } from \"viem\";\nimport { AccountantAbi } from \"../abi/accountant-abi\";\nimport { TellerAbi } from \"../abi/teller-abi\";\nimport { getClient } from \"../lib/viem/client\";\nimport type { ChainId } from \"./vault-config\";\n\ntype RateInQuoteWithAssetDecimalsProps = {\n assetAddress: Address;\n accountantAddress: Address;\n chainId: ChainId;\n};\n\nconst getRateInQuoteWithAssetDecimals = async ({\n assetAddress,\n accountantAddress,\n chainId,\n}: RateInQuoteWithAssetDecimalsProps) => {\n const client = await getClient(chainId);\n\n const results = await client.multicall({\n contracts: [\n {\n abi: erc20Abi,\n address: assetAddress,\n functionName: \"decimals\",\n },\n {\n abi: AccountantAbi,\n address: accountantAddress,\n functionName: \"getRateInQuote\",\n args: [assetAddress],\n },\n ],\n });\n return results;\n};\n\ntype PausedStatusProps = {\n accountantAddress: Address;\n tellerAddress: Address;\n chainId: ChainId;\n};\n\nconst getPausedStates = async ({\n accountantAddress,\n tellerAddress,\n chainId,\n}: PausedStatusProps) => {\n const client = await getClient(chainId);\n\n const results = await client.multicall({\n contracts: [\n {\n abi: TellerAbi,\n address: tellerAddress,\n functionName: \"isPaused\",\n },\n {\n abi: AccountantAbi,\n address: accountantAddress,\n functionName: \"accountantState\",\n },\n ],\n });\n return results;\n};\n\nexport { getPausedStates, getRateInQuoteWithAssetDecimals };\n","/**\n * @fileoverview Functions for interacting with the Teller contract\n */\nimport type { Address } from \"viem\";\nimport { TellerAbi } from \"../abi/teller-abi\";\nimport { getClient } from \"../lib/viem/client\";\nimport type { ChainId } from \"./vault-config\";\n\n/**\n * Arguments required by the bridge contract for cross-chain transfers\n * @interface BridgeData\n * @property {number} chainSelector - Unique identifier for the destination chain\n * @property {Address} destinationChainReceiver - Address that will receive the bridged tokens\n * @property {Address} bridgeFeeToken - Token used to pay the bridge fee\n * @property {bigint} messageGas - Amount of gas allocated for the cross-chain message\n * @property {`0x${string}`} data - Additional data required for the bridge operation (hex encoded)\n */\nexport type BridgeData = {\n chainSelector: number;\n destinationChainReceiver: Address;\n bridgeFeeToken: Address;\n messageGas: bigint;\n data: `0x${string}`;\n};\n\ntype GetPreviewFeeProps = {\n shareAmount: bigint;\n bridgeData: BridgeData;\n contractAddress: Address;\n chainId: ChainId;\n};\n\nconst getPreviewFee = async ({\n shareAmount,\n bridgeData,\n contractAddress,\n chainId,\n}: GetPreviewFeeProps): Promise<bigint> => {\n const client = await getClient(chainId);\n\n const rate = await client.readContract({\n abi: TellerAbi,\n address: contractAddress,\n functionName: \"previewFee\",\n args: [shareAmount, bridgeData],\n });\n\n return rate;\n};\n\nexport { getPreviewFee };\n"]}
|
|
@@ -4,8 +4,8 @@ var YieldType = {
|
|
|
4
4
|
TBILL: "TBILL",
|
|
5
5
|
LENDING: "LENDING"
|
|
6
6
|
};
|
|
7
|
-
var DEFAULT_SLIPPAGE_BPS =
|
|
7
|
+
var DEFAULT_SLIPPAGE_BPS = 50;
|
|
8
8
|
|
|
9
9
|
export { DEFAULT_SLIPPAGE_BPS, YieldType };
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-AQFFMJX7.mjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-AQFFMJX7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/config.ts"],"names":[],"mappings":";AAeO,IAAM,SAAA,GAAY;AAAA,EACvB,KAAA,EAAO,OAAA;AAAA,EACP,KAAA,EAAO,OAAA;AAAA,EACP,OAAA,EAAS;AACX;AAwDO,IAAM,oBAAA,GAAuB","file":"chunk-AQFFMJX7.mjs","sourcesContent":["/**\n * SDK Configuration Constants\n *\n * Global constants for supported chains, yield types, tokens, and defaults.\n * Centralized configuration for address book integration and permit deposits.\n */\n\nimport type { Address } from \"viem\";\n\n/**\n * Yield Type identifiers\n *\n * Use as const values: YieldType.PRIME, YieldType.TBILL, YieldType.LENDING\n * Use as type annotation: yieldType: YieldType\n */\nexport const YieldType = {\n PRIME: \"PRIME\",\n TBILL: \"TBILL\",\n LENDING: \"LENDING\",\n} as const;\n\nexport type YieldType = (typeof YieldType)[keyof typeof YieldType];\n\n/**\n * Supported Yield Types\n *\n * Yield products offered by Nucleus.\n */\nexport const SUPPORTED_YIELD_TYPES: readonly YieldType[] = [\n \"PRIME\",\n \"TBILL\",\n \"LENDING\",\n];\n\n/**\n * Token Allow List for Permit Deposits\n *\n * @returns Token allow list for permit deposits\n */\nexport const TOKEN_ALLOW_LIST_BY_CHAIN_FOR_PERMIT_DEPOSITS = {\n 1: [\n {\n symbol: \"USDC\",\n address: \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n supportsPermit: true,\n },\n {\n symbol: \"USDG\",\n address: \"0xe343167631d89b6ffc58b88d6b7fb0228795491d\",\n supportsPermit: true,\n },\n ],\n} as const;\n\n/**\n * Permit Types\n *\n * @returns Permit types\n */\nexport const PERMIT_TYPES = {\n Permit: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\n/**\n * Default Slippage: 50 basis points (0.5%)\n *\n * Conservative default for deposit transactions.\n * Can be overridden per transaction.\n */\nexport const DEFAULT_SLIPPAGE_BPS = 50; // 0.5%\n\n/**\n * Maximum Slippage: 10000 basis points (100%)\n *\n * Safeguard against accidental extreme slippage.\n */\nexport const MAX_SLIPPAGE_BPS = 10000;\n\n/**\n * Minimum Slippage: 0 basis points (0%)\n *\n * Minimum enforced slippage in basis points.\n */\nexport const MIN_SLIPPAGE_BPS = 0;\n\n/**\n * Permit Configuration Defaults\n *\n * Default settings for ERC2612 permit-based approvals.\n */\nexport const PERMIT_CONFIG = {\n /** Default deadline: 1 hour from signature */\n defaultDeadlineSeconds: 3600,\n /** Minimum deadline: 5 minutes (time to submit transaction) */\n minDeadlineSeconds: 300,\n /** Maximum deadline: 24 hours (limits signature validity) */\n maxDeadlineSeconds: 86400,\n /** Cache permit support checks for 24 hours */\n cachePermitSupport: true,\n /** Permit support cache TTL: 24 hours */\n permitSupportCacheTTL: 86400000,\n} as const;\n\n/**\n * Address Book Cache Configuration\n *\n * Default settings for address book query caching.\n */\nexport const ADDRESS_BOOK_CACHE_CONFIG = {\n /** Cache TTL: 1 hour */\n defaultTTL: 3600000,\n /** Auto-refresh cache on errors */\n autoRefreshOnError: true,\n /** Maximum cache size: 1000 entries */\n maxCacheSize: 1000,\n} as const;\n\n/**\n * Deposit Configuration Defaults\n *\n * Default settings for deposit transaction preparation.\n */\nexport const DEPOSIT_CONFIG = {\n /** Default slippage in basis points */\n defaultSlippageBps: DEFAULT_SLIPPAGE_BPS,\n /** Maximum allowed slippage */\n maxSlippageBps: MAX_SLIPPAGE_BPS,\n /** Require approval check before deposit */\n requireApprovalCheck: true,\n /** Don't auto-approve without user confirmation */\n autoApprove: false,\n} as const;\n\n/**\n * Gas Estimation Defaults\n *\n * Default gas limits for different operations.\n */\nexport const GAS_CONFIG = {\n /** Gas limit for approve transaction */\n approveGasLimit: 100000n,\n /** Gas limit for permit deposit transaction */\n permitDepositGasLimit: 500000n,\n /** Gas limit for standard deposit + approve */\n standardDepositGasLimit: 600000n,\n} as const;\n\n/**\n * Performance Targets\n *\n * Expected performance characteristics for monitoring.\n */\nexport const PERFORMANCE_TARGETS = {\n /** Address book queries should complete in <50ms */\n addressBookQueryMs: 50,\n /** Permit signature generation should complete in <100ms */\n permitSignatureMs: 100,\n /** Transaction preparation should complete in <200ms */\n transactionPreparationMs: 200,\n} as const;\n\n/**\n * Error Codes\n *\n * Standardized error codes for programmatic error handling.\n */\nexport const ERROR_CODES = {\n // Address Book Errors\n VAULT_NOT_FOUND: \"VAULT_NOT_FOUND\",\n CHAIN_NOT_SUPPORTED: \"CHAIN_NOT_SUPPORTED\",\n TOKEN_NOT_SUPPORTED: \"TOKEN_NOT_SUPPORTED\",\n YIELD_TYPE_NOT_SUPPORTED: \"YIELD_TYPE_NOT_SUPPORTED\",\n ADDRESS_BOOK_DATA_ERROR: \"ADDRESS_BOOK_DATA_ERROR\",\n ADDRESS_BOOK_CACHE_ERROR: \"ADDRESS_BOOK_CACHE_ERROR\",\n\n // Permit Errors\n PERMIT_NOT_SUPPORTED: \"PERMIT_NOT_SUPPORTED\",\n PERMIT_SIGNATURE_ERROR: \"PERMIT_SIGNATURE_ERROR\",\n INVALID_DEADLINE: \"INVALID_DEADLINE\",\n NONCE_ERROR: \"NONCE_ERROR\",\n DOMAIN_SEPARATOR_ERROR: \"DOMAIN_SEPARATOR_ERROR\",\n INVALID_PERMIT_SIGNATURE: \"INVALID_PERMIT_SIGNATURE\",\n\n // Deposit Errors\n INVALID_DEPOSIT_AMOUNT: \"INVALID_DEPOSIT_AMOUNT\",\n INVALID_SLIPPAGE: \"INVALID_SLIPPAGE\",\n INSUFFICIENT_APPROVAL: \"INSUFFICIENT_APPROVAL\",\n INVALID_USER_ADDRESS: \"INVALID_USER_ADDRESS\",\n DEPOSIT_VALIDATION_ERROR: \"DEPOSIT_VALIDATION_ERROR\",\n TRANSACTION_PREPARATION_ERROR: \"TRANSACTION_PREPARATION_ERROR\",\n\n // CommunityCodeDepositor Errors\n INVALID_DEPOSITOR_ADDRESS: \"INVALID_DEPOSITOR_ADDRESS\",\n DEPOSITOR_CONTRACT_ERROR: \"DEPOSITOR_CONTRACT_ERROR\",\n} as const;\n\n/**\n * Type for error codes\n */\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];\n\n/**\n * Helper: Check if yield type is supported\n *\n * @param yieldType - Yield product type\n * @returns true if yield type is in the supported list\n */\nexport function isSupportedYieldType(\n yieldType: string\n): yieldType is YieldType {\n return SUPPORTED_YIELD_TYPES.includes(yieldType as YieldType);\n}\n\n/**\n * Helper: Get permit version for token\n *\n * @param symbol - Stablecoin symbol\n * @returns Permit version (\"1\" or \"2\") or undefined if not supported\n */\nexport function getTokenAllowListByChainForPermitDeposits(\n chainId: number,\n depositTokenAddress: Address\n) {\n const tokens =\n TOKEN_ALLOW_LIST_BY_CHAIN_FOR_PERMIT_DEPOSITS[\n chainId as keyof typeof TOKEN_ALLOW_LIST_BY_CHAIN_FOR_PERMIT_DEPOSITS\n ];\n if (!tokens) {\n return null;\n }\n\n return tokens.find(\n (t: { address: string; supportsPermit: boolean }) =>\n t.address.toLowerCase() === depositTokenAddress.toLowerCase()\n );\n}\n"]}
|
|
@@ -3,29 +3,91 @@
|
|
|
3
3
|
var viem = require('viem');
|
|
4
4
|
var chains = require('viem/chains');
|
|
5
5
|
|
|
6
|
-
// src/types/
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
// src/types/telemetry.ts
|
|
7
|
+
var LogLevel = {
|
|
8
|
+
DEBUG: 0,
|
|
9
|
+
INFO: 1,
|
|
10
|
+
WARN: 2,
|
|
11
|
+
ERROR: 3,
|
|
12
|
+
NONE: 4
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/lib/logger.ts
|
|
16
|
+
var ConsoleLogger = class {
|
|
17
|
+
constructor(level = LogLevel.ERROR) {
|
|
18
|
+
this.level = level;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Update log level
|
|
22
|
+
*/
|
|
23
|
+
setLevel(level) {
|
|
24
|
+
this.level = level;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get current log level
|
|
28
|
+
*/
|
|
29
|
+
getLevel() {
|
|
30
|
+
return this.level;
|
|
31
|
+
}
|
|
32
|
+
debug(message, context) {
|
|
33
|
+
if (this.level <= LogLevel.DEBUG) {
|
|
34
|
+
if (context) {
|
|
35
|
+
console.debug("[Amplify SDK]", message, context);
|
|
36
|
+
} else {
|
|
37
|
+
console.debug("[Amplify SDK]", message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
info(message, context) {
|
|
42
|
+
if (this.level <= LogLevel.INFO) {
|
|
43
|
+
if (context) {
|
|
44
|
+
console.info("[Amplify SDK]", message, context);
|
|
45
|
+
} else {
|
|
46
|
+
console.info("[Amplify SDK]", message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
warn(message, context) {
|
|
51
|
+
if (this.level <= LogLevel.WARN) {
|
|
52
|
+
if (context) {
|
|
53
|
+
console.warn("[Amplify SDK]", message, context);
|
|
54
|
+
} else {
|
|
55
|
+
console.warn("[Amplify SDK]", message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
error(message, context) {
|
|
60
|
+
if (this.level <= LogLevel.ERROR) {
|
|
61
|
+
if (context) {
|
|
62
|
+
console.error("[Amplify SDK]", message, context);
|
|
63
|
+
} else {
|
|
64
|
+
console.error("[Amplify SDK]", message);
|
|
65
|
+
}
|
|
16
66
|
}
|
|
17
67
|
}
|
|
18
68
|
};
|
|
19
|
-
|
|
20
|
-
|
|
69
|
+
var currentLogger = new ConsoleLogger(LogLevel.ERROR);
|
|
70
|
+
var defaultLogger = currentLogger;
|
|
71
|
+
function setLogger(logger) {
|
|
72
|
+
currentLogger = logger;
|
|
21
73
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
74
|
+
function getLogger() {
|
|
75
|
+
return currentLogger;
|
|
24
76
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
77
|
+
function setLogLevel(level) {
|
|
78
|
+
if (defaultLogger && typeof defaultLogger.setLevel === "function") {
|
|
79
|
+
defaultLogger.setLevel(level);
|
|
80
|
+
}
|
|
27
81
|
}
|
|
28
82
|
|
|
83
|
+
// src/constants/index.ts
|
|
84
|
+
var ATOMIC_QUEUE_CONTRACT_ADDRESS = "0x228c44bb4885c6633f4b6c83f14622f37d5112e5";
|
|
85
|
+
var DEFAULT_DEADLINE = 3;
|
|
86
|
+
var NATIVE_TOKEN_FOR_BRIDGE_FEE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
87
|
+
var CHAINLINK_ADDRESS = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
88
|
+
var DEFAULT_APPROVAL_AMOUNT = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
89
|
+
var API_BASE_URL = "https://api.paxoslabs.com";
|
|
90
|
+
|
|
29
91
|
// src/lib/vault-cache.ts
|
|
30
92
|
var DEFAULT_TTL = 6e5;
|
|
31
93
|
var VaultCache = class {
|
|
@@ -193,7 +255,6 @@ var VaultCache = class {
|
|
|
193
255
|
};
|
|
194
256
|
|
|
195
257
|
// src/api/amplify-sdk-client.ts
|
|
196
|
-
var API_BASE_URL = "https://api.paxoslabs.com";
|
|
197
258
|
var DEFAULT_TIMEOUT = 1e4;
|
|
198
259
|
function createTimeoutSignal(timeoutMs) {
|
|
199
260
|
const controller = new AbortController();
|
|
@@ -619,7 +680,8 @@ var sdkConfig = {
|
|
|
619
680
|
isInitialized: false,
|
|
620
681
|
initializedAt: null,
|
|
621
682
|
isInitializing: false,
|
|
622
|
-
initPromise: null
|
|
683
|
+
initPromise: null,
|
|
684
|
+
telemetryEnabled: true
|
|
623
685
|
};
|
|
624
686
|
var ERROR_MESSAGES = {
|
|
625
687
|
INVALID_API_KEY: "Invalid API key format. Expected format: pxl_<type>_<string>",
|
|
@@ -652,6 +714,8 @@ function clearConfig() {
|
|
|
652
714
|
sdkConfig.initializedAt = null;
|
|
653
715
|
sdkConfig.isInitializing = false;
|
|
654
716
|
sdkConfig.initPromise = null;
|
|
717
|
+
sdkConfig.telemetryEnabled = true;
|
|
718
|
+
resetTelemetry();
|
|
655
719
|
}
|
|
656
720
|
function getRequestHeaders() {
|
|
657
721
|
const apiKey = getAPIKey();
|
|
@@ -663,7 +727,7 @@ function getRequestHeaders() {
|
|
|
663
727
|
}
|
|
664
728
|
return headers;
|
|
665
729
|
}
|
|
666
|
-
async function initAmplifySDK(apiKey) {
|
|
730
|
+
async function initAmplifySDK(apiKey, options) {
|
|
667
731
|
validateAPIKey(apiKey);
|
|
668
732
|
if (sdkConfig.isInitialized && sdkConfig.apiKey === apiKey) {
|
|
669
733
|
return;
|
|
@@ -676,6 +740,13 @@ async function initAmplifySDK(apiKey) {
|
|
|
676
740
|
clearConfig();
|
|
677
741
|
clearCache();
|
|
678
742
|
}
|
|
743
|
+
if (options?.logger) {
|
|
744
|
+
setLogger(options.logger);
|
|
745
|
+
}
|
|
746
|
+
if (options?.logLevel !== void 0) {
|
|
747
|
+
setLogLevel(options.logLevel);
|
|
748
|
+
}
|
|
749
|
+
sdkConfig.telemetryEnabled = options?.telemetry !== false;
|
|
679
750
|
sdkConfig.isInitializing = true;
|
|
680
751
|
sdkConfig.initPromise = (async () => {
|
|
681
752
|
try {
|
|
@@ -684,6 +755,10 @@ async function initAmplifySDK(apiKey) {
|
|
|
684
755
|
await cache.refresh();
|
|
685
756
|
sdkConfig.isInitialized = true;
|
|
686
757
|
sdkConfig.initializedAt = /* @__PURE__ */ new Date();
|
|
758
|
+
if (sdkConfig.telemetryEnabled) {
|
|
759
|
+
initTelemetry(apiKey).catch(() => {
|
|
760
|
+
});
|
|
761
|
+
}
|
|
687
762
|
} catch (error) {
|
|
688
763
|
clearConfig();
|
|
689
764
|
clearCache();
|
|
@@ -701,6 +776,213 @@ async function initAmplifySDK(apiKey) {
|
|
|
701
776
|
})();
|
|
702
777
|
await sdkConfig.initPromise;
|
|
703
778
|
}
|
|
779
|
+
|
|
780
|
+
// src/lib/telemetry.ts
|
|
781
|
+
var SDK_VERSION = "0.1.1-beta.1";
|
|
782
|
+
var MAX_ERROR_BUFFER_SIZE = 10;
|
|
783
|
+
var CONFIG_FETCH_TIMEOUT = 5e3;
|
|
784
|
+
var telemetryState = {
|
|
785
|
+
enabled: false,
|
|
786
|
+
isInitialized: false,
|
|
787
|
+
isInitializing: false,
|
|
788
|
+
initPromise: null,
|
|
789
|
+
config: null,
|
|
790
|
+
apiKey: null
|
|
791
|
+
};
|
|
792
|
+
var posthogClient = null;
|
|
793
|
+
var errorBuffer = [];
|
|
794
|
+
var bufferFullWarningLogged = false;
|
|
795
|
+
function createTimeoutSignal2(timeoutMs) {
|
|
796
|
+
const controller = new AbortController();
|
|
797
|
+
setTimeout(() => controller.abort(), timeoutMs);
|
|
798
|
+
return controller.signal;
|
|
799
|
+
}
|
|
800
|
+
function hashApiKey(apiKey) {
|
|
801
|
+
const FNV_OFFSET = BigInt("0xcbf29ce484222325");
|
|
802
|
+
const FNV_PRIME = BigInt("0x100000001b3");
|
|
803
|
+
let hash = FNV_OFFSET;
|
|
804
|
+
for (let i = 0; i < apiKey.length; i++) {
|
|
805
|
+
hash ^= BigInt(apiKey.charCodeAt(i));
|
|
806
|
+
hash = hash * FNV_PRIME & BigInt("0xffffffffffffffff");
|
|
807
|
+
}
|
|
808
|
+
return `sdk_${hash.toString(16).slice(0, 12)}`;
|
|
809
|
+
}
|
|
810
|
+
async function fetchTelemetryConfig(apiKey) {
|
|
811
|
+
const endpoint = "/v1/earn-sdk/config";
|
|
812
|
+
const url = `${API_BASE_URL}${endpoint}`;
|
|
813
|
+
try {
|
|
814
|
+
const headers = getRequestHeaders();
|
|
815
|
+
if (!headers["x-api-key"]) {
|
|
816
|
+
headers["x-api-key"] = apiKey;
|
|
817
|
+
}
|
|
818
|
+
const response = await fetch(url, {
|
|
819
|
+
method: "GET",
|
|
820
|
+
headers,
|
|
821
|
+
signal: createTimeoutSignal2(CONFIG_FETCH_TIMEOUT)
|
|
822
|
+
});
|
|
823
|
+
if (!response.ok) {
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
const data = await response.json();
|
|
827
|
+
if (!data || typeof data.posthogApiKey !== "string") {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
return {
|
|
831
|
+
posthogApiKey: data.posthogApiKey,
|
|
832
|
+
posthogHost: data.posthogHost || "https://us.i.posthog.com"
|
|
833
|
+
};
|
|
834
|
+
} catch {
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
async function flushErrorBuffer() {
|
|
839
|
+
if (errorBuffer.length === 0 || !posthogClient) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
for (const bufferedError of errorBuffer) {
|
|
843
|
+
const payload = {
|
|
844
|
+
error_type: bufferedError.name,
|
|
845
|
+
error_message: bufferedError.message,
|
|
846
|
+
error_code: bufferedError.code,
|
|
847
|
+
sdk_version: SDK_VERSION,
|
|
848
|
+
buffered: true,
|
|
849
|
+
...bufferedError.context
|
|
850
|
+
};
|
|
851
|
+
posthogClient.capture("sdk_error", payload);
|
|
852
|
+
}
|
|
853
|
+
errorBuffer.length = 0;
|
|
854
|
+
}
|
|
855
|
+
async function initTelemetry(apiKey) {
|
|
856
|
+
if (telemetryState.isInitialized) {
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (telemetryState.isInitializing && telemetryState.initPromise) {
|
|
860
|
+
await telemetryState.initPromise;
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
telemetryState.isInitializing = true;
|
|
864
|
+
telemetryState.apiKey = apiKey;
|
|
865
|
+
telemetryState.initPromise = (async () => {
|
|
866
|
+
try {
|
|
867
|
+
const config = await fetchTelemetryConfig(apiKey);
|
|
868
|
+
if (!config) {
|
|
869
|
+
telemetryState.enabled = false;
|
|
870
|
+
telemetryState.isInitialized = true;
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
telemetryState.config = config;
|
|
874
|
+
const posthogModule = await import('posthog-js');
|
|
875
|
+
const posthog = posthogModule.default;
|
|
876
|
+
posthog.init(config.posthogApiKey, {
|
|
877
|
+
api_host: config.posthogHost,
|
|
878
|
+
autocapture: false,
|
|
879
|
+
capture_pageview: false,
|
|
880
|
+
capture_pageleave: false,
|
|
881
|
+
disable_session_recording: true,
|
|
882
|
+
persistence: "memory",
|
|
883
|
+
// Don't persist to localStorage
|
|
884
|
+
loaded: (ph) => {
|
|
885
|
+
ph.identify(hashApiKey(apiKey));
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
posthogClient = posthog;
|
|
889
|
+
telemetryState.enabled = true;
|
|
890
|
+
telemetryState.isInitialized = true;
|
|
891
|
+
await flushErrorBuffer();
|
|
892
|
+
posthog.capture("sdk_initialized", {
|
|
893
|
+
sdk_version: SDK_VERSION
|
|
894
|
+
});
|
|
895
|
+
} catch (error) {
|
|
896
|
+
const logger = getLogger();
|
|
897
|
+
logger.warn("Telemetry initialization failed", {
|
|
898
|
+
error: error instanceof Error ? error.message : String(error)
|
|
899
|
+
});
|
|
900
|
+
telemetryState.enabled = false;
|
|
901
|
+
telemetryState.isInitialized = true;
|
|
902
|
+
} finally {
|
|
903
|
+
telemetryState.isInitializing = false;
|
|
904
|
+
telemetryState.initPromise = null;
|
|
905
|
+
}
|
|
906
|
+
})();
|
|
907
|
+
await telemetryState.initPromise;
|
|
908
|
+
}
|
|
909
|
+
function trackError(error, context) {
|
|
910
|
+
const logger = getLogger();
|
|
911
|
+
logger.error(error.message, {
|
|
912
|
+
name: error.name,
|
|
913
|
+
stack: error.stack,
|
|
914
|
+
...context
|
|
915
|
+
});
|
|
916
|
+
const errorDetails = {
|
|
917
|
+
name: error.name,
|
|
918
|
+
message: error.message,
|
|
919
|
+
code: error.code,
|
|
920
|
+
context: context || {},
|
|
921
|
+
timestamp: Date.now()
|
|
922
|
+
};
|
|
923
|
+
if (!posthogClient || !telemetryState.enabled) {
|
|
924
|
+
if (errorBuffer.length < MAX_ERROR_BUFFER_SIZE) {
|
|
925
|
+
errorBuffer.push(errorDetails);
|
|
926
|
+
} else if (!bufferFullWarningLogged) {
|
|
927
|
+
logger.warn(
|
|
928
|
+
`Telemetry error buffer full (${MAX_ERROR_BUFFER_SIZE} errors). Additional errors will not be tracked until telemetry initializes.`
|
|
929
|
+
);
|
|
930
|
+
bufferFullWarningLogged = true;
|
|
931
|
+
}
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const payload = {
|
|
935
|
+
error_type: error.name,
|
|
936
|
+
error_message: error.message,
|
|
937
|
+
error_code: error.code,
|
|
938
|
+
endpoint: error.endpoint,
|
|
939
|
+
status_code: error.statusCode,
|
|
940
|
+
sdk_version: SDK_VERSION,
|
|
941
|
+
...context
|
|
942
|
+
};
|
|
943
|
+
posthogClient.capture("sdk_error", payload);
|
|
944
|
+
}
|
|
945
|
+
function resetTelemetry() {
|
|
946
|
+
telemetryState.enabled = false;
|
|
947
|
+
telemetryState.isInitialized = false;
|
|
948
|
+
telemetryState.isInitializing = false;
|
|
949
|
+
telemetryState.initPromise = null;
|
|
950
|
+
telemetryState.config = null;
|
|
951
|
+
telemetryState.apiKey = null;
|
|
952
|
+
posthogClient = null;
|
|
953
|
+
errorBuffer.length = 0;
|
|
954
|
+
bufferFullWarningLogged = false;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// src/types/amplify-sdk-api.ts
|
|
958
|
+
var APIError = class _APIError extends Error {
|
|
959
|
+
constructor(message, options) {
|
|
960
|
+
super(message);
|
|
961
|
+
this.name = "APIError";
|
|
962
|
+
this.statusCode = options?.statusCode;
|
|
963
|
+
this.endpoint = options?.endpoint;
|
|
964
|
+
this.cause = options?.cause;
|
|
965
|
+
if (Error.captureStackTrace) {
|
|
966
|
+
Error.captureStackTrace(this, _APIError);
|
|
967
|
+
}
|
|
968
|
+
try {
|
|
969
|
+
trackError(this, {
|
|
970
|
+
endpoint: this.endpoint,
|
|
971
|
+
statusCode: this.statusCode
|
|
972
|
+
});
|
|
973
|
+
} catch {
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
function isValidYieldType(value) {
|
|
978
|
+
return typeof value === "string" && (value === "PRIME" || value === "TBILL" || value === "LENDING");
|
|
979
|
+
}
|
|
980
|
+
function isValidAddress(value) {
|
|
981
|
+
return typeof value === "string" && /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
982
|
+
}
|
|
983
|
+
function isValidChainId(value) {
|
|
984
|
+
return typeof value === "number" && value > 0 && Number.isInteger(value);
|
|
985
|
+
}
|
|
704
986
|
var rari = viem.defineChain({
|
|
705
987
|
id: 1380012617,
|
|
706
988
|
name: "Rari Chain",
|
|
@@ -803,21 +1085,14 @@ function clearChainsCache() {
|
|
|
803
1085
|
chainsCache = null;
|
|
804
1086
|
}
|
|
805
1087
|
|
|
806
|
-
// src/constants/index.ts
|
|
807
|
-
var ATOMIC_QUEUE_CONTRACT_ADDRESS = "0x228c44bb4885c6633f4b6c83f14622f37d5112e5";
|
|
808
|
-
var DEFAULT_DEADLINE = 3;
|
|
809
|
-
var NATIVE_TOKEN_FOR_BRIDGE_FEE = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
810
|
-
var CHAINLINK_ADDRESS = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
811
|
-
var DEFAULT_APPROVAL_AMOUNT = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
812
|
-
var NUCLEUS_BASE_URL = "https://backend.nucleusearn.io/v1/protocol";
|
|
813
|
-
|
|
814
1088
|
exports.APIError = APIError;
|
|
1089
|
+
exports.API_BASE_URL = API_BASE_URL;
|
|
815
1090
|
exports.ATOMIC_QUEUE_CONTRACT_ADDRESS = ATOMIC_QUEUE_CONTRACT_ADDRESS;
|
|
816
1091
|
exports.CHAINLINK_ADDRESS = CHAINLINK_ADDRESS;
|
|
817
1092
|
exports.DEFAULT_APPROVAL_AMOUNT = DEFAULT_APPROVAL_AMOUNT;
|
|
818
1093
|
exports.DEFAULT_DEADLINE = DEFAULT_DEADLINE;
|
|
1094
|
+
exports.LogLevel = LogLevel;
|
|
819
1095
|
exports.NATIVE_TOKEN_FOR_BRIDGE_FEE = NATIVE_TOKEN_FOR_BRIDGE_FEE;
|
|
820
|
-
exports.NUCLEUS_BASE_URL = NUCLEUS_BASE_URL;
|
|
821
1096
|
exports.clearChainsCache = clearChainsCache;
|
|
822
1097
|
exports.fetchSupportedAssets = fetchSupportedAssets;
|
|
823
1098
|
exports.fetchVaults = fetchVaults;
|
|
@@ -825,9 +1100,12 @@ exports.findVaultByConfig = findVaultByConfig;
|
|
|
825
1100
|
exports.getAssetsFromCache = getAssetsFromCache;
|
|
826
1101
|
exports.getCache = getCache;
|
|
827
1102
|
exports.getChainFromConfig = getChainFromConfig;
|
|
1103
|
+
exports.getLogger = getLogger;
|
|
828
1104
|
exports.getWithdrawSupportedAssets = getWithdrawSupportedAssets;
|
|
829
1105
|
exports.initAmplifySDK = initAmplifySDK;
|
|
830
1106
|
exports.initializeCache = initializeCache;
|
|
831
1107
|
exports.refreshVaultCache = refreshVaultCache;
|
|
832
|
-
|
|
833
|
-
|
|
1108
|
+
exports.setLogLevel = setLogLevel;
|
|
1109
|
+
exports.setLogger = setLogger;
|
|
1110
|
+
//# sourceMappingURL=chunk-EWJDKRSY.js.map
|
|
1111
|
+
//# sourceMappingURL=chunk-EWJDKRSY.js.map
|