carbon-js-sdk 0.3.18 → 0.3.20-beta.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.
@@ -6,7 +6,7 @@ import * as clients from "./clients";
6
6
  import N3Client from "./clients/N3Client";
7
7
  import { AdminModule, BankModule, BrokerModule, CDPModule, CoinModule, FeeModule, GovModule, IBCModule, LeverageModule, LiquidityPoolModule, MarketModule, OracleModule, OrderModule, PositionModule, ProfileModule, SubAccountModule, XChainModule } from "./modules";
8
8
  import { StakingModule } from "./modules/staking";
9
- import { CosmosLedger, Keplr } from "./provider";
9
+ import { CosmosLedger, Keplr, Leap } from "./provider";
10
10
  import { CarbonSigner, CarbonWallet, CarbonWalletGenericOpts } from "./wallet";
11
11
  export { CarbonTx } from "./util";
12
12
  export { CarbonSigner, CarbonSignerTypes, CarbonWallet, CarbonWalletGenericOpts, CarbonWalletInitOpts } from "./wallet";
@@ -14,6 +14,7 @@ export { DenomPrefix } from "./constant";
14
14
  export interface CarbonSDKOpts {
15
15
  network: Network;
16
16
  tmClient: Tendermint34Client;
17
+ chainId?: string;
17
18
  token?: TokenClient;
18
19
  config?: Partial<NetworkConfig>;
19
20
  defaultTimeoutBlocks?: number;
@@ -69,6 +70,7 @@ declare class CarbonSDK {
69
70
  bsc: ETHClient;
70
71
  zil: ZILClient;
71
72
  n3: N3Client;
73
+ chainId: string;
72
74
  constructor(opts: CarbonSDKOpts);
73
75
  static instance(opts?: CarbonSDKInitOpts): Promise<CarbonSDK>;
74
76
  static instanceWithWallet(wallet: CarbonWallet, sdkOpts?: CarbonSDKInitOpts): Promise<ConnectedCarbonSDK>;
@@ -77,6 +79,7 @@ declare class CarbonSDK {
77
79
  static instanceWithSigner(signer: CarbonSigner, publicKeyBase64: string, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
78
80
  static instanceWithLedger(ledger: CosmosLedger, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
79
81
  static instanceWithKeplr(keplr: Keplr, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
82
+ static instanceWithLeap(leap: Leap, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
80
83
  static instanceViewOnly(bech32Address: string, sdkOpts?: CarbonSDKInitOpts, walletOpts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
81
84
  initialize(): Promise<CarbonSDK>;
82
85
  clone(): CarbonSDK;
@@ -88,6 +91,7 @@ declare class CarbonSDK {
88
91
  connectWithSigner(signer: CarbonSigner, publicKeyBase64: string, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
89
92
  connectWithLedger(ledger: CosmosLedger, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
90
93
  connectWithKeplr(keplr: Keplr, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
94
+ connectWithLeap(leap: Leap, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
91
95
  connectViewOnly(bech32Address: string, opts?: CarbonWalletGenericOpts): Promise<ConnectedCarbonSDK>;
92
96
  getConfig(): NetworkConfig;
93
97
  getTokenClient(): TokenClient;
package/lib/CarbonSDK.js CHANGED
@@ -60,15 +60,16 @@ const DEFAULT_SDK_INIT_OPTS = {
60
60
  */
61
61
  class CarbonSDK {
62
62
  constructor(opts) {
63
- var _a, _b, _c;
63
+ var _a, _b, _c, _d, _e;
64
64
  this.network = (_a = opts.network) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_NETWORK;
65
65
  this.configOverride = (_b = opts.config) !== null && _b !== void 0 ? _b : {};
66
66
  this.networkConfig = util_1.GenericUtils.overrideConfig(constant_1.NetworkConfigs[this.network], this.configOverride);
67
67
  this.tmClient = opts.tmClient;
68
+ this.chainId = (_d = (_c = opts.chainId) !== null && _c !== void 0 ? _c : constant_1.CarbonChainIDs[this.network]) !== null && _d !== void 0 ? _d : constant_1.CarbonChainIDs[constant_1.Network.MainNet];
68
69
  this.query = new clients_1.CarbonQueryClient(opts.tmClient);
69
70
  this.insights = new clients_1.InsightsQueryClient(this.networkConfig);
70
71
  this.hydrogen = new clients_1.HydrogenClient(this.networkConfig);
71
- this.token = (_c = opts.token) !== null && _c !== void 0 ? _c : clients_1.TokenClient.instance(this.query, this);
72
+ this.token = (_e = opts.token) !== null && _e !== void 0 ? _e : clients_1.TokenClient.instance(this.query, this);
72
73
  this.admin = new modules_1.AdminModule(this);
73
74
  this.order = new modules_1.OrderModule(this);
74
75
  this.lp = new modules_1.LiquidityPoolModule(this);
@@ -111,14 +112,15 @@ class CarbonSDK {
111
112
  });
112
113
  }
113
114
  static instance(opts = DEFAULT_SDK_INIT_OPTS) {
114
- var _a, _b, _c;
115
+ var _a, _b, _c, _d;
115
116
  return __awaiter(this, void 0, void 0, function* () {
116
117
  const network = (_a = opts.network) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_NETWORK;
117
118
  const configOverride = (_b = opts.config) !== null && _b !== void 0 ? _b : {};
118
119
  const networkConfig = util_1.GenericUtils.overrideConfig(constant_1.NetworkConfigs[network], configOverride);
119
120
  const tmClient = (_c = opts.tmClient) !== null && _c !== void 0 ? _c : util_1.GenericUtils.modifyTmClient(yield tendermint_rpc_1.Tendermint34Client.connect(networkConfig.tmRpcUrl));
120
121
  const defaultTimeoutBlocks = opts.defaultTimeoutBlocks;
121
- const sdk = new CarbonSDK({ network, config: configOverride, tmClient, defaultTimeoutBlocks });
122
+ const chainId = (_d = (yield tmClient.status())) === null || _d === void 0 ? void 0 : _d.nodeInfo.network;
123
+ const sdk = new CarbonSDK({ network, config: configOverride, tmClient, defaultTimeoutBlocks, chainId });
122
124
  if (opts.wallet) {
123
125
  yield sdk.connect(opts.wallet);
124
126
  }
@@ -164,6 +166,12 @@ class CarbonSDK {
164
166
  return sdk.connectWithKeplr(keplr, walletOpts);
165
167
  });
166
168
  }
169
+ static instanceWithLeap(leap, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ const sdk = yield CarbonSDK.instance(sdkOpts);
172
+ return sdk.connectWithLeap(leap, walletOpts);
173
+ });
174
+ }
167
175
  static instanceViewOnly(bech32Address, sdkOpts = DEFAULT_SDK_INIT_OPTS, walletOpts) {
168
176
  return __awaiter(this, void 0, void 0, function* () {
169
177
  const sdk = yield CarbonSDK.instance(sdkOpts);
@@ -172,6 +180,8 @@ class CarbonSDK {
172
180
  }
173
181
  initialize() {
174
182
  return __awaiter(this, void 0, void 0, function* () {
183
+ const chainId = yield this.query.chain.getChainId();
184
+ this.chainId = chainId;
175
185
  yield this.token.initialize();
176
186
  if (this.wallet) {
177
187
  yield this.wallet.initialize(this.query);
@@ -187,6 +197,7 @@ class CarbonSDK {
187
197
  network: this.network,
188
198
  config: this.configOverride,
189
199
  tmClient: this.tmClient,
200
+ chainId: this.chainId,
190
201
  };
191
202
  }
192
203
  connect(wallet) {
@@ -249,6 +260,15 @@ class CarbonSDK {
249
260
  return this.connect(wallet);
250
261
  });
251
262
  }
263
+ connectWithLeap(leap, opts) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ const chainId = this.chainId;
266
+ const leapKey = yield leap.getKey(chainId);
267
+ yield leap.enable(chainId);
268
+ const wallet = wallet_1.CarbonWallet.withLeap(leap, chainId, leapKey, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
269
+ return this.connect(wallet);
270
+ });
271
+ }
252
272
  connectViewOnly(bech32Address, opts) {
253
273
  return __awaiter(this, void 0, void 0, function* () {
254
274
  const wallet = wallet_1.CarbonWallet.withAddress(bech32Address, Object.assign(Object.assign({}, opts), { network: this.network, config: this.configOverride }));
@@ -156,7 +156,7 @@ exports.EmbedChainInfosInit = {
156
156
  average: 0.025,
157
157
  high: 0.04,
158
158
  },
159
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
159
+ features: ["ibc-transfer", "ibc-go"],
160
160
  explorerUrlToTx: "https://www.mintscan.io/osmosis/txs/{txHash}",
161
161
  tmRpc: "https://rpc-osmosis.blockapsis.com/",
162
162
  },
@@ -192,7 +192,7 @@ exports.EmbedChainInfosInit = {
192
192
  },
193
193
  ],
194
194
  coinType: 118,
195
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
195
+ features: ["ibc-transfer", "ibc-go"],
196
196
  explorerUrlToTx: "https://www.mintscan.io/cosmos/txs/{txHash}",
197
197
  tmRpc: "https://rpc.cosmos.network/",
198
198
  },
@@ -250,7 +250,7 @@ exports.EmbedChainInfosInit = {
250
250
  average: 0.2,
251
251
  high: 0.25,
252
252
  },
253
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
253
+ features: ["ibc-transfer", "ibc-go"],
254
254
  explorerUrlToTx: "https://finder.terra.money/columbus-5/tx/{txHash}",
255
255
  tmRpc: "https://terra-rpc.easy2stake.com/",
256
256
  },
@@ -286,7 +286,7 @@ exports.EmbedChainInfosInit = {
286
286
  },
287
287
  ],
288
288
  coinType: 118,
289
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
289
+ features: ["ibc-transfer", "ibc-go"],
290
290
  explorerUrlToTx: "https://secretnodes.com/secret/chains/secret-4/transactions/{txHash}",
291
291
  },
292
292
  [ChainIds.Akash]: {
@@ -321,7 +321,7 @@ exports.EmbedChainInfosInit = {
321
321
  },
322
322
  ],
323
323
  coinType: 118,
324
- features: ["stargate", "ibc-transfer"],
324
+ features: ["ibc-transfer", "ibc-go"],
325
325
  explorerUrlToTx: "https://www.mintscan.io/akash/txs/{txHash}",
326
326
  },
327
327
  [ChainIds.Regen]: {
@@ -353,7 +353,7 @@ exports.EmbedChainInfosInit = {
353
353
  coinGeckoId: "regen",
354
354
  },
355
355
  ],
356
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
356
+ features: ["ibc-transfer", "ibc-go"],
357
357
  explorerUrlToTx: "https://regen.aneka.io/txs/{txHash}",
358
358
  },
359
359
  [ChainIds.Sentinel]: {
@@ -386,7 +386,7 @@ exports.EmbedChainInfosInit = {
386
386
  },
387
387
  ],
388
388
  explorerUrlToTx: "https://www.mintscan.io/sentinel/txs/{txHash}",
389
- features: ["stargate", "ibc-transfer"],
389
+ features: ["ibc-transfer", "ibc-go"],
390
390
  },
391
391
  [ChainIds.Persistence]: {
392
392
  rpc: "https://rpc-persistence.keplr.app",
@@ -425,7 +425,7 @@ exports.EmbedChainInfosInit = {
425
425
  coinGeckoId: "persistence",
426
426
  },
427
427
  ],
428
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
428
+ features: ["ibc-transfer", "ibc-go"],
429
429
  explorerUrlToTx: "https://www.mintscan.io/persistence/txs/{txHash}",
430
430
  },
431
431
  [ChainIds.IrisNet]: {
@@ -459,7 +459,7 @@ exports.EmbedChainInfosInit = {
459
459
  coinGeckoId: "iris-network",
460
460
  },
461
461
  ],
462
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
462
+ features: ["ibc-transfer", "ibc-go"],
463
463
  explorerUrlToTx: "https://www.mintscan.io/iris/txs/{txHash}",
464
464
  },
465
465
  [ChainIds.CryptoOrg]: {
@@ -493,7 +493,7 @@ exports.EmbedChainInfosInit = {
493
493
  coinGeckoId: "crypto-com-chain",
494
494
  },
495
495
  ],
496
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
496
+ features: ["ibc-transfer", "ibc-go"],
497
497
  explorerUrlToTx: "https://www.mintscan.io/crypto-org/txs/{txHash}",
498
498
  },
499
499
  [ChainIds.Starname]: {
@@ -527,7 +527,7 @@ exports.EmbedChainInfosInit = {
527
527
  coinGeckoId: "starname",
528
528
  },
529
529
  ],
530
- features: ["stargate", "ibc-transfer"],
530
+ features: ["ibc-transfer", "ibc-go"],
531
531
  explorerUrlToTx: "https://www.mintscan.io/starname/txs/{txHash}",
532
532
  },
533
533
  [ChainIds.EMoney]: {
@@ -572,7 +572,7 @@ exports.EmbedChainInfosInit = {
572
572
  average: 1,
573
573
  high: 1,
574
574
  },
575
- features: ["stargate", "ibc-transfer"],
575
+ features: ["ibc-transfer", "ibc-go"],
576
576
  explorerUrlToTx: "https://emoney.bigdipper.live/transactions/{txHash}",
577
577
  },
578
578
  [ChainIds.Juno]: {
@@ -611,7 +611,7 @@ exports.EmbedChainInfosInit = {
611
611
  average: 0.0025,
612
612
  high: 0.004,
613
613
  },
614
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
614
+ features: ["ibc-transfer", "ibc-go"],
615
615
  explorerUrlToTx: "https://www.mintscan.io/juno/txs/{txHash}",
616
616
  },
617
617
  [ChainIds.Evmos]: {
@@ -650,7 +650,7 @@ exports.EmbedChainInfosInit = {
650
650
  average: 25000000000,
651
651
  high: 40000000000,
652
652
  },
653
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
653
+ features: ["ibc-transfer", "ibc-go"],
654
654
  explorerUrlToTx: "https://www.mintscan.io/evmos/txs/{txHash}",
655
655
  },
656
656
  [ChainIds.Microtick]: {
@@ -684,7 +684,7 @@ exports.EmbedChainInfosInit = {
684
684
  coinGeckoId: "pool:utick",
685
685
  },
686
686
  ],
687
- features: ["stargate", "ibc-transfer"],
687
+ features: ["ibc-transfer", "ibc-go"],
688
688
  explorerUrlToTx: "https://explorer.microtick.zone/transactions/{txHash}",
689
689
  },
690
690
  [ChainIds.LikeCoin]: {
@@ -718,7 +718,7 @@ exports.EmbedChainInfosInit = {
718
718
  coinGeckoId: "likecoin",
719
719
  },
720
720
  ],
721
- features: ["stargate", "ibc-transfer"],
721
+ features: ["ibc-transfer", "ibc-go"],
722
722
  explorerUrlToTx: "https://likecoin.bigdipper.live/transactions/{txHash}",
723
723
  },
724
724
  [ChainIds.IXO]: {
@@ -752,7 +752,7 @@ exports.EmbedChainInfosInit = {
752
752
  coinGeckoId: "pool:uixo",
753
753
  },
754
754
  ],
755
- features: ["stargate", "ibc-transfer"],
755
+ features: ["ibc-transfer", "ibc-go"],
756
756
  explorerUrlToTx: "https://blockscan.ixo.world/transactions/{txHash}",
757
757
  },
758
758
  [ChainIds.BitCanna]: {
@@ -786,7 +786,7 @@ exports.EmbedChainInfosInit = {
786
786
  coinGeckoId: "bitcanna",
787
787
  },
788
788
  ],
789
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
789
+ features: ["ibc-transfer", "ibc-go"],
790
790
  explorerUrlToTx: "https://www.mintscan.io/bitcanna/txs/{txHash}",
791
791
  tmRpc: "https://rpc.bitcanna.io/",
792
792
  },
@@ -821,7 +821,7 @@ exports.EmbedChainInfosInit = {
821
821
  coinGeckoId: "pool:ubtsg",
822
822
  },
823
823
  ],
824
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
824
+ features: ["ibc-transfer", "ibc-go"],
825
825
  explorerUrlToTx: "https://explorebitsong.com/transactions/{txHash}",
826
826
  tmRpc: "https://rpc.explorebitsong.com/",
827
827
  },
