@ledgerhq/coin-cardano 0.4.2 → 0.4.3
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +14 -0
- package/lib/account.js +5 -6
- package/lib/account.js.map +1 -1
- package/lib/api/getDelegationInfo.js +18 -32
- package/lib/api/getDelegationInfo.js.map +1 -1
- package/lib/api/getNetworkInfo.js +7 -18
- package/lib/api/getNetworkInfo.js.map +1 -1
- package/lib/api/getPools.js +16 -29
- package/lib/api/getPools.js.map +1 -1
- package/lib/api/getTransactions.js +101 -116
- package/lib/api/getTransactions.js.map +1 -1
- package/lib/api/submitTransaction.js +10 -21
- package/lib/api/submitTransaction.js.map +1 -1
- package/lib/bridge/index.js +1 -10
- package/lib/bridge/index.js.map +1 -1
- package/lib/broadcast.js +3 -12
- package/lib/broadcast.js.map +1 -1
- package/lib/buildOptimisticOperation.js +1 -2
- package/lib/buildOptimisticOperation.js.map +1 -1
- package/lib/buildSubAccounts.js +2 -3
- package/lib/buildSubAccounts.js.map +1 -1
- package/lib/buildTransaction.js +10 -19
- package/lib/buildTransaction.js.map +1 -1
- package/lib/cli-transaction.js +6 -1
- package/lib/cli-transaction.js.map +1 -1
- package/lib/estimateMaxSpendable.js +11 -15
- package/lib/estimateMaxSpendable.js.map +1 -1
- package/lib/getTransactionStatus.js +148 -165
- package/lib/getTransactionStatus.js.map +1 -1
- package/lib/getTransactionStatus.unit.test.js +5 -14
- package/lib/getTransactionStatus.unit.test.js.map +1 -1
- package/lib/hw-getAddress.js +3 -12
- package/lib/hw-getAddress.js.map +1 -1
- package/lib/logic.js +3 -5
- package/lib/logic.js.map +1 -1
- package/lib/prepareTransaction.js +4 -13
- package/lib/prepareTransaction.js.map +1 -1
- package/lib/signOperation.js +25 -36
- package/lib/signOperation.js.map +1 -1
- package/lib/specs.js +9 -16
- package/lib/specs.js.map +1 -1
- package/lib/synchronisation.js +13 -23
- package/lib/synchronisation.js.map +1 -1
- package/lib/synchronisation.unit.test.js +9 -18
- package/lib/synchronisation.unit.test.js.map +1 -1
- package/lib/transaction.js +18 -3
- package/lib/transaction.js.map +1 -1
- package/lib/typhonSerializer.js +2 -3
- package/lib/typhonSerializer.js.map +1 -1
- package/lib-es/account.js +5 -6
- package/lib-es/account.js.map +1 -1
- package/lib-es/api/getDelegationInfo.js +18 -32
- package/lib-es/api/getDelegationInfo.js.map +1 -1
- package/lib-es/api/getNetworkInfo.js +7 -18
- package/lib-es/api/getNetworkInfo.js.map +1 -1
- package/lib-es/api/getPools.js +16 -29
- package/lib-es/api/getPools.js.map +1 -1
- package/lib-es/api/getTransactions.js +101 -116
- package/lib-es/api/getTransactions.js.map +1 -1
- package/lib-es/api/submitTransaction.js +10 -21
- package/lib-es/api/submitTransaction.js.map +1 -1
- package/lib-es/bridge/index.js +1 -10
- package/lib-es/bridge/index.js.map +1 -1
- package/lib-es/broadcast.js +3 -12
- package/lib-es/broadcast.js.map +1 -1
- package/lib-es/buildOptimisticOperation.js +1 -2
- package/lib-es/buildOptimisticOperation.js.map +1 -1
- package/lib-es/buildSubAccounts.js +2 -3
- package/lib-es/buildSubAccounts.js.map +1 -1
- package/lib-es/buildTransaction.js +10 -19
- package/lib-es/buildTransaction.js.map +1 -1
- package/lib-es/cli-transaction.js +6 -1
- package/lib-es/cli-transaction.js.map +1 -1
- package/lib-es/estimateMaxSpendable.js +11 -15
- package/lib-es/estimateMaxSpendable.js.map +1 -1
- package/lib-es/getTransactionStatus.js +148 -165
- package/lib-es/getTransactionStatus.js.map +1 -1
- package/lib-es/getTransactionStatus.unit.test.js +5 -14
- package/lib-es/getTransactionStatus.unit.test.js.map +1 -1
- package/lib-es/hw-getAddress.js +3 -12
- package/lib-es/hw-getAddress.js.map +1 -1
- package/lib-es/logic.js +3 -5
- package/lib-es/logic.js.map +1 -1
- package/lib-es/prepareTransaction.js +4 -13
- package/lib-es/prepareTransaction.js.map +1 -1
- package/lib-es/signOperation.js +25 -36
- package/lib-es/signOperation.js.map +1 -1
- package/lib-es/specs.js +9 -16
- package/lib-es/specs.js.map +1 -1
- package/lib-es/synchronisation.js +13 -23
- package/lib-es/synchronisation.js.map +1 -1
- package/lib-es/synchronisation.unit.test.js +9 -18
- package/lib-es/synchronisation.unit.test.js.map +1 -1
- package/lib-es/transaction.js +18 -3
- package/lib-es/transaction.js.map +1 -1
- package/lib-es/typhonSerializer.js +2 -3
- package/lib-es/typhonSerializer.js.map +1 -1
- package/package.json +4 -4
- package/tsconfig.json +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @ledgerhq/coin-cardano@0.4.
|
|
3
|
-
> tsc && tsc -m
|
|
2
|
+
> @ledgerhq/coin-cardano@0.4.3 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-cardano
|
|
3
|
+
> tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ledgerhq/coin-cardano
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`5e18866`](https://github.com/LedgerHQ/ledger-live/commit/5e18866320b843632699659ee66f6c410c108c1e)]:
|
|
8
|
+
- @ledgerhq/coin-framework@1.0.0
|
|
9
|
+
|
|
10
|
+
## 0.4.3-next.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`5e18866`](https://github.com/LedgerHQ/ledger-live/commit/5e18866320b843632699659ee66f6c410c108c1e)]:
|
|
15
|
+
- @ledgerhq/coin-framework@1.0.0-next.0
|
|
16
|
+
|
|
3
17
|
## 0.4.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/lib/account.js
CHANGED
|
@@ -8,7 +8,6 @@ const invariant_1 = __importDefault(require("invariant"));
|
|
|
8
8
|
const index_1 = require("@ledgerhq/coin-framework/account/index");
|
|
9
9
|
const index_2 = require("@ledgerhq/coin-framework/currencies/index");
|
|
10
10
|
function formatAccountSpecifics(account) {
|
|
11
|
-
var _a, _b, _c, _d, _e;
|
|
12
11
|
const { cardanoResources } = account;
|
|
13
12
|
(0, invariant_1.default)(cardanoResources, "cardano account expected");
|
|
14
13
|
const unit = (0, index_1.getAccountCurrency)(account).units[0];
|
|
@@ -18,16 +17,16 @@ function formatAccountSpecifics(account) {
|
|
|
18
17
|
showCode: true,
|
|
19
18
|
};
|
|
20
19
|
let str = " ";
|
|
21
|
-
if (
|
|
20
|
+
if (cardanoResources?.delegation?.poolId) {
|
|
22
21
|
str += (0, index_2.formatCurrencyUnit)(unit, account.balance, formatConfig) + " delegated to ";
|
|
23
22
|
}
|
|
24
|
-
if (
|
|
23
|
+
if (cardanoResources.delegation?.name)
|
|
25
24
|
str += cardanoResources.delegation.name + " ";
|
|
26
|
-
if (
|
|
25
|
+
if (cardanoResources.delegation?.ticker)
|
|
27
26
|
str += "(" + cardanoResources.delegation.ticker + ") ";
|
|
28
|
-
if (
|
|
27
|
+
if (cardanoResources.delegation?.poolId)
|
|
29
28
|
str += cardanoResources.delegation.poolId + ". ";
|
|
30
|
-
if (
|
|
29
|
+
if (cardanoResources.delegation?.rewards)
|
|
31
30
|
str +=
|
|
32
31
|
"Total " +
|
|
33
32
|
(0, index_2.formatCurrencyUnit)(unit, cardanoResources.delegation.rewards, formatConfig) +
|
package/lib/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,kEAA4E;AAC5E,qEAA+E;AAG/E,SAAgB,sBAAsB,CAAC,OAAuB
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;;;;AAAA,0DA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 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -17,31 +8,26 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
17
8
|
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
18
9
|
const constants_1 = require("../constants");
|
|
19
10
|
const logic_1 = require("../logic");
|
|
20
|
-
function fetchDelegationInfo(currency, stakeKey) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
return res && res.data && res.data.delegation;
|
|
11
|
+
async function fetchDelegationInfo(currency, stakeKey) {
|
|
12
|
+
const res = await (0, network_1.default)({
|
|
13
|
+
method: "GET",
|
|
14
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
15
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/delegation`
|
|
16
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/delegation`,
|
|
17
|
+
params: {
|
|
18
|
+
stakeKey,
|
|
19
|
+
},
|
|
32
20
|
});
|
|
21
|
+
return res && res.data && res.data.delegation;
|
|
33
22
|
}
|
|
34
|
-
function getDelegationInfo(currency, stakeKey) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
name: (_c = res.poolInfo) === null || _c === void 0 ? void 0 : _c.name,
|
|
43
|
-
rewards: new bignumber_js_1.default(res.rewardsAvailable),
|
|
44
|
-
});
|
|
23
|
+
async function getDelegationInfo(currency, stakeKey) {
|
|
24
|
+
const res = await fetchDelegationInfo(currency, stakeKey);
|
|
25
|
+
return (res && {
|
|
26
|
+
status: res.status,
|
|
27
|
+
poolId: res.poolInfo?.poolId,
|
|
28
|
+
ticker: res.poolInfo?.ticker,
|
|
29
|
+
name: res.poolInfo?.name,
|
|
30
|
+
rewards: new bignumber_js_1.default(res.rewardsAvailable),
|
|
45
31
|
});
|
|
46
32
|
}
|
|
47
33
|
exports.getDelegationInfo = getDelegationInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDelegationInfo.js","sourceRoot":"","sources":["../../src/api/getDelegationInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDelegationInfo.js","sourceRoot":"","sources":["../../src/api/getDelegationInfo.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AACrC,6EAAqD;AACrD,4CAAkF;AAClF,oCAAqC;AAIrC,KAAK,UAAU,mBAAmB,CAChC,QAAwB,EACxB,QAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC;QACxB,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;YACtB,CAAC,CAAC,GAAG,wCAA4B,gBAAgB;YACjD,CAAC,CAAC,GAAG,gCAAoB,gBAAgB;QAC3C,MAAM,EAAE;YACN,QAAQ;SACT;KACF,CAAC,CAAC;IACH,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,IAAK,GAAG,CAAC,IAAI,CAAC,UAA4B,CAAC;AACnE,CAAC;AAEM,KAAK,UAAU,iBAAiB,CACrC,QAAwB,EACxB,QAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1D,OAAO,CACL,GAAG,IAAI;QACL,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM;QAC5B,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM;QAC5B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC;KAC7C,CACF,CAAC;AACJ,CAAC;AAdD,8CAcC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -16,16 +7,14 @@ exports.fetchNetworkInfo = void 0;
|
|
|
16
7
|
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
17
8
|
const constants_1 = require("../constants");
|
|
18
9
|
const logic_1 = require("../logic");
|
|
19
|
-
function fetchNetworkInfo(currency) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
: `${constants_1.CARDANO_API_ENDPOINT}/v1/network/info`,
|
|
26
|
-
});
|
|
27
|
-
return res && res.data;
|
|
10
|
+
async function fetchNetworkInfo(currency) {
|
|
11
|
+
const res = await (0, network_1.default)({
|
|
12
|
+
method: "GET",
|
|
13
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
14
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/network/info`
|
|
15
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/network/info`,
|
|
28
16
|
});
|
|
17
|
+
return res && res.data;
|
|
29
18
|
}
|
|
30
19
|
exports.fetchNetworkInfo = fetchNetworkInfo;
|
|
31
20
|
//# sourceMappingURL=getNetworkInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNetworkInfo.js","sourceRoot":"","sources":["../../src/api/getNetworkInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getNetworkInfo.js","sourceRoot":"","sources":["../../src/api/getNetworkInfo.ts"],"names":[],"mappings":";;;;;;AAAA,6EAAqD;AAErD,4CAAkF;AAClF,oCAAqC;AAG9B,KAAK,UAAU,gBAAgB,CAAC,QAAwB;IAC7D,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC;QACxB,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;YACtB,CAAC,CAAC,GAAG,wCAA4B,kBAAkB;YACnD,CAAC,CAAC,GAAG,gCAAoB,kBAAkB;KAC9C,CAAC,CAAC;IACH,OAAO,GAAG,IAAK,GAAG,CAAC,IAAuB,CAAC;AAC7C,CAAC;AARD,4CAQC"}
|
package/lib/api/getPools.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -16,30 +7,26 @@ exports.fetchPoolDetails = exports.fetchPoolList = void 0;
|
|
|
16
7
|
const logic_1 = require("../logic");
|
|
17
8
|
const constants_1 = require("../constants");
|
|
18
9
|
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
19
|
-
function fetchPoolList(currency, search, pageNo, limit) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
params: { search, pageNo, limit },
|
|
27
|
-
});
|
|
28
|
-
return res && res.data;
|
|
10
|
+
async function fetchPoolList(currency, search, pageNo, limit) {
|
|
11
|
+
const res = await (0, network_1.default)({
|
|
12
|
+
method: "GET",
|
|
13
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
14
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/pool/list`
|
|
15
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/pool/list`,
|
|
16
|
+
params: { search, pageNo, limit },
|
|
29
17
|
});
|
|
18
|
+
return res && res.data;
|
|
30
19
|
}
|
|
31
20
|
exports.fetchPoolList = fetchPoolList;
|
|
32
|
-
function fetchPoolDetails(currency, poolIds) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
params: { poolIds },
|
|
40
|
-
});
|
|
41
|
-
return data;
|
|
21
|
+
async function fetchPoolDetails(currency, poolIds) {
|
|
22
|
+
const { data } = await (0, network_1.default)({
|
|
23
|
+
method: "GET",
|
|
24
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
25
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/pool/detail`
|
|
26
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/pool/detail`,
|
|
27
|
+
params: { poolIds },
|
|
42
28
|
});
|
|
29
|
+
return data;
|
|
43
30
|
}
|
|
44
31
|
exports.fetchPoolDetails = fetchPoolDetails;
|
|
45
32
|
//# sourceMappingURL=getPools.js.map
|
package/lib/api/getPools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPools.js","sourceRoot":"","sources":["../../src/api/getPools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPools.js","sourceRoot":"","sources":["../../src/api/getPools.ts"],"names":[],"mappings":";;;;;;AACA,oCAAqC;AACrC,4CAAkF;AAElF,6EAAqD;AAE9C,KAAK,UAAU,aAAa,CACjC,QAAwB,EACxB,MAAc,EACd,MAAc,EACd,KAAa;IAEb,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC;QACxB,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;YACtB,CAAC,CAAC,GAAG,wCAA4B,eAAe;YAChD,CAAC,CAAC,GAAG,gCAAoB,eAAe;QAC1C,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE;KAClC,CAAC,CAAC;IACH,OAAO,GAAG,IAAK,GAAG,CAAC,IAAuB,CAAC;AAC7C,CAAC;AAdD,sCAcC;AAEM,KAAK,UAAU,gBAAgB,CACpC,QAAwB,EACxB,OAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAoB;QAChD,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;YACtB,CAAC,CAAC,GAAG,wCAA4B,iBAAiB;YAClD,CAAC,CAAC,GAAG,gCAAoB,iBAAiB;QAC5C,MAAM,EAAE,EAAE,OAAO,EAAE;KACpB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAZD,4CAYC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -20,120 +11,114 @@ const live_env_1 = require("@ledgerhq/live-env");
|
|
|
20
11
|
const constants_1 = require("../constants");
|
|
21
12
|
const logic_1 = require("../logic");
|
|
22
13
|
const types_1 = require("../types");
|
|
23
|
-
function fetchTransactions(paymentKeys, pageNo, blockHeight, currency) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
return res.data;
|
|
14
|
+
async function fetchTransactions(paymentKeys, pageNo, blockHeight, currency) {
|
|
15
|
+
const res = await (0, network_1.default)({
|
|
16
|
+
method: "POST",
|
|
17
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
18
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/transaction`
|
|
19
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/transaction`,
|
|
20
|
+
data: {
|
|
21
|
+
paymentKeys,
|
|
22
|
+
pageNo,
|
|
23
|
+
blockHeight,
|
|
24
|
+
},
|
|
37
25
|
});
|
|
26
|
+
return res.data;
|
|
38
27
|
}
|
|
39
|
-
function getAllTransactionsByKeys(paymentKeys, blockHeight, currency) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
56
|
-
});
|
|
28
|
+
async function getAllTransactionsByKeys(paymentKeys, blockHeight, currency) {
|
|
29
|
+
const transactions = [];
|
|
30
|
+
let latestBlockHeight = 0;
|
|
31
|
+
let isAllTrxFetched = false;
|
|
32
|
+
let pageNo = 1;
|
|
33
|
+
while (!isAllTrxFetched) {
|
|
34
|
+
const res = await fetchTransactions(paymentKeys, pageNo, blockHeight, currency);
|
|
35
|
+
transactions.push(...res.transactions);
|
|
36
|
+
latestBlockHeight = Math.max(res.blockHeight, latestBlockHeight);
|
|
37
|
+
isAllTrxFetched = res.transactions.length < res.limit;
|
|
38
|
+
pageNo += 1;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
transactions,
|
|
42
|
+
blockHeight: latestBlockHeight,
|
|
43
|
+
};
|
|
57
44
|
}
|
|
58
|
-
function getSyncedTransactionsByChain(accountPubKey, accountIndex, chainType, blockHeight, initialPaymentCredentials, currency) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
45
|
+
async function getSyncedTransactionsByChain(accountPubKey, accountIndex, chainType, blockHeight, initialPaymentCredentials, currency) {
|
|
46
|
+
const keyChainRange = (0, live_env_1.getEnv)("KEYCHAIN_OBSERVABLE_RANGE") || 20;
|
|
47
|
+
// credentialsMap for efficient use
|
|
48
|
+
const initialPaymentCredentialMap = {};
|
|
49
|
+
let maxUsedKeyIndex = -1;
|
|
50
|
+
initialPaymentCredentials.forEach(cred => {
|
|
51
|
+
initialPaymentCredentialMap[cred.key] = cred;
|
|
52
|
+
if (cred.isUsed)
|
|
53
|
+
maxUsedKeyIndex = cred.path.index;
|
|
54
|
+
});
|
|
55
|
+
const transactions = [];
|
|
56
|
+
let latestBlockHeight = 0;
|
|
57
|
+
// fetch transactions for existing keys
|
|
58
|
+
const trxsRes = await Promise.all((0, chunk_1.default)(Object.keys(initialPaymentCredentialMap), keyChainRange).map(keys => getAllTransactionsByKeys(keys, blockHeight, currency)));
|
|
59
|
+
trxsRes.forEach(txRes => {
|
|
60
|
+
transactions.push(...txRes.transactions);
|
|
61
|
+
latestBlockHeight = Math.max(latestBlockHeight, txRes.blockHeight);
|
|
62
|
+
});
|
|
63
|
+
// fetch transactions for new avaialble keys
|
|
64
|
+
let newPaymentCredentialsMap = {};
|
|
65
|
+
let lastSyncedKeyIndex = initialPaymentCredentials.length
|
|
66
|
+
? initialPaymentCredentials[initialPaymentCredentials.length - 1].path.index
|
|
67
|
+
: -1;
|
|
68
|
+
let syncToKeyIndex = maxUsedKeyIndex + keyChainRange;
|
|
69
|
+
while (syncToKeyIndex !== lastSyncedKeyIndex) {
|
|
70
|
+
const currentPaymentKeysMap = {};
|
|
71
|
+
(0, range_1.default)(lastSyncedKeyIndex + 1, syncToKeyIndex + 1, 1).forEach(keyIndex => {
|
|
72
|
+
const keyPath = (0, logic_1.getCredentialKey)(accountPubKey, (0, logic_1.getBipPath)({
|
|
73
|
+
account: accountIndex,
|
|
74
|
+
chain: chainType,
|
|
75
|
+
index: keyIndex,
|
|
76
|
+
}));
|
|
77
|
+
currentPaymentKeysMap[keyPath.key] = {
|
|
78
|
+
isUsed: false,
|
|
79
|
+
key: keyPath.key,
|
|
80
|
+
path: keyPath.path,
|
|
81
|
+
};
|
|
76
82
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
path: keyPath.path,
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
const trxRes = yield getAllTransactionsByKeys(Object.keys(currentPaymentKeysMap), blockHeight, currency);
|
|
98
|
-
transactions.push(...trxRes.transactions);
|
|
99
|
-
lastSyncedKeyIndex = syncToKeyIndex;
|
|
100
|
-
latestBlockHeight = Math.max(latestBlockHeight, trxRes.blockHeight);
|
|
101
|
-
newPaymentCredentialsMap = Object.assign({}, newPaymentCredentialsMap, currentPaymentKeysMap);
|
|
102
|
-
maxUsedKeyIndex = trxRes.transactions.reduce((maxIndexA, { inputs, outputs }) => [...inputs, ...outputs].reduce((maxIndexB, io) => { var _a; return Math.max(((_a = newPaymentCredentialsMap[io.paymentKey]) === null || _a === void 0 ? void 0 : _a.path.index) || -1, maxIndexB); }, maxIndexA), maxUsedKeyIndex);
|
|
103
|
-
syncToKeyIndex = maxUsedKeyIndex + keyChainRange;
|
|
104
|
-
}
|
|
105
|
-
const availablePaymentCredentialsMap = Object.assign(Object.assign({}, initialPaymentCredentialMap), newPaymentCredentialsMap);
|
|
106
|
-
transactions.forEach(trx => {
|
|
107
|
-
[...trx.inputs, ...trx.outputs].forEach(io => {
|
|
108
|
-
if (availablePaymentCredentialsMap[io.paymentKey]) {
|
|
109
|
-
availablePaymentCredentialsMap[io.paymentKey].isUsed = true;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
83
|
+
const trxRes = await getAllTransactionsByKeys(Object.keys(currentPaymentKeysMap), blockHeight, currency);
|
|
84
|
+
transactions.push(...trxRes.transactions);
|
|
85
|
+
lastSyncedKeyIndex = syncToKeyIndex;
|
|
86
|
+
latestBlockHeight = Math.max(latestBlockHeight, trxRes.blockHeight);
|
|
87
|
+
newPaymentCredentialsMap = Object.assign({}, newPaymentCredentialsMap, currentPaymentKeysMap);
|
|
88
|
+
maxUsedKeyIndex = trxRes.transactions.reduce((maxIndexA, { inputs, outputs }) => [...inputs, ...outputs].reduce((maxIndexB, io) => Math.max(newPaymentCredentialsMap[io.paymentKey]?.path.index || -1, maxIndexB), maxIndexA), maxUsedKeyIndex);
|
|
89
|
+
syncToKeyIndex = maxUsedKeyIndex + keyChainRange;
|
|
90
|
+
}
|
|
91
|
+
const availablePaymentCredentialsMap = {
|
|
92
|
+
...initialPaymentCredentialMap,
|
|
93
|
+
...newPaymentCredentialsMap,
|
|
94
|
+
};
|
|
95
|
+
transactions.forEach(trx => {
|
|
96
|
+
[...trx.inputs, ...trx.outputs].forEach(io => {
|
|
97
|
+
if (availablePaymentCredentialsMap[io.paymentKey]) {
|
|
98
|
+
availablePaymentCredentialsMap[io.paymentKey].isUsed = true;
|
|
99
|
+
}
|
|
112
100
|
});
|
|
113
|
-
return {
|
|
114
|
-
transactions,
|
|
115
|
-
latestBlockHeight,
|
|
116
|
-
paymentCredentials: Object.values(availablePaymentCredentialsMap).sort((aCred, bCred) => aCred.path.index - bCred.path.index),
|
|
117
|
-
};
|
|
118
101
|
});
|
|
102
|
+
return {
|
|
103
|
+
transactions,
|
|
104
|
+
latestBlockHeight,
|
|
105
|
+
paymentCredentials: Object.values(availablePaymentCredentialsMap).sort((aCred, bCred) => aCred.path.index - bCred.path.index),
|
|
106
|
+
};
|
|
119
107
|
}
|
|
120
|
-
function getTransactions(xpub, accountIndex, initialAccount, blockHeight, currency) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
]
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
internalCredentials,
|
|
135
|
-
};
|
|
136
|
-
});
|
|
108
|
+
async function getTransactions(xpub, accountIndex, initialAccount, blockHeight, currency) {
|
|
109
|
+
const accountPubKey = (0, logic_1.getExtendedPublicKeyFromHex)(xpub);
|
|
110
|
+
const oldExternalCredentials = initialAccount?.cardanoResources?.externalCredentials || [];
|
|
111
|
+
const oldInternalCredentials = initialAccount?.cardanoResources?.internalCredentials || [];
|
|
112
|
+
const [{ transactions: externalKeyTransactions, latestBlockHeight: aBlockHeight, paymentCredentials: externalCredentials, }, { transactions: internalKeyTransactions, latestBlockHeight: bBlockHeight, paymentCredentials: internalCredentials, },] = await Promise.all([
|
|
113
|
+
getSyncedTransactionsByChain(accountPubKey, accountIndex, types_1.PaymentChain.external, blockHeight, oldExternalCredentials, currency),
|
|
114
|
+
getSyncedTransactionsByChain(accountPubKey, accountIndex, types_1.PaymentChain.internal, blockHeight, oldInternalCredentials, currency),
|
|
115
|
+
]);
|
|
116
|
+
return {
|
|
117
|
+
transactions: [...externalKeyTransactions, ...internalKeyTransactions],
|
|
118
|
+
blockHeight: Math.max(aBlockHeight, bBlockHeight),
|
|
119
|
+
externalCredentials,
|
|
120
|
+
internalCredentials,
|
|
121
|
+
};
|
|
137
122
|
}
|
|
138
123
|
exports.getTransactions = getTransactions;
|
|
139
124
|
//# sourceMappingURL=getTransactions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactions.js","sourceRoot":"","sources":["../../src/api/getTransactions.ts"],"names":[],"mappings":"
|
|
1
|
+
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EAAE,mBAAmB,IAAI,EAAE,CAAC;IAC3F,MAAM,sBAAsB,GAAG,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,IAAI,EAAE,CAAC;IAE3F,MAAM,CACJ,EACE,YAAY,EAAE,uBAAuB,EACrC,iBAAiB,EAAE,YAAY,EAC/B,kBAAkB,EAAE,mBAAmB,GACxC,EACD,EACE,YAAY,EAAE,uBAAuB,EACrC,iBAAiB,EAAE,YAAY,EAC/B,kBAAkB,EAAE,mBAAmB,GACxC,EACF,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpB,4BAA4B,CAC1B,aAAa,EACb,YAAY,EACZ,oBAAY,CAAC,QAAQ,EACrB,WAAW,EACX,sBAAsB,EACtB,QAAQ,CACT;QACD,4BAA4B,CAC1B,aAAa,EACb,YAAY,EACZ,oBAAY,CAAC,QAAQ,EACrB,WAAW,EACX,sBAAsB,EACtB,QAAQ,CACT;KACF,CAAC,CAAC;IAEH,OAAO;QACL,YAAY,EAAE,CAAC,GAAG,uBAAuB,EAAE,GAAG,uBAAuB,CAAC;QACtE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC;QACjD,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;AACJ,CAAC;AApDD,0CAoDC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -16,19 +7,17 @@ exports.submitTransaction = void 0;
|
|
|
16
7
|
const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
|
|
17
8
|
const constants_1 = require("../constants");
|
|
18
9
|
const logic_1 = require("../logic");
|
|
19
|
-
function submitTransaction(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
return res.data.transaction;
|
|
10
|
+
async function submitTransaction({ transaction, currency, }) {
|
|
11
|
+
const res = await (0, network_1.default)({
|
|
12
|
+
method: "POST",
|
|
13
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
14
|
+
? `${constants_1.CARDANO_TESTNET_API_ENDPOINT}/v1/transaction/submit`
|
|
15
|
+
: `${constants_1.CARDANO_API_ENDPOINT}/v1/transaction/submit`,
|
|
16
|
+
data: {
|
|
17
|
+
transaction: transaction,
|
|
18
|
+
},
|
|
31
19
|
});
|
|
20
|
+
return res.data.transaction;
|
|
32
21
|
}
|
|
33
22
|
exports.submitTransaction = submitTransaction;
|
|
34
23
|
//# sourceMappingURL=submitTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submitTransaction.js","sourceRoot":"","sources":["../../src/api/submitTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"submitTransaction.js","sourceRoot":"","sources":["../../src/api/submitTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,6EAAqD;AAErD,4CAAkF;AAClF,oCAAqC;AAG9B,KAAK,UAAU,iBAAiB,CAAC,EACtC,WAAW,EACX,QAAQ,GAIT;IACC,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAO,EAAC;QACxB,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;YACtB,CAAC,CAAC,GAAG,wCAA4B,wBAAwB;YACzD,CAAC,CAAC,GAAG,gCAAoB,wBAAwB;QACnD,IAAI,EAAE;YACJ,WAAW,EAAE,WAAW;SACzB;KACF,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;AAC9B,CAAC;AAjBD,8CAiBC"}
|
package/lib/bridge/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -34,7 +25,7 @@ function buildCurrencyBridge(signerContext) {
|
|
|
34
25
|
});
|
|
35
26
|
return {
|
|
36
27
|
scanAccounts,
|
|
37
|
-
preload: () =>
|
|
28
|
+
preload: async () => ({}),
|
|
38
29
|
hydrate: () => { },
|
|
39
30
|
};
|
|
40
31
|
}
|
package/lib/bridge/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/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