@paxoslabs/amplify-sdk 0.0.1-alpha.1 → 0.0.1-alpha.3
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/{chunk-ZSFIOWWT.js → chunk-AIBI7ZQM.js} +8 -8
- package/dist/{chunk-ZSFIOWWT.js.map → chunk-AIBI7ZQM.js.map} +1 -1
- package/dist/{chunk-JLXNOGZB.js → chunk-BXUG3WDV.js} +46 -21
- package/dist/chunk-BXUG3WDV.js.map +1 -0
- package/dist/{chunk-GE2VQUPP.mjs → chunk-GBWBO6ZF.mjs} +4 -4
- package/dist/{chunk-GE2VQUPP.mjs.map → chunk-GBWBO6ZF.mjs.map} +1 -1
- package/dist/{chunk-BDXS57YH.js → chunk-IBNTWZ4S.js} +33 -6
- package/dist/chunk-IBNTWZ4S.js.map +1 -0
- package/dist/{chunk-AFWUOS3M.js → chunk-K4DL2AII.js} +4 -4
- package/dist/{chunk-AFWUOS3M.js.map → chunk-K4DL2AII.js.map} +1 -1
- package/dist/{chunk-SIR2TCAR.mjs → chunk-OPOYGPSS.mjs} +3 -3
- package/dist/{chunk-SIR2TCAR.mjs.map → chunk-OPOYGPSS.mjs.map} +1 -1
- package/dist/{chunk-ISO6Z7LD.mjs → chunk-WFCHKDDG.mjs} +33 -6
- package/dist/chunk-WFCHKDDG.mjs.map +1 -0
- package/dist/{chunk-ZZBZIDZP.mjs → chunk-YP2TR5RP.mjs} +44 -19
- package/dist/chunk-YP2TR5RP.mjs.map +1 -0
- package/dist/{chunk-O5P6SP2O.js → chunk-ZCVMGIMV.js} +20 -20
- package/dist/{chunk-O5P6SP2O.js.map → chunk-ZCVMGIMV.js.map} +1 -1
- package/dist/{chunk-FYNPQXCR.mjs → chunk-ZLS2AAMI.mjs} +3 -3
- package/dist/{chunk-FYNPQXCR.mjs.map → chunk-ZLS2AAMI.mjs.map} +1 -1
- package/dist/core.js +14 -14
- package/dist/core.mjs +4 -4
- package/dist/display.js +12 -12
- package/dist/display.mjs +4 -4
- package/dist/index.js +131 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -5
- package/dist/index.mjs.map +1 -1
- package/dist/utils.js +5 -5
- package/dist/utils.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-BDXS57YH.js.map +0 -1
- package/dist/chunk-ISO6Z7LD.mjs.map +0 -1
- package/dist/chunk-JLXNOGZB.js.map +0 -1
- package/dist/chunk-ZZBZIDZP.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/multi-call.ts","../src/api/teller.ts"],"names":[],"mappings":";;;AA2CA,IAAM,kBAAkB,OAAO;AAAA,EAC7B,iBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAyB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,SAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,SAAA,CAAU;AAAA,IACrC,SAAA,EAAW;AAAA,MACT;AAAA,QACE,GAAA,EAAK,SAAA;AAAA,QACL,OAAA,EAAS,aAAA;AAAA,QACT,YAAA,EAAc;AAAA,OAChB;AAAA,MACA;AAAA,QACE,GAAA,EAAK,aAAA;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,MAAM,SAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,IAAA,GAAO,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACrC,GAAA,EAAK,SAAA;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":[],"mappings":";;;AA2CA,IAAM,kBAAkB,OAAO;AAAA,EAC7B,iBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAA,KAAyB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,SAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,SAAA,CAAU;AAAA,IACrC,SAAA,EAAW;AAAA,MACT;AAAA,QACE,GAAA,EAAK,SAAA;AAAA,QACL,OAAA,EAAS,aAAA;AAAA,QACT,YAAA,EAAc;AAAA,OAChB;AAAA,MACA;AAAA,QACE,GAAA,EAAK,aAAA;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,MAAM,SAAA,CAAU,OAAO,CAAA;AAEtC,EAAA,MAAM,IAAA,GAAO,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACrC,GAAA,EAAK,SAAA;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-ZLS2AAMI.mjs","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"]}
|
package/dist/core.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkITB7FXG4_js = require('./chunk-ITB7FXG4.js');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkAIBI7ZQM_js = require('./chunk-AIBI7ZQM.js');
|
|
5
|
+
var chunkBXUG3WDV_js = require('./chunk-BXUG3WDV.js');
|
|
6
6
|
var chunkRUIAH5HY_js = require('./chunk-RUIAH5HY.js');
|
|
7
|
-
var
|
|
7
|
+
var chunkIBNTWZ4S_js = require('./chunk-IBNTWZ4S.js');
|
|
8
8
|
var viem = require('viem');
|
|
9
9
|
|
|
10
10
|
async function getVaultAllowance({
|
|
@@ -13,7 +13,7 @@ async function getVaultAllowance({
|
|
|
13
13
|
userAddress,
|
|
14
14
|
chainId
|
|
15
15
|
}) {
|
|
16
|
-
const client = await
|
|
16
|
+
const client = await chunkBXUG3WDV_js.getClient(chainId);
|
|
17
17
|
const allowance = await client.readContract({
|
|
18
18
|
abi: viem.erc20Abi,
|
|
19
19
|
address: tokenAddress,
|
|
@@ -26,7 +26,7 @@ async function getTotalSupply({
|
|
|
26
26
|
tokenAddress,
|
|
27
27
|
chainId
|
|
28
28
|
}) {
|
|
29
|
-
const client = await
|
|
29
|
+
const client = await chunkBXUG3WDV_js.getClient(chainId);
|
|
30
30
|
const totalSupply = await client.readContract({
|
|
31
31
|
abi: viem.erc20Abi,
|
|
32
32
|
address: tokenAddress,
|
|
@@ -76,10 +76,10 @@ var ChainlinkAbi = [
|
|
|
76
76
|
async function getEthPrice({
|
|
77
77
|
chainId
|
|
78
78
|
}) {
|
|
79
|
-
const client = await
|
|
79
|
+
const client = await chunkBXUG3WDV_js.getClient(chainId);
|
|
80
80
|
const priceData = await client.readContract({
|
|
81
81
|
abi: ChainlinkAbi,
|
|
82
|
-
address:
|
|
82
|
+
address: chunkIBNTWZ4S_js.CHAINLINK_ADDRESS,
|
|
83
83
|
functionName: "latestRoundData",
|
|
84
84
|
args: []
|
|
85
85
|
});
|
|
@@ -92,7 +92,7 @@ async function getEthPrice({
|
|
|
92
92
|
// src/api/withdraw-assets.ts
|
|
93
93
|
var assetsCache = null;
|
|
94
94
|
function constructUrl(params) {
|
|
95
|
-
const withdrawAssetsUrl = `${
|
|
95
|
+
const withdrawAssetsUrl = `${chunkIBNTWZ4S_js.NUCLEUS_BASE_URL}/withdraw-assets`;
|
|
96
96
|
if (!params) return withdrawAssetsUrl;
|
|
97
97
|
const queryParams = new URLSearchParams();
|
|
98
98
|
if (params.chainId) queryParams.append("chainId", params.chainId.toString());
|
|
@@ -148,27 +148,27 @@ async function getAssetSlippage(chainId, vaultAddress, tokenAddress, defaultSlip
|
|
|
148
148
|
|
|
149
149
|
Object.defineProperty(exports, "getPausedStates", {
|
|
150
150
|
enumerable: true,
|
|
151
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkAIBI7ZQM_js.getPausedStates; }
|
|
152
152
|
});
|
|
153
153
|
Object.defineProperty(exports, "getPreviewFee", {
|
|
154
154
|
enumerable: true,
|
|
155
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunkAIBI7ZQM_js.getPreviewFee; }
|
|
156
156
|
});
|
|
157
157
|
Object.defineProperty(exports, "getErc20Allowance", {
|
|
158
158
|
enumerable: true,
|
|
159
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunkBXUG3WDV_js.getErc20Allowance; }
|
|
160
160
|
});
|
|
161
161
|
Object.defineProperty(exports, "getErc20Balance", {
|
|
162
162
|
enumerable: true,
|
|
163
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunkBXUG3WDV_js.getErc20Balance; }
|
|
164
164
|
});
|
|
165
165
|
Object.defineProperty(exports, "getErc20Decimals", {
|
|
166
166
|
enumerable: true,
|
|
167
|
-
get: function () { return
|
|
167
|
+
get: function () { return chunkBXUG3WDV_js.getErc20Decimals; }
|
|
168
168
|
});
|
|
169
169
|
Object.defineProperty(exports, "getRateInQuoteWithAssetDecimals", {
|
|
170
170
|
enumerable: true,
|
|
171
|
-
get: function () { return
|
|
171
|
+
get: function () { return chunkBXUG3WDV_js.getRateInQuoteWithAssetDecimals; }
|
|
172
172
|
});
|
|
173
173
|
Object.defineProperty(exports, "fetchVaultConfig", {
|
|
174
174
|
enumerable: true,
|
package/dist/core.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DEFAULT_SLIPPAGE_BPS } from './chunk-XXHRCCZS.mjs';
|
|
2
|
-
export { getPausedStates, getPreviewFee } from './chunk-
|
|
3
|
-
import { getClient } from './chunk-
|
|
4
|
-
export { getErc20Allowance, getErc20Balance, getErc20Decimals, getRateInQuoteWithAssetDecimals } from './chunk-
|
|
2
|
+
export { getPausedStates, getPreviewFee } from './chunk-ZLS2AAMI.mjs';
|
|
3
|
+
import { getClient } from './chunk-YP2TR5RP.mjs';
|
|
4
|
+
export { getErc20Allowance, getErc20Balance, getErc20Decimals, getRateInQuoteWithAssetDecimals } from './chunk-YP2TR5RP.mjs';
|
|
5
5
|
export { fetchVaultConfig, toChainId } from './chunk-J3662HYT.mjs';
|
|
6
|
-
import { CHAINLINK_ADDRESS, NUCLEUS_BASE_URL } from './chunk-
|
|
6
|
+
import { CHAINLINK_ADDRESS, NUCLEUS_BASE_URL } from './chunk-WFCHKDDG.mjs';
|
|
7
7
|
import { erc20Abi } from 'viem';
|
|
8
8
|
|
|
9
9
|
async function getVaultAllowance({
|
package/dist/display.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkZCVMGIMV_js = require('./chunk-ZCVMGIMV.js');
|
|
4
|
+
var chunkAIBI7ZQM_js = require('./chunk-AIBI7ZQM.js');
|
|
5
|
+
require('./chunk-BXUG3WDV.js');
|
|
6
6
|
var chunkICKDAKVS_js = require('./chunk-ICKDAKVS.js');
|
|
7
7
|
require('./chunk-RUIAH5HY.js');
|
|
8
8
|
require('./chunk-3I3PYX2F.js');
|
|
9
|
-
var
|
|
9
|
+
var chunkIBNTWZ4S_js = require('./chunk-IBNTWZ4S.js');
|
|
10
10
|
|
|
11
11
|
// src/vaults/bridge.ts
|
|
12
12
|
var prepareBridgeContractArg = ({
|
|
13
13
|
bridgeChainIdentifier,
|
|
14
14
|
userAddress,
|
|
15
|
-
nativeTokenForBridgeFee =
|
|
15
|
+
nativeTokenForBridgeFee = chunkIBNTWZ4S_js.NATIVE_TOKEN_FOR_BRIDGE_FEE
|
|
16
16
|
}) => {
|
|
17
17
|
return {
|
|
18
18
|
chainSelector: bridgeChainIdentifier,
|
|
@@ -30,7 +30,7 @@ var getBridgeFee = async ({
|
|
|
30
30
|
sourceChainId,
|
|
31
31
|
destinationChainId,
|
|
32
32
|
userAddress,
|
|
33
|
-
nativeTokenForBridgeFee =
|
|
33
|
+
nativeTokenForBridgeFee = chunkIBNTWZ4S_js.NATIVE_TOKEN_FOR_BRIDGE_FEE
|
|
34
34
|
}) => {
|
|
35
35
|
const vault = await chunkICKDAKVS_js.getVaultByKey(vaultKey);
|
|
36
36
|
if (!vault) {
|
|
@@ -64,7 +64,7 @@ var getBridgeFee = async ({
|
|
|
64
64
|
userAddress,
|
|
65
65
|
nativeTokenForBridgeFee
|
|
66
66
|
});
|
|
67
|
-
const previewFee = await
|
|
67
|
+
const previewFee = await chunkAIBI7ZQM_js.getPreviewFee({
|
|
68
68
|
shareAmount: bridgeAmount,
|
|
69
69
|
bridgeData: bridgeContractArg,
|
|
70
70
|
contractAddress: vault.contracts.teller,
|
|
@@ -81,7 +81,7 @@ var getVaultStatus = async ({ vaultKey, chainId }) => {
|
|
|
81
81
|
}
|
|
82
82
|
const tellerAddress = vault.contracts.teller;
|
|
83
83
|
const accountantAddress = vault.contracts.accountant;
|
|
84
|
-
const [tellerStatus, accountantStatus] = await
|
|
84
|
+
const [tellerStatus, accountantStatus] = await chunkAIBI7ZQM_js.getPausedStates({
|
|
85
85
|
accountantAddress,
|
|
86
86
|
tellerAddress,
|
|
87
87
|
chainId
|
|
@@ -104,19 +104,19 @@ var getVaultStatus = async ({ vaultKey, chainId }) => {
|
|
|
104
104
|
|
|
105
105
|
Object.defineProperty(exports, "getDepositExchangeRate", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkZCVMGIMV_js.getDepositExchangeRate; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "getWithdrawExchangeRate", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkZCVMGIMV_js.getWithdrawExchangeRate; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "isDepositSpendApproved", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkZCVMGIMV_js.isDepositSpendApproved; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "isWithdrawalSpendApproved", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkZCVMGIMV_js.isWithdrawalSpendApproved; }
|
|
120
120
|
});
|
|
121
121
|
exports.getBridgeFee = getBridgeFee;
|
|
122
122
|
exports.getVaultStatus = getVaultStatus;
|
package/dist/display.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { getDepositExchangeRate, getWithdrawExchangeRate, isDepositSpendApproved, isWithdrawalSpendApproved } from './chunk-
|
|
2
|
-
import { getPreviewFee, getPausedStates } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { getDepositExchangeRate, getWithdrawExchangeRate, isDepositSpendApproved, isWithdrawalSpendApproved } from './chunk-GBWBO6ZF.mjs';
|
|
2
|
+
import { getPreviewFee, getPausedStates } from './chunk-ZLS2AAMI.mjs';
|
|
3
|
+
import './chunk-YP2TR5RP.mjs';
|
|
4
4
|
import { getVaultByKey } from './chunk-R663BFAZ.mjs';
|
|
5
5
|
import './chunk-J3662HYT.mjs';
|
|
6
6
|
import './chunk-7RWWVUHP.mjs';
|
|
7
|
-
import { NATIVE_TOKEN_FOR_BRIDGE_FEE } from './chunk-
|
|
7
|
+
import { NATIVE_TOKEN_FOR_BRIDGE_FEE } from './chunk-WFCHKDDG.mjs';
|
|
8
8
|
|
|
9
9
|
// src/vaults/bridge.ts
|
|
10
10
|
var prepareBridgeContractArg = ({
|