@@ -856,7 +856,7 @@ exports.EmbedChainInfosInit = {
856
856
  coinGeckoId: "pool:uxki",
857
857
  },
858
858
  ],
859
- features: ["stargate", "ibc-transfer"],
859
+ features: ["ibc-transfer", "ibc-go"],
860
860
  explorerUrlToTx: "https://www.mintscan.io/ki-chain/txs/{txHash}",
861
861
  tmRpc: "https://rpc-mainnet.blockchain.ki",
862
862
  },
@@ -896,7 +896,7 @@ exports.EmbedChainInfosInit = {
896
896
  average: 7,
897
897
  high: 9,
898
898
  },
899
- features: ["stargate", "ibc-transfer"],
899
+ features: ["ibc-transfer", "ibc-go"],
900
900
  explorerUrlToTx: "https://www.mintscan.io/medibloc/txs/{txHash}",
901
901
  tmRpc: "https://rpc.gopanacea.org/",
902
902
  },
@@ -931,7 +931,7 @@ exports.EmbedChainInfosInit = {
931
931
  // coinGeckoId: "pool:boot",
932
932
  },
933
933
  ],
934
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
934
+ features: ["ibc-transfer", "ibc-go"],
935
935
  explorerUrlToTx: "https://cyb.ai/network/bostrom/tx/{txHash}",
