@ledgerhq/live-common 22.3.0-universal.0 → 23.0.0-next.1
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__/test-helpers/setup.js +2 -0
- package/lib/__tests__/test-helpers/setup.js.map +1 -1
- package/lib/account/pending.d.ts +2 -1
- package/lib/account/pending.d.ts.map +1 -1
- package/lib/account/serialization.d.ts +3 -1
- package/lib/account/serialization.d.ts.map +1 -1
- package/lib/account/serialization.js +12 -3
- package/lib/account/serialization.js.map +1 -1
- package/lib/cross.d.ts.map +1 -1
- package/lib/cross.js +2 -1
- package/lib/cross.js.map +1 -1
- package/lib/derivation.d.ts +10 -1
- package/lib/derivation.d.ts.map +1 -1
- package/lib/derivation.js +28 -5
- package/lib/derivation.js.map +1 -1
- package/lib/env.d.ts +20 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +16 -1
- 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 +1 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -0
- package/lib/errors.js.map +1 -1
- package/lib/families/algorand/js-synchronization.d.ts +2 -2
- package/lib/families/bitcoin/exchange.d.ts +1 -1
- package/lib/families/bitcoin/js-synchronisation.d.ts +2 -2
- package/lib/families/cardano/api/api-types.d.ts +38 -0
- package/lib/families/cardano/api/api-types.d.ts.map +1 -0
- package/lib/families/cardano/api/api-types.js +3 -0
- package/lib/families/cardano/api/api-types.js.map +1 -0
- package/lib/families/cardano/api/getNetworkInfo.d.ts +4 -0
- package/lib/families/cardano/api/getNetworkInfo.d.ts.map +1 -0
- package/lib/families/cardano/api/getNetworkInfo.js +83 -0
- package/lib/families/cardano/api/getNetworkInfo.js.map +1 -0
- package/lib/families/cardano/api/getTransactions.d.ts +10 -0
- package/lib/families/cardano/api/getTransactions.d.ts.map +1 -0
- package/lib/families/cardano/api/getTransactions.js +257 -0
- package/lib/families/cardano/api/getTransactions.js.map +1 -0
- package/lib/families/cardano/api/submitTransaction.d.ts +7 -0
- package/lib/families/cardano/api/submitTransaction.d.ts.map +1 -0
- package/lib/families/cardano/api/submitTransaction.js +69 -0
- package/lib/families/cardano/api/submitTransaction.js.map +1 -0
- package/lib/families/cardano/bridge/js.d.ts +8 -0
- package/lib/families/cardano/bridge/js.d.ts.map +1 -0
- package/lib/families/cardano/bridge/js.js +69 -0
- package/lib/families/cardano/bridge/js.js.map +1 -0
- package/lib/families/cardano/bridge.test.d.ts +2 -0
- package/lib/families/cardano/bridge.test.d.ts.map +1 -0
- package/lib/families/cardano/bridge.test.js +11 -0
- package/lib/families/cardano/bridge.test.js.map +1 -0
- package/lib/families/cardano/buildSubAccounts.d.ts +25 -0
- package/lib/families/cardano/buildSubAccounts.d.ts.map +1 -0
- package/lib/families/cardano/buildSubAccounts.js +176 -0
- package/lib/families/cardano/buildSubAccounts.js.map +1 -0
- package/lib/families/cardano/cli-transaction.d.ts +19 -0
- package/lib/families/cardano/cli-transaction.d.ts.map +1 -0
- package/lib/families/cardano/cli-transaction.js +70 -0
- package/lib/families/cardano/cli-transaction.js.map +1 -0
- package/lib/families/cardano/constants.d.ts +8 -0
- package/lib/families/cardano/constants.d.ts.map +1 -0
- package/lib/families/cardano/constants.js +12 -0
- package/lib/families/cardano/constants.js.map +1 -0
- package/lib/families/cardano/datasets/rawAccount.1.d.ts +3 -0
- package/lib/families/cardano/datasets/rawAccount.1.d.ts.map +1 -0
- package/lib/families/cardano/datasets/rawAccount.1.js +27 -0
- package/lib/families/cardano/datasets/rawAccount.1.js.map +1 -0
- package/lib/families/cardano/datasets/scanAccounts.d.ts +5 -0
- package/lib/families/cardano/datasets/scanAccounts.d.ts.map +1 -0
- package/lib/families/cardano/datasets/scanAccounts.js +10 -0
- package/lib/families/cardano/datasets/scanAccounts.js.map +1 -0
- package/lib/families/cardano/errors.d.ts +7 -0
- package/lib/families/cardano/errors.d.ts.map +1 -0
- package/lib/families/cardano/errors.js +9 -0
- package/lib/families/cardano/errors.js.map +1 -0
- package/lib/families/cardano/hw-getAddress.d.ts +4 -0
- package/lib/families/cardano/hw-getAddress.d.ts.map +1 -0
- package/lib/families/cardano/hw-getAddress.js +126 -0
- package/lib/families/cardano/hw-getAddress.js.map +1 -0
- package/lib/families/cardano/js-broadcast.d.ts +8 -0
- package/lib/families/cardano/js-broadcast.d.ts.map +1 -0
- package/lib/families/cardano/js-broadcast.js +65 -0
- package/lib/families/cardano/js-broadcast.js.map +1 -0
- package/lib/families/cardano/js-buildTransaction.d.ts +12 -0
- package/lib/families/cardano/js-buildTransaction.d.ts.map +1 -0
- package/lib/families/cardano/js-buildTransaction.js +253 -0
- package/lib/families/cardano/js-buildTransaction.js.map +1 -0
- package/lib/families/cardano/js-estimateMaxSpendable.d.ts +15 -0
- package/lib/families/cardano/js-estimateMaxSpendable.d.ts.map +1 -0
- package/lib/families/cardano/js-estimateMaxSpendable.js +99 -0
- package/lib/families/cardano/js-estimateMaxSpendable.js.map +1 -0
- package/lib/families/cardano/js-getFeesForTransaction.d.ts +15 -0
- package/lib/families/cardano/js-getFeesForTransaction.d.ts.map +1 -0
- package/lib/families/cardano/js-getFeesForTransaction.js +61 -0
- package/lib/families/cardano/js-getFeesForTransaction.js.map +1 -0
- package/lib/families/cardano/js-getTransactionStatus.d.ts +5 -0
- package/lib/families/cardano/js-getTransactionStatus.d.ts.map +1 -0
- package/lib/families/cardano/js-getTransactionStatus.js +156 -0
- package/lib/families/cardano/js-getTransactionStatus.js.map +1 -0
- package/lib/families/cardano/js-signOperation.d.ts +13 -0
- package/lib/families/cardano/js-signOperation.d.ts.map +1 -0
- package/lib/families/cardano/js-signOperation.js +274 -0
- package/lib/families/cardano/js-signOperation.js.map +1 -0
- package/lib/families/cardano/js-synchronisation.d.ts +11 -0
- package/lib/families/cardano/js-synchronisation.d.ts.map +1 -0
- package/lib/families/cardano/js-synchronisation.js +247 -0
- package/lib/families/cardano/js-synchronisation.js.map +1 -0
- package/lib/families/cardano/js-transaction.d.ts +23 -0
- package/lib/families/cardano/js-transaction.d.ts.map +1 -0
- package/lib/families/cardano/js-transaction.js +112 -0
- package/lib/families/cardano/js-transaction.js.map +1 -0
- package/lib/families/cardano/logic.d.ts +92 -0
- package/lib/families/cardano/logic.d.ts.map +1 -0
- package/lib/families/cardano/logic.js +378 -0
- package/lib/families/cardano/logic.js.map +1 -0
- package/lib/families/cardano/networks.d.ts +3 -0
- package/lib/families/cardano/networks.d.ts.map +1 -0
- package/lib/families/cardano/networks.js +34 -0
- package/lib/families/cardano/networks.js.map +1 -0
- package/lib/families/cardano/postSyncPatch.d.ts +7 -0
- package/lib/families/cardano/postSyncPatch.d.ts.map +1 -0
- package/lib/families/cardano/postSyncPatch.js +37 -0
- package/lib/families/cardano/postSyncPatch.js.map +1 -0
- package/lib/families/cardano/serialization.d.ts +4 -0
- package/lib/families/cardano/serialization.d.ts.map +1 -0
- package/lib/families/cardano/serialization.js +121 -0
- package/lib/families/cardano/serialization.js.map +1 -0
- package/lib/families/cardano/specs.d.ts +7 -0
- package/lib/families/cardano/specs.d.ts.map +1 -0
- package/lib/families/cardano/specs.js +83 -0
- package/lib/families/cardano/specs.js.map +1 -0
- package/lib/families/cardano/speculos-deviceActions.d.ts +7 -0
- package/lib/families/cardano/speculos-deviceActions.d.ts.map +1 -0
- package/lib/families/cardano/speculos-deviceActions.js +69 -0
- package/lib/families/cardano/speculos-deviceActions.js.map +1 -0
- package/lib/families/cardano/test-dataset.d.ts +5 -0
- package/lib/families/cardano/test-dataset.d.ts.map +1 -0
- package/lib/families/cardano/test-dataset.js +42 -0
- package/lib/families/cardano/test-dataset.js.map +1 -0
- package/lib/families/cardano/transaction.d.ts +12 -0
- package/lib/families/cardano/transaction.d.ts.map +1 -0
- package/lib/families/cardano/transaction.js +47 -0
- package/lib/families/cardano/transaction.js.map +1 -0
- package/lib/families/cardano/types.d.ts +152 -0
- package/lib/families/cardano/types.d.ts.map +1 -0
- package/lib/families/cardano/types.js +18 -0
- package/lib/families/cardano/types.js.map +1 -0
- package/lib/families/celo/js-synchronisation.d.ts +2 -2
- package/lib/families/cosmos/js-synchronisation.d.ts +2 -2
- package/lib/families/crypto_org/js-synchronisation.d.ts +2 -2
- package/lib/families/elrond/js-synchronisation.d.ts +2 -2
- package/lib/families/ethereum/hw-signMessage.d.ts.map +1 -1
- package/lib/families/ethereum/hw-signMessage.js +10 -4
- package/lib/families/ethereum/hw-signMessage.js.map +1 -1
- package/lib/families/filecoin/bridge/account.js +18 -14
- package/lib/families/filecoin/bridge/account.js.map +1 -1
- package/lib/families/filecoin/bridge/utils/types.d.ts +1 -1
- package/lib/families/filecoin/bridge/utils/types.d.ts.map +1 -1
- package/lib/families/filecoin/bridge/utils/utils.d.ts +1 -1
- package/lib/families/filecoin/bridge/utils/utils.d.ts.map +1 -1
- package/lib/families/filecoin/bridge/utils/utils.js +9 -8
- package/lib/families/filecoin/bridge/utils/utils.js.map +1 -1
- package/lib/families/filecoin/bridge.test.d.ts +2 -0
- package/lib/families/filecoin/bridge.test.d.ts.map +1 -0
- package/lib/families/filecoin/bridge.test.js +92 -0
- package/lib/families/filecoin/bridge.test.js.map +1 -0
- package/lib/families/filecoin/specs.d.ts.map +1 -1
- package/lib/families/filecoin/specs.js +1 -2
- package/lib/families/filecoin/specs.js.map +1 -1
- package/lib/families/filecoin/test-dataset.d.ts.map +1 -1
- package/lib/families/filecoin/test-dataset.js +8 -9
- package/lib/families/filecoin/test-dataset.js.map +1 -1
- package/lib/families/hedera/js-synchronisation.d.ts +2 -2
- package/lib/families/polkadot/js-synchronisation.d.ts +2 -2
- package/lib/families/ripple/js-synchronization.d.ts +2 -2
- package/lib/families/stellar/js-synchronization.d.ts +2 -2
- package/lib/generated/bridge/js.d.ts +4 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +30 -28
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/cli-transaction.d.ts +15 -0
- package/lib/generated/cli-transaction.d.ts.map +1 -1
- package/lib/generated/cli-transaction.js +28 -26
- package/lib/generated/cli-transaction.js.map +1 -1
- package/lib/generated/exchange.d.ts +1 -1
- package/lib/generated/hw-getAddress.d.ts +1 -0
- package/lib/generated/hw-getAddress.d.ts.map +1 -1
- package/lib/generated/hw-getAddress.js +30 -28
- package/lib/generated/hw-getAddress.js.map +1 -1
- package/lib/generated/specs.d.ts +3 -0
- package/lib/generated/specs.d.ts.map +1 -1
- package/lib/generated/specs.js +28 -26
- package/lib/generated/specs.js.map +1 -1
- package/lib/generated/speculos-deviceActions.d.ts +3 -0
- package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
- package/lib/generated/speculos-deviceActions.js +28 -26
- package/lib/generated/speculos-deviceActions.js.map +1 -1
- package/lib/generated/test-dataset.d.ts +1 -0
- package/lib/generated/test-dataset.d.ts.map +1 -1
- package/lib/generated/test-dataset.js +26 -24
- package/lib/generated/test-dataset.js.map +1 -1
- package/lib/generated/transaction.d.ts +5 -0
- package/lib/generated/transaction.d.ts.map +1 -1
- package/lib/generated/transaction.js +30 -28
- package/lib/generated/transaction.js.map +1 -1
- package/lib/generated/types.d.ts +4 -2
- package/lib/generated/types.d.ts.map +1 -1
- package/lib/reconciliation.d.ts.map +1 -1
- package/lib/reconciliation.js +6 -0
- package/lib/reconciliation.js.map +1 -1
- package/lib/types/account.d.ts +3 -0
- package/lib/types/account.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/__tests__/test-helpers/setup.ts +2 -0
- package/src/account/serialization.ts +15 -0
- package/src/cross.ts +2 -1
- package/src/derivation.ts +19 -2
- package/src/env.ts +16 -1
- package/src/errors.ts +1 -0
- package/src/families/cardano/__snapshots__/bridge.test.ts.snap +1667 -0
- package/src/families/cardano/api/api-types.ts +33 -0
- package/src/families/cardano/api/getNetworkInfo.ts +38 -0
- package/src/families/cardano/api/getTransactions.ts +240 -0
- package/src/families/cardano/api/submitTransaction.ts +27 -0
- package/src/families/cardano/bridge/js.ts +35 -0
- package/src/families/cardano/bridge.test.ts +6 -0
- package/src/families/cardano/buildSubAccounts.ts +182 -0
- package/src/families/cardano/cli-transaction.ts +78 -0
- package/src/families/cardano/constants.ts +12 -0
- package/src/families/cardano/datasets/rawAccount.1.ts +28 -0
- package/src/families/cardano/datasets/scanAccounts.ts +23 -0
- package/src/families/cardano/errors.ts +8 -0
- package/src/families/cardano/hw-getAddress.ts +61 -0
- package/src/families/cardano/js-broadcast.ts +25 -0
- package/src/families/cardano/js-buildTransaction.ts +293 -0
- package/src/families/cardano/js-estimateMaxSpendable.ts +60 -0
- package/src/families/cardano/js-getFeesForTransaction.ts +25 -0
- package/src/families/cardano/js-getTransactionStatus.ts +123 -0
- package/src/families/cardano/js-signOperation.ts +265 -0
- package/src/families/cardano/js-synchronisation.ts +255 -0
- package/src/families/cardano/js-transaction.ts +69 -0
- package/src/families/cardano/logic.ts +454 -0
- package/src/families/cardano/networks.ts +33 -0
- package/src/families/cardano/postSyncPatch.ts +45 -0
- package/src/families/cardano/serialization.ts +179 -0
- package/src/families/cardano/specs.ts +96 -0
- package/src/families/cardano/speculos-deviceActions.ts +66 -0
- package/src/families/cardano/test-dataset.ts +41 -0
- package/src/families/cardano/transaction.ts +55 -0
- package/src/families/cardano/types.ts +178 -0
- package/src/families/ethereum/hw-signMessage.ts +9 -5
- package/src/families/filecoin/__snapshots__/bridge.test.ts.snap +87 -0
- package/src/families/filecoin/bridge/account.ts +20 -20
- package/src/families/filecoin/bridge/utils/types.ts +1 -1
- package/src/families/filecoin/bridge/utils/utils.ts +8 -7
- package/src/families/filecoin/bridge.test.ts +39 -0
- package/src/families/filecoin/specs.ts +1 -2
- package/src/families/filecoin/test-dataset.ts +19 -15
- package/src/generated/bridge/js.ts +3 -0
- package/src/generated/cli-transaction.ts +3 -0
- package/src/generated/hw-getAddress.ts +3 -0
- package/src/generated/specs.ts +3 -0
- package/src/generated/speculos-deviceActions.ts +3 -0
- package/src/generated/test-dataset.ts +3 -0
- package/src/generated/transaction.ts +3 -0
- package/src/generated/types.ts +4 -0
- package/src/reconciliation.ts +10 -0
- package/src/types/account.ts +6 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
+
if (ar || !(i in from)) {
|
|
68
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
+
ar[i] = from[i];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
+
};
|
|
74
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
75
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
|
+
};
|
|
77
|
+
exports.__esModule = true;
|
|
78
|
+
exports.getTransactions = void 0;
|
|
79
|
+
var network_1 = __importDefault(require("../../../network"));
|
|
80
|
+
var types_1 = require("../types");
|
|
81
|
+
var env_1 = require("../../../env");
|
|
82
|
+
var logic_1 = require("../logic");
|
|
83
|
+
var range_1 = __importDefault(require("lodash/range"));
|
|
84
|
+
var chunk_1 = __importDefault(require("lodash/chunk"));
|
|
85
|
+
var constants_1 = require("../constants");
|
|
86
|
+
function fetchTransactions(paymentKeys, pageNo, blockHeight, currency) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var res;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, (0, network_1["default"])({
|
|
92
|
+
method: "POST",
|
|
93
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
94
|
+
? "".concat(constants_1.CARDANO_TESTNET_API_ENDPOINT, "/v1/transaction")
|
|
95
|
+
: "".concat(constants_1.CARDANO_API_ENDPOINT, "/v1/transaction"),
|
|
96
|
+
data: {
|
|
97
|
+
paymentKeys: paymentKeys,
|
|
98
|
+
pageNo: pageNo,
|
|
99
|
+
blockHeight: blockHeight
|
|
100
|
+
}
|
|
101
|
+
})];
|
|
102
|
+
case 1:
|
|
103
|
+
res = _a.sent();
|
|
104
|
+
return [2 /*return*/, res.data];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function getAllTransactionsByKeys(paymentKeys, blockHeight, currency) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var transactions, latestBlockHeight, isAllTrxFetched, pageNo, res;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
transactions = [];
|
|
116
|
+
latestBlockHeight = 0;
|
|
117
|
+
isAllTrxFetched = false;
|
|
118
|
+
pageNo = 1;
|
|
119
|
+
_a.label = 1;
|
|
120
|
+
case 1:
|
|
121
|
+
if (!!isAllTrxFetched) return [3 /*break*/, 3];
|
|
122
|
+
return [4 /*yield*/, fetchTransactions(paymentKeys, pageNo, blockHeight, currency)];
|
|
123
|
+
case 2:
|
|
124
|
+
res = _a.sent();
|
|
125
|
+
transactions.push.apply(transactions, __spreadArray([], __read(res.transactions), false));
|
|
126
|
+
latestBlockHeight = Math.max(res.blockHeight, latestBlockHeight);
|
|
127
|
+
isAllTrxFetched = res.transactions.length < res.limit;
|
|
128
|
+
pageNo += 1;
|
|
129
|
+
return [3 /*break*/, 1];
|
|
130
|
+
case 3: return [2 /*return*/, {
|
|
131
|
+
transactions: transactions,
|
|
132
|
+
blockHeight: latestBlockHeight
|
|
133
|
+
}];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function getSyncedTransactionsByChain(accountPubKey, accountIndex, chainType, blockHeight, initialPaymentCredentials, currency) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var keyChainRange, initialPaymentCredentialMap, maxUsedKeyIndex, transactions, latestBlockHeight, trxsRes, newPaymentCredentialsMap, lastSyncedKeyIndex, syncToKeyIndex, _loop_1, availablePaymentCredentialsMap;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
keyChainRange = (0, env_1.getEnv)("KEYCHAIN_OBSERVABLE_RANGE") || 20;
|
|
145
|
+
initialPaymentCredentialMap = {};
|
|
146
|
+
maxUsedKeyIndex = -1;
|
|
147
|
+
initialPaymentCredentials.forEach(function (cred) {
|
|
148
|
+
initialPaymentCredentialMap[cred.key] = cred;
|
|
149
|
+
if (cred.isUsed)
|
|
150
|
+
maxUsedKeyIndex = cred.path.index;
|
|
151
|
+
});
|
|
152
|
+
transactions = [];
|
|
153
|
+
latestBlockHeight = 0;
|
|
154
|
+
return [4 /*yield*/, Promise.all((0, chunk_1["default"])(Object.keys(initialPaymentCredentialMap), keyChainRange).map(function (keys) {
|
|
155
|
+
return getAllTransactionsByKeys(keys, blockHeight, currency);
|
|
156
|
+
}))];
|
|
157
|
+
case 1:
|
|
158
|
+
trxsRes = _a.sent();
|
|
159
|
+
trxsRes.forEach(function (txRes) {
|
|
160
|
+
transactions.push.apply(transactions, __spreadArray([], __read(txRes.transactions), false));
|
|
161
|
+
latestBlockHeight = Math.max(latestBlockHeight, txRes.blockHeight);
|
|
162
|
+
});
|
|
163
|
+
newPaymentCredentialsMap = {};
|
|
164
|
+
lastSyncedKeyIndex = initialPaymentCredentials.length
|
|
165
|
+
? initialPaymentCredentials[initialPaymentCredentials.length - 1].path.index
|
|
166
|
+
: -1;
|
|
167
|
+
syncToKeyIndex = maxUsedKeyIndex + keyChainRange;
|
|
168
|
+
_loop_1 = function () {
|
|
169
|
+
var currentPaymentKeysMap, trxRes;
|
|
170
|
+
return __generator(this, function (_b) {
|
|
171
|
+
switch (_b.label) {
|
|
172
|
+
case 0:
|
|
173
|
+
currentPaymentKeysMap = {};
|
|
174
|
+
(0, range_1["default"])(lastSyncedKeyIndex + 1, syncToKeyIndex + 1, 1).forEach(function (keyIndex) {
|
|
175
|
+
var keyPath = (0, logic_1.getCredentialKey)(accountPubKey, (0, logic_1.getBipPath)({
|
|
176
|
+
account: accountIndex,
|
|
177
|
+
chain: chainType,
|
|
178
|
+
index: keyIndex
|
|
179
|
+
}));
|
|
180
|
+
currentPaymentKeysMap[keyPath.key] = {
|
|
181
|
+
isUsed: false,
|
|
182
|
+
key: keyPath.key,
|
|
183
|
+
path: keyPath.path
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
return [4 /*yield*/, getAllTransactionsByKeys(Object.keys(currentPaymentKeysMap), blockHeight, currency)];
|
|
187
|
+
case 1:
|
|
188
|
+
trxRes = _b.sent();
|
|
189
|
+
transactions.push.apply(transactions, __spreadArray([], __read(trxRes.transactions), false));
|
|
190
|
+
lastSyncedKeyIndex = syncToKeyIndex;
|
|
191
|
+
latestBlockHeight = Math.max(latestBlockHeight, trxRes.blockHeight);
|
|
192
|
+
newPaymentCredentialsMap = Object.assign({}, newPaymentCredentialsMap, currentPaymentKeysMap);
|
|
193
|
+
maxUsedKeyIndex = trxRes.transactions.reduce(function (maxIndexA, _a) {
|
|
194
|
+
var inputs = _a.inputs, outputs = _a.outputs;
|
|
195
|
+
return __spreadArray(__spreadArray([], __read(inputs), false), __read(outputs), false).reduce(function (maxIndexB, io) {
|
|
196
|
+
var _a;
|
|
197
|
+
return Math.max(((_a = newPaymentCredentialsMap[io.paymentKey]) === null || _a === void 0 ? void 0 : _a.path.index) || -1, maxIndexB);
|
|
198
|
+
}, maxIndexA);
|
|
199
|
+
}, maxUsedKeyIndex);
|
|
200
|
+
syncToKeyIndex = maxUsedKeyIndex + keyChainRange;
|
|
201
|
+
return [2 /*return*/];
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
_a.label = 2;
|
|
206
|
+
case 2:
|
|
207
|
+
if (!(syncToKeyIndex !== lastSyncedKeyIndex)) return [3 /*break*/, 4];
|
|
208
|
+
return [5 /*yield**/, _loop_1()];
|
|
209
|
+
case 3:
|
|
210
|
+
_a.sent();
|
|
211
|
+
return [3 /*break*/, 2];
|
|
212
|
+
case 4:
|
|
213
|
+
availablePaymentCredentialsMap = __assign(__assign({}, initialPaymentCredentialMap), newPaymentCredentialsMap);
|
|
214
|
+
transactions.forEach(function (trx) {
|
|
215
|
+
__spreadArray(__spreadArray([], __read(trx.inputs), false), __read(trx.outputs), false).forEach(function (io) {
|
|
216
|
+
if (availablePaymentCredentialsMap[io.paymentKey]) {
|
|
217
|
+
availablePaymentCredentialsMap[io.paymentKey].isUsed = true;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
return [2 /*return*/, {
|
|
222
|
+
transactions: transactions,
|
|
223
|
+
latestBlockHeight: latestBlockHeight,
|
|
224
|
+
paymentCredentials: Object.values(availablePaymentCredentialsMap).sort(function (aCred, bCred) { return aCred.path.index - bCred.path.index; })
|
|
225
|
+
}];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function getTransactions(xpub, accountIndex, initialAccount, blockHeight, currency) {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
233
|
+
var accountPubKey, oldExternalCredentials, oldInternalCredentials, _c, _d, externalKeyTransactions, aBlockHeight, externalCredentials, _e, internalKeyTransactions, bBlockHeight, internalCredentials;
|
|
234
|
+
return __generator(this, function (_f) {
|
|
235
|
+
switch (_f.label) {
|
|
236
|
+
case 0:
|
|
237
|
+
accountPubKey = (0, logic_1.getExtendedPublicKeyFromHex)(xpub);
|
|
238
|
+
oldExternalCredentials = ((_a = initialAccount === null || initialAccount === void 0 ? void 0 : initialAccount.cardanoResources) === null || _a === void 0 ? void 0 : _a.externalCredentials) || [];
|
|
239
|
+
oldInternalCredentials = ((_b = initialAccount === null || initialAccount === void 0 ? void 0 : initialAccount.cardanoResources) === null || _b === void 0 ? void 0 : _b.internalCredentials) || [];
|
|
240
|
+
return [4 /*yield*/, Promise.all([
|
|
241
|
+
getSyncedTransactionsByChain(accountPubKey, accountIndex, types_1.PaymentChain.external, blockHeight, oldExternalCredentials, currency),
|
|
242
|
+
getSyncedTransactionsByChain(accountPubKey, accountIndex, types_1.PaymentChain.internal, blockHeight, oldInternalCredentials, currency),
|
|
243
|
+
])];
|
|
244
|
+
case 1:
|
|
245
|
+
_c = __read.apply(void 0, [_f.sent(), 2]), _d = _c[0], externalKeyTransactions = _d.transactions, aBlockHeight = _d.latestBlockHeight, externalCredentials = _d.paymentCredentials, _e = _c[1], internalKeyTransactions = _e.transactions, bBlockHeight = _e.latestBlockHeight, internalCredentials = _e.paymentCredentials;
|
|
246
|
+
return [2 /*return*/, {
|
|
247
|
+
transactions: __spreadArray(__spreadArray([], __read(externalKeyTransactions), false), __read(internalKeyTransactions), false),
|
|
248
|
+
blockHeight: Math.max(aBlockHeight, bBlockHeight),
|
|
249
|
+
externalCredentials: externalCredentials,
|
|
250
|
+
internalCredentials: internalCredentials
|
|
251
|
+
}];
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
exports.getTransactions = getTransactions;
|
|
257
|
+
//# sourceMappingURL=getTransactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactions.js","sourceRoot":"","sources":["../../../../src/families/cardano/api/getTransactions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAuC;AAGvC,kCAA2D;AAC3D,oCAAsC;AACtC,kCAKkB;AAClB,uDAAiC;AACjC,uDAAiC;AAGjC,0CAGsB;AAEtB,SAAe,iBAAiB,CAC9B,WAA0B,EAC1B,MAAc,EACd,WAAmB,EACnB,QAAwB;;;;;wBAOZ,qBAAM,IAAA,oBAAO,EAAC;wBACxB,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;4BACtB,CAAC,CAAC,UAAG,wCAA4B,oB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,CACT;yBACF,CAAC,EAAA;;oBA5BI,KAAA,sBAWF,SAiBF,KAAA,EA3BA,UAIC,EAHe,uBAAuB,kBAAA,EAClB,YAAY,uBAAA,EACX,mBAAmB,wBAAA,EAEzC,UAIC,EAHe,uBAAuB,kBAAA,EAClB,YAAY,uBAAA,EACX,mBAAmB,wBAAA;oBAqB3C,sBAAO;4BACL,YAAY,yCAAM,uBAAuB,kBAAK,uBAAuB,SAAC;4BACtE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC;4BACjD,mBAAmB,qBAAA;4BACnB,mBAAmB,qBAAA;yBACpB,EAAC;;;;CACH;AAtDD,0CAsDC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CryptoCurrency } from "@ledgerhq/cryptoassets";
|
|
2
|
+
import { APITransaction } from "./api-types";
|
|
3
|
+
export declare function submitTransaction({ transaction, currency, }: {
|
|
4
|
+
transaction: string;
|
|
5
|
+
currency: CryptoCurrency;
|
|
6
|
+
}): Promise<APITransaction>;
|
|
7
|
+
//# sourceMappingURL=submitTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitTransaction.d.ts","sourceRoot":"","sources":["../../../../src/families/cardano/api/submitTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;CAC1B,GAAG,OAAO,CAAC,cAAc,CAAC,CAW1B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
exports.submitTransaction = void 0;
|
|
43
|
+
var network_1 = __importDefault(require("../../../network"));
|
|
44
|
+
var constants_1 = require("../constants");
|
|
45
|
+
var logic_1 = require("../logic");
|
|
46
|
+
function submitTransaction(_a) {
|
|
47
|
+
var transaction = _a.transaction, currency = _a.currency;
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var res;
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
switch (_b.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, (0, network_1["default"])({
|
|
53
|
+
method: "POST",
|
|
54
|
+
url: (0, logic_1.isTestnet)(currency)
|
|
55
|
+
? "".concat(constants_1.CARDANO_TESTNET_API_ENDPOINT, "/v1/transaction/submit")
|
|
56
|
+
: "".concat(constants_1.CARDANO_API_ENDPOINT, "/v1/transaction/submit"),
|
|
57
|
+
data: {
|
|
58
|
+
transaction: transaction
|
|
59
|
+
}
|
|
60
|
+
})];
|
|
61
|
+
case 1:
|
|
62
|
+
res = _b.sent();
|
|
63
|
+
return [2 /*return*/, res.data.transaction];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.submitTransaction = submitTransaction;
|
|
69
|
+
//# sourceMappingURL=submitTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitTransaction.js","sourceRoot":"","sources":["../../../../src/families/cardano/api/submitTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAAuC;AACvC,0CAGsB;AACtB,kCAAqC;AAGrC,SAAsB,iBAAiB,CAAC,EAMvC;QALC,WAAW,iBAAA,EACX,QAAQ,cAAA;;;;;wBAKI,qBAAM,IAAA,oBAAO,EAAC;wBACxB,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;4BACtB,CAAC,CAAC,UAAG,wCAA4B,2BAAwB;4BACzD,CAAC,CAAC,UAAG,gCAAoB,2BAAwB;wBACnD,IAAI,EAAE;4BACJ,WAAW,EAAE,WAAW;yBACzB;qBACF,CAAC,EAAA;;oBARI,GAAG,GAAG,SAQV;oBACF,sBAAO,GAAG,CAAC,IAAI,CAAC,WAAW,EAAC;;;;CAC7B;AAjBD,8CAiBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transaction } from "../types";
|
|
2
|
+
import type { AccountBridge, CurrencyBridge } from "../../../types";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
currencyBridge: CurrencyBridge;
|
|
5
|
+
accountBridge: AccountBridge<Transaction>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=js.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../../src/families/cardano/bridge/js.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;;;;;AAiCpE,wBAAiD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
var js_synchronisation_1 = require("../js-synchronisation");
|
|
43
|
+
var js_estimateMaxSpendable_1 = __importDefault(require("../js-estimateMaxSpendable"));
|
|
44
|
+
var js_transaction_1 = require("../js-transaction");
|
|
45
|
+
var js_getTransactionStatus_1 = __importDefault(require("../js-getTransactionStatus"));
|
|
46
|
+
var js_signOperation_1 = __importDefault(require("../js-signOperation"));
|
|
47
|
+
var js_broadcast_1 = __importDefault(require("../js-broadcast"));
|
|
48
|
+
var jsHelpers_1 = require("../../../bridge/jsHelpers");
|
|
49
|
+
var receive = (0, jsHelpers_1.makeAccountBridgeReceive)();
|
|
50
|
+
var accountBridge = {
|
|
51
|
+
estimateMaxSpendable: js_estimateMaxSpendable_1["default"],
|
|
52
|
+
createTransaction: js_transaction_1.createTransaction,
|
|
53
|
+
updateTransaction: js_transaction_1.updateTransaction,
|
|
54
|
+
getTransactionStatus: js_getTransactionStatus_1["default"],
|
|
55
|
+
prepareTransaction: js_transaction_1.prepareTransaction,
|
|
56
|
+
sync: js_synchronisation_1.sync,
|
|
57
|
+
receive: receive,
|
|
58
|
+
signOperation: js_signOperation_1["default"],
|
|
59
|
+
broadcast: js_broadcast_1["default"]
|
|
60
|
+
};
|
|
61
|
+
var currencyBridge = {
|
|
62
|
+
scanAccounts: js_synchronisation_1.scanAccounts,
|
|
63
|
+
preload: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
64
|
+
return [2 /*return*/, ({})];
|
|
65
|
+
}); }); },
|
|
66
|
+
hydrate: function () { }
|
|
67
|
+
};
|
|
68
|
+
exports["default"] = { currencyBridge: currencyBridge, accountBridge: accountBridge };
|
|
69
|
+
//# sourceMappingURL=js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.js","sourceRoot":"","sources":["../../../../src/families/cardano/bridge/js.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAA2D;AAC3D,uFAA8D;AAC9D,oDAI2B;AAC3B,uFAA8D;AAC9D,yEAAgD;AAChD,iEAAwC;AACxC,uDAAqE;AAErE,IAAM,OAAO,GAAG,IAAA,oCAAwB,GAAE,CAAC;AAE3C,IAAM,aAAa,GAA+B;IAChD,oBAAoB,sCAAA;IACpB,iBAAiB,oCAAA;IACjB,iBAAiB,oCAAA;IACjB,oBAAoB,sCAAA;IACpB,kBAAkB,qCAAA;IAClB,IAAI,2BAAA;IACJ,OAAO,SAAA;IACP,aAAa,+BAAA;IACb,SAAS,2BAAA;CACV,CAAC;AAEF,IAAM,cAAc,GAAmB;IACrC,YAAY,mCAAA;IACZ,OAAO,EAAE;QAAY,sBAAA,CAAC,EAAE,CAAC,EAAA;aAAA;IACzB,OAAO,EAAE,cAAO,CAAC;CAClB,CAAC;AAEF,qBAAe,EAAE,cAAc,gBAAA,EAAE,aAAa,eAAA,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.test.d.ts","sourceRoot":"","sources":["../../../src/families/cardano/bridge.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
var libcore_setup_1 = require("../../__tests__/test-helpers/libcore-setup");
|
|
7
|
+
var bridge_1 = require("../../__tests__/test-helpers/bridge");
|
|
8
|
+
var test_dataset_1 = __importDefault(require("./test-dataset"));
|
|
9
|
+
(0, libcore_setup_1.setup)("cardano_testnet");
|
|
10
|
+
(0, bridge_1.testBridge)("cardano_testnet", test_dataset_1["default"]);
|
|
11
|
+
//# sourceMappingURL=bridge.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.test.js","sourceRoot":"","sources":["../../../src/families/cardano/bridge.test.ts"],"names":[],"mappings":";;;;;AAAA,4EAAmE;AACnE,8DAAiE;AACjE,gEAAqC;AAErC,IAAA,qBAAK,EAAC,iBAAiB,CAAC,CAAC;AACzB,IAAA,mBAAU,EAAC,iBAAiB,EAAE,yBAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Account, CryptoCurrency, TokenAccount } from "../../types";
|
|
2
|
+
import { APITransaction } from "./api/api-types";
|
|
3
|
+
import { PaymentCredential, Token } from "./types";
|
|
4
|
+
export declare const getTokenAssetId: ({ policyId, assetName, }: {
|
|
5
|
+
policyId: string;
|
|
6
|
+
assetName: string;
|
|
7
|
+
}) => string;
|
|
8
|
+
export declare const decodeTokenAssetId: (id: string) => {
|
|
9
|
+
policyId: string;
|
|
10
|
+
assetName: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const decodeTokenCurrencyId: (id: string) => {
|
|
13
|
+
parentCurrencyId: string;
|
|
14
|
+
type: string;
|
|
15
|
+
assetId: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function buildSubAccounts({ initialAccount, parentAccountId, parentCurrency, newTransactions, tokens, accountCredentialsMap, }: {
|
|
18
|
+
initialAccount: Account | undefined;
|
|
19
|
+
parentAccountId: string;
|
|
20
|
+
parentCurrency: CryptoCurrency;
|
|
21
|
+
newTransactions: Array<APITransaction>;
|
|
22
|
+
tokens: Array<Token>;
|
|
23
|
+
accountCredentialsMap: Record<string, PaymentCredential>;
|
|
24
|
+
}): Array<TokenAccount>;
|
|
25
|
+
//# sourceMappingURL=buildSubAccounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSubAccounts.d.ts","sourceRoot":"","sources":["../../../src/families/cardano/buildSubAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAa,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAWnD,eAAO,MAAM,eAAe;cAIhB,MAAM;eACL,MAAM;MACf,MAAmC,CAAC;AAExC,eAAO,MAAM,kBAAkB,OACzB,MAAM;cACG,MAAM;eAAa,MAAM;CAIvC,CAAC;AAOF,eAAO,MAAM,qBAAqB,OAC5B,MAAM;sBACW,MAAM;UAAQ,MAAM;aAAW,MAAM;CAO3D,CAAC;AAsEF,wBAAgB,gBAAgB,CAAC,EAC/B,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,MAAM,EACN,qBAAqB,GACtB,EAAE;IACD,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,cAAc,CAAC;IAC/B,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACvC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC1D,GAAG,KAAK,CAAC,YAAY,CAAC,CAmDtB"}
|