@axelar-network/axelarjs-sdk 0.4.11 → 0.4.12
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/README.md +27 -182
- package/dist/src/assets/index.d.ts.map +1 -1
- package/dist/src/assets/index.js +0 -5
- package/dist/src/assets/index.js.map +1 -1
- package/dist/src/services/RestServices.d.ts.map +1 -1
- package/dist/src/services/RestServices.js +5 -1
- package/dist/src/services/RestServices.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,215 +1,60 @@
|
|
|
1
1
|
# AxelarJS SDK
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
The Axelar JS SDK was created to abstract a set of tools used to make requests into the Axelar Network from a frontend.
|
|
6
|
-
|
|
7
|
-
One of our early use cases is a simple transfer of crypto assets across any of our supported chains.
|
|
8
|
-
|
|
9
|
-
Day 1, this will include:
|
|
10
|
-
|
|
11
|
-
| Supported Assets | Supported Blockchain Networks |
|
|
12
|
-
| ------------- | ------------- |
|
|
13
|
-
| <ul><li>Axelar native tokens</li><li>LUNA (Terra native tokens)</li><li>UST (Terra stablecoin)</li></ul> | <ul><li>Avalanche</li><li>Axelar</li><li>Ethereum</li><li>Fantom</li><li>Moonbeam</li><li>Polygon</li><li>Terra</li></ul> |
|
|
14
|
-
|
|
15
|
-
The list will continue to grow, as will the use cases of this SDK.
|
|
16
|
-
|
|
17
|
-
Thank you for your support!
|
|
18
|
-
|
|
19
|
-
## Technical Overview
|
|
20
|
-
|
|
21
|
-
The Axelar JS SDK is an npm dependency that includes libraries that make requests into the Axelar Network.
|
|
22
|
-
|
|
23
|
-
- Any request from the JS SDK is routed through a node rest server that redirects requests through a coordinated
|
|
24
|
-
collection of microservices controlled by Axelar.
|
|
25
|
-
- These microservices facilitate the relay of cross-chain transactions that run on top of the Axelar Network.
|
|
26
|
-
- See diagram below.
|
|
27
|
-
|
|
28
|
-

|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Note
|
|
32
|
-
This SDK repo is still in early development, and candidly, Axelar's own webapp has been its only consumer so far.
|
|
33
|
-
|
|
34
|
-
***We expect to continue iterating quickly until the ultimate launch, and there are several (potentially breaking)
|
|
35
|
-
changes in the hopper including
|
|
36
|
-
- requirements for API keys/tokens for SDK consumers
|
|
37
|
-
- other potential refactoring
|
|
38
|
-
|
|
39
|
-
Accordingly, please ensure you have the latest and let us know of any issues you encounter using the SDK.
|
|
40
|
-
|
|
41
|
-
Either reach out to us directly or file a github issue on the repo.
|
|
3
|
+
## Coming soon
|
|
42
4
|
|
|
43
|
-
|
|
5
|
+
The `axelarjs-sdk` nodejs repo is currently private and can be accessed only with a NPM token. The repo will be made public shortly.
|
|
44
6
|
|
|
45
|
-
|
|
46
|
-
This is by design and part of a growing list of security measures we have in place to protect our services.
|
|
47
|
-
|
|
48
|
-
For API/SDK users, we will eventually implement an API-key mechanism.
|
|
49
|
-
|
|
50
|
-
## Onboarding process
|
|
51
|
-
Initially, we are gatekeeping the rollout of this SDK a bit as we work through some kinks.
|
|
7
|
+
## Overview
|
|
52
8
|
|
|
53
|
-
|
|
54
|
-
i.e. it is restricted by both cryptographic signing and cors settings.
|
|
9
|
+
The AxelarJS SDK empowers developers to make cross-chain transfers using the Axelar network from their frontend.
|
|
55
10
|
|
|
56
|
-
|
|
57
|
-
1. Install and integrate the API, as shown in the `Installation` and `Getting Started` steps below.
|
|
58
|
-
2. Let us know the hostnames you intend to have access the APIs. We will add that to our list of approved domains.
|
|
59
|
-
Note: API access will shortly be restricted by API keys
|
|
11
|
+
### Example use case: asset transfer
|
|
60
12
|
|
|
61
|
-
|
|
13
|
+
AxelarJS enables the transfer of crypto assets across any blockchain supported by Axelar.
|
|
62
14
|
|
|
63
|
-
|
|
64
|
-
npm i --save @axelar-network/axelarjs-sdk
|
|
65
|
-
```
|
|
15
|
+
Currently supported assets and chains:
|
|
66
16
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
73
|
-
```
|
|
17
|
+
| Supported Assets | Supported Blockchain Networks |
|
|
18
|
+
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| <ul><li>AXL (Axelar native token)</li><li>LUNA (Terra native token)</li><li>UST (Terra stablecoin)</li></ul> | <ul><li>Avalanche</li><li>Axelar</li><li>Ethereum</li><li>Fantom</li><li>Moonbeam</li><li>Polygon</li><li>Terra</li></ul> |
|
|
74
20
|
|
|
75
|
-
|
|
21
|
+
Axelar will continue to add support for new assets and chains in the future.
|
|
76
22
|
|
|
77
|
-
|
|
23
|
+
## Technical overview
|
|
78
24
|
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
import {
|
|
82
|
-
AssetInfoWithTrace,
|
|
83
|
-
AssetTransferObject,
|
|
84
|
-
CallbackStatus,
|
|
85
|
-
TransferAssetBridge
|
|
86
|
-
} from "@axelar-network/axelarjs-sdk";
|
|
25
|
+
The AxelarJS SDK is a `npm` dependency that includes libraries that make requests into the Axelar network.
|
|
87
26
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
private environment: string;
|
|
91
|
-
private axelarJsSDK: TransferAssetBridge;
|
|
92
|
-
|
|
93
|
-
constructor(environment: string) {
|
|
94
|
-
this.environment = environment;
|
|
95
|
-
this.axelarJsSDK = new TransferAssetBridge(environment);
|
|
96
|
-
}
|
|
27
|
+