936
936
  tmRpc: "https://rpc.bostrom.cybernode.ai/",
937
937
  },
@@ -966,7 +966,7 @@ exports.EmbedChainInfosInit = {
966
966
  coinGeckoId: "comdex",
967
967
  },
968
968
  ],
969
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
969
+ features: ["ibc-transfer", "ibc-go"],
970
970
  explorerUrlToTx: "https://www.mintscan.io/comdex/txs/{txHash}",
971
971
  tmRpc: "https://rpc.comdex.one/",
972
972
  },
@@ -1006,7 +1006,7 @@ exports.EmbedChainInfosInit = {
1006
1006
  average: 30,
1007
1007
  high: 50,
1008
1008
  },
1009
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1009
+ features: ["ibc-transfer", "ibc-go"],
1010
1010
  explorerUrlToTx: "https://explorer.cheqd.io/transactions/{txHash}",
1011
1011
  tmRpc: "https://rpc.cheqd.net/",
1012
1012
  },
@@ -1041,7 +1041,7 @@ exports.EmbedChainInfosInit = {
1041
1041
  coinGeckoId: "pool:ustars",
1042
1042
  },
1043
1043
  ],
1044
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1044
+ features: ["ibc-transfer", "ibc-go"],
1045
1045
  explorerUrlToTx: "https://www.mintscan.io/stargaze/txs/{txHash}",
1046
1046
  tmRpc: "https://rpc.stargaze-apis.com/",
1047
1047
  },
@@ -1081,7 +1081,7 @@ exports.EmbedChainInfosInit = {
1081
1081
  average: 0.03,
1082
1082
  high: 0.035,
1083
1083
  },
1084
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1084
+ features: ["ibc-transfer", "ibc-go"],
1085
1085
  explorerUrlToTx: "https://ping.pub/chihuahua/tx/{txHash}",
1086
1086
  },
1087
1087
  [ChainIds.LumNetwork]: {
@@ -1116,7 +1116,7 @@ exports.EmbedChainInfosInit = {
1116
1116
  },
1117
1117
  ],
1118
1118
  coinType: 118,
1119
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1119
+ features: ["ibc-transfer", "ibc-go"],
1120
1120
  explorerUrlToTx: "https://www.mintscan.io/lum/txs/{txHash}",
1121
1121
  tmRpc: "https://node0.mainnet.lum.network/rpc/",
1122
1122
  },
@@ -1152,7 +1152,7 @@ exports.EmbedChainInfosInit = {
1152
1152
  },
1153
1153
  ],
1154
1154
  coinType: 370,
1155
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1155
+ features: ["ibc-transfer", "ibc-go"],
1156
1156
  explorerUrlToTx: "https://explorers.vidulum.app/vidulum/tx/{txHash}",
1157
1157
  tmRpc: "https://mainnet-rpc.vidulum.app/",
