carbon-js-sdk 0.3.17 → 0.3.19
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/lib/constant/ibc.d.ts +4 -1
- package/lib/constant/ibc.js +164 -4
- package/lib/provider/leap/LeapAccount.d.ts +10 -0
- package/lib/provider/leap/LeapAccount.js +45 -0
- package/lib/provider/leap/index.d.ts +3 -0
- package/lib/provider/leap/index.js +8 -0
- package/lib/provider/metamask/MetaMask.js +54 -44
- package/lib/util/blockchain.d.ts +7 -1
- package/lib/util/blockchain.js +25 -1
- package/lib/util/ibc.js +6 -0
- package/package.json +1 -1
- package/lib/clients/CarbonTendermintClient.d.ts +0 -117
- package/lib/clients/CarbonTendermintClient.js +0 -376
- package/lib/codec/cdp/vault.d.ts +0 -44
- package/lib/codec/cdp/vault.js +0 -235
- package/lib/codec/cosmos/base/store/v1beta1/snapshot.d.ts +0 -45
- package/lib/codec/cosmos/base/store/v1beta1/snapshot.js +0 -246
- package/lib/wallet/CarbonTendermintClient.js +0 -376
package/lib/constant/ibc.d.ts
CHANGED
|
@@ -51,7 +51,10 @@ export declare enum ChainIds {
|
|
|
51
51
|
Carbon = "carbon-1",
|
|
52
52
|
Axelar = "axelar-dojo-1",
|
|
53
53
|
Stride = "stride-1",
|
|
54
|
-
Kujira = "kaiyo-1"
|
|
54
|
+
Kujira = "kaiyo-1",
|
|
55
|
+
Terra2 = "phoenix-1",
|
|
56
|
+
Quicksilver = "quicksilver-1",
|
|
57
|
+
StafiHub = "stafihub-1"
|
|
55
58
|
}
|
|
56
59
|
export declare const swthIbcWhitelist: string[];
|
|
57
60
|
export declare const ibcWhitelist: string[];
|
package/lib/constant/ibc.js
CHANGED
|
@@ -90,6 +90,9 @@ var ChainIds;
|
|
|
90
90
|
ChainIds["Axelar"] = "axelar-dojo-1";
|
|
91
91
|
ChainIds["Stride"] = "stride-1";
|
|
92
92
|
ChainIds["Kujira"] = "kaiyo-1";
|
|
93
|
+
ChainIds["Terra2"] = "phoenix-1";
|
|
94
|
+
ChainIds["Quicksilver"] = "quicksilver-1";
|
|
95
|
+
ChainIds["StafiHub"] = "stafihub-1";
|
|
93
96
|
})(ChainIds = exports.ChainIds || (exports.ChainIds = {}));
|
|
94
97
|
// whitelisted networks for addition of swth as a currency
|
|
95
98
|
exports.swthIbcWhitelist = [ChainIds.Osmosis];
|
|
@@ -103,6 +106,12 @@ exports.ibcWhitelist = [
|
|
|
103
106
|
ChainIds.Axelar,
|
|
104
107
|
ChainIds.Stride,
|
|
105
108
|
ChainIds.Kujira,
|
|
109
|
+
ChainIds.Terra2,
|
|
110
|
+
ChainIds.Quicksilver,
|
|
111
|
+
ChainIds.Comdex,
|
|
112
|
+
ChainIds.StafiHub,
|
|
113
|
+
ChainIds.Persistence,
|
|
114
|
+
ChainIds.Stargaze,
|
|
106
115
|
];
|
|
107
116
|
exports.EmbedChainInfosInit = {
|
|
108
117
|
[ChainIds.Osmosis]: {
|
|
@@ -957,7 +966,7 @@ exports.EmbedChainInfosInit = {
|
|
|
957
966
|
coinGeckoId: "comdex",
|
|
958
967
|
},
|
|
959
968
|
],
|
|
960
|
-
features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
|
|
969
|
+
features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
|
|
961
970
|
explorerUrlToTx: "https://www.mintscan.io/comdex/txs/{txHash}",
|
|
962
971
|
tmRpc: "https://rpc.comdex.one/",
|
|
963
972
|
},
|
|
@@ -1032,7 +1041,7 @@ exports.EmbedChainInfosInit = {
|
|
|
1032
1041
|
coinGeckoId: "pool:ustars",
|
|
1033
1042
|
},
|
|
1034
1043
|
],
|
|
1035
|
-
features: ["stargate", "ibc-transfer", "no-legacy-stdTx"],
|
|
1044
|
+
features: ["stargate", "ibc-transfer", "no-legacy-stdTx", "ibc-go"],
|
|
1036
1045
|
explorerUrlToTx: "https://www.mintscan.io/stargaze/txs/{txHash}",
|
|
1037
1046
|
tmRpc: "https://rpc.stargaze-apis.com/",
|
|
1038
1047
|
},
|
|
@@ -1667,14 +1676,12 @@ exports.EmbedChainInfosInit = {
|
|
|
1667
1676
|
coinMinimalDenom: "ukuji",
|
|
1668
1677
|
coinDecimals: 6,
|
|
1669
1678
|
coinGeckoId: "kujira",
|
|
1670
|
-
coinImageUrl: "/tokens/kuji.png",
|
|
1671
1679
|
},
|
|
1672
1680
|
{
|
|
1673
1681
|
coinDenom: "USK",
|
|
1674
1682
|
coinMinimalDenom: "factory/kujira1qk00h5atutpsv900x202pxx42npjr9thg58dnqpa72f2p7m2luase444a7/uusk",
|
|
1675
1683
|
coinDecimals: 6,
|
|
1676
1684
|
coinGeckoId: "usk",
|
|
1677
|
-
coinImageUrl: "/tokens/usk.png",
|
|
1678
1685
|
},
|
|
1679
1686
|
],
|
|
1680
1687
|
feeCurrencies: [
|
|
@@ -1693,6 +1700,135 @@ exports.EmbedChainInfosInit = {
|
|
|
1693
1700
|
features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx", "ibc-go"],
|
|
1694
1701
|
explorerUrlToTx: "https://finder.kujira.app/kaiyo-1/tx/{txHash}",
|
|
1695
1702
|
},
|
|
1703
|
+
[ChainIds.Terra2]: {
|
|
1704
|
+
rpc: "https://rpc.terrav2.ccvalidators.com/",
|
|
1705
|
+
rest: "https://phoenix-lcd.terra.dev/",
|
|
1706
|
+
chainId: "phoenix-1",
|
|
1707
|
+
chainName: "Terra 2.0",
|
|
1708
|
+
bip44: {
|
|
1709
|
+
coinType: 118,
|
|
1710
|
+
},
|
|
1711
|
+
bech32Config: exports.IBCAddress.defaultBech32Config("terra"),
|
|
1712
|
+
stakeCurrency: {
|
|
1713
|
+
coinDenom: "LUNA",
|
|
1714
|
+
coinMinimalDenom: "uluna",
|
|
1715
|
+
coinDecimals: 6,
|
|
1716
|
+
// coinGeckoId: "terra-luna-2",
|
|
1717
|
+
coinGeckoId: "pool:uluna",
|
|
1718
|
+
},
|
|
1719
|
+
currencies: [
|
|
1720
|
+
{
|
|
1721
|
+
coinDenom: "LUNA",
|
|
1722
|
+
coinMinimalDenom: "uluna",
|
|
1723
|
+
coinDecimals: 6,
|
|
1724
|
+
// coinGeckoId: "terra-luna-2",
|
|
1725
|
+
coinGeckoId: "pool:uluna",
|
|
1726
|
+
},
|
|
1727
|
+
],
|
|
1728
|
+
feeCurrencies: [
|
|
1729
|
+
{
|
|
1730
|
+
coinDenom: "LUNA",
|
|
1731
|
+
coinMinimalDenom: "uluna",
|
|
1732
|
+
coinDecimals: 6,
|
|
1733
|
+
// coinGeckoId: "terra-luna-2",
|
|
1734
|
+
coinGeckoId: "pool:uluna",
|
|
1735
|
+
},
|
|
1736
|
+
],
|
|
1737
|
+
gasPriceStep: {
|
|
1738
|
+
low: 0.15,
|
|
1739
|
+
average: 0.2,
|
|
1740
|
+
high: 0.25,
|
|
1741
|
+
},
|
|
1742
|
+
features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
|
|
1743
|
+
explorerUrlToTx: "https://finder.terra.money/phoenix-1/tx/{txHash}",
|
|
1744
|
+
},
|
|
1745
|
+
[ChainIds.Quicksilver]: {
|
|
1746
|
+
rpc: "https://rpc-quicksilver.keplr.app",
|
|
1747
|
+
rest: "https://lcd-quicksilver.keplr.app",
|
|
1748
|
+
chainId: "quicksilver-1",
|
|
1749
|
+
chainName: "Quicksilver",
|
|
1750
|
+
stakeCurrency: {
|
|
1751
|
+
coinDenom: "QCK",
|
|
1752
|
+
coinMinimalDenom: "uqck",
|
|
1753
|
+
coinDecimals: 6,
|
|
1754
|
+
},
|
|
1755
|
+
bip44: {
|
|
1756
|
+
coinType: 118,
|
|
1757
|
+
},
|
|
1758
|
+
bech32Config: exports.IBCAddress.defaultBech32Config("quick"),
|
|
1759
|
+
currencies: [
|
|
1760
|
+
{
|
|
1761
|
+
coinDenom: "QCK",
|
|
1762
|
+
coinMinimalDenom: "uqck",
|
|
1763
|
+
coinDecimals: 6,
|
|
1764
|
+
},
|
|
1765
|
+
],
|
|
1766
|
+
feeCurrencies: [
|
|
1767
|
+
{
|
|
1768
|
+
coinDenom: "QCK",
|
|
1769
|
+
coinMinimalDenom: "uqck",
|
|
1770
|
+
coinDecimals: 6,
|
|
1771
|
+
},
|
|
1772
|
+
],
|
|
1773
|
+
gasPriceStep: {
|
|
1774
|
+
low: 0,
|
|
1775
|
+
average: 0.0001,
|
|
1776
|
+
high: 0.00025,
|
|
1777
|
+
},
|
|
1778
|
+
features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
|
|
1779
|
+
explorerUrlToTx: "https://www.mintscan.io/quicksilver/txs/{txHash}",
|
|
1780
|
+
},
|
|
1781
|
+
[ChainIds.StafiHub]: {
|
|
1782
|
+
rpc: "https://public-rpc1.stafihub.io",
|
|
1783
|
+
rest: "https://public-rest-rpc1.stafihub.io",
|
|
1784
|
+
chainId: "stafihub-1",
|
|
1785
|
+
chainName: "StaFi Hub",
|
|
1786
|
+
stakeCurrency: {
|
|
1787
|
+
coinDenom: "FIS",
|
|
1788
|
+
coinMinimalDenom: "ufis",
|
|
1789
|
+
coinDecimals: 6
|
|
1790
|
+
},
|
|
1791
|
+
bip44: {
|
|
1792
|
+
coinType: 118
|
|
1793
|
+
},
|
|
1794
|
+
bech32Config: exports.IBCAddress.defaultBech32Config("stafi"),
|
|
1795
|
+
currencies: [
|
|
1796
|
+
{
|
|
1797
|
+
coinDenom: "FIS",
|
|
1798
|
+
coinMinimalDenom: "ufis",
|
|
1799
|
+
coinDecimals: 6
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
coinDenom: "rATOM",
|
|
1803
|
+
coinMinimalDenom: "uratom",
|
|
1804
|
+
coinDecimals: 6
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
coinDenom: "rIRIS",
|
|
1808
|
+
coinMinimalDenom: "uriris",
|
|
1809
|
+
coinDecimals: 6
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
coinDenom: "rHUAHUA",
|
|
1813
|
+
coinMinimalDenom: "urhuahua",
|
|
1814
|
+
coinDecimals: 6
|
|
1815
|
+
}
|
|
1816
|
+
],
|
|
1817
|
+
feeCurrencies: [
|
|
1818
|
+
{
|
|
1819
|
+
coinDenom: "FIS",
|
|
1820
|
+
coinMinimalDenom: "ufis",
|
|
1821
|
+
coinDecimals: 6,
|
|
1822
|
+
}
|
|
1823
|
+
],
|
|
1824
|
+
gasPriceStep: {
|
|
1825
|
+
low: 0.01,
|
|
1826
|
+
average: 0.025,
|
|
1827
|
+
high: 0.04
|
|
1828
|
+
},
|
|
1829
|
+
features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
|
|
1830
|
+
explorerUrlToTx: "https://www.mintscan.io/stafi/txs/{txHash}",
|
|
1831
|
+
}
|
|
1696
1832
|
};
|
|
1697
1833
|
exports.swthChannels = {
|
|
1698
1834
|
[ChainIds.Osmosis]: {
|
|
@@ -1727,6 +1863,30 @@ exports.swthChannels = {
|
|
|
1727
1863
|
sourceChannel: "channel-9",
|
|
1728
1864
|
dstChannel: "channel-46",
|
|
1729
1865
|
},
|
|
1866
|
+
[ChainIds.Terra2]: {
|
|
1867
|
+
sourceChannel: "channel-12",
|
|
1868
|
+
dstChannel: "channel-36",
|
|
1869
|
+
},
|
|
1870
|
+
[ChainIds.Comdex]: {
|
|
1871
|
+
sourceChannel: "channel-11",
|
|
1872
|
+
dstChannel: "channel-50",
|
|
1873
|
+
},
|
|
1874
|
+
[ChainIds.Quicksilver]: {
|
|
1875
|
+
sourceChannel: "channel-10",
|
|
1876
|
+
dstChannel: "channel-0",
|
|
1877
|
+
},
|
|
1878
|
+
[ChainIds.StafiHub]: {
|
|
1879
|
+
sourceChannel: "channel-13",
|
|
1880
|
+
dstChannel: "channel-5",
|
|
1881
|
+
},
|
|
1882
|
+
[ChainIds.Persistence]: {
|
|
1883
|
+
sourceChannel: "channel-14",
|
|
1884
|
+
dstChannel: "channel-62",
|
|
1885
|
+
},
|
|
1886
|
+
[ChainIds.Stargaze]: {
|
|
1887
|
+
sourceChannel: "channel-15",
|
|
1888
|
+
dstChannel: "channel-123",
|
|
1889
|
+
},
|
|
1730
1890
|
};
|
|
1731
1891
|
exports.cibtIbcTokenRegex = RegExp(`^${token_1.DenomPrefix.CDPToken}/ibc/([a-f\\d]+)$`, "i");
|
|
1732
1892
|
exports.ibcTokenRegex = /^ibc\/([a-f\d]+)$/i;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CarbonSigner } from "../../wallet";
|
|
2
|
+
import { Leap } from "@cosmos-kit/leap";
|
|
3
|
+
import SDKProvider from "../sdk";
|
|
4
|
+
declare class LeapAccount {
|
|
5
|
+
static createLeapSigner(leap: Leap, chainId: string): CarbonSigner;
|
|
6
|
+
static getChainId(configProvider: SDKProvider): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
declare namespace LeapAccount {
|
|
9
|
+
}
|
|
10
|
+
export default LeapAccount;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const wallet_1 = require("../../wallet");
|
|
13
|
+
class LeapAccount {
|
|
14
|
+
static createLeapSigner(leap, chainId) {
|
|
15
|
+
const signDirect = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const signOpts = { preferNoSetFee: true };
|
|
17
|
+
return yield leap.signDirect(chainId, signerAddress, doc, signOpts);
|
|
18
|
+
});
|
|
19
|
+
const signAmino = (signerAddress, doc) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const signOpts = { preferNoSetFee: true };
|
|
21
|
+
return yield leap.signAmino(chainId, signerAddress, doc, signOpts);
|
|
22
|
+
});
|
|
23
|
+
const getAccounts = () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const account = yield leap.getKey(chainId);
|
|
25
|
+
return [{
|
|
26
|
+
algo: 'secp256k1',
|
|
27
|
+
address: account.bech32Address,
|
|
28
|
+
pubkey: account.pubKey,
|
|
29
|
+
}];
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
type: wallet_1.CarbonSignerTypes.BrowserInjected,
|
|
33
|
+
signDirect,
|
|
34
|
+
signAmino,
|
|
35
|
+
getAccounts,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static getChainId(configProvider) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const chainId = yield configProvider.query.chain.getChainId();
|
|
41
|
+
return chainId;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = LeapAccount;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var LeapAccount_1 = require("./LeapAccount");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(LeapAccount_1).default; } });
|
|
@@ -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
|
|
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
|
|
138
|
+
return ETH_TESTNET;
|
|
129
139
|
}
|
|
130
140
|
}
|
|
131
141
|
static getRequiredChainId(network, blockchain = blockchain_1.Blockchain.Ethereum) {
|
package/lib/util/blockchain.d.ts
CHANGED
|
@@ -19,7 +19,13 @@ export declare enum Blockchain {
|
|
|
19
19
|
Evmos = "evmos",
|
|
20
20
|
Axelar = "axelar",
|
|
21
21
|
Stride = "stride",
|
|
22
|
-
Kujira = "kujira"
|
|
22
|
+
Kujira = "kujira",
|
|
23
|
+
Terra2 = "terra2",
|
|
24
|
+
Quicksilver = "quicksilver",
|
|
25
|
+
Comdex = "comdex",
|
|
26
|
+
StafiHub = "stafihub",
|
|
27
|
+
Persistence = "persistence",
|
|
28
|
+
Stargaze = "stargaze"
|
|
23
29
|
}
|
|
24
30
|
export declare const BRIDGE_IDS: {
|
|
25
31
|
polynetwork: number;
|
package/lib/util/blockchain.js
CHANGED
|
@@ -24,6 +24,12 @@ var Blockchain;
|
|
|
24
24
|
Blockchain["Axelar"] = "axelar";
|
|
25
25
|
Blockchain["Stride"] = "stride";
|
|
26
26
|
Blockchain["Kujira"] = "kujira";
|
|
27
|
+
Blockchain["Terra2"] = "terra2";
|
|
28
|
+
Blockchain["Quicksilver"] = "quicksilver";
|
|
29
|
+
Blockchain["Comdex"] = "comdex";
|
|
30
|
+
Blockchain["StafiHub"] = "stafihub";
|
|
31
|
+
Blockchain["Persistence"] = "persistence";
|
|
32
|
+
Blockchain["Stargaze"] = "stargaze";
|
|
27
33
|
})(Blockchain = exports.Blockchain || (exports.Blockchain = {}));
|
|
28
34
|
;
|
|
29
35
|
exports.BRIDGE_IDS = {
|
|
@@ -54,7 +60,13 @@ exports.CHAIN_IDS = {
|
|
|
54
60
|
'evmos': 248,
|
|
55
61
|
'axelar': 249,
|
|
56
62
|
'stride': 313,
|
|
57
|
-
'kujira': 314
|
|
63
|
+
'kujira': 314,
|
|
64
|
+
'terra2': 315,
|
|
65
|
+
'quicksilver': 316,
|
|
66
|
+
'comdex': 317,
|
|
67
|
+
'stafihub': 318,
|
|
68
|
+
'persistence': 319,
|
|
69
|
+
'stargaze': 320,
|
|
58
70
|
};
|
|
59
71
|
exports.CHAIN_IDS_DEV = {
|
|
60
72
|
'eth': 350,
|
|
@@ -143,6 +155,18 @@ const blockchainForChainId = (chainId) => {
|
|
|
143
155
|
return Blockchain.Stride;
|
|
144
156
|
case 314: // mainnnet
|
|
145
157
|
return Blockchain.Kujira;
|
|
158
|
+
case 315: // mainnnet
|
|
159
|
+
return Blockchain.Terra2;
|
|
160
|
+
case 316: // mainnnet
|
|
161
|
+
return Blockchain.Quicksilver;
|
|
162
|
+
case 317: // mainnnet
|
|
163
|
+
return Blockchain.Comdex;
|
|
164
|
+
case 318: // mainnnet
|
|
165
|
+
return Blockchain.StafiHub;
|
|
166
|
+
case 319: // mainnnet
|
|
167
|
+
return Blockchain.Persistence;
|
|
168
|
+
case 320: // mainnnet
|
|
169
|
+
return Blockchain.Stargaze;
|
|
146
170
|
default:
|
|
147
171
|
return undefined;
|
|
148
172
|
}
|
package/lib/util/ibc.js
CHANGED
|
@@ -51,6 +51,12 @@ exports.ChainIdBlockchainMap = {
|
|
|
51
51
|
[constant_1.ChainIds.Axelar]: blockchain_1.Blockchain.Axelar,
|
|
52
52
|
[constant_1.ChainIds.Stride]: blockchain_1.Blockchain.Stride,
|
|
53
53
|
[constant_1.ChainIds.Kujira]: blockchain_1.Blockchain.Kujira,
|
|
54
|
+
[constant_1.ChainIds.Terra2]: blockchain_1.Blockchain.Terra2,
|
|
55
|
+
[constant_1.ChainIds.Quicksilver]: blockchain_1.Blockchain.Quicksilver,
|
|
56
|
+
[constant_1.ChainIds.Comdex]: blockchain_1.Blockchain.Comdex,
|
|
57
|
+
[constant_1.ChainIds.StafiHub]: blockchain_1.Blockchain.StafiHub,
|
|
58
|
+
[constant_1.ChainIds.Persistence]: blockchain_1.Blockchain.Persistence,
|
|
59
|
+
[constant_1.ChainIds.Stargaze]: blockchain_1.Blockchain.Stargaze,
|
|
54
60
|
};
|
|
55
61
|
const getIbcChainFromBlockchain = (blockchain) => {
|
|
56
62
|
let ibcChain = undefined;
|
package/package.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { Stream } from "xstream";
|
|
2
|
-
import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc/build/types";
|
|
3
|
-
import * as requests from "@cosmjs/tendermint-rpc/build/tendermint34/requests";
|
|
4
|
-
import * as responses from "@cosmjs/tendermint-rpc/build/tendermint34/responses";
|
|
5
|
-
export interface SubscriptionEvent {
|
|
6
|
-
readonly query: string;
|
|
7
|
-
readonly data: {
|
|
8
|
-
readonly type: string;
|
|
9
|
-
readonly value: any;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare type JsonRpcId = number | string;
|
|
13
|
-
export interface JsonRpcRequest {
|
|
14
|
-
readonly jsonrpc: "2.0";
|
|
15
|
-
readonly id: JsonRpcId;
|
|
16
|
-
readonly method: string;
|
|
17
|
-
readonly params: JsonCompatibleArray | JsonCompatibleDictionary;
|
|
18
|
-
}
|
|
19
|
-
export interface JsonCompatibleArray extends ReadonlyArray<JsonCompatibleValue> {
|
|
20
|
-
}
|
|
21
|
-
export interface JsonCompatibleDictionary {
|
|
22
|
-
readonly [key: string]: JsonCompatibleValue | readonly JsonCompatibleValue[];
|
|
23
|
-
}
|
|
24
|
-
export declare type JsonCompatibleValue = JsonCompatibleDictionary | JsonCompatibleArray | string | number | boolean | null;
|
|
25
|
-
export interface RpcClient {
|
|
26
|
-
readonly execute: (request: JsonRpcRequest) => Promise<JsonRpcSuccessResponse>;
|
|
27
|
-
readonly disconnect: () => void;
|
|
28
|
-
}
|
|
29
|
-
export declare function instanceOfRpcStreamingClient(client: RpcClient): client is RpcStreamingClient;
|
|
30
|
-
export interface RpcStreamingClient extends RpcClient {
|
|
31
|
-
readonly listen: (request: JsonRpcRequest) => Stream<SubscriptionEvent>;
|
|
32
|
-
}
|
|
33
|
-
export default class CarbonTendermintClient {
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new Tendermint client for the given endpoint.
|
|
36
|
-
*
|
|
37
|
-
* Uses HTTP when the URL schema is http or https. Uses WebSockets otherwise.
|
|
38
|
-
*/
|
|
39
|
-
static connect(endpoint: string): Promise<CarbonTendermintClient>;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a new Tendermint client given an RPC client.
|
|
42
|
-
*/
|
|
43
|
-
static create(rpcClient: RpcClient): Promise<CarbonTendermintClient>;
|
|
44
|
-
private static detectVersion;
|
|
45
|
-
private readonly client;
|
|
46
|
-
private readonly p;
|
|
47
|
-
private readonly r;
|
|
48
|
-
/**
|
|
49
|
-
* Use `CarbonTendermintClient.connect` or `CarbonTendermintClient.create` to create an instance.
|
|
50
|
-
*/
|
|
51
|
-
private constructor();
|
|
52
|
-
disconnect(): void;
|
|
53
|
-
abciInfo(): Promise<responses.AbciInfoResponse>;
|
|
54
|
-
abciQuery(params: requests.AbciQueryParams): Promise<responses.AbciQueryResponse>;
|
|
55
|
-
block(height?: number): Promise<responses.BlockResponse>;
|
|
56
|
-
blockResults(height?: number): Promise<responses.BlockResultsResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* Search for events that are in a block.
|
|
59
|
-
*
|
|
60
|
-
* NOTE
|
|
61
|
-
* This method will error on any node that is running a Tendermint version lower than 0.34.9.
|
|
62
|
-
*
|
|
63
|
-
* @see https://docs.tendermint.com/master/rpc/#/Info/block_search
|
|
64
|
-
*/
|
|
65
|
-
blockSearch(params: requests.BlockSearchParams): Promise<responses.BlockSearchResponse>;
|
|
66
|
-
blockSearchAll(params: requests.BlockSearchParams): Promise<responses.BlockSearchResponse>;
|
|
67
|
-
/**
|
|
68
|
-
* Queries block headers filtered by minHeight <= height <= maxHeight.
|
|
69
|
-
*
|
|
70
|
-
* @param minHeight The minimum height to be included in the result. Defaults to 0.
|
|
71
|
-
* @param maxHeight The maximum height to be included in the result. Defaults to infinity.
|
|
72
|
-
*/
|
|
73
|
-
blockchain(minHeight?: number, maxHeight?: number): Promise<responses.BlockchainResponse>;
|
|
74
|
-
/**
|
|
75
|
-
* Broadcast transaction to mempool and wait for response
|
|
76
|
-
*
|
|
77
|
-
* @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync
|
|
78
|
-
*/
|
|
79
|
-
broadcastTxSync(params: requests.BroadcastTxParams): Promise<responses.BroadcastTxSyncResponse>;
|
|
80
|
-
/**
|
|
81
|
-
* Broadcast transaction to mempool and do not wait for result
|
|
82
|
-
*
|
|
83
|
-
* @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async
|
|
84
|
-
*/
|
|
85
|
-
broadcastTxAsync(params: requests.BroadcastTxParams): Promise<responses.BroadcastTxAsyncResponse>;
|
|
86
|
-
/**
|
|
87
|
-
* Broadcast transaction to mempool and wait for block
|
|
88
|
-
*
|
|
89
|
-
* @see https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit
|
|
90
|
-
*/
|
|
91
|
-
broadcastTxCommit(params: requests.BroadcastTxParams): Promise<responses.BroadcastTxCommitResponse>;
|
|
92
|
-
commit(height?: number): Promise<responses.CommitResponse>;
|
|
93
|
-
genesis(): Promise<responses.GenesisResponse>;
|
|
94
|
-
health(): Promise<responses.HealthResponse>;
|
|
95
|
-
numUnconfirmedTxs(): Promise<responses.NumUnconfirmedTxsResponse>;
|
|
96
|
-
status(): Promise<responses.StatusResponse>;
|
|
97
|
-
subscribeNewBlock(): Stream<responses.NewBlockEvent>;
|
|
98
|
-
subscribeNewBlockHeader(): Stream<responses.NewBlockHeaderEvent>;
|
|
99
|
-
subscribeTx(query?: string): Stream<responses.TxEvent>;
|
|
100
|
-
/**
|
|
101
|
-
* Get a single transaction by hash
|
|
102
|
-
*
|
|
103
|
-
* @see https://docs.tendermint.com/master/rpc/#/Info/tx
|
|
104
|
-
*/
|
|
105
|
-
tx(params: requests.TxParams): Promise<responses.TxResponse>;
|
|
106
|
-
/**
|
|
107
|
-
* Search for transactions that are in a block
|
|
108
|
-
*
|
|
109
|
-
* @see https://docs.tendermint.com/master/rpc/#/Info/tx_search
|
|
110
|
-
*/
|
|
111
|
-
txSearch(params: requests.TxSearchParams): Promise<responses.TxSearchResponse>;
|
|
112
|
-
txSearchAll(params: requests.TxSearchParams): Promise<responses.TxSearchResponse>;
|
|
113
|
-
validators(params: requests.ValidatorsParams): Promise<responses.ValidatorsResponse>;
|
|
114
|
-
validatorsAll(height?: number): Promise<responses.ValidatorsResponse>;
|
|
115
|
-
private doCall;
|
|
116
|
-
private subscribe;
|
|
117
|
-
}
|