@xyo-network/xl1-cli 1.20.22 → 1.20.24
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/dist/cli-min.mjs +298 -223
- package/dist/cli-min.mjs.map +1 -1
- package/package.json +25 -25
package/dist/cli-min.mjs
CHANGED
|
@@ -36699,7 +36699,7 @@ function requireFollowRedirects () {
|
|
|
36699
36699
|
var followRedirectsExports = requireFollowRedirects();
|
|
36700
36700
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
36701
36701
|
|
|
36702
|
-
const VERSION$1 = "1.15.
|
|
36702
|
+
const VERSION$1 = "1.15.2";
|
|
36703
36703
|
|
|
36704
36704
|
function parseProtocol(url) {
|
|
36705
36705
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -37456,6 +37456,11 @@ const { http: httpFollow, https: httpsFollow } = followRedirects;
|
|
|
37456
37456
|
|
|
37457
37457
|
const isHttps = /https:?/;
|
|
37458
37458
|
|
|
37459
|
+
// Symbols used to bind a single 'error' listener to a pooled socket and track
|
|
37460
|
+
// the request currently owning that socket across keep-alive reuse (issue #10780).
|
|
37461
|
+
const kAxiosSocketListener = Symbol('axios.http.socketListener');
|
|
37462
|
+
const kAxiosCurrentReq = Symbol('axios.http.currentReq');
|
|
37463
|
+
|
|
37459
37464
|
const supportedProtocols = platform.protocols.map((protocol) => {
|
|
37460
37465
|
return protocol + ':';
|
|
37461
37466
|
});
|
|
@@ -38021,9 +38026,10 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38021
38026
|
|
|
38022
38027
|
// HTTP basic authentication
|
|
38023
38028
|
let auth = undefined;
|
|
38024
|
-
|
|
38025
|
-
|
|
38026
|
-
const
|
|
38029
|
+
const configAuth = own('auth');
|
|
38030
|
+
if (configAuth) {
|
|
38031
|
+
const username = configAuth.username || '';
|
|
38032
|
+
const password = configAuth.password || '';
|
|
38027
38033
|
auth = username + ':' + password;
|
|
38028
38034
|
}
|
|
38029
38035
|
|
|
@@ -38057,7 +38063,10 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38057
38063
|
false
|
|
38058
38064
|
);
|
|
38059
38065
|
|
|
38060
|
-
|
|
38066
|
+
// Null-prototype to block prototype pollution gadgets on properties read
|
|
38067
|
+
// directly by Node's http.request (e.g. insecureHTTPParser, lookup).
|
|
38068
|
+
// See GHSA-q8qp-cvcw-x6jj.
|
|
38069
|
+
const options = Object.assign(Object.create(null), {
|
|
38061
38070
|
path,
|
|
38062
38071
|
method: method,
|
|
38063
38072
|
headers: headers.toJSON(),
|
|
@@ -38066,14 +38075,41 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38066
38075
|
protocol,
|
|
38067
38076
|
family,
|
|
38068
38077
|
beforeRedirect: dispatchBeforeRedirect,
|
|
38069
|
-
beforeRedirects:
|
|
38078
|
+
beforeRedirects: Object.create(null),
|
|
38070
38079
|
http2Options,
|
|
38071
|
-
};
|
|
38080
|
+
});
|
|
38072
38081
|
|
|
38073
38082
|
// cacheable-lookup integration hotfix
|
|
38074
38083
|
!utils$8.isUndefined(lookup) && (options.lookup = lookup);
|
|
38075
38084
|
|
|
38076
38085
|
if (config.socketPath) {
|
|
38086
|
+
if (typeof config.socketPath !== 'string') {
|
|
38087
|
+
return reject(new AxiosError$1(
|
|
38088
|
+
'socketPath must be a string',
|
|
38089
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
38090
|
+
config
|
|
38091
|
+
));
|
|
38092
|
+
}
|
|
38093
|
+
|
|
38094
|
+
if (config.allowedSocketPaths != null) {
|
|
38095
|
+
const allowed = Array.isArray(config.allowedSocketPaths)
|
|
38096
|
+
? config.allowedSocketPaths
|
|
38097
|
+
: [config.allowedSocketPaths];
|
|
38098
|
+
|
|
38099
|
+
const resolvedSocket = resolve$1(config.socketPath);
|
|
38100
|
+
const isAllowed = allowed.some(
|
|
38101
|
+
(entry) => typeof entry === 'string' && resolve$1(entry) === resolvedSocket
|
|
38102
|
+
);
|
|
38103
|
+
|
|
38104
|
+
if (!isAllowed) {
|
|
38105
|
+
return reject(new AxiosError$1(
|
|
38106
|
+
`socketPath "${config.socketPath}" is not permitted by allowedSocketPaths`,
|
|
38107
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
38108
|
+
config
|
|
38109
|
+
));
|
|
38110
|
+
}
|
|
38111
|
+
}
|
|
38112
|
+
|
|
38077
38113
|
options.socketPath = config.socketPath;
|
|
38078
38114
|
} else {
|
|
38079
38115
|
options.hostname = parsed.hostname.startsWith('[')
|
|
@@ -38102,8 +38138,9 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38102
38138
|
if (config.maxRedirects) {
|
|
38103
38139
|
options.maxRedirects = config.maxRedirects;
|
|
38104
38140
|
}
|
|
38105
|
-
|
|
38106
|
-
|
|
38141
|
+
const configBeforeRedirect = own('beforeRedirect');
|
|
38142
|
+
if (configBeforeRedirect) {
|
|
38143
|
+
options.beforeRedirects.config = configBeforeRedirect;
|
|
38107
38144
|
}
|
|
38108
38145
|
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
38109
38146
|
}
|
|
@@ -38116,9 +38153,10 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38116
38153
|
options.maxBodyLength = Infinity;
|
|
38117
38154
|
}
|
|
38118
38155
|
|
|
38119
|
-
|
|
38120
|
-
|
|
38121
|
-
|
|
38156
|
+
// Always set an explicit own value so a polluted
|
|
38157
|
+
// Object.prototype.insecureHTTPParser cannot enable the lenient parser
|
|
38158
|
+
// through Node's internal options copy (GHSA-q8qp-cvcw-x6jj).
|
|
38159
|
+
options.insecureHTTPParser = Boolean(own('insecureHTTPParser'));
|
|
38122
38160
|
|
|
38123
38161
|
// Create the request
|
|
38124
38162
|
req = transport.request(options, function handleResponse(res) {
|
|
@@ -38316,20 +38354,28 @@ var httpAdapter = isHttpAdapterSupported &&
|
|
|
38316
38354
|
// default interval of sending ack packet is 1 minute
|
|
38317
38355
|
socket.setKeepAlive(true, 1000 * 60);
|
|
38318
38356
|
|
|
38319
|
-
|
|
38320
|
-
|
|
38321
|
-
|
|
38357
|
+
// Install a single 'error' listener per socket (not per request) to avoid
|
|
38358
|
+
// accumulating listeners on pooled keep-alive sockets that get reassigned
|
|
38359
|
+
// to new requests before the previous request's 'close' fires (issue #10780).
|
|
38360
|
+
// The listener is bound to the socket's currently-active request via a
|
|
38361
|
+
// symbol, which is swapped as the socket is reassigned.
|
|
38362
|
+
if (!socket[kAxiosSocketListener]) {
|
|
38363
|
+
socket.on('error', function handleSocketError(err) {
|
|
38364
|
+
const current = socket[kAxiosCurrentReq];
|
|
38365
|
+
if (current && !current.destroyed) {
|
|
38366
|
+
current.destroy(err);
|
|
38367
|
+
}
|
|
38368
|
+
});
|
|
38369
|
+
socket[kAxiosSocketListener] = true;
|
|
38370
|
+
}
|
|
38322
38371
|
|
|
38323
|
-
|
|
38324
|
-
removeSocketErrorListener();
|
|
38372
|
+
socket[kAxiosCurrentReq] = req;
|
|
38325
38373
|
|
|
38326
|
-
|
|
38327
|
-
|
|
38374
|
+
req.once('close', function clearCurrentReq() {
|
|
38375
|
+
if (socket[kAxiosCurrentReq] === req) {
|
|
38376
|
+
socket[kAxiosCurrentReq] = null;
|
|
38328
38377
|
}
|
|
38329
|
-
}
|
|
38330
|
-
|
|
38331
|
-
socket.on('error', handleRequestSocketError);
|
|
38332
|
-
req.once('close', removeSocketErrorListener);
|
|
38378
|
+
});
|
|
38333
38379
|
});
|
|
38334
38380
|
|
|
38335
38381
|
// Handle request timeout
|
|
@@ -38515,7 +38561,18 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing
|
|
|
38515
38561
|
function mergeConfig$2(config1, config2) {
|
|
38516
38562
|
// eslint-disable-next-line no-param-reassign
|
|
38517
38563
|
config2 = config2 || {};
|
|
38518
|
-
|
|
38564
|
+
|
|
38565
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
38566
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype
|
|
38567
|
+
// (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
|
|
38568
|
+
// own slot to preserve ergonomics for user code that relies on it.
|
|
38569
|
+
const config = Object.create(null);
|
|
38570
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
38571
|
+
value: Object.prototype.hasOwnProperty,
|
|
38572
|
+
enumerable: false,
|
|
38573
|
+
writable: true,
|
|
38574
|
+
configurable: true,
|
|
38575
|
+
});
|
|
38519
38576
|
|
|
38520
38577
|
function getMergedValue(target, source, prop, caseless) {
|
|
38521
38578
|
if (utils$8.isPlainObject(target) && utils$8.isPlainObject(source)) {
|
|
@@ -38588,6 +38645,7 @@ function mergeConfig$2(config1, config2) {
|
|
|
38588
38645
|
httpsAgent: defaultToConfig2,
|
|
38589
38646
|
cancelToken: defaultToConfig2,
|
|
38590
38647
|
socketPath: defaultToConfig2,
|
|
38648
|
+
allowedSocketPaths: defaultToConfig2,
|
|
38591
38649
|
responseEncoding: defaultToConfig2,
|
|
38592
38650
|
validateStatus: mergeDirectKeys,
|
|
38593
38651
|
headers: (a, b, prop) =>
|
|
@@ -38609,12 +38667,24 @@ function mergeConfig$2(config1, config2) {
|
|
|
38609
38667
|
var resolveConfig$1 = (config) => {
|
|
38610
38668
|
const newConfig = mergeConfig$2({}, config);
|
|
38611
38669
|
|
|
38612
|
-
|
|
38670
|
+
// Read only own properties to prevent prototype pollution gadgets
|
|
38671
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
|
|
38672
|
+
const own = (key) => (utils$8.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
|
|
38673
|
+
|
|
38674
|
+
const data = own('data');
|
|
38675
|
+
let withXSRFToken = own('withXSRFToken');
|
|
38676
|
+
const xsrfHeaderName = own('xsrfHeaderName');
|
|
38677
|
+
const xsrfCookieName = own('xsrfCookieName');
|
|
38678
|
+
let headers = own('headers');
|
|
38679
|
+
const auth = own('auth');
|
|
38680
|
+
const baseURL = own('baseURL');
|
|
38681
|
+
const allowAbsoluteUrls = own('allowAbsoluteUrls');
|
|
38682
|
+
const url = own('url');
|
|
38613
38683
|
|
|
38614
38684
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
38615
38685
|
|
|
38616
38686
|
newConfig.url = buildURL(
|
|
38617
|
-
buildFullPath(
|
|
38687
|
+
buildFullPath(baseURL, url, allowAbsoluteUrls),
|
|
38618
38688
|
config.params,
|
|
38619
38689
|
config.paramsSerializer
|
|
38620
38690
|
);
|
|
@@ -39644,7 +39714,9 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
39644
39714
|
let i = keys.length;
|
|
39645
39715
|
while (i-- > 0) {
|
|
39646
39716
|
const opt = keys[i];
|
|
39647
|
-
|
|
39717
|
+
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
39718
|
+
// a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
|
|
39719
|
+
const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
39648
39720
|
if (validator) {
|
|
39649
39721
|
const value = options[opt];
|
|
39650
39722
|
const result = value === undefined || validator(value, opt, options);
|
|
@@ -93366,10 +93438,6 @@ async function validateTransactionsOpcodes(txs) {
|
|
|
93366
93438
|
}
|
|
93367
93439
|
return txElevatedPayloads;
|
|
93368
93440
|
}
|
|
93369
|
-
var MnemonicStringZod = string$2().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
93370
|
-
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
93371
|
-
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
93372
|
-
).describe("BIP-39 mnemonic string");
|
|
93373
93441
|
var ChainConfigZod = object$4({
|
|
93374
93442
|
id: HexZod.optional().register(globalRegistry, {
|
|
93375
93443
|
description: "The unique identifier for the chain. Should be the staking contract address for contract-backed chains.",
|
|
@@ -94238,11 +94306,15 @@ var BaseConfigZod = object$4({
|
|
|
94238
94306
|
});
|
|
94239
94307
|
|
|
94240
94308
|
// src/config/Actor.ts
|
|
94309
|
+
var AccountPathZod = string$2().regex(
|
|
94310
|
+
/^(m(\/\d+'?)+|\d+'?(\/\d+'?)*)$/,
|
|
94311
|
+
`Invalid BIP-32 derivation path. Use either an absolute path like "m/44'/60'/0'/0/0" or a relative path like "0", "0/1", or "44'/60'/0'/0/0".`
|
|
94312
|
+
);
|
|
94241
94313
|
var ActorConfigZod = BaseConfigZod.extend({
|
|
94242
94314
|
name: string$2(),
|
|
94243
|
-
|
|
94244
|
-
description:
|
|
94245
|
-
title: "
|
|
94315
|
+
accountPath: AccountPathZod.optional().register(globalRegistry, {
|
|
94316
|
+
description: 'BIP-32 derivation path for the actor wallet. Absolute when it starts with "m/"; otherwise relative to the root wallet base path. Each actor must derive to a distinct path.',
|
|
94317
|
+
title: "accountPath",
|
|
94246
94318
|
type: "string"
|
|
94247
94319
|
}),
|
|
94248
94320
|
healthCheckPort: number$2().optional().register(globalRegistry, {
|
|
@@ -97354,13 +97426,16 @@ var RuntimeStatusMonitor = class extends LoggerStatusReporter {
|
|
|
97354
97426
|
}
|
|
97355
97427
|
}
|
|
97356
97428
|
};
|
|
97429
|
+
string$2().transform((s) => s.trim().replaceAll(/\s+/g, " ")).refine(
|
|
97430
|
+
(s) => [12, 15, 18, 21, 24].includes(s.split(" ").length),
|
|
97431
|
+
{ message: "Mnemonic must contain 12, 15, 18, 21, or 24 words." }
|
|
97432
|
+
).describe("BIP-39 mnemonic string");
|
|
97357
97433
|
|
|
97358
97434
|
// src/wallet/paths.ts
|
|
97359
97435
|
var WALLET_COMPLIANCE = "44'";
|
|
97360
97436
|
var COIN_TYPES = { Ethereum: "60'" };
|
|
97361
97437
|
var ACCOUNT_TYPE = { XYO: "0'" };
|
|
97362
97438
|
var CHANGE_ADDRESS = { XYO: "0" };
|
|
97363
|
-
var ADDRESS_INDEX = { XYO: "0" };
|
|
97364
97439
|
var DEFAULT_WALLET_PATH = `m/${WALLET_COMPLIANCE}/${COIN_TYPES.Ethereum}/${ACCOUNT_TYPE.XYO}/${CHANGE_ADDRESS.XYO}`;
|
|
97365
97440
|
|
|
97366
97441
|
// src/wallet/generateXyoBaseWalletFromPhrase.ts
|
|
@@ -106406,7 +106481,7 @@ var ChainHeadSelector = class extends ChainFinalizer {
|
|
|
106406
106481
|
constructor(params) {
|
|
106407
106482
|
super(params);
|
|
106408
106483
|
this.allowedProducers = params.allowedProducers;
|
|
106409
|
-
this.minCandidates = params.minCandidates
|
|
106484
|
+
this.minCandidates = params.minCandidates;
|
|
106410
106485
|
}
|
|
106411
106486
|
get context() {
|
|
106412
106487
|
return this.params.context;
|
|
@@ -202706,15 +202781,7 @@ function buildTelemetryConfig(config, serviceName, serviceVersion, defaultMetric
|
|
|
202706
202781
|
return telemetryConfig;
|
|
202707
202782
|
}
|
|
202708
202783
|
__name$7(buildTelemetryConfig, "buildTelemetryConfig");
|
|
202709
|
-
var ActorAccountIndexZod = /* @__PURE__ */ __name$7((title) => number$2().int().min(0).optional().register(globalRegistry, {
|
|
202710
|
-
description: "Account index derived from the actor wallet phrase. Defaults to 0 for actor mnemonics and to the actor-specific shared index for the root mnemonic.",
|
|
202711
|
-
title,
|
|
202712
|
-
type: "number"
|
|
202713
|
-
}), "ActorAccountIndexZod");
|
|
202714
|
-
|
|
202715
|
-
// src/shared/config/actors/Api.ts
|
|
202716
202784
|
var ApiConfigZod = HostActorConfigZod.extend(object$4({
|
|
202717
|
-
accountIndex: ActorAccountIndexZod("api.accountIndex"),
|
|
202718
202785
|
initRewardsCache: union$1([
|
|
202719
202786
|
number$3(),
|
|
202720
202787
|
string$2(),
|
|
@@ -202738,7 +202805,6 @@ var DEFAULT_MAX_BRIDGE_AMOUNT = toHex(XL1(1000000n) * AttoXL1ConvertFactor.xl1);
|
|
|
202738
202805
|
var DEFAULT_MIN_BRIDGE_AMOUNT = toHex(XL1(1500n) * AttoXL1ConvertFactor.xl1);
|
|
202739
202806
|
var BasisPointsZod = number$2().int().nonnegative().max(1e4);
|
|
202740
202807
|
var BridgeConfigZod = HostActorConfigZod.extend({
|
|
202741
|
-
accountIndex: ActorAccountIndexZod("bridge.accountIndex"),
|
|
202742
202808
|
escrowAddress: AddressZod.optional().register(globalRegistry, {
|
|
202743
202809
|
description: "Address to which bridge escrow will be sent",
|
|
202744
202810
|
title: "bridge.escrowAddress",
|
|
@@ -202836,9 +202902,8 @@ var BridgeConfigContext = BaseConfigContextZod.extend({
|
|
|
202836
202902
|
});
|
|
202837
202903
|
var asBridgeConfigContext = zodAsFactory(BridgeConfigContext, "asBridgeConfigContext");
|
|
202838
202904
|
var FinalizerConfigZod = HostActorConfigZod.extend({
|
|
202839
|
-
accountIndex: ActorAccountIndexZod("finalizer.accountIndex"),
|
|
202840
202905
|
allowedProducers: array$1(AddressZod).optional(),
|
|
202841
|
-
minCandidates: number$3().int().min(0).default(
|
|
202906
|
+
minCandidates: number$3().int().min(0).default(DEFAULT_MIN_CANDIDATES)
|
|
202842
202907
|
});
|
|
202843
202908
|
BaseConfigContextZod.extend({
|
|
202844
202909
|
config: FinalizerConfigZod
|
|
@@ -202846,7 +202911,6 @@ BaseConfigContextZod.extend({
|
|
|
202846
202911
|
var DEFAULT_MEMPOOL_BLOCK_PRUNE_INTERVAL = 1e3;
|
|
202847
202912
|
var DEFAULT_MEMPOOL_TRANSACTION_PRUNE_INTERVAL = 1e3;
|
|
202848
202913
|
var MempoolConfigZod = HostActorConfigZod.extend({
|
|
202849
|
-
accountIndex: ActorAccountIndexZod("mempool.accountIndex"),
|
|
202850
202914
|
enabled: union$1([
|
|
202851
202915
|
string$2(),
|
|
202852
202916
|
boolean$1()
|
|
@@ -202893,7 +202957,6 @@ BaseConfigContextZod.extend({
|
|
|
202893
202957
|
});
|
|
202894
202958
|
var DEFAULT_BLOCK_PRODUCTION_CHECK_INTERVAL = 1e4;
|
|
202895
202959
|
var ProducerConfigZod = ActorConfigZod.extend(object$4({
|
|
202896
|
-
accountIndex: ActorAccountIndexZod("producer.accountIndex"),
|
|
202897
202960
|
allowlist: preprocess((val) => {
|
|
202898
202961
|
if (typeof val === "string") {
|
|
202899
202962
|
return val.split(",").map((s) => asAddress(s.trim()));
|
|
@@ -202935,9 +202998,7 @@ var ProducerConfigZod = ActorConfigZod.extend(object$4({
|
|
|
202935
202998
|
BaseConfigContextZod.extend({
|
|
202936
202999
|
config: ProducerConfigZod
|
|
202937
203000
|
});
|
|
202938
|
-
var RewardRedemptionConfigZod = HostActorConfigZod.extend({
|
|
202939
|
-
accountIndex: ActorAccountIndexZod("rewardRedemption.accountIndex")
|
|
202940
|
-
});
|
|
203001
|
+
var RewardRedemptionConfigZod = HostActorConfigZod.extend({});
|
|
202941
203002
|
BaseConfigContextZod.extend({
|
|
202942
203003
|
config: RewardRedemptionConfigZod
|
|
202943
203004
|
});
|
|
@@ -202992,21 +203053,20 @@ __name$7(createProducerChainStakeIntentBlock, "createProducerChainStakeIntentBlo
|
|
|
202992
203053
|
return this._services[serviceIdentifier];
|
|
202993
203054
|
}
|
|
202994
203055
|
});
|
|
203056
|
+
var DEFAULT_ACTOR_ACCOUNT_PATH = {
|
|
203057
|
+
api: "3",
|
|
203058
|
+
bridge: "1",
|
|
203059
|
+
finalizer: "5",
|
|
203060
|
+
mempool: "4",
|
|
203061
|
+
producer: "0",
|
|
203062
|
+
rewardRedemption: "2"
|
|
203063
|
+
};
|
|
202995
203064
|
var BUILT_IN_DEV_MNEMONIC = "crane ribbon cook cousin tobacco vital moral protect merit knock veteran hint knee ocean nurse";
|
|
202996
203065
|
var INSECURE_GENESIS_REWARD_MNEMONIC = "test test test test test test test test test test test junk";
|
|
202997
203066
|
var GENESIS_REWARD_AMOUNT = 20000000000000000000000n;
|
|
202998
203067
|
var ATTO_XL1_PER_XL1 = 1000000000000000000n;
|
|
202999
203068
|
var ROOT_WALLET_RUNTIME_ID = "_root";
|
|
203000
203069
|
var SHARED_ACCOUNT_REPORT_COUNT = 10;
|
|
203001
|
-
var RESERVED_ACTOR_INDEX = {
|
|
203002
|
-
[ROOT_WALLET_RUNTIME_ID]: 0,
|
|
203003
|
-
api: 4,
|
|
203004
|
-
bridge: 2,
|
|
203005
|
-
finalizer: 6,
|
|
203006
|
-
mempool: 5,
|
|
203007
|
-
producer: 1,
|
|
203008
|
-
rewardRedemption: 3
|
|
203009
|
-
};
|
|
203010
203070
|
var ACTOR_LABELS = {
|
|
203011
203071
|
[ROOT_WALLET_RUNTIME_ID]: "root/local-node",
|
|
203012
203072
|
api: "api",
|
|
@@ -203025,10 +203085,30 @@ function clearResolvedWalletReport() {
|
|
|
203025
203085
|
activeWalletReport = void 0;
|
|
203026
203086
|
}
|
|
203027
203087
|
__name$7(clearResolvedWalletReport, "clearResolvedWalletReport");
|
|
203028
|
-
function
|
|
203029
|
-
|
|
203030
|
-
|
|
203031
|
-
|
|
203088
|
+
function resolveActorAccountPath(actorName, actorConfig) {
|
|
203089
|
+
if (actorConfig?.accountPath !== void 0) return actorConfig.accountPath;
|
|
203090
|
+
return DEFAULT_ACTOR_ACCOUNT_PATH[actorName] ?? "0";
|
|
203091
|
+
}
|
|
203092
|
+
__name$7(resolveActorAccountPath, "resolveActorAccountPath");
|
|
203093
|
+
function isAbsoluteAccountPath(accountPath) {
|
|
203094
|
+
return accountPath.startsWith("m/");
|
|
203095
|
+
}
|
|
203096
|
+
__name$7(isAbsoluteAccountPath, "isAbsoluteAccountPath");
|
|
203097
|
+
function expandAccountPath(accountPath, basePath = DEFAULT_WALLET_PATH) {
|
|
203098
|
+
return isAbsoluteAccountPath(accountPath) ? accountPath : `${basePath}/${accountPath}`;
|
|
203099
|
+
}
|
|
203100
|
+
__name$7(expandAccountPath, "expandAccountPath");
|
|
203101
|
+
async function deriveWalletAtPath(mnemonic, accountPath) {
|
|
203102
|
+
if (isAbsoluteAccountPath(accountPath)) {
|
|
203103
|
+
const seed = Mnemonic.fromPhrase(mnemonic).computeSeed();
|
|
203104
|
+
const rootNode = HDNodeWallet.fromSeed(seed);
|
|
203105
|
+
const derivedNode = rootNode.derivePath(accountPath);
|
|
203106
|
+
return await HDWallet.createFromNode(derivedNode);
|
|
203107
|
+
}
|
|
203108
|
+
const baseWallet = await generateXyoBaseWalletFromPhrase(mnemonic);
|
|
203109
|
+
return await baseWallet.derivePath(accountPath);
|
|
203110
|
+
}
|
|
203111
|
+
__name$7(deriveWalletAtPath, "deriveWalletAtPath");
|
|
203032
203112
|
function getBuiltInDevMnemonic() {
|
|
203033
203113
|
return BUILT_IN_DEV_MNEMONIC;
|
|
203034
203114
|
}
|
|
@@ -203050,83 +203130,115 @@ function resolveRootWallet(configuration) {
|
|
|
203050
203130
|
};
|
|
203051
203131
|
}
|
|
203052
203132
|
__name$7(resolveRootWallet, "resolveRootWallet");
|
|
203053
|
-
async function resolveWalletMetadata({
|
|
203054
|
-
const
|
|
203055
|
-
const derivationPath = `${DEFAULT_WALLET_PATH}/${accountIndex}`;
|
|
203056
|
-
const account = await wallet.derivePath(`${accountIndex}`);
|
|
203133
|
+
async function resolveWalletMetadata({ accountPath, actorName, mnemonic, mnemonicKind }) {
|
|
203134
|
+
const account = await deriveWalletAtPath(mnemonic, accountPath);
|
|
203057
203135
|
return {
|
|
203058
|
-
|
|
203136
|
+
accountPath,
|
|
203059
203137
|
actorName,
|
|
203060
203138
|
address: account.address,
|
|
203061
|
-
derivationPath,
|
|
203139
|
+
derivationPath: expandAccountPath(accountPath),
|
|
203062
203140
|
label: getAccountLabel(actorName),
|
|
203063
203141
|
mnemonic,
|
|
203064
203142
|
mnemonicKind,
|
|
203065
203143
|
privateKey: account.privateKey,
|
|
203066
|
-
source,
|
|
203067
203144
|
usesBuiltInDevMnemonic: mnemonic === BUILT_IN_DEV_MNEMONIC
|
|
203068
203145
|
};
|
|
203069
203146
|
}
|
|
203070
203147
|
__name$7(resolveWalletMetadata, "resolveWalletMetadata");
|
|
203071
203148
|
async function resolveActorWallet(actorName, actorConfig, root) {
|
|
203072
|
-
|
|
203073
|
-
|
|
203074
|
-
return await resolveWalletMetadata(actorMnemonic ? {
|
|
203075
|
-
accountIndex: accountIndex ?? 0,
|
|
203076
|
-
actorName,
|
|
203077
|
-
mnemonic: actorMnemonic,
|
|
203078
|
-
mnemonicKind: "configured-actor",
|
|
203079
|
-
source: "actor"
|
|
203080
|
-
} : {
|
|
203081
|
-
accountIndex: accountIndex ?? getReservedActorIndex(actorName),
|
|
203149
|
+
return await resolveWalletMetadata({
|
|
203150
|
+
accountPath: resolveActorAccountPath(actorName, actorConfig),
|
|
203082
203151
|
actorName,
|
|
203083
203152
|
mnemonic: root.mnemonic,
|
|
203084
|
-
mnemonicKind: root.mnemonicKind
|
|
203085
|
-
source: "root"
|
|
203153
|
+
mnemonicKind: root.mnemonicKind
|
|
203086
203154
|
});
|
|
203087
203155
|
}
|
|
203088
203156
|
__name$7(resolveActorWallet, "resolveActorWallet");
|
|
203157
|
+
var ActorMnemonicNotAllowedError = class extends Error {
|
|
203158
|
+
static {
|
|
203159
|
+
__name$7(this, "ActorMnemonicNotAllowedError");
|
|
203160
|
+
}
|
|
203161
|
+
actors;
|
|
203162
|
+
constructor(actors) {
|
|
203163
|
+
super([
|
|
203164
|
+
`Per-actor mnemonics are no longer allowed (found on: ${actors.join(", ")}).`,
|
|
203165
|
+
'Move the mnemonic to the root (XL1_MNEMONIC, --mnemonic, or config file "xl1.mnemonic") and give each actor a distinct accountPath.'
|
|
203166
|
+
].join("\n"));
|
|
203167
|
+
this.name = "ActorMnemonicNotAllowedError";
|
|
203168
|
+
this.actors = actors;
|
|
203169
|
+
}
|
|
203170
|
+
};
|
|
203171
|
+
function assertNoActorMnemonics(configuration) {
|
|
203172
|
+
const offenders = configuration.actors.filter((actor) => typeof actor.mnemonic === "string").map((actor) => actor.name);
|
|
203173
|
+
if (offenders.length > 0) throw new ActorMnemonicNotAllowedError(offenders);
|
|
203174
|
+
}
|
|
203175
|
+
__name$7(assertNoActorMnemonics, "assertNoActorMnemonics");
|
|
203176
|
+
var DerivationPathCollisionError = class extends Error {
|
|
203177
|
+
static {
|
|
203178
|
+
__name$7(this, "DerivationPathCollisionError");
|
|
203179
|
+
}
|
|
203180
|
+
collisions;
|
|
203181
|
+
constructor(collisions) {
|
|
203182
|
+
const lines = Object.entries(collisions).map(([path, actors]) => ` - ${actors.join(", ")} \u2192 ${path}`);
|
|
203183
|
+
super([
|
|
203184
|
+
"Two or more actors resolve to the same wallet derivation path:",
|
|
203185
|
+
...lines,
|
|
203186
|
+
"Change each actor's accountPath so every actor has a distinct path."
|
|
203187
|
+
].join("\n"));
|
|
203188
|
+
this.name = "DerivationPathCollisionError";
|
|
203189
|
+
this.collisions = collisions;
|
|
203190
|
+
}
|
|
203191
|
+
};
|
|
203192
|
+
function detectDerivationPathCollisions(requestedActors, configuration) {
|
|
203193
|
+
const actorConfigMap = new Map(configuration.actors.map((actor) => [
|
|
203194
|
+
actor.name,
|
|
203195
|
+
actor
|
|
203196
|
+
]));
|
|
203197
|
+
const bucketsByPath = /* @__PURE__ */ new Map();
|
|
203198
|
+
for (const actorName of requestedActors) {
|
|
203199
|
+
const accountPath = resolveActorAccountPath(actorName, actorConfigMap.get(actorName));
|
|
203200
|
+
const fullPath = expandAccountPath(accountPath);
|
|
203201
|
+
const bucket = bucketsByPath.get(fullPath) ?? [];
|
|
203202
|
+
bucket.push(actorName);
|
|
203203
|
+
bucketsByPath.set(fullPath, bucket);
|
|
203204
|
+
}
|
|
203205
|
+
const collisions = {};
|
|
203206
|
+
for (const [path, actors] of bucketsByPath) {
|
|
203207
|
+
if (actors.length > 1) collisions[path] = actors;
|
|
203208
|
+
}
|
|
203209
|
+
if (Object.keys(collisions).length === 0) return void 0;
|
|
203210
|
+
return new DerivationPathCollisionError(collisions);
|
|
203211
|
+
}
|
|
203212
|
+
__name$7(detectDerivationPathCollisions, "detectDerivationPathCollisions");
|
|
203089
203213
|
async function resolveWalletReport(requestedActors, configuration) {
|
|
203090
203214
|
const root = resolveRootWallet(configuration);
|
|
203091
203215
|
const actorConfigMap = new Map(configuration.actors.map((actor) => [
|
|
203092
203216
|
actor.name,
|
|
203093
203217
|
actor
|
|
203094
203218
|
]));
|
|
203095
|
-
const isRootRequired = requestedActors.some((actorName) => !actorConfigMap.get(actorName)?.mnemonic);
|
|
203096
203219
|
const resolvedActors = await Promise.all(requestedActors.map(async (actorName) => await resolveActorWallet(actorName, actorConfigMap.get(actorName), root)));
|
|
203097
|
-
const labelMap = /* @__PURE__ */ new Map(
|
|
203098
|
-
[
|
|
203099
|
-
0,
|
|
203100
|
-
[
|
|
203101
|
-
getAccountLabel(ROOT_WALLET_RUNTIME_ID)
|
|
203102
|
-
]
|
|
203103
|
-
]
|
|
203104
|
-
]);
|
|
203220
|
+
const labelMap = /* @__PURE__ */ new Map();
|
|
203105
203221
|
for (const actor of resolvedActors) {
|
|
203106
|
-
|
|
203107
|
-
const labels = labelMap.get(actor.accountIndex) ?? [];
|
|
203222
|
+
const labels = labelMap.get(actor.derivationPath) ?? [];
|
|
203108
203223
|
labels.push(actor.label);
|
|
203109
|
-
labelMap.set(actor.
|
|
203224
|
+
labelMap.set(actor.derivationPath, labels);
|
|
203110
203225
|
}
|
|
203111
203226
|
const sharedAccounts = await Promise.all(Array.from({
|
|
203112
203227
|
length: SHARED_ACCOUNT_REPORT_COUNT
|
|
203113
|
-
}, (_, index) => index).map(async (
|
|
203228
|
+
}, (_, index) => index).map(async (sharedIndex) => {
|
|
203114
203229
|
const account = await resolveWalletMetadata({
|
|
203115
|
-
|
|
203230
|
+
accountPath: `${sharedIndex}`,
|
|
203116
203231
|
actorName: ROOT_WALLET_RUNTIME_ID,
|
|
203117
203232
|
mnemonic: root.mnemonic,
|
|
203118
|
-
mnemonicKind: root.mnemonicKind
|
|
203119
|
-
source: "root"
|
|
203233
|
+
mnemonicKind: root.mnemonicKind
|
|
203120
203234
|
});
|
|
203121
|
-
const labels = labelMap.get(
|
|
203235
|
+
const labels = labelMap.get(account.derivationPath);
|
|
203122
203236
|
return {
|
|
203123
203237
|
...account,
|
|
203124
|
-
label: labels?.join(", ") ?? `shared[${
|
|
203238
|
+
label: labels?.join(", ") ?? `shared[${sharedIndex}]`
|
|
203125
203239
|
};
|
|
203126
203240
|
}));
|
|
203127
203241
|
return {
|
|
203128
|
-
actorSpecificAccounts: resolvedActors.filter((actor) => actor.source === "actor"),
|
|
203129
|
-
isRootRequired,
|
|
203130
203242
|
requestedActors: [
|
|
203131
203243
|
...requestedActors
|
|
203132
203244
|
],
|
|
@@ -203138,17 +203250,16 @@ __name$7(resolveWalletReport, "resolveWalletReport");
|
|
|
203138
203250
|
async function buildInsecureGenesisRewardAccounts() {
|
|
203139
203251
|
const accounts = await Promise.all(Array.from({
|
|
203140
203252
|
length: SHARED_ACCOUNT_REPORT_COUNT
|
|
203141
|
-
}, (_, index) => index).map(async (
|
|
203253
|
+
}, (_, index) => index).map(async (sharedIndex) => {
|
|
203142
203254
|
const account = await resolveWalletMetadata({
|
|
203143
|
-
|
|
203255
|
+
accountPath: `${sharedIndex}`,
|
|
203144
203256
|
actorName: "genesisReward",
|
|
203145
203257
|
mnemonic: INSECURE_GENESIS_REWARD_MNEMONIC,
|
|
203146
|
-
mnemonicKind: "
|
|
203147
|
-
source: "actor"
|
|
203258
|
+
mnemonicKind: "insecure-genesis-reward"
|
|
203148
203259
|
});
|
|
203149
203260
|
return {
|
|
203150
203261
|
...account,
|
|
203151
|
-
label:
|
|
203262
|
+
label: sharedIndex === 0 ? "genesisRewardAddress" : `genesisReward[${sharedIndex}]`
|
|
203152
203263
|
};
|
|
203153
203264
|
}));
|
|
203154
203265
|
return accounts;
|
|
@@ -203165,7 +203276,7 @@ function getResolvedWalletReport() {
|
|
|
203165
203276
|
__name$7(getResolvedWalletReport, "getResolvedWalletReport");
|
|
203166
203277
|
function formatSharedAccount(account, showPrivateKey) {
|
|
203167
203278
|
const lines = [
|
|
203168
|
-
`[${account.
|
|
203279
|
+
`[${account.accountPath}] ${account.label}`,
|
|
203169
203280
|
`source: ${account.mnemonicKind === "built-in-dev" ? "built-in dev mnemonic" : "configured root mnemonic"}`,
|
|
203170
203281
|
`path: ${account.derivationPath}`,
|
|
203171
203282
|
`address: ${account.address}`
|
|
@@ -203174,19 +203285,10 @@ function formatSharedAccount(account, showPrivateKey) {
|
|
|
203174
203285
|
return lines.join("\n");
|
|
203175
203286
|
}
|
|
203176
203287
|
__name$7(formatSharedAccount, "formatSharedAccount");
|
|
203177
|
-
function formatActorSpecificAccount(account) {
|
|
203178
|
-
return [
|
|
203179
|
-
account.label,
|
|
203180
|
-
"source: actor mnemonic",
|
|
203181
|
-
`path: ${account.derivationPath}`,
|
|
203182
|
-
`address: ${account.address}`
|
|
203183
|
-
].join("\n");
|
|
203184
|
-
}
|
|
203185
|
-
__name$7(formatActorSpecificAccount, "formatActorSpecificAccount");
|
|
203186
203288
|
function formatGenesisRewardAccount(account) {
|
|
203187
|
-
const balance = account.
|
|
203289
|
+
const balance = account.accountPath === "0" ? GENESIS_REWARD_AMOUNT / ATTO_XL1_PER_XL1 : 0n;
|
|
203188
203290
|
return [
|
|
203189
|
-
`[${account.
|
|
203291
|
+
`[${account.accountPath}] ${account.label}`,
|
|
203190
203292
|
`path: ${account.derivationPath}`,
|
|
203191
203293
|
`address: ${account.address}`,
|
|
203192
203294
|
`privateKey: ${account.privateKey ?? "unavailable"}`,
|
|
@@ -203196,13 +203298,8 @@ function formatGenesisRewardAccount(account) {
|
|
|
203196
203298
|
__name$7(formatGenesisRewardAccount, "formatGenesisRewardAccount");
|
|
203197
203299
|
function formatWalletReport(report) {
|
|
203198
203300
|
const sections = [];
|
|
203199
|
-
const
|
|
203200
|
-
|
|
203201
|
-
if (showRootSection) {
|
|
203202
|
-
sections.push(showSecrets ? "Development wallet detected." : "Wallet summary");
|
|
203203
|
-
} else {
|
|
203204
|
-
sections.push("Wallet summary (root wallet not required \u2014 every requested actor has its own mnemonic)");
|
|
203205
|
-
}
|
|
203301
|
+
const showSecrets = report.root.isBuiltInDevMnemonic;
|
|
203302
|
+
sections.push(showSecrets ? "Development wallet detected." : "Wallet summary");
|
|
203206
203303
|
if (showSecrets) {
|
|
203207
203304
|
sections.push([
|
|
203208
203305
|
"DEVELOPMENT WALLET WARNING",
|
|
@@ -203216,20 +203313,11 @@ function formatWalletReport(report) {
|
|
|
203216
203313
|
report.root.mnemonic
|
|
203217
203314
|
].join("\n"));
|
|
203218
203315
|
}
|
|
203219
|
-
|
|
203220
|
-
|
|
203221
|
-
|
|
203222
|
-
|
|
203223
|
-
|
|
203224
|
-
].join("\n"));
|
|
203225
|
-
}
|
|
203226
|
-
if (report.actorSpecificAccounts.length > 0) {
|
|
203227
|
-
sections.push([
|
|
203228
|
-
"Actor-specific wallet accounts:",
|
|
203229
|
-
"",
|
|
203230
|
-
report.actorSpecificAccounts.map((account) => formatActorSpecificAccount(account)).join("\n\n")
|
|
203231
|
-
].join("\n"));
|
|
203232
|
-
}
|
|
203316
|
+
sections.push([
|
|
203317
|
+
`Shared wallet accounts from ${report.root.basePath}:`,
|
|
203318
|
+
"",
|
|
203319
|
+
report.sharedAccounts.map((account) => formatSharedAccount(account, showSecrets)).join("\n\n")
|
|
203320
|
+
].join("\n"));
|
|
203233
203321
|
return sections.join("\n\n");
|
|
203234
203322
|
}
|
|
203235
203323
|
__name$7(formatWalletReport, "formatWalletReport");
|
|
@@ -203259,12 +203347,11 @@ async function resolveGenesisRewardAddress(config) {
|
|
|
203259
203347
|
return account.address;
|
|
203260
203348
|
}
|
|
203261
203349
|
__name$7(resolveGenesisRewardAddress, "resolveGenesisRewardAddress");
|
|
203262
|
-
async function resolveWalletForActor(actorName,
|
|
203263
|
-
const
|
|
203264
|
-
const
|
|
203265
|
-
const
|
|
203266
|
-
|
|
203267
|
-
return await wallet.derivePath(`${resolvedAccountIndex}`);
|
|
203350
|
+
async function resolveWalletForActor(actorName, accountPath) {
|
|
203351
|
+
const report = activeWalletReport;
|
|
203352
|
+
const mnemonic = report?.root.mnemonic ?? BUILT_IN_DEV_MNEMONIC;
|
|
203353
|
+
const resolvedAccountPath = accountPath ?? resolveActorAccountPath(actorName);
|
|
203354
|
+
return await deriveWalletAtPath(mnemonic, resolvedAccountPath);
|
|
203268
203355
|
}
|
|
203269
203356
|
__name$7(resolveWalletForActor, "resolveWalletForActor");
|
|
203270
203357
|
|
|
@@ -203273,8 +203360,8 @@ var actorAccountSingletons = {};
|
|
|
203273
203360
|
async function initActorAccount({ config, logger }) {
|
|
203274
203361
|
const actorName = config.name;
|
|
203275
203362
|
if (isDefined(actorAccountSingletons[actorName])) return actorAccountSingletons[actorName];
|
|
203276
|
-
const
|
|
203277
|
-
const account = await resolveWalletForActor(actorName,
|
|
203363
|
+
const accountPath = typeof config.accountPath === "string" ? config.accountPath : void 0;
|
|
203364
|
+
const account = await resolveWalletForActor(actorName, accountPath);
|
|
203278
203365
|
logger?.debug(`[${actorName}] Using wallet address ${account.address}`);
|
|
203279
203366
|
actorAccountSingletons[actorName] = account;
|
|
203280
203367
|
return actorAccountSingletons[actorName];
|
|
@@ -203284,10 +203371,7 @@ async function initActorSeedPhrase(context, bios) {
|
|
|
203284
203371
|
const { logger, config } = context;
|
|
203285
203372
|
const walletKind = config.name;
|
|
203286
203373
|
const report = getResolvedWalletReport();
|
|
203287
|
-
const account = config.name === ROOT_WALLET_RUNTIME_ID ? report?.sharedAccounts.find((entry) => entry.accountIndex === 0) : report?.actorSpecificAccounts.find((entry) => entry.actorName === config.name);
|
|
203288
|
-
if (isString$3(account?.mnemonic)) return account.mnemonic;
|
|
203289
203374
|
if (isString$3(report?.root.mnemonic)) return report.root.mnemonic;
|
|
203290
|
-
if (isString$3(config.mnemonic)) return config.mnemonic;
|
|
203291
203375
|
const fallback = getBuiltInDevMnemonic();
|
|
203292
203376
|
logger?.debug(`[${walletKind}] Falling back to built-in development mnemonic`);
|
|
203293
203377
|
return assertEx(fallback, () => "Unable to resolve mnemonic");
|
|
@@ -203336,10 +203420,10 @@ function initStatusReporter({ logger }) {
|
|
|
203336
203420
|
__name$7(initStatusReporter, "initStatusReporter");
|
|
203337
203421
|
|
|
203338
203422
|
// src/shared/init/initWallet.ts
|
|
203339
|
-
async function initActorWallet(context
|
|
203340
|
-
const actorName = context.config.name
|
|
203341
|
-
const
|
|
203342
|
-
return await resolveWalletForActor(actorName,
|
|
203423
|
+
async function initActorWallet(context) {
|
|
203424
|
+
const actorName = context.config.name;
|
|
203425
|
+
const accountPath = typeof context.config.accountPath === "string" ? context.config.accountPath : void 0;
|
|
203426
|
+
return await resolveWalletForActor(actorName, accountPath);
|
|
203343
203427
|
}
|
|
203344
203428
|
__name$7(initActorWallet, "initActorWallet");
|
|
203345
203429
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
@@ -261912,19 +261996,8 @@ var getRemoteTokenAddress = /* @__PURE__ */ __name$4((config) => {
|
|
|
261912
261996
|
var accountServiceSingleton;
|
|
261913
261997
|
var getBridgeWalletAccount = /* @__PURE__ */ __name$4(async (config) => {
|
|
261914
261998
|
if (accountServiceSingleton) return accountServiceSingleton;
|
|
261915
|
-
|
|
261916
|
-
|
|
261917
|
-
console.log("[Bridge] No wallet mnemonic specified!");
|
|
261918
|
-
const randomMnemonic = HDWallet.generateMnemonic();
|
|
261919
|
-
console.log(`[Bridge] Using randomly generated mnemonic:
|
|
261920
|
-
|
|
261921
|
-
${randomMnemonic}
|
|
261922
|
-
|
|
261923
|
-
`);
|
|
261924
|
-
walletPhrase = randomMnemonic;
|
|
261925
|
-
}
|
|
261926
|
-
const wallet = await generateXyoBaseWalletFromPhrase(walletPhrase);
|
|
261927
|
-
const account = await wallet.derivePath(ADDRESS_INDEX.XYO);
|
|
261999
|
+
const accountPath = typeof config.accountPath === "string" ? config.accountPath : void 0;
|
|
262000
|
+
const account = await resolveWalletForActor(config.name, accountPath);
|
|
261928
262001
|
accountServiceSingleton = account;
|
|
261929
262002
|
return accountServiceSingleton;
|
|
261930
262003
|
}, "getBridgeWalletAccount");
|
|
@@ -263181,8 +263254,8 @@ var getServices = /* @__PURE__ */ __name$4(async (context, gateway) => {
|
|
|
263181
263254
|
const ethTxStateMap = await getIterableMap(config, "liquidity_bridge_xl1_to_eth_eth_tx_state");
|
|
263182
263255
|
const xl1TxStateMap = await getIterableMap(config, "liquidity_bridge_xl1_to_eth_xl1_tx_state");
|
|
263183
263256
|
const provider = await initEvmProvider(context);
|
|
263184
|
-
const { remoteBridgeContractAddress, remoteChainWalletPrivateKey, remoteTokenAddress,
|
|
263185
|
-
const account =
|
|
263257
|
+
const { remoteBridgeContractAddress, remoteChainWalletPrivateKey, remoteTokenAddress, accountPath } = config;
|
|
263258
|
+
const account = await resolveWalletForActor(config.name, accountPath);
|
|
263186
263259
|
const wallet = new Wallet(remoteChainWalletPrivateKey, provider);
|
|
263187
263260
|
const bridgeableToken = BridgeableToken__factory.connect(getAddress(remoteTokenAddress), wallet);
|
|
263188
263261
|
const bridge = LiquidityPoolBridge__factory.connect(getAddress(remoteBridgeContractAddress), wallet);
|
|
@@ -264398,31 +264471,11 @@ var getNode = /* @__PURE__ */ __name$1(async (context, gateway, wallet) => {
|
|
|
264398
264471
|
|
|
264399
264472
|
// src/server/server.ts
|
|
264400
264473
|
var hostname = "::";
|
|
264401
|
-
var getSeedPhrase = /* @__PURE__ */ __name$1(async (bios, config, logger) => {
|
|
264402
|
-
const storedSeedPhrase = await bios.seedPhraseStore.get("os");
|
|
264403
|
-
logger?.debug(`[RewardsRedemption] Stored mnemonic: ${storedSeedPhrase}`);
|
|
264404
|
-
const { mnemonic } = config;
|
|
264405
|
-
if (isString$3(storedSeedPhrase) && isString$3(mnemonic)) {
|
|
264406
|
-
logger?.warn("[RewardsRedemption] Stored mnemonic does not match supplied. Updating stored mnemonic to supplied.");
|
|
264407
|
-
await bios.seedPhraseStore.set("os", mnemonic);
|
|
264408
|
-
} else {
|
|
264409
|
-
let seedPhrase;
|
|
264410
|
-
if (isString$3(mnemonic)) {
|
|
264411
|
-
seedPhrase = mnemonic;
|
|
264412
|
-
} else {
|
|
264413
|
-
seedPhrase = HDWallet.generateMnemonic();
|
|
264414
|
-
logger?.log("[RewardsRedemption] No mnemonic provided, using random mnemonic. This is not recommended for production use.");
|
|
264415
|
-
logger?.log(`[RewardsRedemption] Mnemonic: ${seedPhrase}`);
|
|
264416
|
-
}
|
|
264417
|
-
await bios.seedPhraseStore.set("os", seedPhrase);
|
|
264418
|
-
}
|
|
264419
|
-
return assertEx(await bios.seedPhraseStore.get("os"), () => "Unable to acquire mnemonic from bios");
|
|
264420
|
-
}, "getSeedPhrase");
|
|
264421
264474
|
var getServer = /* @__PURE__ */ __name$1(async (context, gateway, locator, providedNode) => {
|
|
264422
264475
|
const { logger, config } = context;
|
|
264423
|
-
const { port
|
|
264424
|
-
|
|
264425
|
-
const seedPhrase =
|
|
264476
|
+
const { port } = config;
|
|
264477
|
+
await boot();
|
|
264478
|
+
const seedPhrase = await initActorSeedPhrase(context);
|
|
264426
264479
|
const wallet = await HDWallet.fromPhrase(seedPhrase);
|
|
264427
264480
|
const node = providedNode ?? await getNode(context, gateway, wallet);
|
|
264428
264481
|
const app = getApp(node, config, locator);
|
|
@@ -264913,34 +264966,52 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
264913
264966
|
var deepMerge = createDeepMerge({
|
|
264914
264967
|
arrayStrategy: "concat"
|
|
264915
264968
|
});
|
|
264969
|
+
function coerceActorsArray(argv) {
|
|
264970
|
+
const actors = argv.actors;
|
|
264971
|
+
if (actors === void 0 || Array.isArray(actors)) return argv;
|
|
264972
|
+
if (typeof actors !== "object" || actors === null) return argv;
|
|
264973
|
+
const entries = Object.entries(actors);
|
|
264974
|
+
const numericEntries = entries.map(([key, value]) => [
|
|
264975
|
+
Number(key),
|
|
264976
|
+
value
|
|
264977
|
+
]).filter(([key]) => Number.isInteger(key) && key >= 0);
|
|
264978
|
+
if (numericEntries.length !== entries.length) return argv;
|
|
264979
|
+
const asArray = [];
|
|
264980
|
+
for (const [key, value] of numericEntries) asArray[key] = value;
|
|
264981
|
+
return {
|
|
264982
|
+
...argv,
|
|
264983
|
+
actors: asArray
|
|
264984
|
+
};
|
|
264985
|
+
}
|
|
264986
|
+
__name(coerceActorsArray, "coerceActorsArray");
|
|
264987
|
+
function safeParseOrThrow(input2) {
|
|
264988
|
+
const result = ConfigZod.safeParse(input2);
|
|
264989
|
+
if (!result.success) throw result.error;
|
|
264990
|
+
return result.data;
|
|
264991
|
+
}
|
|
264992
|
+
__name(safeParseOrThrow, "safeParseOrThrow");
|
|
264993
|
+
async function buildFinalConfig(argv) {
|
|
264994
|
+
const configPath = argv.config;
|
|
264995
|
+
const parsedConfigFile = await tryParseConfig({
|
|
264996
|
+
configPath
|
|
264997
|
+
});
|
|
264998
|
+
const rootMnemonicFromFile = typeof parsedConfigFile.mnemonic === "string" ? parsedConfigFile.mnemonic : void 0;
|
|
264999
|
+
const normalizedArgv = coerceActorsArray(argv);
|
|
265000
|
+
const parsedConfigArgs = ConfigZod.safeParse(normalizedArgv).data ?? {};
|
|
265001
|
+
const rootMnemonicFromArgs = typeof normalizedArgv.mnemonic === "string" ? normalizedArgv.mnemonic : void 0;
|
|
265002
|
+
const mergedConfig = safeParseOrThrow(deepMerge(parsedConfigFile, parsedConfigArgs));
|
|
265003
|
+
const validated = safeParseOrThrow(resolveConfig(safeParseOrThrow(mergedConfig)));
|
|
265004
|
+
const rootMnemonic = rootMnemonicFromArgs ?? rootMnemonicFromFile;
|
|
265005
|
+
return isDefined(rootMnemonic) ? {
|
|
265006
|
+
...validated,
|
|
265007
|
+
mnemonic: rootMnemonic
|
|
265008
|
+
} : validated;
|
|
265009
|
+
}
|
|
265010
|
+
__name(buildFinalConfig, "buildFinalConfig");
|
|
264916
265011
|
async function configMiddleware(argv, setConfiguration) {
|
|
264917
265012
|
try {
|
|
264918
|
-
const
|
|
264919
|
-
|
|
264920
|
-
configPath
|
|
264921
|
-
});
|
|
264922
|
-
const rootMnemonicFromFile = typeof parsedConfigFile.mnemonic === "string" ? parsedConfigFile.mnemonic : void 0;
|
|
264923
|
-
const parsedConfigArgs = ConfigZod.safeParse(argv).data ?? {};
|
|
264924
|
-
const rootMnemonicFromArgs = typeof argv.mnemonic === "string" ? argv.mnemonic : void 0;
|
|
264925
|
-
const parseResult = ConfigZod.safeParse(deepMerge(parsedConfigFile, parsedConfigArgs));
|
|
264926
|
-
if (!parseResult.success) {
|
|
264927
|
-
throw parseResult.error;
|
|
264928
|
-
}
|
|
264929
|
-
const mergedConfig = parseResult.data;
|
|
264930
|
-
const validatedMergedConfigResult = ConfigZod.safeParse(mergedConfig);
|
|
264931
|
-
if (!validatedMergedConfigResult.success) {
|
|
264932
|
-
throw validatedMergedConfigResult.error;
|
|
264933
|
-
}
|
|
264934
|
-
const resolvedConfig = resolveConfig(validatedMergedConfigResult.data);
|
|
264935
|
-
const validatedConfigResult = ConfigZod.safeParse(resolvedConfig);
|
|
264936
|
-
if (!validatedConfigResult.success) {
|
|
264937
|
-
throw validatedConfigResult.error;
|
|
264938
|
-
}
|
|
264939
|
-
const rootMnemonic = rootMnemonicFromArgs ?? rootMnemonicFromFile;
|
|
264940
|
-
const finalConfig = rootMnemonic ? {
|
|
264941
|
-
...validatedConfigResult.data,
|
|
264942
|
-
mnemonic: rootMnemonic
|
|
264943
|
-
} : validatedConfigResult.data;
|
|
265013
|
+
const finalConfig = await buildFinalConfig(argv);
|
|
265014
|
+
assertNoActorMnemonics(finalConfig);
|
|
264944
265015
|
setConfiguration(finalConfig);
|
|
264945
265016
|
if (argv["dump-config"]) {
|
|
264946
265017
|
console.log(JSON.stringify(finalConfig, null, 2));
|
|
@@ -264949,12 +265020,14 @@ async function configMiddleware(argv, setConfiguration) {
|
|
|
264949
265020
|
} catch (err) {
|
|
264950
265021
|
if (err instanceof ConfigFileNotFoundError) {
|
|
264951
265022
|
console.error(`${err.message}. Check the path passed to --config/-c and try again.`);
|
|
265023
|
+
} else if (err instanceof ActorMnemonicNotAllowedError) {
|
|
265024
|
+
console.error(err.message);
|
|
264952
265025
|
} else if (isZodError(err)) {
|
|
264953
265026
|
console.error(`Zod error: ${err.message}`);
|
|
264954
265027
|
} else {
|
|
264955
265028
|
console.error(`Error parsing configuration: ${err}`);
|
|
264956
265029
|
}
|
|
264957
|
-
if (!(err instanceof ConfigFileNotFoundError)) {
|
|
265030
|
+
if (!(err instanceof ConfigFileNotFoundError) && !(err instanceof ActorMnemonicNotAllowedError)) {
|
|
264958
265031
|
console.error(`Stack: ${err instanceof Error ? err.stack : "N/A"}`);
|
|
264959
265032
|
}
|
|
264960
265033
|
throw new Error("Invalid configuration", {
|
|
@@ -265295,7 +265368,7 @@ var optionsFromGlobalZodRegistry = /* @__PURE__ */ __name(() => {
|
|
|
265295
265368
|
|
|
265296
265369
|
// src/runCLI.ts
|
|
265297
265370
|
var configuration;
|
|
265298
|
-
var version = isDefined("1.20.
|
|
265371
|
+
var version = isDefined("1.20.24") ? "1.20.24" : "unknown";
|
|
265299
265372
|
function getConfiguration() {
|
|
265300
265373
|
return configuration;
|
|
265301
265374
|
}
|
|
@@ -265337,6 +265410,8 @@ async function getLocatorsFromConfig(actors, configuration2) {
|
|
|
265337
265410
|
const orchestrator = await Orchestrator.create({
|
|
265338
265411
|
logger
|
|
265339
265412
|
});
|
|
265413
|
+
const collision = detectDerivationPathCollisions(actors, configuration2);
|
|
265414
|
+
if (collision) throw collision;
|
|
265340
265415
|
const walletReport = await initializeResolvedWalletReport(actors, configuration2);
|
|
265341
265416
|
logger.info(formatWalletReport(walletReport));
|
|
265342
265417
|
const context = await contextFromConfigWithoutLocator(config2, logger, "xl1-cli", version);
|