carbon-js-sdk 0.11.37 → 0.11.39
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 +5 -1
- package/lib/clients/TokenClient.d.ts +1 -1
- package/lib/clients/TokenClient.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
Try out the [examples](./examples/). The project has to be built before you can start running the examples
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
+
# go to the root of your carbon-js-sdk directory
|
|
9
|
+
cd /path/to/carbon-js-sdk
|
|
8
10
|
|
|
9
11
|
# install ts-node, typescript
|
|
10
12
|
npm i -g ts-node typescript
|
|
@@ -14,10 +16,12 @@ yarn
|
|
|
14
16
|
|
|
15
17
|
# build the SDK
|
|
16
18
|
yarn build
|
|
19
|
+
```
|
|
17
20
|
|
|
21
|
+
## To Run Example script
|
|
22
|
+
```bash
|
|
18
23
|
# run connect SDK example
|
|
19
24
|
ts-node examples/connect_sdk
|
|
20
|
-
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
## Initializing CarbonSDK
|
|
@@ -75,7 +75,7 @@ declare class TokenClient {
|
|
|
75
75
|
getIbcTokens(): TypeUtils.SimpleMap<Carbon.Coin.Token>;
|
|
76
76
|
getPolyNetworkTokens(): TypeUtils.SimpleMap<Carbon.Coin.Token>;
|
|
77
77
|
getBlockchainV2FromIDs(chainId: number, bridgeId: number): BlockchainV2 | undefined;
|
|
78
|
-
getBridgeFromToken(token: Carbon.Coin.Token | null): Carbon.Coin.Bridge | IbcBridge | undefined;
|
|
78
|
+
getBridgeFromToken(token: Carbon.Coin.Token | null | undefined): Carbon.Coin.Bridge | IbcBridge | undefined;
|
|
79
79
|
getIbcChainIdFromToken(token: Carbon.Coin.Token | null): string | undefined;
|
|
80
80
|
getCdpUnderlyingToken(cdpDenom: string): Carbon.Coin.Token | undefined;
|
|
81
81
|
reloadWrapperMap(): Promise<TypeUtils.SimpleMap<string>>;
|
|
@@ -116,17 +116,17 @@ class TokenClient {
|
|
|
116
116
|
var _a;
|
|
117
117
|
if (!denom)
|
|
118
118
|
return undefined;
|
|
119
|
-
const token = this.tokens[denom];
|
|
120
119
|
if (this.isNativeToken(denom) || this.isNativeStablecoin(denom) || TokenClient.isPoolToken(denom) || TokenClient.isCdpToken(denom) || this.isGroupedToken(denom)) {
|
|
121
120
|
// native denoms "swth" and "usc" should be native.
|
|
122
121
|
// pool and cdp tokens are on the Native blockchain, hence 0
|
|
123
122
|
return 'Native';
|
|
124
123
|
}
|
|
124
|
+
const token = this.tokenForDenom(denom);
|
|
125
125
|
if (this.isBridgedToken(denom)) {
|
|
126
126
|
// brdg tokens will all be chain_id 0 which will also be deprecated in future
|
|
127
127
|
// hence for brdg tokens cannot use chain_id to differentiate between blockchains
|
|
128
128
|
const bridgeList = this.bridges.axelar;
|
|
129
|
-
const chainName = (_a = bridgeList.find((bridge) => bridge.bridgeAddress === token.bridgeAddress)) === null || _a === void 0 ? void 0 : _a.chainName;
|
|
129
|
+
const chainName = (_a = bridgeList.find((bridge) => bridge.bridgeAddress === (token === null || token === void 0 ? void 0 : token.bridgeAddress))) === null || _a === void 0 ? void 0 : _a.chainName;
|
|
130
130
|
return chainName;
|
|
131
131
|
}
|
|
132
132
|
const bridge = this.getBridgeFromToken(token);
|