@vapi-network/core 0.9.2 → 0.9.5
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/README.md +2 -2
- package/dist/api-key.js +2 -1
- package/dist/api-key.js.map +1 -1
- package/dist/backup.js +2 -1
- package/dist/backup.js.map +1 -1
- package/dist/call-contracts-wire.d.ts +128 -98
- package/dist/call-contracts-wire.d.ts.map +1 -1
- package/dist/cloud-backup.js +2 -1
- package/dist/cloud-backup.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +152 -30
- package/dist/index.js.map +2 -2
- package/dist/marketplace-contracts.d.ts +104 -76
- package/dist/marketplace-contracts.d.ts.map +1 -1
- package/dist/router-client.d.ts +2 -2
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +84 -20
- package/dist/router-client.js.map +2 -2
- package/dist/secrets.js +2 -1
- package/dist/secrets.js.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/tasks.js +2 -1
- package/dist/tasks.js.map +1 -1
- package/dist/vault-key.d.ts +4 -0
- package/dist/vault-key.d.ts.map +1 -1
- package/dist/wallet-store.d.ts +2 -0
- package/dist/wallet-store.d.ts.map +1 -1
- package/dist/x402-pay.d.ts +2 -2
- package/dist/x402-pay.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AACjE,eAAO,MAAM,qBAAqB,iDAA8C,CAAC;AACjF,eAAO,MAAM,iCAAiC,kDAA+C,CAAC;AAI9F,eAAO,MAAM,0BAA0B;;;EAK7B,CAAC;AAEX;;;;;;;GAOG;AACH,eAA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8 +38805,10 @@ var listingIdentitySchema = external_exports.looseObject({
|
|
|
38805
38805
|
}).optional().catch(void 0)
|
|
38806
38806
|
});
|
|
38807
38807
|
var listingDisclosureShape = {
|
|
38808
|
-
|
|
38809
|
-
fee
|
|
38808
|
+
// Presentation metadata must not make an otherwise executable row vanish
|
|
38809
|
+
// when the registry adds a new group or changes the fee display shape.
|
|
38810
|
+
group: listingGroupSchema.optional().catch(void 0),
|
|
38811
|
+
fee: listingFeeSchema.optional().catch(void 0),
|
|
38810
38812
|
verification: listingVerificationFieldSchema,
|
|
38811
38813
|
liveness: listingLivenessSchema.optional().catch(void 0),
|
|
38812
38814
|
conformance: listingConformanceSchema.optional().catch(void 0),
|
|
@@ -38814,11 +38816,13 @@ var listingDisclosureShape = {
|
|
|
38814
38816
|
};
|
|
38815
38817
|
var marketplaceBadgeCodeSchema = external_exports.enum([
|
|
38816
38818
|
"live_x402",
|
|
38819
|
+
"mpp",
|
|
38817
38820
|
"partner",
|
|
38818
38821
|
"payout_wallet_confirmed",
|
|
38819
38822
|
"vapi_verified",
|
|
38820
38823
|
"external_catalog",
|
|
38821
|
-
"approved_vendor"
|
|
38824
|
+
"approved_vendor",
|
|
38825
|
+
"unverified"
|
|
38822
38826
|
]);
|
|
38823
38827
|
var marketplaceBadgeSchema = external_exports.looseObject({
|
|
38824
38828
|
code: marketplaceBadgeCodeSchema,
|
|
@@ -38837,7 +38841,13 @@ var marketplaceCardSchema = external_exports.looseObject({
|
|
|
38837
38841
|
summary: external_exports.string().trim().min(1).max(1e3),
|
|
38838
38842
|
byline: external_exports.string().trim().min(1).max(160).optional(),
|
|
38839
38843
|
bylineHref: marketplaceHrefSchema.optional(),
|
|
38840
|
-
badges: external_exports.
|
|
38844
|
+
badges: external_exports.preprocess(
|
|
38845
|
+
(badges) => Array.isArray(badges) ? badges.flatMap((badge) => {
|
|
38846
|
+
const parsed = marketplaceBadgeSchema.safeParse(badge);
|
|
38847
|
+
return parsed.success ? [parsed.data] : [];
|
|
38848
|
+
}) : badges,
|
|
38849
|
+
external_exports.array(marketplaceBadgeSchema).max(8)
|
|
38850
|
+
),
|
|
38841
38851
|
facts: external_exports.array(marketplacePublicFactSchema).max(12)
|
|
38842
38852
|
});
|
|
38843
38853
|
var marketplaceHitBase = {
|
|
@@ -45459,7 +45469,7 @@ var CALLABLE_KIND = "agent";
|
|
|
45459
45469
|
var CALLABLE_CATEGORIES = ["ai", "data", "crypto", "compute", "search"];
|
|
45460
45470
|
var callableCategorySchema = external_exports.enum(CALLABLE_CATEGORIES);
|
|
45461
45471
|
var DISCOVERY_CATEGORIES = [...CALLABLE_CATEGORIES, "other"];
|
|
45462
|
-
var discoveryCategorySchema = external_exports.
|
|
45472
|
+
var discoveryCategorySchema = external_exports.string().trim().min(1);
|
|
45463
45473
|
var CALLABLE_CATEGORY_LABELS = {
|
|
45464
45474
|
ai: { catalog: "AI / LLM", publish: "AI and models" },
|
|
45465
45475
|
data: { catalog: "Data", publish: "Data" },
|
|
@@ -45471,7 +45481,7 @@ var CALLABLE_CATEGORY_SET = new Set(CALLABLE_CATEGORIES);
|
|
|
45471
45481
|
function isCallableListing(kind, category) {
|
|
45472
45482
|
return kind === CALLABLE_KIND && CALLABLE_CATEGORY_SET.has(category);
|
|
45473
45483
|
}
|
|
45474
|
-
var serviceTierSchema = external_exports.
|
|
45484
|
+
var serviceTierSchema = external_exports.string().trim().min(1);
|
|
45475
45485
|
var discoveryEndpointSchema = external_exports.looseObject({
|
|
45476
45486
|
name: external_exports.string(),
|
|
45477
45487
|
method: external_exports.string(),
|
|
@@ -45501,6 +45511,24 @@ var discoveryEndpointSchema = external_exports.looseObject({
|
|
|
45501
45511
|
asset: external_exports.string().refine(isSolanaAddress, "Expected a Solana base58 address."),
|
|
45502
45512
|
payTo: external_exports.string().refine(isSolanaAddress, "Expected a Solana base58 address."),
|
|
45503
45513
|
checkedAt: external_exports.iso.datetime()
|
|
45514
|
+
}),
|
|
45515
|
+
external_exports.looseObject({
|
|
45516
|
+
protocol: external_exports.literal("mpp"),
|
|
45517
|
+
intent: external_exports.enum(["charge", "authorize", "subscription"]).nullable(),
|
|
45518
|
+
method: external_exports.string().trim().min(1).max(40).nullable(),
|
|
45519
|
+
checkedAt: external_exports.iso.datetime(),
|
|
45520
|
+
// Keep common x402 properties readable on the union while making it
|
|
45521
|
+
// impossible for MPP metadata to masquerade as executable x402 terms.
|
|
45522
|
+
network: external_exports.never().optional(),
|
|
45523
|
+
payTo: external_exports.never().optional()
|
|
45524
|
+
}),
|
|
45525
|
+
external_exports.looseObject({
|
|
45526
|
+
// Future payment protocols remain visible to callers so the payment
|
|
45527
|
+
// layer can refuse them explicitly instead of discovery losing the row.
|
|
45528
|
+
protocol: external_exports.string().trim().min(1).max(40),
|
|
45529
|
+
checkedAt: external_exports.iso.datetime(),
|
|
45530
|
+
network: external_exports.never().optional(),
|
|
45531
|
+
payTo: external_exports.never().optional()
|
|
45504
45532
|
})
|
|
45505
45533
|
]).optional()
|
|
45506
45534
|
});
|
|
@@ -45596,7 +45624,7 @@ function resolveTarget(service, endpointName) {
|
|
|
45596
45624
|
}
|
|
45597
45625
|
if (targets.size !== 1) {
|
|
45598
45626
|
const paymentNetworks = service.endpoints.flatMap(
|
|
45599
|
-
(endpoint) => endpoint.payment ? [endpoint.payment.network] : []
|
|
45627
|
+
(endpoint) => typeof endpoint.payment?.network === "string" ? [endpoint.payment.network] : []
|
|
45600
45628
|
);
|
|
45601
45629
|
throw new DiscoveryCatalogError(
|
|
45602
45630
|
"ambiguous_default",
|
|
@@ -46574,7 +46602,8 @@ function getVapiPaths(directory = process.env.VAPI_HOME?.trim() || join2(homedir
|
|
|
46574
46602
|
keystore: join2(directory, "keystore.json"),
|
|
46575
46603
|
receipts: join2(directory, "receipts.jsonl"),
|
|
46576
46604
|
searches: join2(directory, "searches.jsonl"),
|
|
46577
|
-
ledger: join2(directory, "spend-ledger.json")
|
|
46605
|
+
ledger: join2(directory, "spend-ledger.json"),
|
|
46606
|
+
updateCheck: join2(directory, "update-check.json")
|
|
46578
46607
|
};
|
|
46579
46608
|
}
|
|
46580
46609
|
var getAgentCashPaths = getVapiPaths;
|
|
@@ -70993,6 +71022,8 @@ var VAULT_KEY_ACCOUNT = "vault-key";
|
|
|
70993
71022
|
var VAULT_SESSION_ACCOUNT = "vault-session";
|
|
70994
71023
|
var DEVICE_KEY_LENGTH = 32;
|
|
70995
71024
|
var DEFAULT_SESSION_HOURS = 8;
|
|
71025
|
+
var RESTORE_GAP_LIMIT = 5;
|
|
71026
|
+
var MAX_RESTORE_ACCOUNTS = 1e4;
|
|
70996
71027
|
var BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;
|
|
70997
71028
|
var deviceKeyOperations = Promise.resolve();
|
|
70998
71029
|
var sessionSchema = external_exports.object({
|
|
@@ -71142,26 +71173,41 @@ async function restoreVault(args) {
|
|
|
71142
71173
|
throw new VaultError("corrupt", "That recovery phrase is not valid.", { cause: error61 });
|
|
71143
71174
|
}
|
|
71144
71175
|
let seed;
|
|
71145
|
-
|
|
71176
|
+
if (args.accountCount !== void 0 && (!Number.isSafeInteger(args.accountCount) || args.accountCount < 1 || args.accountCount > MAX_RESTORE_ACCOUNTS)) {
|
|
71177
|
+
throw new VaultError(
|
|
71178
|
+
"corrupt",
|
|
71179
|
+
`Account count must be a positive integer no greater than ${MAX_RESTORE_ACCOUNTS}.`
|
|
71180
|
+
);
|
|
71181
|
+
}
|
|
71182
|
+
let discoveredAccounts = args.accountCount ?? 0;
|
|
71183
|
+
let scannedAddresses = 0;
|
|
71146
71184
|
try {
|
|
71147
71185
|
seed = phraseToSeed(phrase);
|
|
71148
71186
|
} catch (error61) {
|
|
71149
71187
|
throw asVaultError2(error61, "Unable to derive an account while restoring the vault.");
|
|
71150
71188
|
}
|
|
71151
71189
|
try {
|
|
71152
|
-
for (let index2 = 0; ; index2 += 1) {
|
|
71190
|
+
for (let index2 = 0, emptyRun = 0; args.accountCount === void 0; index2 += 1) {
|
|
71153
71191
|
let address2;
|
|
71154
71192
|
try {
|
|
71155
71193
|
address2 = privateKeyToAccount(deriveEvmPrivateKey(seed, `m/44'/60'/0'/0/${index2}`)).address;
|
|
71156
71194
|
} catch (error61) {
|
|
71157
71195
|
throw asVaultError2(error61, "Unable to derive an account while restoring the vault.");
|
|
71158
71196
|
}
|
|
71159
|
-
|
|
71160
|
-
|
|
71197
|
+
const funded = await args.probe(address2);
|
|
71198
|
+
scannedAddresses += 1;
|
|
71199
|
+
if (funded) {
|
|
71200
|
+
discoveredAccounts = index2 + 1;
|
|
71201
|
+
emptyRun = 0;
|
|
71202
|
+
} else {
|
|
71203
|
+
emptyRun += 1;
|
|
71204
|
+
if (emptyRun === RESTORE_GAP_LIMIT) break;
|
|
71205
|
+
}
|
|
71161
71206
|
}
|
|
71162
71207
|
} finally {
|
|
71163
71208
|
seed.fill(0);
|
|
71164
71209
|
}
|
|
71210
|
+
args.onScanComplete?.(scannedAddresses);
|
|
71165
71211
|
let vault;
|
|
71166
71212
|
try {
|
|
71167
71213
|
vault = await createVault({ path: args.path, key: args.key, phrase, now: args.now });
|
|
@@ -71650,6 +71696,26 @@ var WalletStore = class _WalletStore {
|
|
|
71650
71696
|
}
|
|
71651
71697
|
);
|
|
71652
71698
|
}
|
|
71699
|
+
/** Checks a cached signer's current vault session without decrypting its account again. */
|
|
71700
|
+
async assertSigningAuthority(name) {
|
|
71701
|
+
const stored = await this.readVaultUnlocked();
|
|
71702
|
+
if (!stored?.protected || !stored.accounts.some((account) => account.name === name)) return;
|
|
71703
|
+
try {
|
|
71704
|
+
const key = await unlockProtectedVault({
|
|
71705
|
+
path: this.vaultPath,
|
|
71706
|
+
secrets: this.secrets,
|
|
71707
|
+
env: this.environment,
|
|
71708
|
+
now: () => this.now()
|
|
71709
|
+
});
|
|
71710
|
+
key.fill(0);
|
|
71711
|
+
} catch (error61) {
|
|
71712
|
+
this.dropVaultCache();
|
|
71713
|
+
if (error61 instanceof VaultError && error61.code === "password_required") {
|
|
71714
|
+
throw new KeystoreError(VAULT_LOCKED_MESSAGE, { cause: error61 });
|
|
71715
|
+
}
|
|
71716
|
+
throw error61;
|
|
71717
|
+
}
|
|
71718
|
+
}
|
|
71653
71719
|
/** Returns one wallet's vault signer, migrating its legacy keystore if needed. */
|
|
71654
71720
|
async unlock(name, passphrase) {
|
|
71655
71721
|
const wallet = this.resolve({ name });
|
|
@@ -76939,7 +77005,7 @@ function createRunBudget(args) {
|
|
|
76939
77005
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
76940
77006
|
import { arch, platform, release } from "node:os";
|
|
76941
77007
|
import { join as join13 } from "node:path";
|
|
76942
|
-
var VAPI_CLIENT_VERSION = "0.9.
|
|
77008
|
+
var VAPI_CLIENT_VERSION = "0.9.5";
|
|
76943
77009
|
async function createSupportReport(options) {
|
|
76944
77010
|
const message = options.message.trim();
|
|
76945
77011
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -77212,7 +77278,7 @@ async function completeX402Payment(args) {
|
|
|
77212
77278
|
let paidAttempt;
|
|
77213
77279
|
const requestStarted = nowMs();
|
|
77214
77280
|
try {
|
|
77215
|
-
paidAttempt = await args.send(paidRequest);
|
|
77281
|
+
paidAttempt = await args.send(paidRequest, quote);
|
|
77216
77282
|
} catch (error61) {
|
|
77217
77283
|
if (trace) trace.phases.requestMs = elapsed(nowMs, requestStarted);
|
|
77218
77284
|
throw settlementUnknown(
|
|
@@ -77230,7 +77296,7 @@ async function completeX402Payment(args) {
|
|
|
77230
77296
|
const settleStarted = nowMs();
|
|
77231
77297
|
const settlement = parseSettlementResponse(paidResponse.headers);
|
|
77232
77298
|
const settlementOutcome = classifySettlement(settlement);
|
|
77233
|
-
const receiptSettlement =
|
|
77299
|
+
const receiptSettlement = sanitizeReturnedValue(settlement, receiptSecrets);
|
|
77234
77300
|
if (trace) {
|
|
77235
77301
|
const transaction = settlementTransaction(receiptSettlement);
|
|
77236
77302
|
const explorerUrl = transaction ? explorerTransactionUrl(quote.accepted.network, transaction) : void 0;
|
|
@@ -77307,6 +77373,7 @@ async function completeX402Payment(args) {
|
|
|
77307
77373
|
trace.phases.requestMs = (trace.phases.requestMs ?? 0) + elapsed(nowMs, bodyStarted);
|
|
77308
77374
|
}
|
|
77309
77375
|
}
|
|
77376
|
+
body = sanitizeReturnedValue(body, receiptSecrets);
|
|
77310
77377
|
}
|
|
77311
77378
|
const result = {
|
|
77312
77379
|
response: paidResponse,
|
|
@@ -77315,7 +77382,11 @@ async function completeX402Payment(args) {
|
|
|
77315
77382
|
quote,
|
|
77316
77383
|
payer,
|
|
77317
77384
|
...payment.paymentId ? { paymentId: payment.paymentId } : {},
|
|
77318
|
-
|
|
77385
|
+
paymentProof: sanitizeReturnedValue(
|
|
77386
|
+
paidResponse.headers.get("x-vapi-payment-proof"),
|
|
77387
|
+
receiptSecrets
|
|
77388
|
+
),
|
|
77389
|
+
settlement: receiptSettlement,
|
|
77319
77390
|
settlementOutcome
|
|
77320
77391
|
};
|
|
77321
77392
|
if (settlementOutcome === "succeeded" && args.ceilingSweep) {
|
|
@@ -77452,19 +77523,70 @@ function sanitizeThrownError(error61, secrets) {
|
|
|
77452
77523
|
}
|
|
77453
77524
|
return new Error(message, cause === void 0 ? void 0 : { cause });
|
|
77454
77525
|
}
|
|
77455
|
-
function
|
|
77526
|
+
function sanitizeReturnedValue(value, secrets) {
|
|
77456
77527
|
if (typeof value === "string") return redactKnownSecrets(value, secrets);
|
|
77457
|
-
if (value
|
|
77458
|
-
|
|
77459
|
-
|
|
77460
|
-
|
|
77528
|
+
if (!isPlainReturnedContainer(value)) return value;
|
|
77529
|
+
const nodes = /* @__PURE__ */ new WeakMap();
|
|
77530
|
+
const ordered = [];
|
|
77531
|
+
const nodeFor = (source) => {
|
|
77532
|
+
const existing = nodes.get(source);
|
|
77533
|
+
if (existing) return existing;
|
|
77534
|
+
const copy = Array.isArray(source) ? new Array(source.length) : Object.create(Object.getPrototypeOf(source));
|
|
77535
|
+
const node2 = { source, copy, parents: /* @__PURE__ */ new Set(), changed: false };
|
|
77536
|
+
nodes.set(source, node2);
|
|
77537
|
+
ordered.push(node2);
|
|
77538
|
+
return node2;
|
|
77539
|
+
};
|
|
77540
|
+
const root = nodeFor(value);
|
|
77541
|
+
for (let index2 = 0; index2 < ordered.length; index2 += 1) {
|
|
77542
|
+
const node2 = ordered[index2];
|
|
77543
|
+
for (const [key, item] of Object.entries(node2.source)) {
|
|
77544
|
+
const safeKey = Array.isArray(node2.source) ? key : redactKnownSecrets(key, secrets);
|
|
77545
|
+
if (safeKey !== key) node2.changed = true;
|
|
77546
|
+
if (typeof item === "string") {
|
|
77547
|
+
const safeItem = redactKnownSecrets(item, secrets);
|
|
77548
|
+
defineReturnedProperty(node2.copy, safeKey, safeItem);
|
|
77549
|
+
if (safeItem !== item) node2.changed = true;
|
|
77550
|
+
} else if (isPlainReturnedContainer(item)) {
|
|
77551
|
+
const child = nodeFor(item);
|
|
77552
|
+
child.parents.add(node2);
|
|
77553
|
+
defineReturnedProperty(node2.copy, safeKey, child.copy);
|
|
77554
|
+
} else {
|
|
77555
|
+
defineReturnedProperty(node2.copy, safeKey, item);
|
|
77556
|
+
}
|
|
77557
|
+
}
|
|
77461
77558
|
}
|
|
77462
|
-
|
|
77463
|
-
|
|
77464
|
-
|
|
77465
|
-
|
|
77466
|
-
|
|
77467
|
-
|
|
77559
|
+
const changed = ordered.filter((node2) => node2.changed);
|
|
77560
|
+
for (let index2 = 0; index2 < changed.length; index2 += 1) {
|
|
77561
|
+
for (const parent of changed[index2].parents) {
|
|
77562
|
+
if (parent.changed) continue;
|
|
77563
|
+
parent.changed = true;
|
|
77564
|
+
changed.push(parent);
|
|
77565
|
+
}
|
|
77566
|
+
}
|
|
77567
|
+
for (const node2 of ordered) {
|
|
77568
|
+
for (const [key, item] of Object.entries(node2.source)) {
|
|
77569
|
+
if (!isPlainReturnedContainer(item)) continue;
|
|
77570
|
+
const safeKey = Array.isArray(node2.source) ? key : redactKnownSecrets(key, secrets);
|
|
77571
|
+
const child = nodes.get(item);
|
|
77572
|
+
defineReturnedProperty(node2.copy, safeKey, child.changed ? child.copy : item);
|
|
77573
|
+
}
|
|
77574
|
+
}
|
|
77575
|
+
return root.changed ? root.copy : value;
|
|
77576
|
+
}
|
|
77577
|
+
function defineReturnedProperty(target, key, value) {
|
|
77578
|
+
Object.defineProperty(target, key, {
|
|
77579
|
+
value,
|
|
77580
|
+
enumerable: true,
|
|
77581
|
+
configurable: true,
|
|
77582
|
+
writable: true
|
|
77583
|
+
});
|
|
77584
|
+
}
|
|
77585
|
+
function isPlainReturnedContainer(value) {
|
|
77586
|
+
if (Array.isArray(value)) return true;
|
|
77587
|
+
if (value === null || typeof value !== "object") return false;
|
|
77588
|
+
const prototype = Object.getPrototypeOf(value);
|
|
77589
|
+
return prototype === Object.prototype || prototype === null;
|
|
77468
77590
|
}
|
|
77469
77591
|
function redactKnownSecrets(value, secrets) {
|
|
77470
77592
|
let redacted = value;
|
|
@@ -77499,9 +77621,7 @@ function possibleSettlement(quote, payment, payer, receipt) {
|
|
|
77499
77621
|
payTo: quote.accepted.payTo,
|
|
77500
77622
|
payer,
|
|
77501
77623
|
...payment.paymentId ? { paymentId: payment.paymentId } : {},
|
|
77502
|
-
...isSvmPaymentRequirements(quote.accepted) ? {
|
|
77503
|
-
authorizationTransaction: "transaction" in payment.payload.payload ? payment.payload.payload.transaction : ""
|
|
77504
|
-
} : "authorization" in payment.payload.payload ? {
|
|
77624
|
+
...isSvmPaymentRequirements(quote.accepted) ? {} : "authorization" in payment.payload.payload ? {
|
|
77505
77625
|
authorizationNonce: payment.payload.payload.authorization.nonce,
|
|
77506
77626
|
authorizationExpiresAt: payment.payload.payload.authorization.validBefore
|
|
77507
77627
|
} : {},
|
|
@@ -81296,6 +81416,7 @@ export {
|
|
|
81296
81416
|
MARKETPLACE_EXECUTION_METHODS,
|
|
81297
81417
|
MARKETPLACE_KINDS,
|
|
81298
81418
|
MARKETPLACE_RANKING_VERSION,
|
|
81419
|
+
MAX_RESTORE_ACCOUNTS,
|
|
81299
81420
|
MovementError,
|
|
81300
81421
|
NETWORKS2 as NETWORKS,
|
|
81301
81422
|
ONRAMP_FALLBACK_INSTRUCTIONS,
|
|
@@ -81303,6 +81424,7 @@ export {
|
|
|
81303
81424
|
PASSPHRASE_ENVIRONMENT_VARIABLE,
|
|
81304
81425
|
PROVENANCES,
|
|
81305
81426
|
RELAY_MAX_PER_TRANSFER_ATOMIC,
|
|
81427
|
+
RESTORE_GAP_LIMIT,
|
|
81306
81428
|
ROUTER_TOPUP_TIERS,
|
|
81307
81429
|
RUN_ID_PATTERN,
|
|
81308
81430
|
RunBudgetError,
|