1158
1158
  },
@@ -1187,7 +1187,7 @@ exports.EmbedChainInfosInit = {
1187
1187
  coinGeckoId: "pool:udsm",
1188
1188
  },
1189
1189
  ],
1190
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1190
+ features: ["ibc-transfer", "ibc-go"],
1191
1191
  explorerUrlToTx: "https://explorer.desmos.network/transactions/{txHash}",
1192
1192
  tmRpc: "https://rpc.mainnet.desmos.network/",
1193
1193
  },
@@ -1227,7 +1227,7 @@ exports.EmbedChainInfosInit = {
1227
1227
  average: 0.03,
1228
1228
  high: 0.035,
1229
1229
  },
1230
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1230
+ features: ["ibc-transfer", "ibc-go"],
1231
1231
  explorerUrlToTx: "https://ping.pub/dig/tx/{txHash}",
1232
1232
  tmRpc: "https://rpc-1-dig.notional.ventures/",
1233
1233
  },
@@ -1262,7 +1262,7 @@ exports.EmbedChainInfosInit = {
1262
1262
  coinGeckoId: "pool:usomm",
1263
1263
  },
1264
1264
  ],
1265
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1265
+ features: ["ibc-transfer", "ibc-go"],
1266
1266
  explorerUrlToTx: "https://sommscan.io",
1267
1267
  },
1268
1268
  [ChainIds.Sifchain]: {
@@ -1296,7 +1296,7 @@ exports.EmbedChainInfosInit = {
1296
1296
  coinGeckoId: "sifchain",
1297
1297
  },
1298
1298
  ],
1299
- features: ["stargate", "ibc-transfer"],
1299
+ features: ["ibc-transfer", "ibc-go"],
1300
1300
  explorerUrlToTx: "https://www.mintscan.io/sifchain/txs/{txHash}",
1301
1301
  tmRpc: "https://rpc.sifchain.finance/",
1302
1302
  },
@@ -1331,7 +1331,7 @@ exports.EmbedChainInfosInit = {
1331
1331
  coinGeckoId: "band-protocol",
1332
1332
  },
1333
1333
  ],
1334
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1334
+ features: ["ibc-transfer", "ibc-go"],
1335
1335
  explorerUrlToTx: "https://cosmoscan.io/tx/{txHash}",
1336
1336
  tmRpc: "https://rpc.laozi3.bandchain.org/",
1337
1337
  },
@@ -1366,7 +1366,7 @@ exports.EmbedChainInfosInit = {
1366
1366
  coinGeckoId: "pool:udarc",
1367
1367
  },
1368
1368
  ],
1369
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1369
+ features: ["ibc-transfer", "ibc-go"],
1370
1370
  explorerUrlToTx: "https://www.mintscan.io/konstellation/txs/{txHash}",
1371
1371
  tmRpc: "https://node1.konstellation.tech:26657/",
1372
1372
  },
@@ -1401,7 +1401,7 @@ exports.EmbedChainInfosInit = {
1401
1401
  coinGeckoId: "pool:uumee",
1402
1402
  },
1403
1403
  ],
1404
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1404
+ features: ["ibc-transfer", "ibc-go"],
1405
1405
  explorerUrlToTx: "https://www.mintscan.io/umee/txs/{txHash}",
1406
1406
  tmRpc: "https://rpc.aphrodite.main.network.umee.cc/",
1407
1407
  },
@@ -1447,7 +1447,7 @@ exports.EmbedChainInfosInit = {
1447
1447
  average: 0,
1448
1448
  high: 0.035,
1449
1449
  },
1450
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1450
+ features: ["ibc-transfer", "ibc-go"],
1451
1451
  explorerUrlToTx: "https://www.mintscan.io/gravity-bridge/txs/{txHash}",
1452
1452
  tmRpc: "https://gravitychain.io:26657/",
1453
1453
  },
@@ -1482,7 +1482,7 @@ exports.EmbedChainInfosInit = {
1482
1482
  coinGeckoId: "decentr",
1483
1483
  },
1484
1484
  ],
1485
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
1485
+ features: ["ibc-transfer", "ibc-go"],
1486
1486
  explorerUrlToTx: "https://explorer.decentr.net/transactions/{txHash}?networkId=mainnet",
1487
1487
  tmRpc: "https://poseidon.mainnet.decentr.xyz/",
1488
1488
  },
@@ -1517,7 +1517,7 @@ exports.EmbedChainInfosInit = {
1517
1517
  coinGeckoId: "certik",
1518
1518
  },
1519
1519
  ],
1520
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1520
+ features: ["ibc-transfer", "ibc-go"],
1521
1521
  explorerUrlToTx: "https://www.mintscan.io/certik/txs/{txHash}",
1522
1522
  tmRpc: "https://shenturpc.certikpowered.info/",
1523
1523
  },
@@ -1592,7 +1592,7 @@ exports.EmbedChainInfosInit = {
1592
1592
  chainName: "Axelar",
1593
1593
  chainId: ChainIds.Axelar,
1594
1594
  bech32Config: exports.IBCAddress.defaultBech32Config("axelar"),
1595
- features: ["stargate", "ibc-transfer", "ibc-go", "no-legacy-stdTx"],
1595
+ features: ["ibc-transfer", "ibc-go"],
1596
1596
  explorerUrlToTx: "https://axelarscan.io/tx/{txHash}",
1597
1597
  },
1598
1598
  [ChainIds.Stride]: {
@@ -1651,7 +1651,7 @@ exports.EmbedChainInfosInit = {
1651
1651
  average: 0,
1652
1652
  high: 0.04,
1653
1653
  },
1654
- features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
1654
+ features: ["ibc-transfer", "ibc-go"],
1655
1655
  explorerUrlToTx: "https://www.mintscan.io/stride/txs/{txHash}",
1656
1656
  tmRpc: "https://stride.rpc.kjnodes.com/",
1657
1657
  },
@@ -1697,7 +1697,7 @@ exports.EmbedChainInfosInit = {
1697
1697
  average: 0.025,
1698
1698
  high: 0.03,
1699
1699
  },
1700
- features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx", "ibc-go"],
1700
+ features: ["ibc-transfer", "ibc-go"],
1701
1701
  explorerUrlToTx: "https://finder.kujira.app/kaiyo-1/tx/{txHash}",
1702
1702
  },