|
|
97
28
|
|
|
98
|
-
|
|
29
|
+
Any request from the JS SDK is routed through a node REST server that redirects requests through a coordinated collection of microservices controlled by Axelar.
|
|
99
30
|
|
|
100
|
-
|
|
101
|
-
return await this.axelarJsSDK.getOneTimeCode(sigerAddress);
|
|
102
|
-
} catch (e: any) {
|
|
103
|
-
throw e;
|
|
104
|
-
}
|
|
31
|
+
These microservices facilitate the relay of cross-chain transactions that run on top of the Axelar network.
|
|
105
32
|
|
|
106
|
-
|
|
33
|
+
## Demo
|
|
107
34
|
|
|
108
|
-
|
|
35
|
+
See AxelarJS in action: [deposit-address-demo](https://github.com/axelarnetwork/deposit-address-demo)
|
|
109
36
|
|
|
110
|
-
|
|
111
|
-
return this.axelarJsSDK.getDepositAddress(payload, showAlerts);
|
|
112
|
-
} catch (e: any) {
|
|
113
|
-
throw e;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
37
|
+
## AxelarJS is under active development
|
|
117
38
|
|
|
118
|
-
|
|
119
|
-
```
|
|
39
|
+
AxelarJS is under active development. The API might change. Please ensure you pull the latest from this repo post issues to Github.
|
|
120
40
|
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
|
|
124
|
-
const environment: string = "testnet"; /*environment should be one of local | devnet | testnet | mainnet*/
|
|
125
|
-
|
|
126
|
-
const api: AxelarAPI = new AxelarAPI(environment);
|
|
127
|
-
|
|
128
|
-
/*below is sample implementation using ethers.js, but you can use whatever you want*/
|
|
129
|
-
const provider = new ethers.providers.Web3Provider(window.ethereum, "any"); //2nd param is network type
|
|
130
|
-
const signerAuthority = provider.getSigner();
|
|
131
|
-
const signerAuthorityAddress = signerAuthority.getAddress();
|
|
132
|
-
|
|
133
|
-
const getNoncedMessageToSign = async () => {
|
|
134
|
-
const signerAuthorityAddress = await signerAuthority.getAddress();
|
|
135
|
-
const {validationMsg, otc} = await api.getOneTimeMessageToSign(signerAuthorityAddress);
|
|
136
|
-
return {validationMsg, otc};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const promptUserToSignMessage = async () => {
|
|
140
|
-
const {validationMsg, otc} = await getNoncedMessageToSign();
|
|
141
|
-
const signature = await signerAuthority.signMessage(validationMsg);
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
otc,
|
|
145
|
-
publicAddr: await signerAuthority.getAddress(),
|
|
146
|
-
signature};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const getDepositAddress = async (destinationAddress?: string) => {
|
|
150
|
-
const {otc, publicAddr, signature} = await promptUserToSignMessage();
|
|
151
|
-
const parameters: AssetTransferObject = getParameters(destinationAddress || publicAddr); // wherever you specify for the destination address on the destination chain
|
|
152
|
-
parameters.otc = otc;
|
|
153
|
-
parameters.publicAddr = publicAddr;
|
|
154
|
-
parameters.signature = signature;
|
|
155
|
-
|
|
156
|
-
const linkAddress = await api.getDepositAddress(parameters);
|
|
157
|
-
}
|
|
158
|
-
|
|
41
|
+
## Security mesures
|
|
159
42
|
|
|
160
|
-
|
|
43
|
+
AxelarJS employs security measures to protect our services from abuse. Currently every invocation of `getDepositAddress` requires frontend users to connect to a Web3 wallet and sign a message with a one-time code. Invocations to the API are also rate limited.
|
|
161
44
|
|
|
162
|
-
##
|
|
163
|
-
|
|
164
|
-
The getDepositAddress method takes the following parameters:
|
|
165
|
-
1. requestPayload: a complex struct of type `AssetTransferObject`
|
|
166
|
-
2. optional parameter on whether you want error alerts to show on the UI or not
|
|
167
|
-
|
|
168
|
-
Sample parameters:
|
|
169
|
-
```tsx
|
|
170
|
-
// getParameters.ts
|
|
171
|
-
|
|
172
|
-
const getParameters = (destinationAddress: string, sourceChainName: string = "terra", destinationChainName: string = "avalanche", asset_common_key: string = "uusd") => {
|
|
173
|
-
|
|
174
|
-
/*
|
|
175
|
-
info for sourceChainInfo and destinationChainInfo fetched from the ChainList module.
|
|
176
|
-
* */
|
|
177
|
-
const terraChain: ChainInfo = ChainList.map((chain: Chain) => chain.chainInfo).find((chainInfo: ChainInfo) => chainInfo.chainName.toLowerCase() === sourceChainName.toLowerCase()) as ChainInfo;
|
|
178
|
-
const avalancheChain: ChainInfo = ChainList.map((chain: Chain) => chain.chainInfo).find((chainInfo: ChainInfo) => chainInfo.chainName.toLowerCase() === destinationChainName.toLowerCase()) as ChainInfo;
|
|
179
|
-
const assetObj = terraChain.assets?.find((asset: AssetInfo) => asset.common_key === asset_common_key) as AssetInfo;
|
|
180
|
-
|
|
181
|
-
let requestPayload: AssetTransferObject = {
|
|
182
|
-
sourceChainInfo: terraChain,
|
|
183
|
-
destinationChainInfo: avalancheChain,
|
|
184
|
-
selectedSourceAsset: assetObj,
|
|
185
|
-
selectedDestinationAsset: {
|
|
186
|
-
...assetObj,
|
|
187
|
-
assetAddress: destinationAddress, //address on the destination chain where you want the tokens to arrive
|
|
188
|
-
},
|
|
189
|
-
signature: "SIGNATURE_FROM_METAMASK_SIGN",
|
|
190
|
-
otc: "OTC_RECEIVED_FROM_SERVER",
|
|
191
|
-
publicAddr: "SIGNER_OF_SIGNATURE",
|
|
192
|
-
transactionTraceId: "YOUR_OWN_UUID" //your own UUID, helpful for tracing purposes. optional.
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return requestPayload;
|
|
196
|
-
}
|
|
197
|
-
```
|
|
45
|
+
## Contribute
|
|
198
46
|
|
|
199
|
-
|
|
47
|
+
Github issues and pull requests are welcome!
|
|
200
48
|
|
|
201
|
-
|
|
49
|
+
### TODO clarify the following
|
|
202
50
|
|
|
203
|
-
|
|
51
|
+
Run this repo locally:
|
|
204
52
|
|
|
205
53
|
```bash
|
|
206
54
|
git clone git@github.com:axelarnetwork/axelarjs-sdk.git
|
|
55
|
+
cd axelarjs-sdk
|
|
207
56
|
npm install
|
|
208
57
|
npm run build
|
|
209
58
|
npm link # link your local repo to your global packages
|
|
210
59
|
npm run dev # build the files and watch for changes
|
|
211
60
|
```
|
|
212
|
-
|
|
213
|
-
**Start coding!** 🎉
|
|
214
|
-
|
|
215
|
-
For issues, file a github issue or feel free to put forward a pull request with a fix/enhancement.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,CAAC;CACrD;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,CAAC;CACrD;AA6ID,eAAO,MAAM,SAAS,EAAE,WAAW,EAKlC,CAAC"}
|
package/dist/src/assets/index.js
CHANGED
|
@@ -71,11 +71,6 @@ var ust_terra = {
|
|
|
71
71
|
assetName: "UST (Axelar-wrapped)",
|
|
72
72
|
minDepositAmt: 15,
|
|
73
73
|
},
|
|
74
|
-
osmosis: {
|
|
75
|
-
assetSymbol: "UST",
|
|
76
|
-
assetName: "UST (Axelar-wrapped)",
|
|
77
|
-
minDepositAmt: 0.5,
|
|
78
|
-
},
|
|
79
74
|
polygon: {
|
|
80
75
|
assetSymbol: "UST",
|
|
81
76
|
assetName: "UST (Axelar-wrapped)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/assets/index.ts"],"names":[],"mappings":";;;AAcA,IAAM,UAAU,GAAgB;IAC9B,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,OAAO;IACrB,eAAe,EAAE,IAAI;IACrB,QAAQ,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AE,EAAE;SAClB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,sBAAsB;YACjC,aAAa,EAAE,EAAE;SAClB;QACD,OAAO,EAAE;YACP,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,sBAAsB;YACjC,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/assets/index.ts"],"names":[],"mappings":";;;AAcA,IAAM,UAAU,GAAgB;IAC9B,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,OAAO;IACrB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE;QACb,MAAM,EAAE;YACN,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,KAAK;SACrB;QACD,SAAS,EAAE;YACT,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,GAAG;SACnB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,EAAE;SAClB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,GAAG;SACnB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,GAAG;SACnB;QACD,OAAO,EAAE;YACP,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,uBAAuB;YAClC,aAAa,EAAE,GAAG;SACnB;QACD,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE;KACxE;CACF,CAAC;AAEF,IAAM,SAAS,GAAgB;IAC7B,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,OAAO;IACrB,eAAe,EAAE,IAAI;IACrB,QAAQ,EAAE,CAAC;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E,EAAE;QACtE,QAAQ,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE;QACxE,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,EAAE;KACxE;CACF,CAAC;AAEF,IAAM,SAAS,GAAgB;IAC7B,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,UAAU;IACxB,eAAe,EAAE,KAAK;IACtB,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE;QACb,MAAM,EAAE;YACN,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,SAAS,EAAE;YACT,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,OAAO,EAAE;YACP,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;QACD,OAAO,EAAE;YACP,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,WAAW;YACtB,aAAa,EAAE,EAAE;SAClB;KACF;CACF,CAAC;AAEW,QAAA,SAAS,GAAkB;IACtC,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;CACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestServices.d.ts","sourceRoot":"","sources":["../../../src/services/RestServices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"RestServices.d.ts","sourceRoot":"","sources":["../../../src/services/RestServices.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,EAAE,MAAM;IAIjB,IAAI,CACT,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAAC,GAAG,CAAC;IAoBR,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAe1C,OAAO,CAAC,QAAQ;CAqBjB"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.RestServices = void 0;
|
|
4
7
|
var uuid_1 = require("uuid");
|
|
8
|
+
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
5
9
|
var RestServices = /** @class */ (function () {
|
|
6
10
|
function RestServices(host) {
|
|
7
11
|
this.host = host;
|
|
@@ -43,7 +47,7 @@ var RestServices = /** @class */ (function () {
|
|
|
43
47
|
RestServices.prototype.execRest = function (endpoint, requestOptions) {
|
|
44
48
|
var _this = this;
|
|
45
49
|
return new Promise(function (resolve, reject) {
|
|
46
|
-
|
|
50
|
+
(0, cross_fetch_1.default)(_this.host + endpoint, requestOptions)
|
|
47
51
|
.then(function (response) { return response.json(); })
|
|
48
52
|
.then(function (data) {
|
|
49
53
|
if (data === null || data === void 0 ? void 0 : data.error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestServices.js","sourceRoot":"","sources":["../../../src/services/RestServices.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RestServices.js","sourceRoot":"","sources":["../../../src/services/RestServices.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAoC;AAEpC,4DAAgC;AAEhC;IAGE,sBAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,2BAAI,GAAX,UACE,QAAgB,EAChB,OAA4B,EAC5B,OAAa;QAHf,iBAsBC;QAjBC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAM,cAAc,GAAG;gBACrB,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,EAAE,OAAO,CAAC,kBAAkB,IAAI,IAAA,SAAM,GAAE;oBACnD,aAAa,EAAE,OAAO,CAAC,UAAU;oBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,GAAG,EAAE,OAAO,CAAC,GAAG;iBACjB;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,CAAC;YAEF,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;iBACpC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,EAAb,CAAa,CAAC;iBAC7B,KAAK,CAAC,UAAC,KAAK,IAAK,OAAA,MAAM,CAAC,KAAK,CAAC,EAAb,CAAa,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,0BAAG,GAAV,UAAW,QAAgB;QAA3B,iBAaC;QAZC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAM,cAAc,GAAG;gBACrB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,EAAE,IAAA,SAAM,GAAE;iBACtB;aACF,CAAC;YACF,KAAI,CAA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axelar Network",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@types/uuid": "^8.3.1",
|
|
35
35
|
"bech32": "^2.0.0",
|
|
36
36
|
"blockcypher": "^0.3.0",
|
|
37
|
+
"cross-fetch": "^3.1.5",
|
|
37
38
|
"eslint-plugin-import": "^2.25.4",
|
|
38
39
|
"ethers": "^5.4.7",
|
|
39
40
|
"lodash": "^4.17.21",
|