@ledgerhq/vault-common 2.4.4 → 2.4.6
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 +20 -20
- package/CHANGELOG.md +12 -0
- package/lib/{chunk-N6UGATIN.js → chunk-7PAZRU3A.js} +3 -3
- package/lib/{chunk-N6UGATIN.js.map → chunk-7PAZRU3A.js.map} +1 -1
- package/lib/{chunk-OZIREBYO.js → chunk-K3DKN3IC.js} +21 -21
- package/lib/{chunk-OZIREBYO.js.map → chunk-K3DKN3IC.js.map} +1 -1
- package/lib/{chunk-TBOMCYUR.js → chunk-MM46PB5T.js} +3 -3
- package/lib/{chunk-TBOMCYUR.js.map → chunk-MM46PB5T.js.map} +1 -1
- package/lib/{chunk-TZJ54LD2.js → chunk-OXEPL2GL.js} +3 -3
- package/lib/{chunk-TZJ54LD2.js.map → chunk-OXEPL2GL.js.map} +1 -1
- package/lib/{chunk-BLZRHILW.js → chunk-XQD62EIW.js} +13 -13
- package/lib/{chunk-BLZRHILW.js.map → chunk-XQD62EIW.js.map} +1 -1
- package/lib/createHSMBridge.js +4 -4
- package/lib/index.js +65 -75
- package/lib/index.js.map +1 -1
- package/lib/recipeManifest.js +3 -3
- package/lib/reviewAPIRequest.js +4 -4
- package/lib/utils.js +2 -2
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7PAZRU3Ajs = require('./chunk-7PAZRU3A.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkK3DKN3ICjs = require('./chunk-K3DKN3IC.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -15,10 +15,10 @@ var _chunkOZIREBYOjs = require('./chunk-OZIREBYO.js');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkXQD62EIWjs = require('./chunk-XQD62EIW.js');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkOXEPL2GLjs = require('./chunk-OXEPL2GL.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -39,7 +39,7 @@ var _chunkTZJ54LD2js = require('./chunk-TZJ54LD2.js');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _chunkMM46PB5Tjs = require('./chunk-MM46PB5T.js');
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
var _chunk3L2XDBZ2js = require('./chunk-3L2XDBZ2.js');
|
|
@@ -315,19 +315,9 @@ async function bakeManifest(_manifest, pool, options = {}) {
|
|
|
315
315
|
},
|
|
316
316
|
logger
|
|
317
317
|
);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
logger.info("\u2551 \u2551");
|
|
322
|
-
logger.info("\u2551 Onboarding skipped, as the new onboarding options were not provided. \u2551");
|
|
323
|
-
logger.info("\u2551 Please refer to changelog & announcements to see how you can adapt \u2551");
|
|
324
|
-
logger.info("\u2551 your code or command. \u2551");
|
|
325
|
-
logger.info("\u2551 \u2551");
|
|
326
|
-
logger.info("\u2551 See v2.0 release of vault-cli/vault-common on GitHub. \u2551");
|
|
327
|
-
logger.info("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
328
|
-
}
|
|
329
|
-
const runner = options.runner || _chunkBLZRHILWjs.createDefaultRunner_default.call(void 0, pool, options);
|
|
330
|
-
const manifestFromGate = await _chunkOZIREBYOjs.recipeManifest.call(void 0, pool, { saveAccountsIndexes: true });
|
|
318
|
+
}
|
|
319
|
+
const runner = options.runner || _chunkXQD62EIWjs.createDefaultRunner_default.call(void 0, pool, options);
|
|
320
|
+
const manifestFromGate = await _chunkK3DKN3ICjs.recipeManifest.call(void 0, pool, { saveAccountsIndexes: true });
|
|
331
321
|
const { rawData } = manifestFromGate;
|
|
332
322
|
const {
|
|
333
323
|
groupsByName,
|
|
@@ -425,49 +415,49 @@ async function bakeManifest(_manifest, pool, options = {}) {
|
|
|
425
415
|
)
|
|
426
416
|
);
|
|
427
417
|
}
|
|
428
|
-
await
|
|
418
|
+
await _chunkMM46PB5Tjs.queue.call(void 0,
|
|
429
419
|
_sortBy2.default.call(void 0, adminsAndOperators, (u) => u.device),
|
|
430
420
|
genCreateAdminsAndOperators()
|
|
431
421
|
);
|
|
432
422
|
if (manifest.users.api) {
|
|
433
423
|
logger.step("LAM users creation");
|
|
434
|
-
await
|
|
424
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.users.api, genCreateAPIUser());
|
|
435
425
|
}
|
|
436
426
|
if (manifest.users.apiV2) {
|
|
437
427
|
logger.step("API users creation");
|
|
438
|
-
await
|
|
428
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.users.apiV2, genCreateAPIV2User());
|
|
439
429
|
}
|
|
440
430
|
}
|
|
441
431
|
if (manifest.workspaceRules) {
|
|
442
432
|
logger.step("Workspace rules creation");
|
|
443
|
-
await
|
|
433
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.workspaceRules, createWorkspaceRule);
|
|
444
434
|
}
|
|
445
435
|
if (manifest.groups) {
|
|
446
436
|
logger.step("Groups");
|
|
447
|
-
await
|
|
437
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.groups, createGroup);
|
|
448
438
|
}
|
|
449
439
|
if (manifest.whitelists) {
|
|
450
440
|
logger.step("Whitelists");
|
|
451
|
-
await
|
|
441
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.whitelists, createWhitelist);
|
|
452
442
|
}
|
|
453
443
|
if (manifest.tradelink) {
|
|
454
444
|
logger.step("TradeLink");
|
|
455
445
|
const adminDevices = await pool.getOnboardingAdminDevices();
|
|
456
|
-
await
|
|
446
|
+
await _chunkMM46PB5Tjs.queue.call(void 0,
|
|
457
447
|
adminDevices.map((a) => ({ user: a[1], contractNames: ["TRADELINK_ADDENDUM", "TRADELINK"] })),
|
|
458
448
|
approveContracts
|
|
459
449
|
);
|
|
460
|
-
await
|
|
461
|
-
await
|
|
462
|
-
await
|
|
450
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.tradelink.custodians, createTradelinkCustodian);
|
|
451
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.tradelink.assetManagers, createTradelinkAssetManager);
|
|
452
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.tradelink.exchanges, createTradelinkExchange);
|
|
463
453
|
await createTradelinkNetwork(manifest.tradelink);
|
|
464
454
|
if (manifest.tradelink.onboarded) {
|
|
465
455
|
await onboardTradelinkNetwork(manifest.tradelink);
|
|
466
|
-
await
|
|
456
|
+
await _chunkMM46PB5Tjs.queue.call(void 0,
|
|
467
457
|
manifest.tradelink.exchanges,
|
|
468
458
|
(exchange) => onboardTradelinkEntity(exchange, "exchanges")
|
|
469
459
|
);
|
|
470
|
-
await
|
|
460
|
+
await _chunkMM46PB5Tjs.queue.call(void 0,
|
|
471
461
|
manifest.tradelink.assetManagers,
|
|
472
462
|
(am) => onboardTradelinkEntity(am, "asset_managers")
|
|
473
463
|
);
|
|
@@ -475,20 +465,20 @@ async function bakeManifest(_manifest, pool, options = {}) {
|
|
|
475
465
|
}
|
|
476
466
|
if (manifest.policies) {
|
|
477
467
|
logger.step("Policies");
|
|
478
|
-
await
|
|
468
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.policies, createVaultPolicy);
|
|
479
469
|
}
|
|
480
470
|
if (manifest.accounts) {
|
|
481
471
|
logger.step("Accounts");
|
|
482
472
|
manifest.accounts = _orderBy2.default.call(void 0, manifest.accounts, "contractAddress", "desc");
|
|
483
|
-
await
|
|
473
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.accounts, createAccount);
|
|
484
474
|
}
|
|
485
475
|
if (manifest.entities) {
|
|
486
476
|
logger.step("Entities");
|
|
487
|
-
await
|
|
477
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.entities, createVaultEntity);
|
|
488
478
|
}
|
|
489
479
|
if (manifest.exchanges) {
|
|
490
480
|
logger.step("Exchanges");
|
|
491
|
-
await
|
|
481
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.exchanges, createVaultExchange);
|
|
492
482
|
}
|
|
493
483
|
if (manifest.quorum) {
|
|
494
484
|
logger.step("Quorum");
|
|
@@ -496,7 +486,7 @@ async function bakeManifest(_manifest, pool, options = {}) {
|
|
|
496
486
|
}
|
|
497
487
|
if (manifest.contractApprovals) {
|
|
498
488
|
logger.step("Contract Approvals");
|
|
499
|
-
await
|
|
489
|
+
await _chunkMM46PB5Tjs.queue.call(void 0, manifest.contractApprovals, approveContracts);
|
|
500
490
|
}
|
|
501
491
|
logger.success("Done");
|
|
502
492
|
async function editQuorum(quorum) {
|
|
@@ -580,7 +570,7 @@ async function bakeManifest(_manifest, pool, options = {}) {
|
|
|
580
570
|
}
|
|
581
571
|
function genCreateUser(role) {
|
|
582
572
|
return async function createUser(device) {
|
|
583
|
-
const name = manifest.customUsernames && manifest.customUsernames[device] ||
|
|
573
|
+
const name = manifest.customUsernames && manifest.customUsernames[device] || _chunkMM46PB5Tjs.getDefaultUsername.call(void 0, role, device);
|
|
584
574
|
const userID = await pool.getUserID(device);
|
|
585
575
|
const findByUserID = (ud) => ud.user.user_id === userID;
|
|
586
576
|
const existingUser = usersWithDevice.find(findByUserID);
|
|
@@ -1281,11 +1271,11 @@ var pathArrayToString = (path) => {
|
|
|
1281
1271
|
if (!path[0] || !path[1]) throw new Error("Invalid path array");
|
|
1282
1272
|
return `${path[0] & 268435455}'/${path[1] & 268435455}'`;
|
|
1283
1273
|
};
|
|
1284
|
-
var __DEVICE_API_NETWORK__ =
|
|
1274
|
+
var __DEVICE_API_NETWORK__ = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
1285
1275
|
baseURL: process.env.VAULT_DEVICE_API_URL || "https://localhost:8443/device-api"
|
|
1286
1276
|
});
|
|
1287
1277
|
function setDeviceAPIEndpoint(url) {
|
|
1288
|
-
__DEVICE_API_NETWORK__ =
|
|
1278
|
+
__DEVICE_API_NETWORK__ = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: url });
|
|
1289
1279
|
}
|
|
1290
1280
|
function createAPIDevice(options = {}) {
|
|
1291
1281
|
const { deviceAPISessionID, overrideSeeds, deviceAPIURL, psdModel = "STAX" } = options;
|
|
@@ -1308,7 +1298,7 @@ function createAPIDevice(options = {}) {
|
|
|
1308
1298
|
version: 3
|
|
1309
1299
|
// This is used to choose Noise Channel mode
|
|
1310
1300
|
};
|
|
1311
|
-
const deviceAPINetwork = deviceAPIURL ?
|
|
1301
|
+
const deviceAPINetwork = deviceAPIURL ? _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: deviceAPIURL }) : __DEVICE_API_NETWORK__;
|
|
1312
1302
|
return deviceAPINetwork(method, url, data, requestOptions);
|
|
1313
1303
|
};
|
|
1314
1304
|
const getPublicKey = async (transport, path, secp256k1 = true) => {
|
|
@@ -1905,7 +1895,7 @@ function createInteractions(device) {
|
|
|
1905
1895
|
const finalizePairing = {
|
|
1906
1896
|
responseKey: "pairing_payload",
|
|
1907
1897
|
action: ({ onboardingRegisterChallenge, transport, u2f_key }) => {
|
|
1908
|
-
const secure_channel =
|
|
1898
|
+
const secure_channel = _chunkMM46PB5Tjs.extractSecureChannel.call(void 0,
|
|
1909
1899
|
onboardingRegisterChallenge,
|
|
1910
1900
|
u2f_key.pubKey.toUpperCase()
|
|
1911
1901
|
);
|
|
@@ -1920,7 +1910,7 @@ function createInteractions(device) {
|
|
|
1920
1910
|
const onboardingRegisterDevice = {
|
|
1921
1911
|
responseKey: "u2f_register",
|
|
1922
1912
|
action: async ({ u2f_key, onboardingRegisterChallenge, role, username, transport }) => {
|
|
1923
|
-
const secure_channel =
|
|
1913
|
+
const secure_channel = _chunkMM46PB5Tjs.extractSecureChannel.call(void 0,
|
|
1924
1914
|
onboardingRegisterChallenge,
|
|
1925
1915
|
u2f_key.pubKey.toUpperCase()
|
|
1926
1916
|
);
|
|
@@ -2112,8 +2102,8 @@ var createDevicesPool = (options, { logger = _vaultutils.SILENT_LOGGER } = {}) =
|
|
|
2112
2102
|
recordStore
|
|
2113
2103
|
});
|
|
2114
2104
|
const { loginFlow, readOnlyLoginFlow, registerUserFlow, approveFlow, approveFlowWithoutHSM } = interactions;
|
|
2115
|
-
const workspace =
|
|
2116
|
-
const network =
|
|
2105
|
+
const workspace = _chunkMM46PB5Tjs.getWorkspaceFromGate.call(void 0, gate);
|
|
2106
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2117
2107
|
baseURL: gate,
|
|
2118
2108
|
networkDelay
|
|
2119
2109
|
});
|
|
@@ -2156,7 +2146,7 @@ var createDevicesPool = (options, { logger = _vaultutils.SILENT_LOGGER } = {}) =
|
|
|
2156
2146
|
};
|
|
2157
2147
|
const injectToken = () => _token;
|
|
2158
2148
|
if (!_token || process.env.NODE_ENV === "test") {
|
|
2159
|
-
const network2 =
|
|
2149
|
+
const network2 = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2160
2150
|
baseURL: gate,
|
|
2161
2151
|
interceptToken,
|
|
2162
2152
|
injectToken,
|
|
@@ -2170,7 +2160,7 @@ var createDevicesPool = (options, { logger = _vaultutils.SILENT_LOGGER } = {}) =
|
|
|
2170
2160
|
throw new Error("Could not extract token from login");
|
|
2171
2161
|
}
|
|
2172
2162
|
}
|
|
2173
|
-
const authNetwork =
|
|
2163
|
+
const authNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2174
2164
|
baseURL: gate,
|
|
2175
2165
|
token: _token,
|
|
2176
2166
|
networkDelay
|
|
@@ -2273,7 +2263,7 @@ var createDevicesPool = (options, { logger = _vaultutils.SILENT_LOGGER } = {}) =
|
|
|
2273
2263
|
}
|
|
2274
2264
|
}
|
|
2275
2265
|
};
|
|
2276
|
-
const apiNetwork =
|
|
2266
|
+
const apiNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2277
2267
|
baseURL: lamURL || "",
|
|
2278
2268
|
networkDelay
|
|
2279
2269
|
});
|
|
@@ -2336,7 +2326,7 @@ var createDevicesPool_default = createDevicesPool;
|
|
|
2336
2326
|
|
|
2337
2327
|
// src/createFaucet.ts
|
|
2338
2328
|
var createPralineFaucet = (url) => async (opts) => {
|
|
2339
|
-
const network =
|
|
2329
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2340
2330
|
baseURL: url
|
|
2341
2331
|
});
|
|
2342
2332
|
const { recipient, amount } = opts;
|
|
@@ -2375,13 +2365,13 @@ async function createPledge({
|
|
|
2375
2365
|
}, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
2376
2366
|
const gateAccount = accountsByName[account.name];
|
|
2377
2367
|
if (!gateAccount) throw new Error(`Can't find account with name ${account.name}`);
|
|
2378
|
-
const apiNetwork =
|
|
2368
|
+
const apiNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2379
2369
|
baseURL: apiGateway
|
|
2380
2370
|
});
|
|
2381
2371
|
logger.info(`Authenticate for ${apiUser.name}`);
|
|
2382
|
-
const workspace =
|
|
2383
|
-
const bearerToken = await
|
|
2384
|
-
const pledge = await
|
|
2372
|
+
const workspace = _chunkMM46PB5Tjs.getWorkspaceFromGate.call(void 0, gate);
|
|
2373
|
+
const bearerToken = await _chunkXQD62EIWjs.authenticate.call(void 0, pool, apiNetwork, workspace, apiUser, logger);
|
|
2374
|
+
const pledge = await _chunkXQD62EIWjs.getTradelinkPledge.call(void 0, {
|
|
2385
2375
|
apiNetwork,
|
|
2386
2376
|
workspace,
|
|
2387
2377
|
gateAccount,
|
|
@@ -2395,8 +2385,8 @@ async function createPledge({
|
|
|
2395
2385
|
const admin = await pool.login(4);
|
|
2396
2386
|
tokens = await fetchTokens_default(admin, { logger });
|
|
2397
2387
|
}
|
|
2398
|
-
const unit =
|
|
2399
|
-
const serializedAmount =
|
|
2388
|
+
const unit = _chunkMM46PB5Tjs.getAccountUnit.call(void 0, account, tokens);
|
|
2389
|
+
const serializedAmount = _chunkMM46PB5Tjs.serializeUnitValue.call(void 0, unit, amount);
|
|
2400
2390
|
const data = {
|
|
2401
2391
|
type: "CREATE_PLEDGE_INCREMENT",
|
|
2402
2392
|
data: {
|
|
@@ -2421,7 +2411,7 @@ async function createPledge({
|
|
|
2421
2411
|
});
|
|
2422
2412
|
logger.info(`Approving pledge ${pledgeRequestResp.id}`);
|
|
2423
2413
|
logger.info("Decode challenge");
|
|
2424
|
-
const apiChallenge = await
|
|
2414
|
+
const apiChallenge = await _chunkXQD62EIWjs.decodeChallenge.call(void 0, {
|
|
2425
2415
|
apiNetwork,
|
|
2426
2416
|
workspace,
|
|
2427
2417
|
bearerToken,
|
|
@@ -2430,7 +2420,7 @@ async function createPledge({
|
|
|
2430
2420
|
});
|
|
2431
2421
|
logger.info(apiChallenge.decodedChallenge);
|
|
2432
2422
|
logger.info("Sign and approve");
|
|
2433
|
-
return await
|
|
2423
|
+
return await _chunkXQD62EIWjs.signAndApprove.call(void 0, {
|
|
2434
2424
|
apiNetwork,
|
|
2435
2425
|
workspace,
|
|
2436
2426
|
bearerToken,
|
|
@@ -2457,20 +2447,20 @@ async function createSettlement({
|
|
|
2457
2447
|
}, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
2458
2448
|
const gateAccount = accountsByName[account.name];
|
|
2459
2449
|
if (!gateAccount) throw new Error(`Can't find account with name ${account.name}`);
|
|
2460
|
-
const apiNetwork =
|
|
2450
|
+
const apiNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, {
|
|
2461
2451
|
baseURL: apiGateway
|
|
2462
2452
|
});
|
|
2463
2453
|
logger.info(`Authenticate for ${apiUser.name}`);
|
|
2464
|
-
const workspace =
|
|
2465
|
-
const bearerToken = await
|
|
2466
|
-
const pledge = await
|
|
2454
|
+
const workspace = _chunkMM46PB5Tjs.getWorkspaceFromGate.call(void 0, gate);
|
|
2455
|
+
const bearerToken = await _chunkXQD62EIWjs.authenticate.call(void 0, pool, apiNetwork, workspace, apiUser, logger);
|
|
2456
|
+
const pledge = await _chunkXQD62EIWjs.getTradelinkPledge.call(void 0, {
|
|
2467
2457
|
apiNetwork,
|
|
2468
2458
|
workspace,
|
|
2469
2459
|
gateAccount,
|
|
2470
2460
|
bearerToken,
|
|
2471
2461
|
exchange
|
|
2472
2462
|
});
|
|
2473
|
-
const recipient = await
|
|
2463
|
+
const recipient = await _chunkXQD62EIWjs.getTradelinkRecipient.call(void 0, { pool, gateAccount, pledge });
|
|
2474
2464
|
const settlementAmount = Math.floor(pledge.amount * percentage / 100);
|
|
2475
2465
|
let txIntent = {
|
|
2476
2466
|
account_id: gateAccount.id,
|
|
@@ -2566,10 +2556,10 @@ async function deploy(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
|
2566
2556
|
const now = Date.now();
|
|
2567
2557
|
logger.step(`Deploying ${payload.name}`);
|
|
2568
2558
|
const url = remoteURL.replace(/https:\/\/(.*?)\./, `https://${payload.name}.`);
|
|
2569
|
-
const network =
|
|
2559
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: `${remoteURL}/api` });
|
|
2570
2560
|
const deployment = await network("POST", "/deploy", payload);
|
|
2571
2561
|
const gateURL = `https://${deployment.instance.name}.${deployment.instance.host}/gate/minivault`;
|
|
2572
|
-
const gateNetwork =
|
|
2562
|
+
const gateNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: gateURL });
|
|
2573
2563
|
let state = toSimplifiedState(deployment);
|
|
2574
2564
|
const logState = () => {
|
|
2575
2565
|
const step = deployment.steps.find((s) => s.key === state.currentStep);
|
|
@@ -2607,14 +2597,14 @@ async function deploy(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
|
2607
2597
|
await gateNetwork("GET", "/onboarding/state");
|
|
2608
2598
|
resolve();
|
|
2609
2599
|
} catch (e2) {
|
|
2610
|
-
await
|
|
2600
|
+
await _chunkMM46PB5Tjs.wait.call(void 0, 3e3);
|
|
2611
2601
|
pollGate();
|
|
2612
2602
|
}
|
|
2613
2603
|
}
|
|
2614
2604
|
if (useHTTPPolling) {
|
|
2615
2605
|
logger.info("Using HTTP polling strategy (will not output deployment steps)");
|
|
2616
2606
|
logger.info("Waiting 30 seconds for domain to be deployed...");
|
|
2617
|
-
await
|
|
2607
|
+
await _chunkMM46PB5Tjs.wait.call(void 0, 3e4);
|
|
2618
2608
|
logger.info("Waiting for Gate to be ready...");
|
|
2619
2609
|
pollGate();
|
|
2620
2610
|
} else {
|
|
@@ -2634,7 +2624,7 @@ async function deploy(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
|
2634
2624
|
|
|
2635
2625
|
async function destroy(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
2636
2626
|
const { remoteURL = DEFAULT_VAULT_REMOTE_URL, name } = opts;
|
|
2637
|
-
const network =
|
|
2627
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: `${remoteURL}/api` });
|
|
2638
2628
|
await network("DELETE", `/instances/${name}`);
|
|
2639
2629
|
logger.success(`Successfully destroyed instance ${name}`);
|
|
2640
2630
|
if (opts.wait) {
|
|
@@ -2659,7 +2649,7 @@ async function destroy(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
|
2659
2649
|
async function getMVInstances(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
2660
2650
|
const { remoteURL = DEFAULT_VAULT_REMOTE_URL } = opts;
|
|
2661
2651
|
logger.info("Fetching instances...");
|
|
2662
|
-
const network =
|
|
2652
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: `${remoteURL}/api` });
|
|
2663
2653
|
const instances = await network("GET", "/instances");
|
|
2664
2654
|
return instances;
|
|
2665
2655
|
}
|
|
@@ -2702,8 +2692,8 @@ async function send({
|
|
|
2702
2692
|
const admin = await pool.login(4);
|
|
2703
2693
|
tokens = await fetchTokens_default(admin, { logger });
|
|
2704
2694
|
}
|
|
2705
|
-
const unit =
|
|
2706
|
-
const serializedAmount =
|
|
2695
|
+
const unit = _chunkMM46PB5Tjs.getAccountUnit.call(void 0, account, tokens);
|
|
2696
|
+
const serializedAmount = _chunkMM46PB5Tjs.serializeUnitValue.call(void 0, unit, transaction.amount);
|
|
2707
2697
|
const matchingRule = getMatchingMultiAuthRule({
|
|
2708
2698
|
account,
|
|
2709
2699
|
transaction,
|
|
@@ -2935,7 +2925,7 @@ async function upgrade(opts, { logger = _vaultutils.SILENT_LOGGER } = {}) {
|
|
|
2935
2925
|
const now = Date.now();
|
|
2936
2926
|
logger.step(`Upgrading ${payload.name}`);
|
|
2937
2927
|
const socket = _socketioclient2.default.call(void 0, remoteURL);
|
|
2938
|
-
const network =
|
|
2928
|
+
const network = _chunkOXEPL2GLjs.createNetwork.call(void 0, { baseURL: remoteURL });
|
|
2939
2929
|
const { jobID } = await network("PUT", "/api/upgrade", payload);
|
|
2940
2930
|
let resolve = null;
|
|
2941
2931
|
let reject = null;
|
|
@@ -3006,7 +2996,7 @@ function validateManifest(_manifest) {
|
|
|
3006
2996
|
}
|
|
3007
2997
|
if ("currency" in account) {
|
|
3008
2998
|
try {
|
|
3009
|
-
|
|
2999
|
+
_chunkMM46PB5Tjs.getCryptoCurrencyById.call(void 0, account.currency);
|
|
3010
3000
|
} catch (e) {
|
|
3011
3001
|
throw Error(`Invalid account currency: "${account.currency}"`);
|
|
3012
3002
|
}
|
|
@@ -3106,7 +3096,7 @@ function validateManifest(_manifest) {
|
|
|
3106
3096
|
manifest.whitelists.forEach((whitelist) => {
|
|
3107
3097
|
whitelist.addresses.map((address) => {
|
|
3108
3098
|
try {
|
|
3109
|
-
|
|
3099
|
+
_chunkMM46PB5Tjs.getCryptoCurrencyById.call(void 0, address.currency);
|
|
3110
3100
|
} catch (e) {
|
|
3111
3101
|
throw Error(`Invalid whitelist currency: "${address.currency}"`);
|
|
3112
3102
|
}
|
|
@@ -3179,7 +3169,7 @@ async function wipeBackend(wipeOpts, runnableOpts = {}) {
|
|
|
3179
3169
|
}
|
|
3180
3170
|
logger.step("Wiping backend data");
|
|
3181
3171
|
const gateNetworkOptions = { baseURL: wipeOpts.gate };
|
|
3182
|
-
const gateNetwork =
|
|
3172
|
+
const gateNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, gateNetworkOptions);
|
|
3183
3173
|
try {
|
|
3184
3174
|
await gateNetwork("POST", "/maintenance/wipe");
|
|
3185
3175
|
} catch (e4) {
|
|
@@ -3192,7 +3182,7 @@ async function wipeBackend(wipeOpts, runnableOpts = {}) {
|
|
|
3192
3182
|
if (wipeOpts.lam) {
|
|
3193
3183
|
const lamNetworkOptions = { baseURL: wipeOpts.lam };
|
|
3194
3184
|
const headersAPILam = wipeOpts.lamAPIKey ? { headers: { "X-Ledger-API-Key": wipeOpts.lamAPIKey } } : {};
|
|
3195
|
-
const lamNetwork =
|
|
3185
|
+
const lamNetwork = _chunkOXEPL2GLjs.createNetwork.call(void 0, lamNetworkOptions);
|
|
3196
3186
|
logger.step("Wiping LAM data");
|
|
3197
3187
|
try {
|
|
3198
3188
|
const lamWipeResponse = await lamNetwork(
|
|
@@ -3209,7 +3199,7 @@ async function wipeBackend(wipeOpts, runnableOpts = {}) {
|
|
|
3209
3199
|
}
|
|
3210
3200
|
}
|
|
3211
3201
|
logger.step("Resetting HSM compartment");
|
|
3212
|
-
const hsmBridge =
|
|
3202
|
+
const hsmBridge = _chunk7PAZRU3Ajs.createHSMBridge_default.call(void 0, wipeOpts);
|
|
3213
3203
|
await hsmBridge.resetCompartment(wipeOpts.hsmCompartmentID, runnableOpts);
|
|
3214
3204
|
logger.success("Wiped backend data");
|
|
3215
3205
|
}
|
|
@@ -3265,5 +3255,5 @@ var wipeBackend_default = wipeBackend;
|
|
|
3265
3255
|
|
|
3266
3256
|
|
|
3267
3257
|
|
|
3268
|
-
exports.DEFAULT_SPAWN_WATCH_TIMEOUT_MINUTES = DEFAULT_SPAWN_WATCH_TIMEOUT_MINUTES; exports.DEFAULT_VAULT_REMOTE_URL = DEFAULT_VAULT_REMOTE_URL; exports.GateGroupRequestTypeDefs = _chunkIAJMQIH7js.GateGroupRequestTypeDefs; exports.LIGHT_EVM_CURRENCIES =
|
|
3258
|
+
exports.DEFAULT_SPAWN_WATCH_TIMEOUT_MINUTES = DEFAULT_SPAWN_WATCH_TIMEOUT_MINUTES; exports.DEFAULT_VAULT_REMOTE_URL = DEFAULT_VAULT_REMOTE_URL; exports.GateGroupRequestTypeDefs = _chunkIAJMQIH7js.GateGroupRequestTypeDefs; exports.LIGHT_EVM_CURRENCIES = _chunkMM46PB5Tjs.LIGHT_EVM_CURRENCIES; exports.bakeManifest = bakeManifest; exports.createAPIDevice = createAPIDevice_default; exports.createConfigCatEnvironment = createConfigCatEnvironment; exports.createDevicesPool = createDevicesPool_default; exports.createFaucet = createFaucet_default; exports.createInteractions = createInteractions; exports.createNetwork = _chunkOXEPL2GLjs.createNetwork; exports.createPledge = createPledge_default; exports.createSettlement = createSettlement_default; exports.deleteConfigCatEnvironment = deleteConfigCatEnvironment; exports.deploy = deploy; exports.deserializeUnitValue = _chunkMM46PB5Tjs.deserializeUnitValue; exports.destroy = destroy; exports.device = device_exports; exports.extractSecureChannel = _chunkMM46PB5Tjs.extractSecureChannel; exports.feesLevels = _chunkIAJMQIH7js.feesLevels; exports.fetchTokens = fetchTokens_default; exports.genSeed = genSeed_default; exports.getAccountTypeByCurrency = _chunkMM46PB5Tjs.getAccountTypeByCurrency; exports.getAccountUnit = _chunkMM46PB5Tjs.getAccountUnit; exports.getAuthTokens = _chunkXQD62EIWjs.getAuthTokens; exports.getCryptoCurrencyById = _chunkMM46PB5Tjs.getCryptoCurrencyById; exports.getCurrencyOrToken = _chunkMM46PB5Tjs.getCurrencyOrToken; exports.getCurrencyUnit = _chunkMM46PB5Tjs.getCurrencyUnit; exports.getDefaultUsername = _chunkMM46PB5Tjs.getDefaultUsername; exports.getGateAccountUnit = _chunkMM46PB5Tjs.getGateAccountUnit; exports.getMVInstances = getMVInstances; exports.getTokenUnit = _chunkMM46PB5Tjs.getTokenUnit; exports.getWorkspaceFromGate = _chunkMM46PB5Tjs.getWorkspaceFromGate; exports.listCryptoCurrencies = _chunkMM46PB5Tjs.listCryptoCurrencies; exports.performRequest = _chunkXQD62EIWjs.performRequest; exports.prepareRequest = _chunkXQD62EIWjs.prepareRequest_default; exports.queue = _chunkMM46PB5Tjs.queue; exports.recipeManifest = _chunkK3DKN3ICjs.recipeManifest; exports.reviewAPIRequest = _chunkXQD62EIWjs.reviewAPIRequest_default; exports.send = send_default; exports.serializeUnitValue = _chunkMM46PB5Tjs.serializeUnitValue; exports.setConfigCatFeatureFlagValues = setConfigCatFeatureFlagValues; exports.setDeviceAPIEndpoint = setDeviceAPIEndpoint; exports.unwrapConnection = _chunkMM46PB5Tjs.unwrapConnection; exports.upgrade = upgrade; exports.validateManifest = validateManifest; exports.vaultCoins = _chunkMM46PB5Tjs.vaultCoins; exports.wait = _chunkMM46PB5Tjs.wait; exports.wipeBackend = wipeBackend_default; exports.xpubToExtendedPubKey = _chunkMM46PB5Tjs.xpubToExtendedPubKey;
|
|
3269
3259
|
//# sourceMappingURL=index.js.map
|