carbon-js-sdk 0.11.2-rc1 → 0.11.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.
@@ -24,3 +24,43 @@ export declare enum SupportedEip6963Provider {
24
24
  Fluvi = "Fluvi",
25
25
  SafeheronWallet = "Safeheron Wallet"
26
26
  }
27
+ interface EIP6963ProviderInfo {
28
+ walletId: string;
29
+ uuid: string;
30
+ name: string;
31
+ icon: string;
32
+ }
33
+ interface EIP1193Provider {
34
+ isStatus?: boolean;
35
+ host?: string;
36
+ path?: string;
37
+ isMetaMask: boolean;
38
+ chainId: string;
39
+ sendAsync?: (request: {
40
+ method: string;
41
+ params?: Array<unknown>;
42
+ }, callback: (error: Error | null, response: unknown) => void) => void;
43
+ send?: (request: {
44
+ method: string;
45
+ params?: Array<unknown>;
46
+ }, callback: (error: Error | null, response: unknown) => void) => void;
47
+ request: (request: {
48
+ method: string;
49
+ params?: Array<unknown>;
50
+ }) => Promise<unknown>;
51
+ on: (eventName: string, listener: (...args: unknown[]) => void) => any;
52
+ _state?: {
53
+ isConnected?: boolean;
54
+ };
55
+ }
56
+ export interface EIP6963ProviderDetail {
57
+ info: EIP6963ProviderInfo;
58
+ provider: EIP1193Provider;
59
+ }
60
+ export declare type EIP6963AnnounceProviderEvent = {
61
+ detail: {
62
+ info: EIP6963ProviderInfo;
63
+ provider: EIP1193Provider;
64
+ };
65
+ };
66
+ export {};
@@ -0,0 +1,31 @@
1
+ export interface ChangeNetworkParam {
2
+ chainId: string;
3
+ blockExplorerUrls?: string[];
4
+ chainName?: string;
5
+ iconUrls?: string[];
6
+ nativeCurrency?: {
7
+ name: string;
8
+ symbol: string;
9
+ decimals: number;
10
+ };
11
+ rpcUrls?: string[];
12
+ }
13
+ export declare const CarbonEvmNativeCurrency: {
14
+ decimals: number;
15
+ name: string;
16
+ symbol: string;
17
+ };
18
+ export declare const CARBON_EVM_LOCALHOST: ChangeNetworkParam;
19
+ export declare const CARBON_EVM_DEVNET: ChangeNetworkParam;
20
+ export declare const CARBON_EVM_TESTNET: ChangeNetworkParam;
21
+ export declare const CARBON_EVM_MAINNET: ChangeNetworkParam;
22
+ export declare const BSC_MAINNET: ChangeNetworkParam;
23
+ export declare const BSC_TESTNET: ChangeNetworkParam;
24
+ export declare const ETH_MAINNET: ChangeNetworkParam;
25
+ export declare const ETH_TESTNET: ChangeNetworkParam;
26
+ export declare const ARBITRUM_MAINNET: ChangeNetworkParam;
27
+ export declare const ARBITRUM_TESTNET: ChangeNetworkParam;
28
+ export declare const POLYGON_MAINNET: ChangeNetworkParam;
29
+ export declare const POLYGON_TESTNET: ChangeNetworkParam;
30
+ export declare const OKC_MAINNET: ChangeNetworkParam;
31
+ export declare const OKC_TESTNET: ChangeNetworkParam;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OKC_TESTNET = exports.OKC_MAINNET = exports.POLYGON_TESTNET = exports.POLYGON_MAINNET = exports.ARBITRUM_TESTNET = exports.ARBITRUM_MAINNET = exports.ETH_TESTNET = exports.ETH_MAINNET = exports.BSC_TESTNET = exports.BSC_MAINNET = exports.CARBON_EVM_MAINNET = exports.CARBON_EVM_TESTNET = exports.CARBON_EVM_DEVNET = exports.CARBON_EVM_LOCALHOST = exports.CarbonEvmNativeCurrency = void 0;
4
+ const constant_1 = require("../constant");
5
+ const ethermint_1 = require("../util/ethermint");
6
+ exports.CarbonEvmNativeCurrency = {
7
+ decimals: 18,
8
+ name: "SWTH",
9
+ symbol: "SWTH",
10
+ };
11
+ exports.CARBON_EVM_LOCALHOST = {
12
+ chainId: `0x${Number(ethermint_1.parseChainId(constant_1.CarbonEvmChainIDs[constant_1.Network.LocalHost])).toString(16)}`,
13
+ blockExplorerUrls: ["https://evm-scan.carbon.network"],
14
+ chainName: "Carbon EVM Localhost",
15
+ rpcUrls: [`${constant_1.NetworkConfigs[constant_1.Network.LocalHost].evmJsonRpcUrl}`],
16
+ nativeCurrency: exports.CarbonEvmNativeCurrency,
17
+ };
18
+ exports.CARBON_EVM_DEVNET = {
19
+ chainId: `0x${Number(ethermint_1.parseChainId(constant_1.CarbonEvmChainIDs[constant_1.Network.DevNet])).toString(16)}`,
20
+ blockExplorerUrls: ["https://evm-scan.carbon.network"],
21
+ chainName: "Carbon EVM Devnet",
22
+ rpcUrls: [`${constant_1.NetworkConfigs[constant_1.Network.DevNet].evmJsonRpcUrl}`],
23
+ nativeCurrency: exports.CarbonEvmNativeCurrency,
24
+ };
25
+ exports.CARBON_EVM_TESTNET = {
26
+ chainId: `0x${Number(ethermint_1.parseChainId(constant_1.CarbonEvmChainIDs[constant_1.Network.TestNet])).toString(16)}`,
27
+ blockExplorerUrls: ["https://evm-scan.carbon.network"],
28
+ chainName: "Carbon EVM Testnet",
29
+ rpcUrls: [`${constant_1.NetworkConfigs[constant_1.Network.TestNet].evmJsonRpcUrl}`],
30
+ nativeCurrency: exports.CarbonEvmNativeCurrency,
31
+ };
32
+ exports.CARBON_EVM_MAINNET = {
33
+ chainId: `0x${Number(ethermint_1.parseChainId(constant_1.CarbonEvmChainIDs[constant_1.Network.MainNet])).toString(16)}`,
34
+ blockExplorerUrls: ["https://evm-scan.carbon.network"],
35
+ chainName: "Carbon EVM",
36
+ rpcUrls: [`${constant_1.NetworkConfigs[constant_1.Network.MainNet].evmJsonRpcUrl}`],
37
+ nativeCurrency: exports.CarbonEvmNativeCurrency,
38
+ };
39
+ exports.BSC_MAINNET = {
40
+ chainId: "0x38",
41
+ blockExplorerUrls: ["https://bscscan.com"],
42
+ chainName: "BSC Mainnet",
43
+ rpcUrls: [
44
+ "https://bsc-dataseed2.binance.org/",
45
+ "https://bsc-dataseed3.binance.org/",
46
+ "https://bsc-dataseed4.binance.org/",
47
+ "https://bsc-dataseed1.defibit.io/",
48
+ "https://bsc-dataseed2.defibit.io/",
49
+ "https://bsc-dataseed3.defibit.io/",
50
+ "https://bsc-dataseed4.defibit.io/",
51
+ "https://bsc-dataseed1.ninicoin.io/",
52
+ "https://bsc-dataseed2.ninicoin.io/",
53
+ "https://bsc-dataseed3.ninicoin.io/",
54
+ "https://bsc-dataseed4.ninicoin.io/",
55
+ "https://bsc-dataseed1.binance.org/",
56
+ ],
57
+ nativeCurrency: {
58
+ decimals: 18,
59
+ name: "Binance Coin",
60
+ symbol: "BNB",
61
+ },
62
+ };
63
+ exports.BSC_TESTNET = {
64
+ chainId: "0x61",
65
+ blockExplorerUrls: ["https://testnet.bscscan.com"],
66
+ chainName: "BSC Testnet",
67
+ rpcUrls: [
68
+ "https://data-seed-prebsc-2-s1.binance.org:8545/",
69
+ "http://data-seed-prebsc-1-s2.binance.org:8545/",
70
+ "http://data-seed-prebsc-2-s2.binance.org:8545/",
71
+ "https://data-seed-prebsc-1-s3.binance.org:8545/",
72
+ "https://data-seed-prebsc-2-s3.binance.org:8545/",
73
+ "https://data-seed-prebsc-1-s1.binance.org:8545/",
74
+ ],
75
+ nativeCurrency: {
76
+ decimals: 18,
77
+ name: "Binance Coin",
78
+ symbol: "BNB",
79
+ },
80
+ };
81
+ exports.ETH_MAINNET = {
82
+ chainId: "0x1",
83
+ rpcUrls: ["https://mainnet.infura.io/v3/"],
84
+ };
85
+ exports.ETH_TESTNET = {
86
+ chainId: "0x5",
87
+ rpcUrls: ["https://goerli.infura.io/v3/"],
88
+ };
89
+ exports.ARBITRUM_MAINNET = {
90
+ chainId: "0xA4B1",
91
+ blockExplorerUrls: ["https://explorer.arbitrum.io"],
92
+ chainName: "Arbitrum One",
93
+ rpcUrls: ["https://arb1.arbitrum.io/rpc"],
94
+ nativeCurrency: {
95
+ decimals: 18,
96
+ name: "Ethereum",
97
+ symbol: "ETH",
98
+ },
99
+ };
100
+ exports.ARBITRUM_TESTNET = {
101
+ chainId: "0x66EEB",
102
+ blockExplorerUrls: [""],
103
+ chainName: "Arbitrum Testnet",
104
+ rpcUrls: ["https://rinkeby.arbitrum.io/rpc"],
105
+ nativeCurrency: {
106
+ decimals: 18,
107
+ name: "Ethereum",
108
+ symbol: "ETH",
109
+ },
110
+ };
111
+ exports.POLYGON_MAINNET = {
112
+ chainId: "0x89",
113
+ blockExplorerUrls: ["https://polygonscan.com/"],
114
+ chainName: "Polygon Mainnet",
115
+ rpcUrls: ["https://polygon-rpc.com"],
116
+ nativeCurrency: {
117
+ decimals: 18,
118
+ name: "Matic",
119
+ symbol: "MATIC",
120
+ },
121
+ };
122
+ exports.POLYGON_TESTNET = {
123
+ chainId: "0x13881",
124
+ blockExplorerUrls: ["https://mumbai.polygonscan.com"],
125
+ chainName: "Polygon Mumbai",
126
+ rpcUrls: ["https://polygon-mumbai.infura.io/v3/4458cf4d1689497b9a38b1d6bbf05e78"],
127
+ nativeCurrency: {
128
+ decimals: 18,
129
+ name: "Matic",
130
+ symbol: "MATIC",
131
+ },
132
+ };
133
+ exports.OKC_MAINNET = {
134
+ chainId: "0x42",
135
+ blockExplorerUrls: ["https://www.oklink.com/okc"],
136
+ chainName: "OKC Mainnet",
137
+ rpcUrls: ["https://exchainrpc.okex.org"],
138
+ nativeCurrency: {
139
+ decimals: 18,
140
+ name: "OKT",
141
+ symbol: "OKT",
142
+ },
143
+ };
144
+ exports.OKC_TESTNET = {
145
+ chainId: "0x41",
146
+ blockExplorerUrls: ["https://www.oklink.com/okc-test"],
147
+ chainName: "OKC Testnet",
148
+ rpcUrls: ["https://exchaintestrpc.okex.org"],
149
+ nativeCurrency: {
150
+ decimals: 18,
151
+ name: "OKT",
152
+ symbol: "OKT",
153
+ },
154
+ };
@@ -123,7 +123,7 @@ class IBCModule extends base_1.default {
123
123
  }
