carbon-js-sdk 0.3.41-beta.1 → 0.3.43
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/clients/ETHClient.js
CHANGED
|
@@ -39,7 +39,7 @@ class ETHClient {
|
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
const tokenQueryResults = yield api.token.getAllTokens();
|
|
41
41
|
const lockProxyAddress = this.getLockProxyAddress().toLowerCase();
|
|
42
|
-
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
42
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber(), api.network) == this.blockchain &&
|
|
43
43
|
token.tokenAddress.length == 40 &&
|
|
44
44
|
token.bridgeAddress.toLowerCase() == generic_1.stripHexPrefix(lockProxyAddress) &&
|
|
45
45
|
(!whitelistDenoms || whitelistDenoms.includes(token.denom)) &&
|
|
@@ -239,7 +239,7 @@ class ETHClient {
|
|
|
239
239
|
if (!feeInfo.deposit_fee) {
|
|
240
240
|
throw new Error("unsupported token");
|
|
241
241
|
}
|
|
242
|
-
if (blockchain_1.blockchainForChainId(token.chainId.toNumber()) !== this.blockchain) {
|
|
242
|
+
if (blockchain_1.blockchainForChainId(token.chainId.toNumber(), this.configProvider.getConfig().network) !== this.blockchain) {
|
|
243
243
|
throw new Error("unsupported token");
|
|
244
244
|
}
|
|
245
245
|
let feeAmount = ethers_1.ethers.BigNumber.from(feeInfo.deposit_fee);
|
package/lib/clients/NEOClient.js
CHANGED
|
@@ -64,7 +64,7 @@ class NEOClient {
|
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
const tokenQueryResults = yield sdk.token.getAllTokens();
|
|
66
66
|
const account = new Neon.wallet.Account(address);
|
|
67
|
-
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
67
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain &&
|
|
68
68
|
token.tokenAddress.length == 40 &&
|
|
69
69
|
token.bridgeAddress.length == 40);
|
|
70
70
|
const client = new Neon.rpc.RPCClient(url, "2.5.2"); // TODO: should we change the RPC version??
|
package/lib/clients/ZILClient.js
CHANGED
|
@@ -72,7 +72,7 @@ class ZILClient {
|
|
|
72
72
|
getExternalBalances(sdk, address, whitelistDenoms) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const tokenQueryResults = yield sdk.token.getAllTokens();
|
|
75
|
-
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber()) == this.blockchain &&
|
|
75
|
+
const tokens = tokenQueryResults.filter((token) => blockchain_1.blockchainForChainId(token.chainId.toNumber(), sdk.network) == this.blockchain &&
|
|
76
76
|
token.tokenAddress.length == 40 &&
|
|
77
77
|
(!whitelistDenoms || whitelistDenoms.includes(token.denom)));
|
|
78
78
|
const requests = tokens.map((token) => token.tokenAddress === zeroAddress
|
package/lib/codec/cdp/query.d.ts
CHANGED
|
@@ -126,12 +126,15 @@ export interface CdpPositionItem {
|
|
|
126
126
|
healthFactor: string;
|
|
127
127
|
collateralAmount: string;
|
|
128
128
|
borrowAmount: string;
|
|
129
|
+
mintDenom: string;
|
|
130
|
+
mintAmount: string;
|
|
129
131
|
}
|
|
130
132
|
export interface CdpPosition {
|
|
131
133
|
address: string;
|
|
132
134
|
healthFactor: string;
|
|
133
135
|
collateral: Coin[];
|
|
134
136
|
borrow: Coin[];
|
|
137
|
+
mint: Coin[];
|
|
135
138
|
}
|
|
136
139
|
export interface QueryCdpPositionsRequest {
|
|
137
140
|
pagination?: PageRequest;
|
package/lib/codec/cdp/query.js
CHANGED
|
@@ -1725,6 +1725,8 @@ const baseCdpPositionItem = {
|
|
|
1725
1725
|
healthFactor: "",
|
|
1726
1726
|
collateralAmount: "",
|
|
1727
1727
|
borrowAmount: "",
|
|
1728
|
+
mintDenom: "",
|
|
1729
|
+
mintAmount: "",
|
|
1728
1730
|
};
|
|
1729
1731
|
exports.CdpPositionItem = {
|
|
1730
1732
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
@@ -1746,6 +1748,12 @@ exports.CdpPositionItem = {
|
|
|
1746
1748
|
if (message.borrowAmount !== "") {
|
|
1747
1749
|
writer.uint32(50).string(message.borrowAmount);
|
|
1748
1750
|
}
|
|
1751
|
+
if (message.mintDenom !== "") {
|
|
1752
|
+
writer.uint32(58).string(message.mintDenom);
|
|
1753
|
+
}
|
|
1754
|
+
if (message.mintAmount !== "") {
|
|
1755
|
+
writer.uint32(66).string(message.mintAmount);
|
|
1756
|
+
}
|
|
1749
1757
|
return writer;
|
|
1750
1758
|
},
|
|
1751
1759
|
decode(input, length) {
|
|
@@ -1773,6 +1781,12 @@ exports.CdpPositionItem = {
|
|
|
1773
1781
|
case 6:
|
|
1774
1782
|
message.borrowAmount = reader.string();
|
|
1775
1783
|
break;
|
|
1784
|
+
case 7:
|
|
1785
|
+
message.mintDenom = reader.string();
|
|
1786
|
+
break;
|
|
1787
|
+
case 8:
|
|
1788
|
+
message.mintAmount = reader.string();
|
|
1789
|
+
break;
|
|
1776
1790
|
default:
|
|
1777
1791
|
reader.skipType(tag & 7);
|
|
1778
1792
|
break;
|
|
@@ -1806,6 +1820,14 @@ exports.CdpPositionItem = {
|
|
|
1806
1820
|
object.borrowAmount !== undefined && object.borrowAmount !== null
|
|
1807
1821
|
? String(object.borrowAmount)
|
|
1808
1822
|
: "";
|
|
1823
|
+
message.mintDenom =
|
|
1824
|
+
object.mintDenom !== undefined && object.mintDenom !== null
|
|
1825
|
+
? String(object.mintDenom)
|
|
1826
|
+
: "";
|
|
1827
|
+
message.mintAmount =
|
|
1828
|
+
object.mintAmount !== undefined && object.mintAmount !== null
|
|
1829
|
+
? String(object.mintAmount)
|
|
1830
|
+
: "";
|
|
1809
1831
|
return message;
|
|
1810
1832
|
},
|
|
1811
1833
|
toJSON(message) {
|
|
@@ -1819,10 +1841,12 @@ exports.CdpPositionItem = {
|
|
|
1819
1841
|
(obj.collateralAmount = message.collateralAmount);
|
|
1820
1842
|
message.borrowAmount !== undefined &&
|
|
1821
1843
|
(obj.borrowAmount = message.borrowAmount);
|
|
1844
|
+
message.mintDenom !== undefined && (obj.mintDenom = message.mintDenom);
|
|
1845
|
+
message.mintAmount !== undefined && (obj.mintAmount = message.mintAmount);
|
|
1822
1846
|
return obj;
|
|
1823
1847
|
},
|
|
1824
1848
|
fromPartial(object) {
|
|
1825
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1849
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1826
1850
|
const message = Object.assign({}, baseCdpPositionItem);
|
|
1827
1851
|
message.address = (_a = object.address) !== null && _a !== void 0 ? _a : "";
|
|
1828
1852
|
message.denom = (_b = object.denom) !== null && _b !== void 0 ? _b : "";
|
|
@@ -1830,6 +1854,8 @@ exports.CdpPositionItem = {
|
|
|
1830
1854
|
message.healthFactor = (_d = object.healthFactor) !== null && _d !== void 0 ? _d : "";
|
|
1831
1855
|
message.collateralAmount = (_e = object.collateralAmount) !== null && _e !== void 0 ? _e : "";
|
|
1832
1856
|
message.borrowAmount = (_f = object.borrowAmount) !== null && _f !== void 0 ? _f : "";
|
|
1857
|
+
message.mintDenom = (_g = object.mintDenom) !== null && _g !== void 0 ? _g : "";
|
|
1858
|
+
message.mintAmount = (_h = object.mintAmount) !== null && _h !== void 0 ? _h : "";
|
|
1833
1859
|
return message;
|
|
1834
1860
|
},
|
|
1835
1861
|
};
|
|
@@ -1848,6 +1874,9 @@ exports.CdpPosition = {
|
|
|
1848
1874
|
for (const v of message.borrow) {
|
|
1849
1875
|
coin_1.Coin.encode(v, writer.uint32(34).fork()).ldelim();
|
|
1850
1876
|
}
|
|
1877
|
+
for (const v of message.mint) {
|
|
1878
|
+
coin_1.Coin.encode(v, writer.uint32(42).fork()).ldelim();
|
|
1879
|
+
}
|
|
1851
1880
|
return writer;
|
|
1852
1881
|
},
|
|
1853
1882
|
decode(input, length) {
|
|
@@ -1856,6 +1885,7 @@ exports.CdpPosition = {
|
|
|
1856
1885
|
const message = Object.assign({}, baseCdpPosition);
|
|
1857
1886
|
message.collateral = [];
|
|
1858
1887
|
message.borrow = [];
|
|
1888
|
+
message.mint = [];
|
|
1859
1889
|
while (reader.pos < end) {
|
|
1860
1890
|
const tag = reader.uint32();
|
|
1861
1891
|
switch (tag >>> 3) {
|
|
@@ -1871,6 +1901,9 @@ exports.CdpPosition = {
|
|
|
1871
1901
|
case 4:
|
|
1872
1902
|
message.borrow.push(coin_1.Coin.decode(reader, reader.uint32()));
|
|
1873
1903
|
break;
|
|
1904
|
+
case 5:
|
|
1905
|
+
message.mint.push(coin_1.Coin.decode(reader, reader.uint32()));
|
|
1906
|
+
break;
|
|
1874
1907
|
default:
|
|
1875
1908
|
reader.skipType(tag & 7);
|
|
1876
1909
|
break;
|
|
@@ -1879,7 +1912,7 @@ exports.CdpPosition = {
|
|
|
1879
1912
|
return message;
|
|
1880
1913
|
},
|
|
1881
1914
|
fromJSON(object) {
|
|
1882
|
-
var _a, _b;
|
|
1915
|
+
var _a, _b, _c;
|
|
1883
1916
|
const message = Object.assign({}, baseCdpPosition);
|
|
1884
1917
|
message.address =
|
|
1885
1918
|
object.address !== undefined && object.address !== null
|
|
@@ -1891,6 +1924,7 @@ exports.CdpPosition = {
|
|
|
1891
1924
|
: "";
|
|
1892
1925
|
message.collateral = ((_a = object.collateral) !== null && _a !== void 0 ? _a : []).map((e) => coin_1.Coin.fromJSON(e));
|
|
1893
1926
|
message.borrow = ((_b = object.borrow) !== null && _b !== void 0 ? _b : []).map((e) => coin_1.Coin.fromJSON(e));
|
|
1927
|
+
message.mint = ((_c = object.mint) !== null && _c !== void 0 ? _c : []).map((e) => coin_1.Coin.fromJSON(e));
|
|
1894
1928
|
return message;
|
|
1895
1929
|
},
|
|
1896
1930
|
toJSON(message) {
|
|
@@ -1910,15 +1944,22 @@ exports.CdpPosition = {
|
|
|
1910
1944
|
else {
|
|
1911
1945
|
obj.borrow = [];
|
|
1912
1946
|
}
|
|
1947
|
+
if (message.mint) {
|
|
1948
|
+
obj.mint = message.mint.map((e) => (e ? coin_1.Coin.toJSON(e) : undefined));
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
obj.mint = [];
|
|
1952
|
+
}
|
|
1913
1953
|
return obj;
|
|
1914
1954
|
},
|
|
1915
1955
|
fromPartial(object) {
|
|
1916
|
-
var _a, _b, _c, _d;
|
|
1956
|
+
var _a, _b, _c, _d, _e;
|
|
1917
1957
|
const message = Object.assign({}, baseCdpPosition);
|
|
1918
1958
|
message.address = (_a = object.address) !== null && _a !== void 0 ? _a : "";
|
|
1919
1959
|
message.healthFactor = (_b = object.healthFactor) !== null && _b !== void 0 ? _b : "";
|
|
1920
1960
|
message.collateral = ((_c = object.collateral) !== null && _c !== void 0 ? _c : []).map((e) => coin_1.Coin.fromPartial(e));
|
|
1921
1961
|
message.borrow = ((_d = object.borrow) !== null && _d !== void 0 ? _d : []).map((e) => coin_1.Coin.fromPartial(e));
|
|
1962
|
+
message.mint = ((_e = object.mint) !== null && _e !== void 0 ? _e : []).map((e) => coin_1.Coin.fromPartial(e));
|
|
1922
1963
|
return message;
|
|
1923
1964
|
},
|
|
1924
1965
|
};
|