@ledgerhq/live-common 22.0.1 → 22.1.0
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/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js +5 -5
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js.map +1 -1
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.test.d.ts +2 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.test.d.ts.map +1 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.test.js +147 -0
- package/lib/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.test.js.map +1 -0
- package/lib/api/Ripple.d.ts +17 -21
- package/lib/api/Ripple.d.ts.map +1 -1
- package/lib/api/Ripple.js +117 -176
- package/lib/api/Ripple.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -5
- package/lib/api/index.js.map +1 -1
- package/lib/apps/support.js +1 -1
- package/lib/env.d.ts +6 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +4 -4
- package/lib/env.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -1
- package/lib/errors.js.map +1 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.d.ts.map +1 -1
- package/lib/families/bitcoin/getAccountNetworkInfo.js +4 -2
- package/lib/families/bitcoin/getAccountNetworkInfo.js.map +1 -1
- package/lib/families/bitcoin/js-synchronisation.js +5 -5
- package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
- package/lib/families/bitcoin/specs.d.ts.map +1 -1
- package/lib/families/bitcoin/specs.js +5 -1
- package/lib/families/bitcoin/specs.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/explorer/index.js +2 -2
- package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.d.ts +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/index.js +5 -5
- package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +2 -2
- package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.d.ts +2 -0
- package/lib/families/bitcoin/wallet-btc/utils.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/utils.js +9 -1
- package/lib/families/bitcoin/wallet-btc/utils.js.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
- package/lib/families/bitcoin/wallet-btc/wallet.js +11 -11
- package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -1
- package/lib/families/celo/js-getTransactionStatus.js +2 -0
- package/lib/families/celo/js-getTransactionStatus.js.map +1 -1
- package/lib/families/cosmos/js-prepareTransaction.d.ts.map +1 -1
- package/lib/families/cosmos/js-prepareTransaction.js +29 -5
- package/lib/families/cosmos/js-prepareTransaction.js.map +1 -1
- package/lib/families/cosmos/js-signOperation.d.ts.map +1 -1
- package/lib/families/cosmos/js-signOperation.js +76 -39
- package/lib/families/cosmos/js-signOperation.js.map +1 -1
- package/lib/families/cosmos/validators.js +1 -1
- package/lib/families/ethereum/nft.unit.test.js +2 -0
- package/lib/families/ethereum/nft.unit.test.js.map +1 -1
- package/lib/families/ripple/bridge/js.d.ts +2 -1
- package/lib/families/ripple/bridge/js.d.ts.map +1 -1
- package/lib/families/ripple/bridge/js.js +96 -466
- package/lib/families/ripple/bridge/js.js.map +1 -1
- package/lib/families/ripple/bridge.test.js +0 -48
- package/lib/families/ripple/bridge.test.js.map +1 -1
- package/lib/families/ripple/js-synchronization.d.ts +10 -0
- package/lib/families/ripple/js-synchronization.d.ts.map +1 -0
- package/lib/families/ripple/js-synchronization.js +156 -0
- package/lib/families/ripple/js-synchronization.js.map +1 -0
- package/lib/families/ripple/test-dataset.d.ts.map +1 -1
- package/lib/families/ripple/test-dataset.js +1 -1
- package/lib/families/ripple/test-dataset.js.map +1 -1
- package/lib/families/ripple/types.api.d.ts +24 -0
- package/lib/families/ripple/types.api.d.ts.map +1 -0
- package/lib/families/ripple/types.api.js +3 -0
- package/lib/families/ripple/types.api.js.map +1 -0
- package/lib/families/solana/api/chain/instruction/token/types.d.ts +3 -3
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +46 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/types.d.ts +2 -1
- package/lib/featureFlags/types.d.ts.map +1 -1
- package/lib/nft/helpers.d.ts.map +1 -1
- package/lib/nft/helpers.js +3 -1
- package/lib/nft/helpers.js.map +1 -1
- package/lib/platform/providers/GlobalCatalogProvider/api/mock.json +0 -26
- package/lib/platform/providers/RemoteLiveAppProvider/api/mock.json +0 -63
- package/lib/types/nft.d.ts +1 -1
- package/lib/types/nft.d.ts.map +1 -1
- package/lib/walletconnect/index.d.ts.map +1 -1
- package/lib/walletconnect/index.js +7 -6
- package/lib/walletconnect/index.js.map +1 -1
- package/package.json +21 -21
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +5 -5
- package/src/__tests__/families/bitcoin/wallet-btc/xpub.txs.dogecoin.test.ts +96 -0
- package/src/api/Ripple.ts +95 -160
- package/src/api/index.ts +0 -2
- package/src/apps/support.ts +1 -1
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +47 -3
- package/src/env.ts +4 -4
- package/src/errors.ts +4 -0
- package/src/families/bitcoin/getAccountNetworkInfo.ts +4 -2
- package/src/families/bitcoin/js-synchronisation.ts +5 -5
- package/src/families/bitcoin/specs.ts +5 -1
- package/src/families/bitcoin/wallet-btc/explorer/index.ts +2 -2
- package/src/families/bitcoin/wallet-btc/storage/index.ts +5 -5
- package/src/families/bitcoin/wallet-btc/storage/types.ts +2 -2
- package/src/families/bitcoin/wallet-btc/utils.ts +8 -0
- package/src/families/bitcoin/wallet-btc/wallet.ts +24 -12
- package/src/families/celo/js-getTransactionStatus.ts +3 -1
- package/src/families/cosmos/__snapshots__/bridge.test.ts.snap +128 -7
- package/src/families/cosmos/js-prepareTransaction.ts +7 -5
- package/src/families/cosmos/js-signOperation.ts +54 -36
- package/src/families/cosmos/validators.ts +1 -1
- package/src/families/ethereum/nft.unit.test.ts +2 -0
- package/src/families/ripple/bridge/js.ts +89 -494
- package/src/families/ripple/bridge.test.ts +0 -6
- package/src/families/ripple/js-synchronization.ts +153 -0
- package/src/families/ripple/test-dataset.ts +2 -0
- package/src/families/ripple/types.api.ts +23 -0
- package/src/featureFlags/defaultFeatures.ts +47 -0
- package/src/featureFlags/types.ts +7 -1
- package/src/nft/helpers.ts +3 -1
- package/src/platform/providers/GlobalCatalogProvider/api/mock.json +0 -26
- package/src/platform/providers/RemoteLiveAppProvider/api/mock.json +0 -63
- package/src/types/nft.ts +1 -1
- package/src/walletconnect/index.ts +3 -1
|
@@ -1,67 +1,4 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
"id": "Card",
|
|
4
|
-
"name": "Card",
|
|
5
|
-
"url": "https://cl-cards.com/waiting-list/",
|
|
6
|
-
"homepageUrl": "https://baanx.com/",
|
|
7
|
-
"icon": "https://cdn.live.ledger.com/icons/platform/card2.png",
|
|
8
|
-
"platform": "all",
|
|
9
|
-
"apiVersion": "0.0.1",
|
|
10
|
-
"manifestVersion": "1",
|
|
11
|
-
"branch": "stable",
|
|
12
|
-
"categories": [
|
|
13
|
-
"card"
|
|
14
|
-
],
|
|
15
|
-
"currencies": "*",
|
|
16
|
-
"content": {
|
|
17
|
-
"shortDescription": {
|
|
18
|
-
"en": "Coming soon: spend your crypto globally with the crypto debit CL Card, powered by Ledger. Built to be compatible with your Ledger wallet. Join the waitlist"
|
|
19
|
-
},
|
|
20
|
-
"description": {
|
|
21
|
-
"en": "Coming soon: spend your crypto globally with the crypto debit CL Card, powered by Ledger. Built to be compatible with your Ledger wallet. Join the waitlist"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"permissions": [
|
|
25
|
-
{
|
|
26
|
-
"method": "*"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"domains": [
|
|
30
|
-
"https://*"
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"id": "cl-card",
|
|
35
|
-
"name": "Card",
|
|
36
|
-
"url": "https://cl-cards.com/waiting-list/",
|
|
37
|
-
"homepageUrl": "https://baanx.com/",
|
|
38
|
-
"icon": "https://cdn.live.ledger.com/icons/platform/card2.png",
|
|
39
|
-
"platform": "all",
|
|
40
|
-
"apiVersion": "0.0.1",
|
|
41
|
-
"manifestVersion": "1",
|
|
42
|
-
"private": true,
|
|
43
|
-
"branch": "stable",
|
|
44
|
-
"categories": [
|
|
45
|
-
"card"
|
|
46
|
-
],
|
|
47
|
-
"currencies": "*",
|
|
48
|
-
"content": {
|
|
49
|
-
"shortDescription": {
|
|
50
|
-
"en": "Coming soon: spend your crypto globally with the crypto debit CL Card, powered by Ledger. Built to be compatible with your Ledger wallet. Join the waitlist"
|
|
51
|
-
},
|
|
52
|
-
"description": {
|
|
53
|
-
"en": "Coming soon: spend your crypto globally with the crypto debit CL Card, powered by Ledger. Built to be compatible with your Ledger wallet. Join the waitlist"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"permissions": [
|
|
57
|
-
{
|
|
58
|
-
"method": "*"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"domains": [
|
|
62
|
-
"https://*"
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
2
|
{
|
|
66
3
|
"id": "moonpay",
|
|
67
4
|
"name": "MoonPay",
|
package/lib/types/nft.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare type ProtoNFTRaw = Omit<ProtoNFT, "amount"> & {
|
|
|
27
27
|
export declare type NFT = Omit<ProtoNFT, "metadata"> & {
|
|
28
28
|
metadata: NFTMetadata;
|
|
29
29
|
};
|
|
30
|
-
export declare type NFTMetadataLinksProviders = "opensea" | "rarible" | "
|
|
30
|
+
export declare type NFTMetadataLinksProviders = "opensea" | "rarible" | "explorer";
|
|
31
31
|
export declare type NFTMetadataResponse = {
|
|
32
32
|
status: 200 | 404 | 500;
|
|
33
33
|
result?: {
|
package/lib/types/nft.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nft.d.ts","sourceRoot":"","sources":["../../src/types/nft.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAEtC,oBAAY,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhD,oBAAY,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,KAAK,EAAE,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;CAClD,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,oBAAY,QAAQ,GAAG;IAErB,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CA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M,yBAAyB,CAAC;AAC3D,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,oBAAY,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AACF,oBAAY,aAAa,GACrB;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,GAAG,gBAAgB,CAAC;CACtC,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AACN,aAAK,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AACzE,eAAO,MAAM,gBAAgB,EAAE,MAkH9B,CAAC"}
|
|
@@ -50,13 +50,14 @@ var currencies_1 = require("../currencies");
|
|
|
50
50
|
var hw_signMessage_1 = require("../families/ethereum/hw-signMessage");
|
|
51
51
|
var parseCallRequest = function (account, payload) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
52
|
var wcTransactionData, bridge, transaction, message, rawMessage, hashes, _a, to;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
var _b;
|
|
54
|
+
return __generator(this, function (_c) {
|
|
55
|
+
switch (_c.label) {
|
|
55
56
|
case 0:
|
|
56
57
|
_a = payload.method;
|
|
57
58
|
switch (_a) {
|
|
58
59
|
case "eth_sendRawTransaction": return [3 /*break*/, 1];
|
|
59
|
-
case
|
|
60
|
+
case (_b = payload.method.match(/eth_signTypedData(_v.)?$/)) === null || _b === void 0 ? void 0 : _b.input: return [3 /*break*/, 2];
|
|
60
61
|
case "eth_sign": return [3 /*break*/, 3];
|
|
61
62
|
case "personal_sign": return [3 /*break*/, 4];
|
|
62
63
|
case "eth_signTransaction": return [3 /*break*/, 5];
|
|
@@ -75,7 +76,7 @@ var parseCallRequest = function (account, payload) { return __awaiter(void 0, vo
|
|
|
75
76
|
// $FlowFixMe
|
|
76
77
|
messageHash: (0, ethereumjs_util_1.bufferToHex)((0, hw_signMessage_1.messageHash)(message))
|
|
77
78
|
};
|
|
78
|
-
|
|
79
|
+
_c.label = 3;
|
|
79
80
|
case 3:
|
|
80
81
|
message = message || payload.params[1];
|
|
81
82
|
rawMessage = rawMessage || payload.params[1];
|
|
@@ -86,7 +87,7 @@ var parseCallRequest = function (account, payload) { return __awaiter(void 0, vo
|
|
|
86
87
|
.update(Buffer.from(payload.params[1].slice(2), "hex"))
|
|
87
88
|
.digest("hex")
|
|
88
89
|
};
|
|
89
|
-
|
|
90
|
+
_c.label = 4;
|
|
90
91
|
case 4:
|
|
91
92
|
message =
|
|
92
93
|
message || Buffer.from(payload.params[0].slice(2), "hex").toString();
|
|
@@ -151,7 +152,7 @@ var parseCallRequest = function (account, payload) { return __awaiter(void 0, vo
|
|
|
151
152
|
});
|
|
152
153
|
return [4 /*yield*/, bridge.prepareTransaction(account, transaction)];
|
|
153
154
|
case 6:
|
|
154
|
-
transaction =
|
|
155
|
+
transaction = _c.sent();
|
|
155
156
|
return [2 /*return*/, {
|
|
156
157
|
type: "transaction",
|
|
157
158
|
method: payload.method === "eth_signTransaction" ? "sign" : "send",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/walletconnect/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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,CAAC,KAAK,EAAE;oBAC3B,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE;wBAClD,KAAK,EAAE,iBAAiB,CAAC,KAAK;qBAC/B,CAAC,CAAC;iBACJ;gBAED,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE;oBAClD,eAAe,EAAE,IAAI;iBACtB,CAAC,CAAC;gBACW,qBAAM,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAA;;gBAAnE,WAAW,GAAG,SAAqD,CAAC;gBACpE,sBAAO;wBACL,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;wBAClE,IAAI,EAAE,WAAW;qBAClB,EAAC;oBAGF,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;;;KAEtC,CAAC;AAlHW,QAAA,gBAAgB,oBAkH3B"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/LedgerHQ/ledger-live-common"
|
|
10
10
|
},
|
|
11
|
-
"version": "22.0
|
|
11
|
+
"version": "22.1.0",
|
|
12
12
|
"main": "lib/index.js",
|
|
13
13
|
"types": "lib/index.d.ts",
|
|
14
14
|
"license": "Apache-2.0",
|
|
@@ -44,35 +44,35 @@
|
|
|
44
44
|
"@celo/contractkit": "^1.5.2",
|
|
45
45
|
"@celo/wallet-base": "^1.5.2",
|
|
46
46
|
"@celo/wallet-ledger": "^1.5.2",
|
|
47
|
+
"@cosmjs/amino": "^0.28.4",
|
|
47
48
|
"@cosmjs/crypto": "^0.26.5",
|
|
48
|
-
"@cosmjs/ledger-amino": "^0.26.5",
|
|
49
49
|
"@cosmjs/proto-signing": "^0.26.5",
|
|
50
50
|
"@cosmjs/stargate": "^0.26.5",
|
|
51
51
|
"@crypto-com/chain-jslib": "0.0.19",
|
|
52
52
|
"@ethereumjs/common": "^2.6.2",
|
|
53
53
|
"@ethereumjs/tx": "^3.5.0",
|
|
54
54
|
"@ledgerhq/compressjs": "1.3.2",
|
|
55
|
-
"@ledgerhq/cryptoassets": "6.28.
|
|
56
|
-
"@ledgerhq/devices": "6.
|
|
55
|
+
"@ledgerhq/cryptoassets": "6.28.2",
|
|
56
|
+
"@ledgerhq/devices": "6.27.1",
|
|
57
57
|
"@ledgerhq/errors": "6.10.0",
|
|
58
|
-
"@ledgerhq/hw-app-algorand": "6.
|
|
59
|
-
"@ledgerhq/hw-app-btc": "6.
|
|
60
|
-
"@ledgerhq/hw-app-cosmos": "6.
|
|
61
|
-
"@ledgerhq/hw-app-eth": "6.
|
|
62
|
-
"@ledgerhq/hw-app-polkadot": "6.
|
|
63
|
-
"@ledgerhq/hw-app-solana": "^6.27.
|
|
64
|
-
"@ledgerhq/hw-app-str": "6.
|
|
65
|
-
"@ledgerhq/hw-app-tezos": "6.
|
|
66
|
-
"@ledgerhq/hw-app-trx": "6.
|
|
67
|
-
"@ledgerhq/hw-app-xrp": "6.
|
|
68
|
-
"@ledgerhq/hw-transport": "6.
|
|
69
|
-
"@ledgerhq/hw-transport-mocker": "6.
|
|
70
|
-
"@ledgerhq/hw-transport-node-speculos": "6.
|
|
58
|
+
"@ledgerhq/hw-app-algorand": "6.27.1",
|
|
59
|
+
"@ledgerhq/hw-app-btc": "6.27.1",
|
|
60
|
+
"@ledgerhq/hw-app-cosmos": "6.27.1",
|
|
61
|
+
"@ledgerhq/hw-app-eth": "6.28.2",
|
|
62
|
+
"@ledgerhq/hw-app-polkadot": "6.27.1",
|
|
63
|
+
"@ledgerhq/hw-app-solana": "^6.27.1",
|
|
64
|
+
"@ledgerhq/hw-app-str": "6.27.1",
|
|
65
|
+
"@ledgerhq/hw-app-tezos": "6.27.1",
|
|
66
|
+
"@ledgerhq/hw-app-trx": "6.27.1",
|
|
67
|
+
"@ledgerhq/hw-app-xrp": "6.27.1",
|
|
68
|
+
"@ledgerhq/hw-transport": "6.27.1",
|
|
69
|
+
"@ledgerhq/hw-transport-mocker": "6.27.1",
|
|
70
|
+
"@ledgerhq/hw-transport-node-speculos": "6.27.1",
|
|
71
71
|
"@ledgerhq/json-bignumber": "^1.1.0",
|
|
72
|
-
"@ledgerhq/live-app-sdk": "^0.
|
|
72
|
+
"@ledgerhq/live-app-sdk": "^0.6.1",
|
|
73
73
|
"@ledgerhq/logs": "6.10.0",
|
|
74
|
-
"@polkadot/types": "
|
|
75
|
-
"@polkadot/types-known": "
|
|
74
|
+
"@polkadot/types": "8.1.1",
|
|
75
|
+
"@polkadot/types-known": "8.1.1",
|
|
76
76
|
"@solana/spl-token": "^0.1.8",
|
|
77
77
|
"@solana/web3.js": "^1.32.0",
|
|
78
78
|
"@taquito/ledger-signer": "stablelib",
|
|
@@ -123,7 +123,6 @@
|
|
|
123
123
|
"ripemd160": "^2.0.2",
|
|
124
124
|
"ripple-binary-codec": "^1.3.0",
|
|
125
125
|
"ripple-bs58check": "^2.0.2",
|
|
126
|
-
"ripple-lib": "1.10.0",
|
|
127
126
|
"rlp": "^3.0.0",
|
|
128
127
|
"rxjs": "6",
|
|
129
128
|
"rxjs-compat": "^6.6.7",
|
|
@@ -133,6 +132,7 @@
|
|
|
133
132
|
"stellar-sdk": "^10.0.1",
|
|
134
133
|
"superstruct": "^0.14.2",
|
|
135
134
|
"triple-beam": "^1.3.0",
|
|
135
|
+
"varuint-bitcoin": "1.1.2",
|
|
136
136
|
"winston": "^3.4.0",
|
|
137
137
|
"xstate": "^4.28.1"
|
|
138
138
|
},
|
package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts
CHANGED
|
@@ -60,7 +60,7 @@ describe("testing xpub legacy transactions", () => {
|
|
|
60
60
|
// Initialize the xpub with 2 txs. So that it has 2 utxo
|
|
61
61
|
dataset.xpub.storage.appendTxs([
|
|
62
62
|
{
|
|
63
|
-
|
|
63
|
+
id: "9e1b337875c21f751e70ee2c2c6ee93d8a6733d0f3ba6d139ae6a0479ebcefb0",
|
|
64
64
|
inputs: [],
|
|
65
65
|
outputs: [
|
|
66
66
|
{
|
|
@@ -93,7 +93,7 @@ describe("testing xpub legacy transactions", () => {
|
|
|
93
93
|
received_at: "2021-07-28T13:34:17Z",
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
|
|
96
|
+
id: "0b9f98d07eb418fa20573112d3cba6b871d429a06c724a7888ff0886be5213d1",
|
|
97
97
|
inputs: [
|
|
98
98
|
{
|
|
99
99
|
output_hash:
|
|
@@ -188,7 +188,7 @@ describe("testing xpub legacy transactions", () => {
|
|
|
188
188
|
// Add 3 txs for the xpub. So that it has 5 utxo
|
|
189
189
|
dataset.xpub.storage.appendTxs([
|
|
190
190
|
{
|
|
191
|
-
|
|
191
|
+
id: "8f30fe84da5a5846d668b4bad260730f2b0125fa66fb2633fa1cee23c6b11053",
|
|
192
192
|
inputs: [
|
|
193
193
|
{
|
|
194
194
|
output_hash:
|
|
@@ -230,7 +230,7 @@ describe("testing xpub legacy transactions", () => {
|
|
|
230
230
|
received_at: "2021-07-28T14:46:51Z",
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
|
-
|
|
233
|
+
id: "2f90f3312ffd4dce490cb2f7429c586a43ef68c99fc2f8e549127b72af7b4209",
|
|
234
234
|
inputs: [
|
|
235
235
|
{
|
|
236
236
|
output_hash:
|
|
@@ -272,7 +272,7 @@ describe("testing xpub legacy transactions", () => {
|
|
|
272
272
|
received_at: "2021-07-28T14:46:51Z",
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
|
-
|
|
275
|
+
id: "2fee0c4b55e08583aa5bc565d7e428f7cdcbd2b73262f62208a6a72a74e2c945",
|
|
276
276
|
inputs: [
|
|
277
277
|
{
|
|
278
278
|
output_hash:
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import coininfo from "coininfo";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import { DerivationModes } from "../../../../families/bitcoin/wallet-btc/types";
|
|
4
|
+
import Xpub from "../../../../families/bitcoin/wallet-btc/xpub";
|
|
5
|
+
import Doge from "../../../../families/bitcoin/wallet-btc/crypto/doge";
|
|
6
|
+
import BitcoinLikeExplorer from "../../../../families/bitcoin/wallet-btc/explorer";
|
|
7
|
+
import BitcoinLikeStorage from "../../../../families/bitcoin/wallet-btc/storage";
|
|
8
|
+
import { Merge } from "../../../../families/bitcoin/wallet-btc/pickingstrategies/Merge";
|
|
9
|
+
import BitcoinLikeWallet from "../../../../families/bitcoin/wallet-btc/wallet";
|
|
10
|
+
import MockBtc from "../../../../mock/Btc";
|
|
11
|
+
|
|
12
|
+
describe("testing dogecoin transactions", () => {
|
|
13
|
+
const wallet = new BitcoinLikeWallet();
|
|
14
|
+
const explorer = new BitcoinLikeExplorer({
|
|
15
|
+
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/doge",
|
|
16
|
+
explorerVersion: "v3",
|
|
17
|
+
disableBatchSize: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const network = coininfo.dogecoin.main.toBitcoinJS();
|
|
21
|
+
const crypto = new Doge({ network });
|
|
22
|
+
|
|
23
|
+
const storage = new BitcoinLikeStorage();
|
|
24
|
+
const xpub = new Xpub({
|
|
25
|
+
storage,
|
|
26
|
+
explorer,
|
|
27
|
+
crypto,
|
|
28
|
+
xpub: "dgub8rBf7BYsf5YoMezYuPaEhc2tsr7sQA2v2xNCj4mt1czF1m4hRiBdjYeAq5xDVQhN5HqYQnxv2DwyfmDvp1QEfmi44b8uynPL45KXQJrsoi8",
|
|
29
|
+
derivationMode: DerivationModes.LEGACY,
|
|
30
|
+
});
|
|
31
|
+
it("testing dogecoin transactions with huge amount", async () => {
|
|
32
|
+
const utxoPickingStrategy = new Merge(xpub.crypto, xpub.derivationMode, []);
|
|
33
|
+
const changeAddress = await xpub.getNewAddress(1, 0);
|
|
34
|
+
xpub.storage.appendTxs([
|
|
35
|
+
{
|
|
36
|
+
id: "c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147",
|
|
37
|
+
inputs: [],
|
|
38
|
+
outputs: [
|
|
39
|
+
{
|
|
40
|
+
output_index: 0,
|
|
41
|
+
value: "500000000000000000", // huge utxo
|
|
42
|
+
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
43
|
+
output_hash:
|
|
44
|
+
"c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147",
|
|
45
|
+
block_height: 1,
|
|
46
|
+
rbf: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
output_index: 1,
|
|
50
|
+
value: "0",
|
|
51
|
+
address: "<unknown>",
|
|
52
|
+
output_hash:
|
|
53
|
+
"c4ee70c30b9c5c5fed60c37ce86046156af3623f32aa5be94556b35dcf0af147",
|
|
54
|
+
block_height: 1,
|
|
55
|
+
rbf: false,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
block: {
|
|
59
|
+
hash: "73c565a6f226978df23480e440b27eb02f307855f50aa3bc72ebb586938f23e0",
|
|
60
|
+
height: 1,
|
|
61
|
+
time: "2021-07-28T13:34:17Z",
|
|
62
|
+
},
|
|
63
|
+
account: 0,
|
|
64
|
+
index: 0,
|
|
65
|
+
address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
|
|
66
|
+
received_at: "2021-07-28T13:34:17Z",
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
const txInfo = await xpub.buildTx({
|
|
71
|
+
destAddress: "D9fSjc6zAyjdRgSfbfMLv5z5FpuacvguUi",
|
|
72
|
+
amount: new BigNumber(200000000000000000),
|
|
73
|
+
feePerByte: 100,
|
|
74
|
+
changeAddress,
|
|
75
|
+
utxoPickingStrategy,
|
|
76
|
+
sequence: 0,
|
|
77
|
+
});
|
|
78
|
+
const account = await wallet.generateAccount({
|
|
79
|
+
xpub: xpub.xpub,
|
|
80
|
+
path: "44'/0'",
|
|
81
|
+
index: 0,
|
|
82
|
+
currency: "dogecoin",
|
|
83
|
+
network: "mainnet",
|
|
84
|
+
derivationMode: DerivationModes.LEGACY,
|
|
85
|
+
explorer: "ledgerv3",
|
|
86
|
+
explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/doge",
|
|
87
|
+
storage: "mock",
|
|
88
|
+
storageParams: [],
|
|
89
|
+
});
|
|
90
|
+
await wallet.signAccountTx({
|
|
91
|
+
btc: new MockBtc(),
|
|
92
|
+
fromAccount: account,
|
|
93
|
+
txInfo,
|
|
94
|
+
});
|
|
95
|
+
}, 100000);
|
|
96
|
+
});
|
package/src/api/Ripple.ts
CHANGED
|
@@ -1,185 +1,120 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
|
-
import {
|
|
3
|
-
parseCurrencyUnit,
|
|
4
|
-
getCryptoCurrencyById,
|
|
5
|
-
formatCurrencyUnit,
|
|
6
|
-
} from "../currencies";
|
|
7
2
|
import { getEnv } from "../env";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { TransactionsOptions } from "ripple-lib/dist/npm/ledger/transactions";
|
|
3
|
+
import network from "../network";
|
|
4
|
+
import { parseCurrencyUnit, getCryptoCurrencyById } from "../currencies";
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type XRPInstruction = {
|
|
15
|
-
fee: string;
|
|
16
|
-
maxLedgerVersionOffset: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const rippleUnit = getCryptoCurrencyById("ripple").units[0];
|
|
20
|
-
|
|
21
|
-
const defaultEndpoint = () => getEnv("API_RIPPLE_WS");
|
|
6
|
+
const defaultEndpoint = () => getEnv("API_RIPPLE_RPC");
|
|
22
7
|
|
|
23
8
|
export const connectionTimeout = 30 * 1000; // default connectionTimeout is 2s and make the specs bot failed
|
|
24
9
|
|
|
25
|
-
const
|
|
26
|
-
let api;
|
|
27
|
-
let pendingQueries: Promise<any>[] = [];
|
|
28
|
-
let apiDisconnectTimeout;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Connects to Substrate Node, executes calls then disconnects
|
|
32
|
-
*
|
|
33
|
-
* @param {*} execute - the calls to execute on api
|
|
34
|
-
*/
|
|
35
|
-
async function withApi(
|
|
36
|
-
execute: AsyncApiFunction,
|
|
37
|
-
endpointConfig: string | null | undefined = null
|
|
38
|
-
): Promise<any> {
|
|
39
|
-
const server = endpointConfig || defaultEndpoint();
|
|
40
|
-
|
|
41
|
-
// If client is instanciated already, ensure it is connected & ready
|
|
42
|
-
if (api) {
|
|
43
|
-
try {
|
|
44
|
-
if (!(await api.isConnected)) {
|
|
45
|
-
throw new Error("XRP WS is not connected");
|
|
46
|
-
}
|
|
47
|
-
} catch (err) {
|
|
48
|
-
// definitely not connected...
|
|
49
|
-
api = null;
|
|
50
|
-
pendingQueries = [];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (!api) {
|
|
55
|
-
api = new RippleAPI({
|
|
56
|
-
server,
|
|
57
|
-
});
|
|
58
|
-
// https://github.com/ripple/ripple-lib/issues/1196#issuecomment-583156895
|
|
59
|
-
// We can't add connectionTimeout to the constructor
|
|
60
|
-
// We need to add this config to allow the bot to not timeout on github action
|
|
61
|
-
// but it will throw a 'additionalProperty "connectionTimeout" exists'
|
|
62
|
-
// during the preparePayment
|
|
63
|
-
api.connection._config.connectionTimeout = connectionTimeout;
|
|
64
|
-
api.on("error", (errorCode, errorMessage) => {
|
|
65
|
-
console.warn(`Ripple API error: ${errorCode}: ${errorMessage}`);
|
|
66
|
-
});
|
|
67
|
-
await api.connect();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
cancelDebouncedDisconnect();
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
const query = execute(api);
|
|
74
|
-
pendingQueries.push(query.catch((err) => err));
|
|
75
|
-
const res = await query;
|
|
76
|
-
return res;
|
|
77
|
-
} finally {
|
|
78
|
-
debouncedDisconnect();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Disconnects Websocket API client after all pending queries are flushed.
|
|
84
|
-
*/
|
|
85
|
-
export const disconnect = async (): Promise<void> => {
|
|
86
|
-
cancelDebouncedDisconnect();
|
|
87
|
-
|
|
88
|
-
if (api) {
|
|
89
|
-
const disconnecting = api;
|
|
90
|
-
const pending = pendingQueries;
|
|
91
|
-
api = undefined;
|
|
92
|
-
pendingQueries = [];
|
|
93
|
-
await Promise.all(pending);
|
|
94
|
-
await disconnecting.disconnect();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const cancelDebouncedDisconnect = () => {
|
|
99
|
-
if (apiDisconnectTimeout) {
|
|
100
|
-
clearTimeout(apiDisconnectTimeout);
|
|
101
|
-
apiDisconnectTimeout = null;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Disconnects Websocket client after a delay.
|
|
107
|
-
*/
|
|
108
|
-
const debouncedDisconnect = () => {
|
|
109
|
-
cancelDebouncedDisconnect();
|
|
110
|
-
apiDisconnectTimeout = setTimeout(disconnect, WEBSOCKET_DEBOUNCE_DELAY);
|
|
111
|
-
};
|
|
10
|
+
const rippleUnit = getCryptoCurrencyById("ripple").units[0];
|
|
112
11
|
|
|
113
12
|
export const parseAPIValue = (value: string): BigNumber =>
|
|
114
13
|
parseCurrencyUnit(rippleUnit, value);
|
|
115
14
|
|
|
116
|
-
export const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
15
|
+
export const submit = async (signature: string): Promise<any> => {
|
|
16
|
+
const res = await network({
|
|
17
|
+
method: "POST",
|
|
18
|
+
url: `${defaultEndpoint()}`,
|
|
19
|
+
data: {
|
|
20
|
+
method: "submit",
|
|
21
|
+
params: [
|
|
22
|
+
{
|
|
23
|
+
tx_blob: signature,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return res.data.result;
|
|
129
29
|
};
|
|
130
30
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
31
|
+
type AccountInfo = {
|
|
32
|
+
account_data: {
|
|
33
|
+
Account: string;
|
|
34
|
+
Balance: string;
|
|
35
|
+
Flags: number;
|
|
36
|
+
LedgerEntryType: string;
|
|
37
|
+
OwnerCount: number;
|
|
38
|
+
PreviousTxnID: string;
|
|
39
|
+
PreviousTxnLgrSeq: number;
|
|
40
|
+
Sequence: number;
|
|
41
|
+
index: string;
|
|
142
42
|
};
|
|
43
|
+
error: string;
|
|
143
44
|
};
|
|
144
45
|
|
|
145
|
-
export const preparePayment = async (
|
|
146
|
-
address: string,
|
|
147
|
-
payment: Payment,
|
|
148
|
-
instruction: XRPInstruction
|
|
149
|
-
): Promise<any> =>
|
|
150
|
-
withApi(async (api: RippleAPI) => {
|
|
151
|
-
return api.preparePayment(address, payment, instruction);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
export const submit = async (signature: string): Promise<any> =>
|
|
155
|
-
withApi(async (api: RippleAPI) => {
|
|
156
|
-
return api.request("submit", {
|
|
157
|
-
tx_blob: signature,
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
// endpointConfig does not seem to be undestood by linter
|
|
161
|
-
|
|
162
46
|
export const getAccountInfo = async (
|
|
163
47
|
recipient: string,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
48
|
+
current?: boolean
|
|
49
|
+
): Promise<AccountInfo> => {
|
|
50
|
+
const res = await network({
|
|
51
|
+
method: "POST",
|
|
52
|
+
url: `${defaultEndpoint()}`,
|
|
53
|
+
data: {
|
|
54
|
+
method: "account_info",
|
|
55
|
+
params: [
|
|
56
|
+
{
|
|
57
|
+
account: recipient,
|
|
58
|
+
ledger_index: current ? "current" : "validated",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
169
62
|
});
|
|
63
|
+
return res.data.result;
|
|
64
|
+
};
|
|
65
|
+
|
|
170
66
|
export const getServerInfo = async (
|
|
171
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
172
67
|
endpointConfig?: string | null | undefined
|
|
173
|
-
): Promise<any> =>
|
|
174
|
-
|
|
175
|
-
|
|
68
|
+
): Promise<any> => {
|
|
69
|
+
const res = await network({
|
|
70
|
+
method: "POST",
|
|
71
|
+
url: endpointConfig ?? `${defaultEndpoint()}`,
|
|
72
|
+
data: {
|
|
73
|
+
method: "server_info",
|
|
74
|
+
params: [
|
|
75
|
+
{
|
|
76
|
+
ledger_index: "validated",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
176
80
|
});
|
|
177
81
|
|
|
178
|
-
|
|
82
|
+
return res.data.result;
|
|
83
|
+
};
|
|
84
|
+
|
|
179
85
|
export const getTransactions = async (
|
|
180
86
|
address: string,
|
|
181
|
-
options:
|
|
182
|
-
): Promise<any> =>
|
|
183
|
-
|
|
184
|
-
|
|
87
|
+
options: any | undefined
|
|
88
|
+
): Promise<any> => {
|
|
89
|
+
const res = await network({
|
|
90
|
+
method: "POST",
|
|
91
|
+
url: `${defaultEndpoint()}`,
|
|
92
|
+
data: {
|
|
93
|
+
method: "account_tx",
|
|
94
|
+
params: [
|
|
95
|
+
{
|
|
96
|
+
account: address,
|
|
97
|
+
ledger_index: "validated",
|
|
98
|
+
...options,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
185
102
|
});
|
|
103
|
+
return res.data.result.transactions;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default async function getLedgerIndex(): Promise<number> {
|
|
107
|
+
const ledgerResponse = await network({
|
|
108
|
+
method: "POST",
|
|
109
|
+
url: `${defaultEndpoint()}`,
|
|
110
|
+
data: {
|
|
111
|
+
method: "ledger",
|
|
112
|
+
params: [
|
|
113
|
+
{
|
|
114
|
+
ledger_index: "validated",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
return ledgerResponse.data.result.ledger_index;
|
|
120
|
+
}
|