124
124
  getChainInfo(chainName) {
125
125
  return __awaiter(this, void 0, void 0, function* () {
126
- if (!chainName)
126
+ if (!chainName || chainName === "mainnet")
127
127
  return undefined;
128
128
  const chainInfoResponse = yield fetch(`https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/master/cosmos/${chainName}.json`);
129
129
  if (!chainInfoResponse.ok) {
@@ -1,4 +1,4 @@
1
- import { SupportedEip6963Provider } from "../../constant";
1
+ import { EIP6963ProviderDetail, SupportedEip6963Provider } from "../../constant";
2
2
  declare class Eip6963Provider {
3
3
  private providers;
4
4
  constructor();
@@ -1,23 +1,19 @@
1
- import { CarbonSDK, EVMChain as EVMChainV2 } from "../../index";
1
+ import { CarbonSDK, SupportedEip6963Provider } from "../../index";
2
2
  import { CarbonSigner } from "../../wallet";
3
3
  import { ethers } from "ethers";
4
4
  import { StdFee } from "@cosmjs/stargate";
5
5
  import { SWTHAddressOptions } from "../../util/address";
6
6
  import { AminoMsg } from "@cosmjs/amino";
7
- import { Blockchain, BlockchainV2 } from "../../util/blockchain";
8
- import { Network } from "../../constant";
7
+ import { BlockchainV2 } from "../../util/blockchain";
8
+ import { EVMChain, Network, SyncResult } from "../../constant";
9
+ import { Eip6963Provider } from "../eip6963Provider";
9
10
  import { ChangeNetworkParam } from "../../constant";
10
11
  export interface RainbowKitWalletOpts {
11
12
  publicKeyMessage?: string;
12
13
  publicKeyBase64: string;
13
- walletProvider: string;
14
+ walletProvider: SupportedEip6963Provider;
14
15
  }
15
- export interface SyncResult {
16
- blockchain?: Blockchain | BlockchainV2;
17
- chainId?: number;
18
- }
19
- export declare type EVMChain = EVMChainV2;
20
- declare class RainbowKitAccount {
16
+ declare class RainbowKitAccount extends Eip6963Provider {
21
17
  readonly legacyEip712SignMode: boolean;
22
18
  private provider;
23
19
  private blockchain;
@@ -22,9 +22,11 @@ const legacyEIP712_1 = require("../../util/legacyEIP712");
22
22
  const network_1 = require("../../util/network");
23
23
  const blockchain_1 = require("../../util/blockchain");
24
24
  const constant_1 = require("../../constant");
25
+ const eip6963Provider_1 = require("../eip6963Provider");
25
26
  const constant_2 = require("../../constant");
26
- class RainbowKitAccount {
27
+ class RainbowKitAccount extends eip6963Provider_1.Eip6963Provider {
27
28
  constructor(provider, legacyEip712SignMode = false) {
29
+ super();
28
30
  this.legacyEip712SignMode = legacyEip712SignMode;
29
31
  this.blockchain = 'Ethereum';
30
32
  this.provider = provider;
@@ -119,6 +121,7 @@ class RainbowKitAccount {
119
121
  });
120
122
  return {
121
123
  type: wallet_1.CarbonSignerTypes.BrowserInjected,
124
+ legacyEip712SignMode: rainbowKit.legacyEip712SignMode,
122
125
  getAccounts,
123
126
  signDirect,
124
127
  sendEvmTransaction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.11.2-rc1",
3
+ "version": "0.11.2",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",