1703
1703
  [ChainIds.Terra2]: {
@@ -4,6 +4,12 @@ export declare enum Network {
4
4
  DevNet = "devnet",
5
5
  LocalHost = "localhost"
6
6
  }
7
+ export declare const CarbonChainIDs: {
8
+ readonly mainnet: "carbon-1";
9
+ readonly testnet: "carbon-testnet-42069";
10
+ readonly devnet: "carbon-devnet-39911";
11
+ readonly localhost: "carbon";
12
+ };
7
13
  export declare const DEFAULT_NETWORK = Network.MainNet;
8
14
  export interface EthNetworkConfig {
9
15
  rpcURL: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkConfigs = exports.DEFAULT_NETWORK = exports.Network = void 0;
3
+ exports.NetworkConfigs = exports.DEFAULT_NETWORK = exports.CarbonChainIDs = exports.Network = void 0;
4
4
  const neon_core_next_1 = require("@cityofzion/neon-core-next");
5
5
  var Network;
6
6
  (function (Network) {
@@ -9,6 +9,12 @@ var Network;
9
9
  Network["DevNet"] = "devnet";
10
10
  Network["LocalHost"] = "localhost";
11
11
  })(Network = exports.Network || (exports.Network = {}));
12
+ exports.CarbonChainIDs = {
13
+ [Network.MainNet]: "carbon-1",
14
+ [Network.TestNet]: "carbon-testnet-42069",
15
+ [Network.DevNet]: "carbon-devnet-39911",
16
+ [Network.LocalHost]: "carbon",
17
+ };
12
18
  exports.DEFAULT_NETWORK = Network.MainNet;
13
19
  exports.NetworkConfigs = {
14
20
  [Network.MainNet]: {
package/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * as Models from "./codec";
4
4
  export * from "./util";
5
5
  export { Blockchain } from "./util/blockchain";
6
6
  export * from "./websocket";
7
- export { AminoTypesMap, CoinPretty, SDKProvider, KeplrAccount, KeplrWindow, CosmosLedger, Keplr, ChainInfo, EVMChain, MetaMaskChangeNetworkParam, CallContractArgs, MetaMaskSyncResult, MetaMask, EthLedgerAccount, EthLedgerSigner, NeoLedgerAccount, Zilpay, ZilPayChangeNetworkParam, O3Types, O3Wallet } from "./provider";
7
+ export { AminoTypesMap, CoinPretty, SDKProvider, KeplrAccount, KeplrWindow, CosmosLedger, Keplr, ChainInfo, EVMChain, MetaMaskChangeNetworkParam, CallContractArgs, MetaMaskSyncResult, MetaMask, EthLedgerAccount, EthLedgerSigner, NeoLedgerAccount, Zilpay, ZilPayChangeNetworkParam, O3Types, O3Wallet, LeapAccount, Leap } from "./provider";
8
8
  export { default as CarbonSDK } from "./CarbonSDK";
9
9
  export { ProviderAgent } from "./constant";
10
10
  export * as Insights from "./insights";
package/lib/index.js CHANGED
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.CarbonNonSigner = exports.CarbonPrivateKeySigner = exports.CarbonLedgerSigner = exports.Hydrogen = exports.Insights = exports.ProviderAgent = exports.CarbonSDK = exports.O3Wallet = exports.O3Types = exports.Zilpay = exports.NeoLedgerAccount = exports.EthLedgerSigner = exports.EthLedgerAccount = exports.MetaMask = exports.CosmosLedger = exports.KeplrAccount = exports.CoinPretty = exports.AminoTypesMap = exports.Blockchain = exports.Models = void 0;
28
+ exports.CarbonNonSigner = exports.CarbonPrivateKeySigner = exports.CarbonLedgerSigner = exports.Hydrogen = exports.Insights = exports.ProviderAgent = exports.CarbonSDK = exports.LeapAccount = exports.O3Wallet = exports.O3Types = exports.Zilpay = exports.NeoLedgerAccount = exports.EthLedgerSigner = exports.EthLedgerAccount = exports.MetaMask = exports.CosmosLedger = exports.KeplrAccount = exports.CoinPretty = exports.AminoTypesMap = exports.Blockchain = exports.Models = void 0;
29
29
  __exportStar(require("./CarbonSDK"), exports);
30
30
  __exportStar(require("./modules"), exports);
31
31
  exports.Models = __importStar(require("./codec"));
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "NeoLedgerAccount", { enumerable: true, get: func
45
45
  Object.defineProperty(exports, "Zilpay", { enumerable: true, get: function () { return provider_1.Zilpay; } });
46
46
  Object.defineProperty(exports, "O3Types", { enumerable: true, get: function () { return provider_1.O3Types; } });
47
47
  Object.defineProperty(exports, "O3Wallet", { enumerable: true, get: function () { return provider_1.O3Wallet; } });
48
+ Object.defineProperty(exports, "LeapAccount", { enumerable: true, get: function () { return provider_1.LeapAccount; } });
48
49
  var CarbonSDK_1 = require("./CarbonSDK");
49
50
  Object.defineProperty(exports, "CarbonSDK", { enumerable: true, get: function () { return __importDefault(CarbonSDK_1).default; } });
50
51
  var constant_1 = require("./constant");
@@ -1,6 +1,7 @@
1
1
  export { EthLedgerAccount, EthLedgerSigner, NeoLedgerAccount } from "./account";
2
2
  export { AminoTypesMap } from "./amino";
3
3
  export { ChainInfo, CoinPretty, default as KeplrAccount, Keplr, KeplrWindow } from "./keplr";
4
+ export { default as LeapAccount, Leap } from "./leap";
4
5
  export { default as CosmosLedger } from "./ledger";
5
6
  export { CallContractArgs, EVMChain, MetaMask, MetaMaskChangeNetworkParam, MetaMaskSyncResult } from "./metamask";
6
7
  export { O3Types, O3Wallet } from "./o3";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Zilpay = exports.O3Wallet = exports.O3Types = exports.MetaMask = exports.CosmosLedger = exports.KeplrAccount = exports.CoinPretty = exports.AminoTypesMap = exports.NeoLedgerAccount = exports.EthLedgerSigner = exports.EthLedgerAccount = void 0;
6
+ exports.Zilpay = exports.O3Wallet = exports.O3Types = exports.MetaMask = exports.CosmosLedger = exports.LeapAccount = exports.KeplrAccount = exports.CoinPretty = exports.AminoTypesMap = exports.NeoLedgerAccount = exports.EthLedgerSigner = exports.EthLedgerAccount = void 0;
7
7
  var account_1 = require("./account");
8
8
  Object.defineProperty(exports, "EthLedgerAccount", { enumerable: true, get: function () { return account_1.EthLedgerAccount; } });
9
9
  Object.defineProperty(exports, "EthLedgerSigner", { enumerable: true, get: function () { return account_1.EthLedgerSigner; } });
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "AminoTypesMap", { enumerable: true, get: functio
13
13
  var keplr_1 = require("./keplr");
14
14
  Object.defineProperty(exports, "CoinPretty", { enumerable: true, get: function () { return keplr_1.CoinPretty; } });
15
15
  Object.defineProperty(exports, "KeplrAccount", { enumerable: true, get: function () { return __importDefault(keplr_1).default; } });
16
+ var leap_1 = require("./leap");
17
+ Object.defineProperty(exports, "LeapAccount", { enumerable: true, get: function () { return __importDefault(leap_1).default; } });
16
18
  var ledger_1 = require("./ledger");
17
19
  Object.defineProperty(exports, "CosmosLedger", { enumerable: true, get: function () { return __importDefault(ledger_1).default; } });
18
20
  var metamask_1 = require("./metamask");
@@ -1,9 +1,15 @@
1
- import { AccountStore, ChainStore, QueriesStore, AccountWithCosmos, QueriesWithCosmos } from "@keplr-wallet/stores";
1
+ import { AccountStore, ChainStore, CosmosAccount, CosmosQueries, CosmwasmAccount, CosmwasmQueries, QueriesStore } from "@keplr-wallet/stores";
2
2
  import { ChainInfo } from "@keplr-wallet/types";
3
3
  export declare class RootStore {
4
4
  readonly chainStore: ChainStore;
5
- readonly queriesStore: QueriesStore<QueriesWithCosmos>;
6
- readonly accountStore: AccountStore<AccountWithCosmos>;
5
+ readonly queriesStore: QueriesStore<[
6
+ CosmosQueries,
7
+ CosmwasmQueries
8
+ ]>;
9
+ readonly accountStore: AccountStore<[
10
+ CosmosAccount,
11
+ CosmwasmAccount
12
+ ]>;
7
13
  constructor(getKeplr: () => Promise<any>, additionalChains?: ChainInfo[]);
8
14
  }
9
15
  export declare function createRootStore(getKeplr: () => Promise<any>, additionalChains?: ChainInfo[]): RootStore | null;
@@ -1,11 +1,25 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  exports.createRootStore = exports.RootStore = void 0;
4
16
  const ibc_1 = require("../../constant/ibc");
5
- const stores_1 = require("@keplr-wallet/stores");
6
- const common_1 = require("@keplr-wallet/common");
7
- const external_1 = require("../../util/external");
17
+ // import { iOS } from "../../util/external";
8
18
  const ibc_2 = require("../../util/ibc");
19
+ const common_1 = require("@keplr-wallet/common");
20
+ const stores_1 = require("@keplr-wallet/stores");
21
+ const eventemitter3_1 = __importDefault(require("eventemitter3"));
22
+ const semver_1 = __importDefault(require("semver"));
9
23
  class RootStore {
10
24
  constructor(getKeplr, additionalChains) {
11
25
  const embedChainInfos = Object.values(ibc_2.EmbedChainInfos).map((chainInfo) => {
@@ -19,29 +33,66 @@ class RootStore {
19
33
  if (additionalChains && (additionalChains === null || additionalChains === void 0 ? void 0 : additionalChains.length) > 0) {
20
34
  embedChainInfos.push(...additionalChains);
21
35
  }
36
+ const eventListener = (() => {
37
+ // On client-side (web browser), use the global window object.
38
+ if (typeof window !== "undefined") {
39
+ return window;
40
+ }
41
+ // On server-side (nodejs), there is no global window object.
42
+ // Alternatively, use the event emitter library.
43
+ const emitter = new eventemitter3_1.default();
44
+ return {
45
+ addEventListener: (type, fn) => {
46
+ emitter.addListener(type, fn);
47
+ },
48
+ removeEventListener: (type, fn) => {
49
+ emitter.removeListener(type, fn);
50
+ },
51
+ };
52
+ })();
53
+ function suggestChainFromWindow(keplr, chainInfo) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const info = Object.assign(Object.assign({}, chainInfo), { stakeCurrency: Object.assign(Object.assign({}, chainInfo.stakeCurrency), { coinImageUrl: chainInfo.stakeCurrency.coinImageUrl
56
+ ? window.origin + chainInfo.stakeCurrency.coinImageUrl
57
+ : undefined }), currencies: chainInfo.currencies.map((currency) => (Object.assign(Object.assign({}, currency), { coinImageUrl: currency.coinImageUrl
58
+ ? window.origin + currency.coinImageUrl
59
+ : undefined }))), feeCurrencies: chainInfo.feeCurrencies.map((currency) => (Object.assign(Object.assign({}, currency), { coinImageUrl: currency.coinImageUrl
60
+ ? window.origin + currency.coinImageUrl
61
+ : undefined }))) });
62
+ yield keplr.experimentalSuggestChain(info);
63
+ });
64
+ }
22
65
  this.chainStore = new stores_1.ChainStore(embedChainInfos);
23
- this.queriesStore = new stores_1.QueriesStore(new common_1.IndexedDBKVStore("store_queries"), this.chainStore, getKeplr, stores_1.QueriesWithCosmos);
24
- this.accountStore = new stores_1.AccountStore(window, stores_1.AccountWithCosmos, this.chainStore, this.queriesStore, {
25
- defaultOpts: {
26
- prefetching: false,
66
+ this.queriesStore = new stores_1.QueriesStore(new common_1.IndexedDBKVStore("store_web_queries"), this.chainStore, stores_1.CosmosQueries.use(), stores_1.CosmwasmQueries.use());
67
+ this.accountStore = new stores_1.AccountStore(eventListener, this.chainStore, () => {
68
+ return {
27
69
  suggestChain: true,
70
+ suggestChainFn: (keplr, chainInfo) => __awaiter(this, void 0, void 0, function* () {
71
+ if (keplr.mode === "mobile-web" &&
72
+ // In keplr mobile below 0.10.9, there is no receiver for the suggest chain.
73
+ // Therefore, it cannot be processed because it takes infinite pending.
74
+ // As of 0.10.10, experimental support was added.
75
+ !semver_1.default.satisfies(keplr.version, ">=0.10.10")) {
76
+ // Can't suggest the chain on mobile web.
77
+ return;
78
+ }
79
+ yield suggestChainFromWindow(keplr, chainInfo.raw);
80
+ }),
28
81
  autoInit: true,
29
82
  getKeplr,
30
- msgOpts: {
31
- ibcTransfer: {
32
- type: 'cosmos-sdk/MsgTransfer',
33
- gas: ibc_1.ibcDefaultGas,
34
- },
35
- },
36
- },
37
- });
83
+ };
84
+ }, stores_1.CosmosAccount.use({
85
+ queriesStore: this.queriesStore,
86
+ msgOptsCreator: () => ({ ibcTransfer: { gas: ibc_1.ibcDefaultGas } }),
87
+ }), stores_1.CosmwasmAccount.use({ queriesStore: this.queriesStore }));
38
88
  }
39
89
  }
40
90
  exports.RootStore = RootStore;
41
91
  function createRootStore(getKeplr, additionalChains) {
42
- if (external_1.iOS()) {
43
- return null;
44
- }
92
+ // TODO: Un-comment if Safari iOS mobile crashes the page
93
+ // if (iOS()) {
94
+ // return null
95
+ // }
45
96
  return new RootStore(getKeplr, additionalChains);
46
97
  }
47
98
  exports.createRootStore = createRootStore;
@@ -62,6 +62,56 @@ const getEncryptMessage = (input) => {
62
62
  -----END MNEMONIC PHRASE-----
63
63
  `.trim().replace(/^\s+/gm, '');
64
64
  };
65
+ const BSC_MAINNET = {
66
+ chainId: '0x38',
67
+ blockExplorerUrls: ['https://bscscan.com'],
68
+ chainName: 'BSC Mainnet',
69
+ rpcUrls: [
70
+ 'https://bsc-dataseed2.binance.org/',
71
+ 'https://bsc-dataseed3.binance.org/',
72
+ 'https://bsc-dataseed4.binance.org/',
73
+ 'https://bsc-dataseed1.defibit.io/',
74
+ 'https://bsc-dataseed2.defibit.io/',
75
+ 'https://bsc-dataseed3.defibit.io/',
76
+ 'https://bsc-dataseed4.defibit.io/',
77
+ 'https://bsc-dataseed1.ninicoin.io/',
78
+ 'https://bsc-dataseed2.ninicoin.io/',
79
+ 'https://bsc-dataseed3.ninicoin.io/',
80
+ 'https://bsc-dataseed4.ninicoin.io/',
81
+ 'https://bsc-dataseed1.binance.org/',
82
+ ],
83
+ nativeCurrency: {
84
+ decimals: 18,
85
+ name: 'Binance Coin',
86
+ symbol: 'BNB',
87
+ },
88
+ };
89
+ const BSC_TESTNET = {
90
+ chainId: '0x61',
91
+ blockExplorerUrls: ['https://testnet.bscscan.com'],
92
+ chainName: 'BSC Testnet',
93
+ rpcUrls: [
94
+ 'https://data-seed-prebsc-2-s1.binance.org:8545/',
95
+ 'http://data-seed-prebsc-1-s2.binance.org:8545/',
96
+ 'http://data-seed-prebsc-2-s2.binance.org:8545/',
97
+ 'https://data-seed-prebsc-1-s3.binance.org:8545/',
98
+ 'https://data-seed-prebsc-2-s3.binance.org:8545/',
99
+ 'https://data-seed-prebsc-1-s1.binance.org:8545/',
100
+ ],
101
+ nativeCurrency: {
102
+ decimals: 18,
103
+ name: 'Binance Coin',
104
+ symbol: 'BNB',
105
+ },
106
+ };
107
+ const ETH_MAINNET = {
108
+ chainId: '0x1',
109
+ rpcUrls: ['https://mainnet.infura.io/v3/'],
110
+ };
111
+ const ETH_TESTNET = {
112
+ chainId: '0x4',
113
+ rpcUrls: ['https://rinkeby.infura.io/v3/'],
114
+ };
65
115
  /**
66
116
  * TODO: Add docs
67
117
  */
@@ -74,58 +124,18 @@ class MetaMask {
74
124
  if (network === constant_1.Network.MainNet) {
75
125
  switch (blockchain) {
76
126
  case blockchain_1.Blockchain.BinanceSmartChain:
77
- return {
78
- chainId: '0x38',
79
- blockExplorerUrls: ['https://bscscan.com'],
80
- chainName: 'BSC Mainnet',
81
- rpcUrls: [
82
- 'https://bsc-dataseed2.binance.org/',
83
- 'https://bsc-dataseed3.binance.org/',
84
- 'https://bsc-dataseed4.binance.org/',
85
- 'https://bsc-dataseed1.defibit.io/',
86
- 'https://bsc-dataseed2.defibit.io/',
87
- 'https://bsc-dataseed3.defibit.io/',
88
- 'https://bsc-dataseed4.defibit.io/',
89
- 'https://bsc-dataseed1.ninicoin.io/',
90
- 'https://bsc-dataseed2.ninicoin.io/',
91
- 'https://bsc-dataseed3.ninicoin.io/',
92
- 'https://bsc-dataseed4.ninicoin.io/',
93
- 'https://bsc-dataseed1.binance.org/',
94
- ],
95
- nativeCurrency: {
96
- decimals: 18,
97
- name: 'Binance Coin',
98
- symbol: 'BNB',
99
- },
100
- };
127
+ return BSC_MAINNET;
101
128
  default:
102
129
  // metamask should come with Ethereum configs
103
- return { chainId: '0x1' };
130
+ return ETH_MAINNET;
104
131
  }
105
132
  }
106
133
  switch (blockchain) {
107
134
  case blockchain_1.Blockchain.BinanceSmartChain:
108
- return {
109
- chainId: '0x61',
110
- blockExplorerUrls: ['https://testnet.bscscan.com'],
111
- chainName: 'BSC Testnet',
112
- rpcUrls: [
113
- 'https://data-seed-prebsc-2-s1.binance.org:8545/',
114
- 'http://data-seed-prebsc-1-s2.binance.org:8545/',
115
- 'http://data-seed-prebsc-2-s2.binance.org:8545/',
116
- 'https://data-seed-prebsc-1-s3.binance.org:8545/',
117
- 'https://data-seed-prebsc-2-s3.binance.org:8545/',
118
- 'https://data-seed-prebsc-1-s1.binance.org:8545/',
119
- ],
120
- nativeCurrency: {
121
- decimals: 18,
122
- name: 'Binance Coin',
123
- symbol: 'BNB',
124
- },
125
- };
135
+ return BSC_TESTNET;
126
136
  default:
127
137
  // metamask should come with Ethereum configs
128
- return { chainId: '0x3' };
138
+ return ETH_TESTNET;
129
139
  }
130
140
  }
131
141
  static getRequiredChainId(network, blockchain = blockchain_1.Blockchain.Ethereum) {
@@ -4,6 +4,7 @@ export declare enum Blockchain {
4
4
  Ethereum = "eth",
5
5
  BinanceSmartChain = "bsc",
6
6
  Zilliqa = "zil",
7
+ Arbitrum = "arbitrum",
7
8
  Native = "native",
8
9
  Btc = "btc",
9
10
  Carbon = "carbon",
@@ -40,6 +41,8 @@ export declare const ChainNames: {
40
41
  readonly 97: "BSC TestNet";
41
42
  readonly 110: "ZIL DevNet";
42
43
  readonly 111: "ZIL TestNet";
44
+ readonly 42161: "Arbitrum MainNet";
45
+ readonly 421611: "Arbitrum TestNet";
43
46
  };
44
47
  export declare const CHAIN_IDS: ChainIds;
45
48
  export declare const CHAIN_IDS_DEV: ChainIds;
@@ -47,5 +50,5 @@ export declare const CHAIN_IDS_TEST: ChainIds;
47
50
  export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
48
51
  export declare function parseBlockchain(value: string | null): Blockchain | null;
49
52
  export declare function getChainFromID(id: number): string | undefined;
50
- export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | undefined;
53
+ export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
51
54
  export declare const blockchainForChainId: (chainId?: number | undefined) => Blockchain | undefined;
@@ -8,6 +8,7 @@ var Blockchain;
8
8
  Blockchain["Ethereum"] = "eth";
9
9
  Blockchain["BinanceSmartChain"] = "bsc";
10
10
  Blockchain["Zilliqa"] = "zil";
11
+ Blockchain["Arbitrum"] = "arbitrum";
11
12
  Blockchain["Native"] = "native";
12
13
  Blockchain["Btc"] = "btc";
13
14
  Blockchain["Carbon"] = "carbon";
@@ -44,6 +45,8 @@ exports.ChainNames = {
44
45
  97: 'BSC TestNet',
45
46
  110: 'ZIL DevNet',
46
47
  111: 'ZIL TestNet',
48
+ 42161: 'Arbitrum MainNet',
49
+ 421611: 'Arbitrum TestNet',
47
50
  };
48
51
  exports.CHAIN_IDS = {
49
52
  'native': 0,
@@ -53,6 +56,7 @@ exports.CHAIN_IDS = {
53
56
  'bsc': 6,
54
57
  'neo3': 14,
55
58
  'zil': 18,
59
+ 'arbitrum': 19,
56
60
  'osmosis': 244,
57
61
  'terra': 245,
58
62
  'cosmoshub': 246,
@@ -111,6 +115,9 @@ const getBlockchainFromChain = (chainId) => {
111
115
  case 110:
112
116
  case 111:
113
117
  return Blockchain.Zilliqa;
118
+ case 42161:
119
+ case 421611:
120
+ return Blockchain.Arbitrum;
114
121
  }
115
122
  return undefined;
116
123
  };
@@ -139,6 +146,8 @@ const blockchainForChainId = (chainId) => {
139
146
  case 14: // mainnet
140
147
  case 88: // testnet
141
148
  return Blockchain.Neo3;
149
+ case 19: // mainnet
150
+ return Blockchain.Arbitrum;
142
151
  case 244: // mainnet
143
152
  return Blockchain.Osmosis;
144
153
  case 245: // mainnet
@@ -10,7 +10,9 @@ import { EncodeObject, OfflineDirectSigner, OfflineSigner } from "@cosmjs/proto-
10
10
  import { Account, DeliverTxResponse } from "@cosmjs/stargate";
11
11
  import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
12
12
  import { BroadcastTxSyncResponse } from "@cosmjs/tendermint-rpc/build/tendermint34/responses";
13
+ import { Leap } from "@cosmos-kit/leap";
13
14
  import { Key } from "@keplr-wallet/types";
15
+ import { Key as LeapKey } from "@cosmos-kit/core";
14
16
  import BigNumber from "bignumber.js";
15
17
  import { TxRaw as StargateTxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
16
18
  import { CarbonSigner, CarbonSignerTypes } from "./CarbonSigner";
@@ -101,6 +103,7 @@ export declare class CarbonWallet {
101
103
  static withLedger(cosmosLedger: CosmosLedger, publicKeyBase64: string, opts?: Omit<CarbonWalletInitOpts, "signer">): CarbonWallet;
102
104
  static withSigner(signer: CarbonSigner, publicKeyBase64: string, opts?: Omit<CarbonWalletInitOpts, "signer">): CarbonWallet;
103
105
  static withKeplr(keplr: Keplr, chainInfo: ChainInfo, keplrKey: Key, opts?: Omit<CarbonWalletInitOpts, "signer">): CarbonWallet;
106
+ static withLeap(leap: Leap, chainId: string, leapKey: LeapKey, opts?: Omit<CarbonWalletInitOpts, "signer">): CarbonWallet;
104
107
  static withAddress(bech32Address: string, opts?: Partial<CarbonWalletInitOpts>): CarbonWallet;
105
108
  initialize(queryClient: CarbonQueryClient): Promise<CarbonWallet>;
106
109
  updateNetwork(network: Network): CarbonWallet;
@@ -115,6 +115,12 @@ class CarbonWallet {
115
115
  const wallet = CarbonWallet.withSigner(signer, publicKeyBase64, opts);
116
116
  return wallet;
117
117
  }
118
+ static withLeap(leap, chainId, leapKey, opts = {}) {
119
+ const signer = provider_1.LeapAccount.createLeapSigner(leap, chainId);
120
+ const publicKeyBase64 = Buffer.from(leapKey.pubKey).toString("base64");
121
+ const wallet = CarbonWallet.withSigner(signer, publicKeyBase64, opts);
122
+ return wallet;
123
+ }
118
124
  static withAddress(bech32Address, opts = {}) {
119
125
  return new CarbonWallet(Object.assign(Object.assign({}, opts), { bech32Address }));
120
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.3.18",
3
+ "version": "0.3.20-beta.1+0c6005427b69",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -38,13 +38,14 @@
38
38
  "dependencies": {
39
39
  "@cityofzion/neon-api": "^4.9.0",
40
40
  "@cityofzion/neon-core": "^4.9.0",
41
- "@cityofzion/neon-js": "^4.9.0",
42
41
  "@cityofzion/neon-core-next": "npm:@cityofzion/neon-core@^5.0.0",
42
+ "@cityofzion/neon-js": "^4.9.0",
43
43
  "@cosmjs/proto-signing": "^0.28.10",
44
44
  "@cosmjs/stargate": "^0.28.10",
45
+ "@cosmos-kit/leap": "^0.13.14",
45
46
  "@grpc/grpc-js": "^1.3.2",
46
- "@keplr-wallet/stores": "~0.9.12",
47
- "@keplr-wallet/types": "~0.9.12",
47
+ "@keplr-wallet/stores": "^0.10.24",
48
+ "@keplr-wallet/types": "^0.10.24",
48
49
  "@ledgerhq/hw-app-eth": "^6.11.2",
49
50
  "@ledgerhq/hw-transport": "^6.3.0",
50
51
  "@ledgerhq/hw-transport-webhid": "^6.4.1",
@@ -58,6 +59,7 @@
58
59
  "dayjs": "^1.10.5",
59
60
  "eth-sig-util": "^3.0.0",
60
61
  "ethers": "^5.5.1",
62
+ "eventemitter3": "^5.0.0",
61
63
  "ledger-cosmos-js": "^2.1.8",
62
64
  "lodash": "^4.17.21",
63
65
  "neo-dapi": "^2.0.4",
@@ -67,6 +69,7 @@
67
69
  "ripemd160": "^2.0.2",
68
70
  "secp256k1": "^4.0.2",
69
71
  "secp256r1": "^0.0.3",
72
+ "semver": "^7.3.7",
70
73
  "tsc-alias": "^1.2.11",
71
74
  "typescript": "^4.3.5",
72
75
  "wif": "^2.0.6"
@@ -80,6 +83,7 @@
80
83
  "@types/node-fetch": "^2.5.12",
81
84
  "@types/ripemd160": "^2.0.0",
82
85
  "@types/secp256k1": "^4.0.2",
86
+ "@types/semver": "^7.3.13",
83
87
  "@types/w3c-web-hid": "^1.0.2",
84
88
  "@types/w3c-web-usb": "^1.0.5",
85
89
  "@types/websocket": "^1.0.4",