@axelar-network/axelarjs-sdk 0.6.0-alpha.1 → 0.6.0-alpha.2
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/src/assets/index.js +10 -10
- package/dist/src/assets/index.js.map +1 -1
- package/dist/src/assets/mainnet.assets.d.ts +1042 -46
- package/dist/src/assets/mainnet.assets.d.ts.map +1 -1
- package/dist/src/assets/mainnet.assets.js +1261 -265
- package/dist/src/assets/mainnet.assets.js.map +1 -1
- package/dist/src/assets/test/loadAssets.spec.js +24 -24
- package/dist/src/assets/test/loadAssets.spec.js.map +1 -1
- package/dist/src/assets/types/index.d.ts +2 -0
- package/dist/src/assets/types/index.d.ts.map +1 -1
- package/dist/src/chains/Avalanche/index.js +6 -24
- package/dist/src/chains/Avalanche/index.js.map +1 -1
- package/dist/src/chains/Axelar/index.js +6 -8
- package/dist/src/chains/Axelar/index.js.map +1 -1
- package/dist/src/chains/Cosmoshub/index.js +8 -26
- package/dist/src/chains/Cosmoshub/index.js.map +1 -1
- package/dist/src/chains/Crescent/index.js +8 -26
- package/dist/src/chains/Crescent/index.js.map +1 -1
- package/dist/src/chains/EMoney/index.js +8 -26
- package/dist/src/chains/EMoney/index.js.map +1 -1
- package/dist/src/chains/Ethereum/index.js +5 -6
- package/dist/src/chains/Ethereum/index.js.map +1 -1
- package/dist/src/chains/Fantom/index.js +6 -24
- package/dist/src/chains/Fantom/index.js.map +1 -1
- package/dist/src/chains/Injective/index.d.ts +8 -0
- package/dist/src/chains/Injective/index.d.ts.map +1 -0
- package/dist/src/chains/Injective/index.js +39 -0
- package/dist/src/chains/Injective/index.js.map +1 -0
- package/dist/src/chains/Juno/index.js +8 -26
- package/dist/src/chains/Juno/index.js.map +1 -1
- package/dist/src/chains/Moonbeam/index.js +6 -24
- package/dist/src/chains/Moonbeam/index.js.map +1 -1
- package/dist/src/chains/Osmosis/index.js +9 -27
- package/dist/src/chains/Osmosis/index.js.map +1 -1
- package/dist/src/chains/Polygon/index.js +6 -24
- package/dist/src/chains/Polygon/index.js.map +1 -1
- package/dist/src/chains/Terra/index.js +11 -29
- package/dist/src/chains/Terra/index.js.map +1 -1
- package/dist/src/chains/index.d.ts.map +1 -1
- package/dist/src/chains/index.js +25 -27
- package/dist/src/chains/index.js.map +1 -1
- package/dist/src/chains/test/loadChains.spec.js +22 -22
- package/dist/src/chains/test/loadChains.spec.js.map +1 -1
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/constants/index.d.ts.map +1 -1
- package/dist/src/constants/index.js +19 -15
- package/dist/src/constants/index.js.map +1 -1
- package/dist/src/libs/AxelarAssetTransfer.js +66 -124
- package/dist/src/libs/AxelarAssetTransfer.js.map +1 -1
- package/dist/src/libs/AxelarGateway.js +68 -135
- package/dist/src/libs/AxelarGateway.js.map +1 -1
- package/dist/src/libs/AxelarQueryAPI.js +61 -112
- package/dist/src/libs/AxelarQueryAPI.js.map +1 -1
- package/dist/src/libs/AxelarSigningClient/const/index.d.ts +3 -0
- package/dist/src/libs/AxelarSigningClient/const/index.d.ts.map +1 -0
- package/dist/src/libs/AxelarSigningClient/const/index.js +13 -0
- package/dist/src/libs/AxelarSigningClient/const/index.js.map +1 -0
- package/dist/src/libs/AxelarSigningClient/index.d.ts +21 -0
- package/dist/src/libs/AxelarSigningClient/index.d.ts.map +1 -0
- package/dist/src/libs/AxelarSigningClient/index.js +76 -0
- package/dist/src/libs/AxelarSigningClient/index.js.map +1 -0
- package/dist/src/libs/AxelarSigningClient/types/AxelarnetTxTypes.d.ts +3 -0
- package/dist/src/libs/AxelarSigningClient/types/AxelarnetTxTypes.d.ts.map +1 -0
- package/dist/src/libs/AxelarSigningClient/types/AxelarnetTxTypes.js +26 -0
- package/dist/src/libs/AxelarSigningClient/types/AxelarnetTxTypes.js.map +1 -0
- package/dist/src/libs/AxelarSigningClient/types/EvmTxTypes.d.ts +3 -0
- package/dist/src/libs/AxelarSigningClient/types/EvmTxTypes.d.ts.map +1 -0
- package/dist/src/libs/AxelarSigningClient/types/EvmTxTypes.js +38 -0
- package/dist/src/libs/AxelarSigningClient/types/EvmTxTypes.js.map +1 -0
- package/dist/src/libs/GatewayTx.js +8 -20
- package/dist/src/libs/GatewayTx.js.map +1 -1
- package/dist/src/libs/TransactionRecoveryApi/AxelarDepositRecoveryAPI.d.ts +44 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarDepositRecoveryAPI.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarDepositRecoveryAPI.js +86 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarDepositRecoveryAPI.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.d.ts +10 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.js +35 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarGMPRecoveryAPI.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarRecoveryApi.d.ts +19 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarRecoveryApi.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarRecoveryApi.js +80 -0
- package/dist/src/libs/TransactionRecoveryApi/AxelarRecoveryApi.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/AxelarRpcClient.d.ts +11 -0
- package/dist/src/libs/TransactionRecoveryApi/client/AxelarRpcClient.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/AxelarRpcClient.js +37 -0
- package/dist/src/libs/TransactionRecoveryApi/client/AxelarRpcClient.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/cosmos.d.ts +6 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/cosmos.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/cosmos.js +36 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/cosmos.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/retryRpc.d.ts +3 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/retryRpc.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/retryRpc.js +37 -0
- package/dist/src/libs/TransactionRecoveryApi/client/helpers/retryRpc.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getAmountFromAmountSymbol.d.ts +2 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getAmountFromAmountSymbol.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getAmountFromAmountSymbol.js +13 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getAmountFromAmountSymbol.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getConfirmedTx.d.ts +6 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getConfirmedTx.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getConfirmedTx.js +63 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getConfirmedTx.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getSymbolFromAmountSymbol.d.ts +2 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getSymbolFromAmountSymbol.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getSymbolFromAmountSymbol.js +13 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/getSymbolFromAmountSymbol.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/index.d.ts +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/index.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/index.js +2 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/index.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/parseConfirmDepositEvent.d.ts +5 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/parseConfirmDepositEvent.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/parseConfirmDepositEvent.js +126 -0
- package/dist/src/libs/TransactionRecoveryApi/helpers/parseConfirmDepositEvent.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/index.d.ts +3 -0
- package/dist/src/libs/TransactionRecoveryApi/index.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/index.js +15 -0
- package/dist/src/libs/TransactionRecoveryApi/index.js.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/interface/index.d.ts +31 -0
- package/dist/src/libs/TransactionRecoveryApi/interface/index.d.ts.map +1 -0
- package/dist/src/libs/TransactionRecoveryApi/interface/index.js +10 -0
- package/dist/src/libs/TransactionRecoveryApi/interface/index.js.map +1 -0
- package/dist/src/libs/index.d.ts +3 -0
- package/dist/src/libs/index.d.ts.map +1 -1
- package/dist/src/libs/index.js +3 -0
- package/dist/src/libs/index.js.map +1 -1
- package/dist/src/libs/test/AxelarAssetTransfer.spec.js +140 -225
- package/dist/src/libs/test/AxelarAssetTransfer.spec.js.map +1 -1
- package/dist/src/libs/test/AxelarQueryAPI.spec.js +51 -121
- package/dist/src/libs/test/AxelarQueryAPI.spec.js.map +1 -1
- package/dist/src/libs/test/AxelarSigningClient.spec.d.ts +2 -0
- package/dist/src/libs/test/AxelarSigningClient.spec.d.ts.map +1 -0
- package/dist/src/libs/test/AxelarSigningClient.spec.js +147 -0
- package/dist/src/libs/test/AxelarSigningClient.spec.js.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarDepositRecoveryAPI.spec.d.ts +2 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarDepositRecoveryAPI.spec.d.ts.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarDepositRecoveryAPI.spec.js +48 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarDepositRecoveryAPI.spec.js.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarGMPRecoveryAPI.spec.d.ts +2 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarGMPRecoveryAPI.spec.d.ts.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarGMPRecoveryAPI.spec.js +31 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarGMPRecoveryAPI.spec.js.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarRecoveryAPI.spec.d.ts +2 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarRecoveryAPI.spec.d.ts.map +1 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarRecoveryAPI.spec.js +41 -0
- package/dist/src/libs/test/TransactionRecoveryAPI/AxelarRecoveryAPI.spec.js.map +1 -0
- package/dist/src/libs/test/axelarGateway.test.js +134 -284
- package/dist/src/libs/test/axelarGateway.test.js.map +1 -1
- package/dist/src/libs/test/stubs/index.js +14 -20
- package/dist/src/libs/test/stubs/index.js.map +1 -1
- package/dist/src/libs/types/index.d.ts +16 -0
- package/dist/src/libs/types/index.d.ts.map +1 -1
- package/dist/src/libs/types/index.js.map +1 -1
- package/dist/src/services/RestService.js +28 -66
- package/dist/src/services/RestService.js.map +1 -1
- package/dist/src/services/SocketService.js +47 -89
- package/dist/src/services/SocketService.js.map +1 -1
- package/dist/src/utils/test/validateDestinationAddress.spec.js +38 -38
- package/dist/src/utils/test/validateDestinationAddress.spec.js.map +1 -1
- package/dist/src/utils/validateDestinationAddress.js +7 -11
- package/dist/src/utils/validateDestinationAddress.js.map +1 -1
- package/dist/src/utils/wallet.js +8 -8
- package/dist/src/utils/wallet.js.map +1 -1
- package/dist/test/chains/Axelar/Axelar.test.js +6 -6
- package/dist/test/chains/Axelar/Axelar.test.js.map +1 -1
- package/dist/test/chains/Osmosis/Osmosis.test.js +6 -6
- package/dist/test/chains/Osmosis/Osmosis.test.js.map +1 -1
- package/dist/test/chains/Terra/Terra.test.js +6 -6
- package/dist/test/chains/Terra/Terra.test.js.map +1 -1
- package/dist/test/e2e/app.e2e-spec.js +1 -1
- package/dist/test/e2e/app.e2e-spec.js.map +1 -1
- package/dist/test/e2e/data/index.js +1 -1
- package/dist/test/e2e/data/index.js.map +1 -1
- package/dist/test/e2e/parts/03.deposit-address.spec.js +20 -61
- package/dist/test/e2e/parts/03.deposit-address.spec.js.map +1 -1
- package/package.json +3 -1
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getConfigs = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
resourceUrl:
|
|
4
|
+
const configsMap = {};
|
|
5
|
+
const localConfigs = {
|
|
6
|
+
resourceUrl: `http://localhost:4000`,
|
|
7
7
|
axelarRpcUrl: "https://axelartest-rpc.quickapi.com",
|
|
8
8
|
axelarLcdUrl: "https://axelartest-lcd.quickapi.com",
|
|
9
|
-
axelarCachingServiceUrl: "https://testnet.api.gmp.axelarscan.io"
|
|
9
|
+
axelarCachingServiceUrl: "https://testnet.api.gmp.axelarscan.io",
|
|
10
|
+
recoveryApiUrl: "https://axelar-signing-relayer-testnet.axelar.dev"
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
resourceUrl:
|
|
12
|
+
const devnetConfigs = {
|
|
13
|
+
resourceUrl: `https://nest-server-devnet.axelar.dev`,
|
|
13
14
|
axelarRpcUrl: "",
|
|
14
15
|
axelarLcdUrl: "",
|
|
15
|
-
axelarCachingServiceUrl: "https://devnet.api.gmp.axelarscan.io"
|
|
16
|
+
axelarCachingServiceUrl: "https://devnet.api.gmp.axelarscan.io",
|
|
17
|
+
recoveryApiUrl: ""
|
|
16
18
|
};
|
|
17
|
-
|
|
18
|
-
resourceUrl:
|
|
19
|
+
const testnetConfigs = {
|
|
20
|
+
resourceUrl: `https://nest-server-testnet.axelar.dev`,
|
|
19
21
|
axelarRpcUrl: "https://axelartest-rpc.quickapi.com",
|
|
20
22
|
axelarLcdUrl: "https://axelartest-lcd.quickapi.com",
|
|
21
|
-
axelarCachingServiceUrl: "https://testnet.api.gmp.axelarscan.io"
|
|
23
|
+
axelarCachingServiceUrl: "https://testnet.api.gmp.axelarscan.io",
|
|
24
|
+
recoveryApiUrl: "https://axelar-signing-relayer-testnet.axelar.dev"
|
|
22
25
|
};
|
|
23
|
-
|
|
24
|
-
resourceUrl:
|
|
26
|
+
const mainnetConfigs = {
|
|
27
|
+
resourceUrl: `https://nest-server-mainnet.axelar.dev`,
|
|
25
28
|
axelarRpcUrl: "https://axelar-rpc.quickapi.com",
|
|
26
29
|
axelarLcdUrl: "https://axelar-lcd.quickapi.com",
|
|
27
|
-
axelarCachingServiceUrl: "https://mainnet.api.gmp.axelarscan.io"
|
|
30
|
+
axelarCachingServiceUrl: "https://mainnet.api.gmp.axelarscan.io",
|
|
31
|
+
recoveryApiUrl: "https://axelar-signing-relayer-mainnet.axelar.dev"
|
|
28
32
|
};
|
|
29
33
|
configsMap["local"] = localConfigs;
|
|
30
34
|
configsMap["devnet"] = devnetConfigs;
|
|
31
35
|
configsMap["testnet"] = testnetConfigs;
|
|
32
36
|
configsMap["mainnet"] = mainnetConfigs;
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
let configToUse;
|
|
38
|
+
const getConfigs = (environment) => {
|
|
35
39
|
if (!configToUse) {
|
|
36
40
|
if (!configsMap[environment])
|
|
37
41
|
throw new Error("config environment does not exist");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,UAAU,GAAkD,EAAE,CAAC;AAUrE,MAAM,YAAY,GAAuB;IACvC,WAAW,EAAE,uBAAuB;IACpC,YAAY,EAAE,qCAAqC;IACnD,YAAY,EAAE,qCAAqC;IACnD,uBAAuB,EAAE,uCAAuC;IAChE,cAAc,EAAE,mDAAmD;CACpE,CAAC;AACF,MAAM,aAAa,GAAuB;IACxC,WAAW,EAAE,uCAAuC;IACpD,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,EAAE;IAChB,uBAAuB,EAAE,sCAAsC;IAC/D,cAAc,EAAE,EAAE;CACnB,CAAC;AACF,MAAM,cAAc,GAAuB;IACzC,WAAW,EAAE,wCAAwC;IACrD,YAAY,EAAE,qCAAqC;IACnD,YAAY,EAAE,qCAAqC;IACnD,uBAAuB,EAAE,uCAAuC;IAChE,cAAc,EAAE,mDAAmD;CACpE,CAAC;AACF,MAAM,cAAc,GAAuB;IACzC,WAAW,EAAE,wCAAwC;IACrD,YAAY,EAAE,iCAAiC;IAC/C,YAAY,EAAE,iCAAiC;IAC/C,uBAAuB,EAAE,uCAAuC;IAChE,cAAc,EAAE,mDAAmD;CACpE,CAAC;AAEF,UAAU,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;AACnC,UAAU,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC;AACrC,UAAU,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC;AACvC,UAAU,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC;AAEvC,IAAI,WAA+B,CAAC;AAE7B,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAsB,EAAE;IACpE,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;KACvC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB"}
|
|
@@ -8,43 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.AxelarAssetTransfer = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
14
|
+
const types_1 = require("../services/types");
|
|
15
|
+
const services_1 = require("../services");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const constants_1 = require("../constants");
|
|
18
|
+
class AxelarAssetTransfer {
|
|
19
|
+
constructor(config) {
|
|
20
|
+
const configs = (0, constants_1.getConfigs)(config.environment);
|
|
48
21
|
this.environment = config.environment;
|
|
49
22
|
this.resourceUrl = configs.resourceUrl;
|
|
50
23
|
// handle resource url overwrite (for tests)
|
|
@@ -53,104 +26,73 @@ var AxelarAssetTransfer = /** @class */ (function () {
|
|
|
53
26
|
this.api = new services_1.RestService(this.resourceUrl);
|
|
54
27
|
this.socket = new services_1.SocketService(this.resourceUrl);
|
|
55
28
|
}
|
|
56
|
-
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
roomId = _a.sent();
|
|
76
|
-
return [4 /*yield*/, this.getLinkEvent(roomId)];
|
|
77
|
-
case 4:
|
|
78
|
-
newRoomId = _a.sent();
|
|
79
|
-
depositAddress = this.extractDepositAddress(newRoomId);
|
|
80
|
-
return [2 /*return*/, depositAddress];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
29
|
+
getDepositAddress(fromChain, toChain, destinationAddress, asset, options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
// use trace ID sent in by invoking user, or otherwise generate a new one
|
|
32
|
+
const traceId = (options === null || options === void 0 ? void 0 : options._traceId) || (0, uuid_1.v4)();
|
|
33
|
+
// verify destination address format
|
|
34
|
+
const isDestinationAddressValid = (0, utils_1.validateDestinationAddressByChainName)(toChain, destinationAddress, this.environment);
|
|
35
|
+
if (!isDestinationAddressValid)
|
|
36
|
+
throw new Error(`Invalid destination address for chain ${toChain}`);
|
|
37
|
+
// auth/rate limiting
|
|
38
|
+
const wallet = (0, utils_1.createWallet)();
|
|
39
|
+
// sign validation message
|
|
40
|
+
const { validationMsg } = yield this.getOneTimeCode(wallet.address, traceId);
|
|
41
|
+
const signature = yield wallet.signMessage(validationMsg);
|
|
42
|
+
// get room id to listen for deposit address (to be extracted from link event)
|
|
43
|
+
const roomId = yield this.getInitRoomId(fromChain, toChain, destinationAddress, asset, wallet.address, signature, traceId);
|
|
44
|
+
// extract deposit address from link event
|
|
45
|
+
const newRoomId = yield this.getLinkEvent(roomId);
|
|
46
|
+
const depositAddress = this.extractDepositAddress(newRoomId);
|
|
47
|
+
return depositAddress;
|
|
83
48
|
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
.then(function (response) { return response; })
|
|
93
|
-
.catch(function (error) {
|
|
94
|
-
throw error;
|
|
95
|
-
})];
|
|
96
|
-
case 1:
|
|
97
|
-
otc = _a.sent();
|
|
98
|
-
return [2 /*return*/, otc];
|
|
99
|
-
}
|
|
49
|
+
}
|
|
50
|
+
getOneTimeCode(signerAddress, traceId) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const otc = yield this.api
|
|
53
|
+
.get(`${types_1.CLIENT_API_GET_OTC}?publicAddress=${signerAddress}`, traceId)
|
|
54
|
+
.then((response) => response)
|
|
55
|
+
.catch((error) => {
|
|
56
|
+
throw error;
|
|
100
57
|
});
|
|
58
|
+
return otc;
|
|
101
59
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
60
|
+
}
|
|
61
|
+
getInitRoomId(fromChain, toChain, destinationAddress, asset, publicAddress, signature, traceId) {
|
|
104
62
|
var _a;
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.post(types_1.CLIENT_API_POST_TRANSFER_ASSET, payload, traceId)
|
|
120
|
-
.then(function (response) { return response; })
|
|
121
|
-
.catch(function (error) {
|
|
122
|
-
throw error;
|
|
123
|
-
})];
|
|
124
|
-
case 1:
|
|
125
|
-
response = _b.sent();
|
|
126
|
-
roomId = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.roomId;
|
|
127
|
-
return [2 /*return*/, roomId];
|
|
128
|
-
}
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const payload = {
|
|
65
|
+
fromChain,
|
|
66
|
+
toChain,
|
|
67
|
+
destinationAddress,
|
|
68
|
+
asset,
|
|
69
|
+
publicAddress,
|
|
70
|
+
signature,
|
|
71
|
+
};
|
|
72
|
+
const response = yield this.api
|
|
73
|
+
.post(types_1.CLIENT_API_POST_TRANSFER_ASSET, payload, traceId)
|
|
74
|
+
.then((response) => response)
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
throw error;
|
|
129
77
|
});
|
|
78
|
+
const roomId = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.roomId;
|
|
79
|
+
return roomId;
|
|
130
80
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.joinRoomAndWaitForEvent(roomId)
|
|
139
|
-
.catch(function (error) {
|
|
140
|
-
throw error;
|
|
141
|
-
})];
|
|
142
|
-
case 1:
|
|
143
|
-
newRoomId = (_a.sent()).newRoomId;
|
|
144
|
-
return [2 /*return*/, newRoomId];
|
|
145
|
-
}
|
|
81
|
+
}
|
|
82
|
+
getLinkEvent(roomId) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const { newRoomId } = yield this.socket
|
|
85
|
+
.joinRoomAndWaitForEvent(roomId)
|
|
86
|
+
.catch((error) => {
|
|
87
|
+
throw error;
|
|
146
88
|
});
|
|
89
|
+
return newRoomId;
|
|
147
90
|
});
|
|
148
|
-
}
|
|
149
|
-
|
|
91
|
+
}
|
|
92
|
+
extractDepositAddress(roomId) {
|
|
150
93
|
var _a;
|
|
151
94
|
return (_a = JSON.parse(roomId)) === null || _a === void 0 ? void 0 : _a.depositAddress;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
}());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
155
97
|
exports.AxelarAssetTransfer = AxelarAssetTransfer;
|
|
156
98
|
//# sourceMappingURL=AxelarAssetTransfer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxelarAssetTransfer.js","sourceRoot":"","sources":["../../../src/libs/AxelarAssetTransfer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AxelarAssetTransfer.js","sourceRoot":"","sources":["../../../src/libs/AxelarAssetTransfer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAoC;AACpC,6CAK2B;AAE3B,0CAAyD;AACzD,oCAA+E;AAE/E,4CAA0C;AAG1C,MAAa,mBAAmB;IAO9B,YAAY,MAAiC;QAC3C,MAAM,OAAO,GAAG,IAAA,sBAAU,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAE/C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,WAAW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EAAE;gBACf,MAAM,KAAK,CAAC;YACd,CAAC,CAAC,CAAC;YAEL,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAEO,qBAAqB,CAAC,MAAc;;QAC1C,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,cAAc,CAAC;IAC5C,CAAC;CACF;AAhID,kDAgIC"}
|
|
@@ -8,71 +8,43 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
|
-
var _a, _b, _c, _d;
|
|
42
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
15
|
exports.AxelarGateway = void 0;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
16
|
+
const ethers_1 = require("ethers");
|
|
17
|
+
const types_1 = require("./types");
|
|
18
|
+
const axelarGatewayAbi_json_1 = __importDefault(require("./abi/axelarGatewayAbi.json"));
|
|
19
|
+
const erc20Abi_json_1 = __importDefault(require("./abi/erc20Abi.json"));
|
|
20
|
+
const GatewayTx_1 = require("./GatewayTx");
|
|
21
|
+
const config = {
|
|
22
|
+
[types_1.Environment.MAINNET]: {
|
|
23
|
+
[types_1.EvmChain.ETHEREUM]: "0x4F4495243837681061C4743b74B3eEdf548D56A5",
|
|
24
|
+
[types_1.EvmChain.AVALANCHE]: "0x5029C0EFf6C34351a0CEc334542cDb22c7928f78",
|
|
25
|
+
[types_1.EvmChain.FANTOM]: "0x304acf330bbE08d1e512eefaa92F6a57871fD895",
|
|
26
|
+
[types_1.EvmChain.POLYGON]: "0x6f015F16De9fC8791b234eF68D486d2bF203FBA8",
|
|
27
|
+
[types_1.EvmChain.MOONBEAM]: "0x4F4495243837681061C4743b74B3eEdf548D56A5",
|
|
28
|
+
},
|
|
29
|
+
[types_1.Environment.TESTNET]: {
|
|
30
|
+
[types_1.EvmChain.ETHEREUM]: "0xBC6fcce7c5487d43830a219CA6E7B83238B41e71",
|
|
31
|
+
[types_1.EvmChain.AVALANCHE]: "0xC249632c2D40b9001FE907806902f63038B737Ab",
|
|
32
|
+
[types_1.EvmChain.FANTOM]: "0x97837985Ec0494E7b9C71f5D3f9250188477ae14",
|
|
33
|
+
[types_1.EvmChain.POLYGON]: "0xBF62ef1486468a6bd26Dd669C06db43dEd5B849B",
|
|
34
|
+
[types_1.EvmChain.MOONBEAM]: "0x5769D84DD62a6fD969856c75c7D321b84d455929",
|
|
35
|
+
},
|
|
36
|
+
[types_1.Environment.DEVNET]: {
|
|
37
|
+
[types_1.EvmChain.ETHEREUM]: "0x7358799e0c8250f0B7D1164824F6Dd5bA31C9Cd6",
|
|
38
|
+
[types_1.EvmChain.AVALANCHE]: "0x4ffb57Aea2295d663B03810a5802ef2Bc322370D",
|
|
39
|
+
[types_1.EvmChain.MOONBEAM]: "0x1b23BE90a16efe8fD3008E742dDd9531dC5845b0",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
class AxelarGateway {
|
|
71
43
|
/**
|
|
72
44
|
* @param contractAddress axelar gateway's contract address.
|
|
73
45
|
* @param provider evm provider to read value from the contract.
|
|
74
46
|
*/
|
|
75
|
-
|
|
47
|
+
constructor(contractAddress, provider) {
|
|
76
48
|
this.provider = provider;
|
|
77
49
|
this.contract = new ethers_1.ethers.Contract(contractAddress, axelarGatewayAbi_json_1.default, provider);
|
|
78
50
|
}
|
|
@@ -84,95 +56,56 @@ var AxelarGateway = /** @class */ (function () {
|
|
|
84
56
|
* @param provider evm provider to read value from the contract.
|
|
85
57
|
* @returns AxelarGateway instance
|
|
86
58
|
*/
|
|
87
|
-
|
|
59
|
+
static create(env, chain, provider) {
|
|
88
60
|
return new AxelarGateway(config[env][chain], provider);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
|
|
93
|
-
return
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0: return [4 /*yield*/, this.contract.populateTransaction.callContract(args.destinationChain, args.destinationContractAddress, args.payload)];
|
|
96
|
-
case 1:
|
|
97
|
-
unsignedTx = _a.sent();
|
|
98
|
-
return [2 /*return*/, new GatewayTx_1.GatewayTx(unsignedTx, this.provider)];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
61
|
+
}
|
|
62
|
+
createCallContractTx(args) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const unsignedTx = yield this.contract.populateTransaction.callContract(args.destinationChain, args.destinationContractAddress, args.payload);
|
|
65
|
+
return new GatewayTx_1.GatewayTx(unsignedTx, this.provider);
|
|
101
66
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, this.contract.populateTransaction.callContractWithToken(args.destinationChain, args.destinationContractAddress, args.payload, args.symbol, args.amount)];
|
|
109
|
-
case 1:
|
|
110
|
-
unsignedTx = _a.sent();
|
|
111
|
-
return [2 /*return*/, new GatewayTx_1.GatewayTx(unsignedTx, this.provider)];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
67
|
+
}
|
|
68
|
+
createCallContractWithTokenTx(args) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const unsignedTx = yield this.contract.populateTransaction.callContractWithToken(args.destinationChain, args.destinationContractAddress, args.payload, args.symbol, args.amount);
|
|
71
|
+
return new GatewayTx_1.GatewayTx(unsignedTx, this.provider);
|
|
114
72
|
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
switch (_a.label) {
|
|
121
|
-
case 0: return [4 /*yield*/, this.contract.populateTransaction.sendToken(args.destinationChain, args.destinationAddress, args.symbol, args.amount)];
|
|
122
|
-
case 1:
|
|
123
|
-
unsignedTx = _a.sent();
|
|
124
|
-
return [2 /*return*/, new GatewayTx_1.GatewayTx(unsignedTx, this.provider)];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
73
|
+
}
|
|
74
|
+
createSendTokenTx(args) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const unsignedTx = yield this.contract.populateTransaction.sendToken(args.destinationChain, args.destinationAddress, args.symbol, args.amount);
|
|
77
|
+
return new GatewayTx_1.GatewayTx(unsignedTx, this.provider);
|
|
127
78
|
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
tokenAddress = args.tokenAddress;
|
|
136
|
-
erc20Contract = new ethers_1.ethers.Contract(tokenAddress, erc20Abi_json_1.default, this.provider);
|
|
137
|
-
return [4 /*yield*/, erc20Contract.populateTransaction.approve(this.contract.address, args.amount || ethers_1.ethers.constants.MaxUint256)];
|
|
138
|
-
case 1:
|
|
139
|
-
unsignedTx = _a.sent();
|
|
140
|
-
return [2 /*return*/, new GatewayTx_1.GatewayTx(unsignedTx, this.provider)];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
79
|
+
}
|
|
80
|
+
createApproveTx(args) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const tokenAddress = args.tokenAddress;
|
|
83
|
+
const erc20Contract = new ethers_1.ethers.Contract(tokenAddress, erc20Abi_json_1.default, this.provider);
|
|
84
|
+
const unsignedTx = yield erc20Contract.populateTransaction.approve(this.contract.address, args.amount || ethers_1.ethers.constants.MaxUint256);
|
|
85
|
+
return new GatewayTx_1.GatewayTx(unsignedTx, this.provider);
|
|
143
86
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
87
|
+
}
|
|
88
|
+
getAllowance(tokenAddress, signerAddress) {
|
|
89
|
+
const erc20Contract = new ethers_1.ethers.Contract(tokenAddress, erc20Abi_json_1.default, this.provider);
|
|
147
90
|
return erc20Contract.allowance(signerAddress, this.contract.address);
|
|
148
|
-
}
|
|
149
|
-
|
|
91
|
+
}
|
|
92
|
+
isTokenFrozen(symbol) {
|
|
150
93
|
return this.contract.tokenFrozen(symbol);
|
|
151
|
-
}
|
|
152
|
-
|
|
94
|
+
}
|
|
95
|
+
isCommandExecuted(commandId) {
|
|
153
96
|
return this.contract.isCommandExecuted(commandId);
|
|
154
|
-
}
|
|
155
|
-
|
|
97
|
+
}
|
|
98
|
+
getTokenAddress(symbol) {
|
|
156
99
|
return this.contract.tokenAddresses(symbol);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
-
|
|
161
|
-
return __generator(this, function (_c) {
|
|
162
|
-
switch (_c.label) {
|
|
163
|
-
case 0:
|
|
164
|
-
_b = (_a = ethers_1.ethers.Contract).bind;
|
|
165
|
-
return [4 /*yield*/, this.getTokenAddress(tokenSymbol)];
|
|
166
|
-
case 1: return [2 /*return*/, new (_b.apply(_a, [void 0, _c.sent(), erc20Abi_json_1.default,
|
|
167
|
-
this.provider]))()];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
100
|
+
}
|
|
101
|
+
getERC20TokenContract(tokenSymbol) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
return new ethers_1.ethers.Contract(yield this.getTokenAddress(tokenSymbol), erc20Abi_json_1.default, this.provider);
|
|
170
104
|
});
|
|
171
|
-
}
|
|
172
|
-
|
|
105
|
+
}
|
|
106
|
+
getContract() {
|
|
173
107
|
return this.contract;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
}());
|
|
108
|
+
}
|
|
109
|
+
}
|
|
177
110
|
exports.AxelarGateway = AxelarGateway;
|
|
178
111
|
//# sourceMappingURL=AxelarGateway.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxelarGateway.js","sourceRoot":"","sources":["../../../src/libs/AxelarGateway.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AxelarGateway.js","sourceRoot":"","sources":["../../../src/libs/AxelarGateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAgC;AAChC,mCAOiB;AACjB,wFAA2D;AAC3D,wEAA2C;AAC3C,2CAAwC;AAExC,MAAM,MAAM,GAA2D;IACrE,CAAC,mBAAW,CAAC,OAAO,CAAC,EAAE;QACrB,CAAC,gBAAQ,CAAC,QAAQ,CAAC,EAAE,4CAA4C;QACjE,CAAC,gBAAQ,CAAC,SAAS,CAAC,EAAE,4CAA4C;QAClE,CAAC,gBAAQ,CAAC,MAAM,CAAC,EAAE,4CAA4C;QAC/D,CAAC,gBAAQ,CAAC,OAAO,CAAC,EAAE,4CAA4C;QAChE,CAAC,gBAAQ,CAAC,QAAQ,CAAC,EAAE,4CAA4C;KAClE;IACD,CAAC,mBAAW,CAAC,OAAO,CAAC,EAAE;QACrB,CAAC,gBAAQ,CAAC,QAAQ,CAAC,EAAE,4CAA4C;QACjE,CAAC,gBAAQ,CAAC,SAAS,CAAC,EAAE,4CAA4C;QAClE,CAAC,gBAAQ,CAAC,MAAM,CAAC,EAAE,4CAA4C;QAC/D,CAAC,gBAAQ,CAAC,OAAO,CAAC,EAAE,4CAA4C;QAChE,CAAC,gBAAQ,CAAC,Q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