@blockrun/clawrouter 0.12.314 → 0.12.315
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.js +439 -306
- package/dist/index.d.ts +3 -1
- package/dist/index.js +364 -231
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -44237,7 +44237,7 @@ var init_chunk_XW2CWVLZ = __esm({
|
|
|
44237
44237
|
}
|
|
44238
44238
|
});
|
|
44239
44239
|
|
|
44240
|
-
// node_modules/@x402/core/dist/esm/chunk-
|
|
44240
|
+
// node_modules/@x402/core/dist/esm/chunk-PVRH2E6N.mjs
|
|
44241
44241
|
function encodePaymentSignatureHeader(paymentPayload) {
|
|
44242
44242
|
return safeBase64Encode(JSON.stringify(paymentPayload));
|
|
44243
44243
|
}
|
|
@@ -44260,8 +44260,8 @@ function decodePaymentResponseHeader(paymentResponseHeader) {
|
|
|
44260
44260
|
);
|
|
44261
44261
|
}
|
|
44262
44262
|
var MAX_CONTROL_PLANE_RESPONSE_BYTES, verifyResponseSchema, settleResponseSchema, supportedKindSchema, supportedResponseSchema, x402HTTPClient, requireDecodedJsonObject;
|
|
44263
|
-
var
|
|
44264
|
-
"node_modules/@x402/core/dist/esm/chunk-
|
|
44263
|
+
var init_chunk_PVRH2E6N = __esm({
|
|
44264
|
+
"node_modules/@x402/core/dist/esm/chunk-PVRH2E6N.mjs"() {
|
|
44265
44265
|
"use strict";
|
|
44266
44266
|
init_chunk_Z7WXFCST();
|
|
44267
44267
|
init_chunk_VE37GDG2();
|
|
@@ -44574,7 +44574,7 @@ var DEFAULT_MAX_AMOUNT_PER_PAYMENT, x402Client;
|
|
|
44574
44574
|
var init_client = __esm({
|
|
44575
44575
|
"node_modules/@x402/core/dist/esm/client/index.mjs"() {
|
|
44576
44576
|
"use strict";
|
|
44577
|
-
|
|
44577
|
+
init_chunk_PVRH2E6N();
|
|
44578
44578
|
init_chunk_Z7WXFCST();
|
|
44579
44579
|
init_chunk_VE37GDG2();
|
|
44580
44580
|
init_chunk_MA7F3CLI();
|
|
@@ -45215,7 +45215,7 @@ var init_client = __esm({
|
|
|
45215
45215
|
var init_http3 = __esm({
|
|
45216
45216
|
"node_modules/@x402/core/dist/esm/http/index.mjs"() {
|
|
45217
45217
|
"use strict";
|
|
45218
|
-
|
|
45218
|
+
init_chunk_PVRH2E6N();
|
|
45219
45219
|
init_chunk_Z7WXFCST();
|
|
45220
45220
|
init_chunk_VE37GDG2();
|
|
45221
45221
|
init_chunk_MA7F3CLI();
|
|
@@ -80345,7 +80345,7 @@ var init_src3 = __esm({
|
|
|
80345
80345
|
}
|
|
80346
80346
|
});
|
|
80347
80347
|
|
|
80348
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
80348
|
+
// node_modules/@x402/svm/dist/esm/chunk-DAIKIZVB.mjs
|
|
80349
80349
|
function normalizeNetwork(network) {
|
|
80350
80350
|
if (network.includes(":")) {
|
|
80351
80351
|
const supported = [SOLANA_MAINNET_CAIP2, SOLANA_DEVNET_CAIP2, SOLANA_TESTNET_CAIP2];
|
|
@@ -80582,8 +80582,8 @@ async function recordPendingOrTerminal(store, key3, signature3, payer, network,
|
|
|
80582
80582
|
};
|
|
80583
80583
|
}
|
|
80584
80584
|
var TOKEN_PROGRAM_ADDRESS3, TOKEN_2022_PROGRAM_ADDRESS2, COMPUTE_BUDGET_PROGRAM_ADDRESS2, MEMO_PROGRAM_ADDRESS, LIGHTHOUSE_PROGRAM_ADDRESS, DEVNET_RPC_URL, TESTNET_RPC_URL, MAINNET_RPC_URL, DEVNET_WS_URL, TESTNET_WS_URL, MAINNET_WS_URL, DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS, MAX_COMPUTE_UNIT_PRICE_MICROLAMPORTS, DEFAULT_COMPUTE_UNIT_LIMIT, DEFAULT_MAX_COMPUTE_UNITS, DEFAULT_MAX_REQUIRED_SIGNATURES, MAX_MEMO_BYTES, ACCEPTED_TRANSACTION_VERSIONS, ADVERTISED_TRANSACTION_VERSIONS, CLIENT_SUPPORTED_TRANSACTION_VERSIONS, SETTLEMENT_TTL_MS, SVM_ADDRESS_REGEX, SOLANA_MAINNET_CAIP2, SOLANA_DEVNET_CAIP2, SOLANA_TESTNET_CAIP2, V1_TO_V2_NETWORK_MAP, ErrInvalidPayloadTransaction, ErrUnsupportedTransactionVersion, ErrFeePayerTransferringFunds, ErrMemoMismatch, ErrMemoCount, ErrSmartWalletFeePayerNotIsolated, ErrSmartWalletMalformedComputeBudget, ErrSmartWalletMalformedComputeLimit, ErrSmartWalletMalformedComputePrice, ErrSmartWalletComputeUnitsTooHigh, ErrSmartWalletPriorityFeeTooHigh, ErrSmartWalletUnsupportedComputeBudget, ErrSmartWalletAltResolutionUnavailable, ErrSmartWalletAltResolutionFailed, ErrSmartWalletComputeBudgetViolation, ErrSmartWalletSimulationFailed, ErrSmartWalletCannotDeriveATA, ErrSmartWalletNoTransferInSimulation, ErrSmartWalletTransferMismatch, ErrSmartWalletMultipleMatchingTransfers, USDC_MAINNET_ADDRESS, USDC_DEVNET_ADDRESS, USDC_TESTNET_ADDRESS, DEFAULT_ASSETS2, getDefaultAsset2, findDefaultAsset2, BASIS_POINTS_DENOMINATOR, SLOT_COMMITMENT, TransactionOnchainFailureError;
|
|
80585
|
-
var
|
|
80586
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
80585
|
+
var init_chunk_DAIKIZVB = __esm({
|
|
80586
|
+
"node_modules/@x402/svm/dist/esm/chunk-DAIKIZVB.mjs"() {
|
|
80587
80587
|
"use strict";
|
|
80588
80588
|
init_sha2563();
|
|
80589
80589
|
init_index_node39();
|
|
@@ -80803,7 +80803,7 @@ var init_src4 = __esm({
|
|
|
80803
80803
|
}
|
|
80804
80804
|
});
|
|
80805
80805
|
|
|
80806
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
80806
|
+
// node_modules/@x402/svm/dist/esm/chunk-RZ6M7L3U.mjs
|
|
80807
80807
|
function maxTransactionSize(version31) {
|
|
80808
80808
|
return version31 === 1 ? V1_MAX_TRANSACTION_SIZE : V0_MAX_TRANSACTION_SIZE;
|
|
80809
80809
|
}
|
|
@@ -80901,10 +80901,10 @@ function checkTransactionV1Budget(config2, programAddresses, limits) {
|
|
|
80901
80901
|
return void 0;
|
|
80902
80902
|
}
|
|
80903
80903
|
var V0_MAX_TRANSACTION_SIZE, V1_MAX_TRANSACTION_SIZE, DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_LIMIT;
|
|
80904
|
-
var
|
|
80905
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
80904
|
+
var init_chunk_RZ6M7L3U = __esm({
|
|
80905
|
+
"node_modules/@x402/svm/dist/esm/chunk-RZ6M7L3U.mjs"() {
|
|
80906
80906
|
"use strict";
|
|
80907
|
-
|
|
80907
|
+
init_chunk_DAIKIZVB();
|
|
80908
80908
|
init_index_node39();
|
|
80909
80909
|
init_src4();
|
|
80910
80910
|
V0_MAX_TRANSACTION_SIZE = 1232;
|
|
@@ -80913,7 +80913,7 @@ var init_chunk_A5U3JRDR = __esm({
|
|
|
80913
80913
|
}
|
|
80914
80914
|
});
|
|
80915
80915
|
|
|
80916
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
80916
|
+
// node_modules/@x402/svm/dist/esm/chunk-DP3B4MQJ.mjs
|
|
80917
80917
|
function encodeVoucherMessageBytes(args) {
|
|
80918
80918
|
const channelBytes = getBase58Encoder().encode(args.channelId);
|
|
80919
80919
|
if (channelBytes.byteLength !== 32) {
|
|
@@ -81359,11 +81359,11 @@ function randomU64() {
|
|
|
81359
81359
|
return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getBigUint64(0, true);
|
|
81360
81360
|
}
|
|
81361
81361
|
var VOUCHER_MAGIC, PAYMENT_CHANNELS_PROGRAM_ADDRESS, ASSOCIATED_TOKEN_PROGRAM_ID, PAYMENT_CHANNELS_PROGRAM_ID, MAINNET_TREASURY_OWNER_BYTES, MAINNET_TREASURY_OWNER, DEVNET_TREASURY_OWNER, OPEN_DISCRIMINATOR, TOP_UP_DISCRIMINATOR, U64_MAX2, OPEN_MAX_COMPUTE_UNIT_LIMIT, OPEN_DEFAULT_COMPUTE_UNIT_LIMIT, RENT_SYSVAR, MAX_CHANNEL_PDA_CACHE_ENTRIES, channelPdaCache;
|
|
81362
|
-
var
|
|
81363
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81362
|
+
var init_chunk_DP3B4MQJ = __esm({
|
|
81363
|
+
"node_modules/@x402/svm/dist/esm/chunk-DP3B4MQJ.mjs"() {
|
|
81364
81364
|
"use strict";
|
|
81365
|
-
|
|
81366
|
-
|
|
81365
|
+
init_chunk_RZ6M7L3U();
|
|
81366
|
+
init_chunk_DAIKIZVB();
|
|
81367
81367
|
init_index_node39();
|
|
81368
81368
|
init_index_node39();
|
|
81369
81369
|
init_index_node39();
|
|
@@ -81428,7 +81428,7 @@ var init_chunk_BU4OMUDH = __esm({
|
|
|
81428
81428
|
}
|
|
81429
81429
|
});
|
|
81430
81430
|
|
|
81431
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81431
|
+
// node_modules/@x402/svm/dist/esm/chunk-VITMNYMM.mjs
|
|
81432
81432
|
function getRequestCloseInstructionDataEncoder() {
|
|
81433
81433
|
return transformEncoder(getStructEncoder([["discriminator", getU8Encoder()]]), (value) => ({
|
|
81434
81434
|
...value,
|
|
@@ -81501,12 +81501,12 @@ function requestMemo(value) {
|
|
|
81501
81501
|
);
|
|
81502
81502
|
}
|
|
81503
81503
|
var REQUEST_CLOSE_DISCRIMINATOR;
|
|
81504
|
-
var
|
|
81505
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81504
|
+
var init_chunk_VITMNYMM = __esm({
|
|
81505
|
+
"node_modules/@x402/svm/dist/esm/chunk-VITMNYMM.mjs"() {
|
|
81506
81506
|
"use strict";
|
|
81507
|
-
|
|
81508
|
-
|
|
81509
|
-
|
|
81507
|
+
init_chunk_DP3B4MQJ();
|
|
81508
|
+
init_chunk_RZ6M7L3U();
|
|
81509
|
+
init_chunk_DAIKIZVB();
|
|
81510
81510
|
init_index_node39();
|
|
81511
81511
|
init_index_node39();
|
|
81512
81512
|
init_index_node40();
|
|
@@ -81514,7 +81514,7 @@ var init_chunk_3WM4BBCN = __esm({
|
|
|
81514
81514
|
}
|
|
81515
81515
|
});
|
|
81516
81516
|
|
|
81517
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81517
|
+
// node_modules/@x402/svm/dist/esm/chunk-NUK2USQ3.mjs
|
|
81518
81518
|
function getChannelDecoder() {
|
|
81519
81519
|
return getStructDecoder([
|
|
81520
81520
|
["discriminator", getU8Decoder()],
|
|
@@ -81536,15 +81536,15 @@ function getChannelDecoder() {
|
|
|
81536
81536
|
["openSlot", getU64Decoder()]
|
|
81537
81537
|
]);
|
|
81538
81538
|
}
|
|
81539
|
-
var
|
|
81540
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81539
|
+
var init_chunk_NUK2USQ3 = __esm({
|
|
81540
|
+
"node_modules/@x402/svm/dist/esm/chunk-NUK2USQ3.mjs"() {
|
|
81541
81541
|
"use strict";
|
|
81542
|
-
|
|
81542
|
+
init_chunk_DP3B4MQJ();
|
|
81543
81543
|
init_index_node39();
|
|
81544
81544
|
}
|
|
81545
81545
|
});
|
|
81546
81546
|
|
|
81547
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81547
|
+
// node_modules/@x402/svm/dist/esm/chunk-RMG2KWUT.mjs
|
|
81548
81548
|
function channelAddressFilters(value, offset) {
|
|
81549
81549
|
return [
|
|
81550
81550
|
{ dataSize: CHANNEL_ACCOUNT_SIZE },
|
|
@@ -81615,11 +81615,11 @@ async function validateDiscoveredAccount(pubkey, owner, base64Data, expectedProg
|
|
|
81615
81615
|
return { channelId: pubkey, channel };
|
|
81616
81616
|
}
|
|
81617
81617
|
var CHANNEL_ACCOUNT_SIZE, CHANNEL_RENT_PAYER_OFFSET, CHANNEL_PAYER_OFFSET;
|
|
81618
|
-
var
|
|
81619
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81618
|
+
var init_chunk_RMG2KWUT = __esm({
|
|
81619
|
+
"node_modules/@x402/svm/dist/esm/chunk-RMG2KWUT.mjs"() {
|
|
81620
81620
|
"use strict";
|
|
81621
|
-
|
|
81622
|
-
|
|
81621
|
+
init_chunk_NUK2USQ3();
|
|
81622
|
+
init_chunk_DP3B4MQJ();
|
|
81623
81623
|
init_index_node39();
|
|
81624
81624
|
CHANNEL_ACCOUNT_SIZE = 256n;
|
|
81625
81625
|
CHANNEL_RENT_PAYER_OFFSET = 216n;
|
|
@@ -81627,7 +81627,7 @@ var init_chunk_PQ3QK4Z4 = __esm({
|
|
|
81627
81627
|
}
|
|
81628
81628
|
});
|
|
81629
81629
|
|
|
81630
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81630
|
+
// node_modules/@x402/svm/dist/esm/chunk-CJ2GGI22.mjs
|
|
81631
81631
|
function isBatchVoucher(value) {
|
|
81632
81632
|
if (!isRecord(value)) return false;
|
|
81633
81633
|
return typeof value.channelId === "string" && typeof value.maxClaimableAmount === "string" && typeof value.expiresAt === "number" && typeof value.signature === "string";
|
|
@@ -81812,12 +81812,12 @@ function parseReceiverBindingMemo(memo2) {
|
|
|
81812
81812
|
return isAddress2(authorizer) ? authorizer : void 0;
|
|
81813
81813
|
}
|
|
81814
81814
|
var BATCH_SETTLEMENT_SCHEME2, MIN_WITHDRAW_DELAY2, MAX_WITHDRAW_DELAY, FULL_SPLIT_BPS, CLIENT_VOUCHER_EXPIRES_AT, AUTHORIZATION_DOMAIN, CLOSE_DOMAIN, V1_MAX_CLAIM_CHANNELS, V1_MAX_SETTLE_CHANNELS, PREFIX, BatchError, isDecimal, isSafeUint, isOptional, isString, RECEIVER_BINDING_MEMO_PREFIX;
|
|
81815
|
-
var
|
|
81816
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81815
|
+
var init_chunk_CJ2GGI22 = __esm({
|
|
81816
|
+
"node_modules/@x402/svm/dist/esm/chunk-CJ2GGI22.mjs"() {
|
|
81817
81817
|
"use strict";
|
|
81818
|
-
|
|
81819
|
-
|
|
81820
|
-
|
|
81818
|
+
init_chunk_DP3B4MQJ();
|
|
81819
|
+
init_chunk_RZ6M7L3U();
|
|
81820
|
+
init_chunk_DAIKIZVB();
|
|
81821
81821
|
init_index_node39();
|
|
81822
81822
|
init_index_node39();
|
|
81823
81823
|
BATCH_SETTLEMENT_SCHEME2 = "batch-settlement";
|
|
@@ -81865,7 +81865,7 @@ var init_chunk_GAYY7QRO = __esm({
|
|
|
81865
81865
|
}
|
|
81866
81866
|
});
|
|
81867
81867
|
|
|
81868
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81868
|
+
// node_modules/@x402/svm/dist/esm/chunk-2RSZYSMO.mjs
|
|
81869
81869
|
function parseTokenProgramHint(extra) {
|
|
81870
81870
|
const hint = extra?.tokenProgram;
|
|
81871
81871
|
if (hint === void 0 || hint === null || hint === "") {
|
|
@@ -81893,14 +81893,14 @@ function requireTokenProgramHint(extra, invalid) {
|
|
|
81893
81893
|
if (hinted === void 0) throw new Error(invalid);
|
|
81894
81894
|
return hinted;
|
|
81895
81895
|
}
|
|
81896
|
-
var
|
|
81897
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
81896
|
+
var init_chunk_2RSZYSMO = __esm({
|
|
81897
|
+
"node_modules/@x402/svm/dist/esm/chunk-2RSZYSMO.mjs"() {
|
|
81898
81898
|
"use strict";
|
|
81899
|
-
|
|
81899
|
+
init_chunk_DAIKIZVB();
|
|
81900
81900
|
}
|
|
81901
81901
|
});
|
|
81902
81902
|
|
|
81903
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
81903
|
+
// node_modules/@x402/svm/dist/esm/chunk-HRH33QP2.mjs
|
|
81904
81904
|
async function checkCorrectiveState(args) {
|
|
81905
81905
|
const state = args.accept.extra?.channelState;
|
|
81906
81906
|
if (!isBatchChannelState(state)) {
|
|
@@ -82341,15 +82341,15 @@ async function buildBatchRefundPayload(args) {
|
|
|
82341
82341
|
});
|
|
82342
82342
|
}
|
|
82343
82343
|
var BatchChannelTracker, NoBatchChannelToRefundError, DEFAULT_SERVER_SIGNED_MAX_DEPOSIT, UntrustedOperatorError, ServerSignedTrustPolicy, DEFAULT_DEPOSIT_MULTIPLIER, MIN_DEPOSIT_MULTIPLIER, OPERATION_KEY_SEPARATOR, BatchSvmScheme;
|
|
82344
|
-
var
|
|
82345
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
82346
|
-
"use strict";
|
|
82347
|
-
|
|
82348
|
-
|
|
82349
|
-
|
|
82350
|
-
|
|
82351
|
-
|
|
82352
|
-
|
|
82344
|
+
var init_chunk_HRH33QP2 = __esm({
|
|
82345
|
+
"node_modules/@x402/svm/dist/esm/chunk-HRH33QP2.mjs"() {
|
|
82346
|
+
"use strict";
|
|
82347
|
+
init_chunk_VITMNYMM();
|
|
82348
|
+
init_chunk_RMG2KWUT();
|
|
82349
|
+
init_chunk_CJ2GGI22();
|
|
82350
|
+
init_chunk_2RSZYSMO();
|
|
82351
|
+
init_chunk_DP3B4MQJ();
|
|
82352
|
+
init_chunk_DAIKIZVB();
|
|
82353
82353
|
init_index_node39();
|
|
82354
82354
|
init_http3();
|
|
82355
82355
|
init_utils9();
|
|
@@ -83337,7 +83337,7 @@ var init_chunk_Y7W3OBHW = __esm({
|
|
|
83337
83337
|
}
|
|
83338
83338
|
});
|
|
83339
83339
|
|
|
83340
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
83340
|
+
// node_modules/@x402/svm/dist/esm/chunk-HQM7VUNZ.mjs
|
|
83341
83341
|
function getChannelDistributionHash(splits) {
|
|
83342
83342
|
const hasher = sha2568.create();
|
|
83343
83343
|
const count = new Uint8Array(4);
|
|
@@ -83351,19 +83351,19 @@ function getChannelDistributionHash(splits) {
|
|
|
83351
83351
|
}
|
|
83352
83352
|
return hasher.digest();
|
|
83353
83353
|
}
|
|
83354
|
-
var
|
|
83355
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
83354
|
+
var init_chunk_HQM7VUNZ = __esm({
|
|
83355
|
+
"node_modules/@x402/svm/dist/esm/chunk-HQM7VUNZ.mjs"() {
|
|
83356
83356
|
"use strict";
|
|
83357
|
-
|
|
83358
|
-
|
|
83359
|
-
|
|
83360
|
-
|
|
83357
|
+
init_chunk_NUK2USQ3();
|
|
83358
|
+
init_chunk_DP3B4MQJ();
|
|
83359
|
+
init_chunk_RZ6M7L3U();
|
|
83360
|
+
init_chunk_DAIKIZVB();
|
|
83361
83361
|
init_sha2563();
|
|
83362
83362
|
init_index_node39();
|
|
83363
83363
|
}
|
|
83364
83364
|
});
|
|
83365
83365
|
|
|
83366
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
83366
|
+
// node_modules/@x402/svm/dist/esm/chunk-SINLL373.mjs
|
|
83367
83367
|
function encodeCloseAuthorizationDigest(binding) {
|
|
83368
83368
|
const base582 = getBase58Encoder();
|
|
83369
83369
|
const network = new TextEncoder().encode(binding.network);
|
|
@@ -83434,11 +83434,11 @@ async function verifyCloseAuthorization(authorization, binding, receiverAuthoriz
|
|
|
83434
83434
|
return false;
|
|
83435
83435
|
}
|
|
83436
83436
|
}
|
|
83437
|
-
var
|
|
83438
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
83437
|
+
var init_chunk_SINLL373 = __esm({
|
|
83438
|
+
"node_modules/@x402/svm/dist/esm/chunk-SINLL373.mjs"() {
|
|
83439
83439
|
"use strict";
|
|
83440
|
-
|
|
83441
|
-
|
|
83440
|
+
init_chunk_CJ2GGI22();
|
|
83441
|
+
init_chunk_DP3B4MQJ();
|
|
83442
83442
|
init_sha2563();
|
|
83443
83443
|
init_index_node39();
|
|
83444
83444
|
}
|
|
@@ -83471,14 +83471,14 @@ var init_chunk_WIPN332D = __esm({
|
|
|
83471
83471
|
}
|
|
83472
83472
|
});
|
|
83473
83473
|
|
|
83474
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
83474
|
+
// node_modules/@x402/svm/dist/esm/chunk-2P7IHAQJ.mjs
|
|
83475
83475
|
var ExactSvmScheme;
|
|
83476
|
-
var
|
|
83477
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
83476
|
+
var init_chunk_2P7IHAQJ = __esm({
|
|
83477
|
+
"node_modules/@x402/svm/dist/esm/chunk-2P7IHAQJ.mjs"() {
|
|
83478
83478
|
"use strict";
|
|
83479
83479
|
init_chunk_WIPN332D();
|
|
83480
|
-
|
|
83481
|
-
|
|
83480
|
+
init_chunk_RZ6M7L3U();
|
|
83481
|
+
init_chunk_DAIKIZVB();
|
|
83482
83482
|
init_src2();
|
|
83483
83483
|
init_src3();
|
|
83484
83484
|
init_index_node39();
|
|
@@ -83592,7 +83592,7 @@ var init_chunk_OJGL5KXB = __esm({
|
|
|
83592
83592
|
}
|
|
83593
83593
|
});
|
|
83594
83594
|
|
|
83595
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
83595
|
+
// node_modules/@x402/svm/dist/esm/chunk-7TSGYOB2.mjs
|
|
83596
83596
|
function assertSmartWalletLimits(limits) {
|
|
83597
83597
|
assertLimit("smartWalletMaxComputeUnits", limits?.maxComputeUnits, 1);
|
|
83598
83598
|
assertLimit("smartWalletMaxPriorityFeeMicroLamports", limits?.maxPriorityFeeMicroLamports, 0);
|
|
@@ -84018,11 +84018,11 @@ async function verifyPostSettlement(signer, signature3, network, requirements, s
|
|
|
84018
84018
|
return { verified: false, method: "unverified" };
|
|
84019
84019
|
}
|
|
84020
84020
|
var DEFAULT_SMART_WALLET_MAX_COMPUTE_UNITS, DEFAULT_SMART_WALLET_MAX_PRIORITY_FEE_MICROLAMPORTS, IX_SET_COMPUTE_UNIT_LIMIT, IX_SET_COMPUTE_UNIT_PRICE, IX_TOKEN_TRANSFER_CHECKED, TOKEN_PROGRAMS, SMART_WALLET_V1_BUDGET_REASONS;
|
|
84021
|
-
var
|
|
84022
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
84021
|
+
var init_chunk_7TSGYOB2 = __esm({
|
|
84022
|
+
"node_modules/@x402/svm/dist/esm/chunk-7TSGYOB2.mjs"() {
|
|
84023
84023
|
"use strict";
|
|
84024
|
-
|
|
84025
|
-
|
|
84024
|
+
init_chunk_RZ6M7L3U();
|
|
84025
|
+
init_chunk_DAIKIZVB();
|
|
84026
84026
|
init_src4();
|
|
84027
84027
|
init_src2();
|
|
84028
84028
|
init_src3();
|
|
@@ -84048,12 +84048,12 @@ var init_chunk_FHYNBUS4 = __esm({
|
|
|
84048
84048
|
}
|
|
84049
84049
|
});
|
|
84050
84050
|
|
|
84051
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
84051
|
+
// node_modules/@x402/svm/dist/esm/chunk-L56Y5KBE.mjs
|
|
84052
84052
|
var SettlementCache;
|
|
84053
|
-
var
|
|
84054
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
84053
|
+
var init_chunk_L56Y5KBE = __esm({
|
|
84054
|
+
"node_modules/@x402/svm/dist/esm/chunk-L56Y5KBE.mjs"() {
|
|
84055
84055
|
"use strict";
|
|
84056
|
-
|
|
84056
|
+
init_chunk_DAIKIZVB();
|
|
84057
84057
|
SettlementCache = class {
|
|
84058
84058
|
constructor() {
|
|
84059
84059
|
this.entries = /* @__PURE__ */ new Map();
|
|
@@ -84100,7 +84100,7 @@ var init_chunk_BAY4U3CP = __esm({
|
|
|
84100
84100
|
}
|
|
84101
84101
|
});
|
|
84102
84102
|
|
|
84103
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
84103
|
+
// node_modules/@x402/svm/dist/esm/chunk-NQRJ53N4.mjs
|
|
84104
84104
|
function resolveUptoSvmPaymentChannelConfig(requirements) {
|
|
84105
84105
|
const feePayer = requirements.extra?.feePayer;
|
|
84106
84106
|
if (typeof feePayer !== "string" || feePayer.length === 0) {
|
|
@@ -84117,22 +84117,22 @@ function resolveUptoSvmPaymentChannelConfig(requirements) {
|
|
|
84117
84117
|
const splits = [{ bps: BASIS_POINTS_DENOMINATOR, recipient: requirements.payTo }];
|
|
84118
84118
|
return { feePayer, receiverAuthorizer, splits, withdrawDelay };
|
|
84119
84119
|
}
|
|
84120
|
-
var
|
|
84121
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
84120
|
+
var init_chunk_NQRJ53N4 = __esm({
|
|
84121
|
+
"node_modules/@x402/svm/dist/esm/chunk-NQRJ53N4.mjs"() {
|
|
84122
84122
|
"use strict";
|
|
84123
|
-
|
|
84123
|
+
init_chunk_DAIKIZVB();
|
|
84124
84124
|
}
|
|
84125
84125
|
});
|
|
84126
84126
|
|
|
84127
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
84127
|
+
// node_modules/@x402/svm/dist/esm/chunk-QPYYLXPW.mjs
|
|
84128
84128
|
var UptoSvmScheme;
|
|
84129
|
-
var
|
|
84130
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
84129
|
+
var init_chunk_QPYYLXPW = __esm({
|
|
84130
|
+
"node_modules/@x402/svm/dist/esm/chunk-QPYYLXPW.mjs"() {
|
|
84131
84131
|
"use strict";
|
|
84132
|
-
|
|
84133
|
-
|
|
84134
|
-
|
|
84135
|
-
|
|
84132
|
+
init_chunk_NQRJ53N4();
|
|
84133
|
+
init_chunk_2RSZYSMO();
|
|
84134
|
+
init_chunk_DP3B4MQJ();
|
|
84135
|
+
init_chunk_DAIKIZVB();
|
|
84136
84136
|
init_src3();
|
|
84137
84137
|
init_src2();
|
|
84138
84138
|
UptoSvmScheme = class {
|
|
@@ -84606,23 +84606,23 @@ var init_esm5 = __esm({
|
|
|
84606
84606
|
"node_modules/@x402/svm/dist/esm/index.mjs"() {
|
|
84607
84607
|
"use strict";
|
|
84608
84608
|
init_chunk_NLVYNPNC();
|
|
84609
|
-
|
|
84610
|
-
|
|
84611
|
-
|
|
84612
|
-
|
|
84613
|
-
|
|
84614
|
-
|
|
84615
|
-
|
|
84616
|
-
|
|
84609
|
+
init_chunk_HRH33QP2();
|
|
84610
|
+
init_chunk_HQM7VUNZ();
|
|
84611
|
+
init_chunk_VITMNYMM();
|
|
84612
|
+
init_chunk_RMG2KWUT();
|
|
84613
|
+
init_chunk_SINLL373();
|
|
84614
|
+
init_chunk_CJ2GGI22();
|
|
84615
|
+
init_chunk_NUK2USQ3();
|
|
84616
|
+
init_chunk_2P7IHAQJ();
|
|
84617
84617
|
init_chunk_WIPN332D();
|
|
84618
|
-
|
|
84619
|
-
|
|
84620
|
-
|
|
84621
|
-
|
|
84622
|
-
|
|
84623
|
-
|
|
84624
|
-
|
|
84625
|
-
|
|
84618
|
+
init_chunk_7TSGYOB2();
|
|
84619
|
+
init_chunk_L56Y5KBE();
|
|
84620
|
+
init_chunk_QPYYLXPW();
|
|
84621
|
+
init_chunk_NQRJ53N4();
|
|
84622
|
+
init_chunk_2RSZYSMO();
|
|
84623
|
+
init_chunk_DP3B4MQJ();
|
|
84624
|
+
init_chunk_RZ6M7L3U();
|
|
84625
|
+
init_chunk_DAIKIZVB();
|
|
84626
84626
|
init_index_node39();
|
|
84627
84627
|
}
|
|
84628
84628
|
});
|
|
@@ -84649,15 +84649,15 @@ __export(client_exports2, {
|
|
|
84649
84649
|
var init_client2 = __esm({
|
|
84650
84650
|
"node_modules/@x402/svm/dist/esm/batch-settlement/client/index.mjs"() {
|
|
84651
84651
|
"use strict";
|
|
84652
|
-
|
|
84653
|
-
|
|
84654
|
-
|
|
84655
|
-
|
|
84656
|
-
|
|
84657
|
-
|
|
84658
|
-
|
|
84659
|
-
|
|
84660
|
-
|
|
84652
|
+
init_chunk_HRH33QP2();
|
|
84653
|
+
init_chunk_VITMNYMM();
|
|
84654
|
+
init_chunk_RMG2KWUT();
|
|
84655
|
+
init_chunk_CJ2GGI22();
|
|
84656
|
+
init_chunk_NUK2USQ3();
|
|
84657
|
+
init_chunk_2RSZYSMO();
|
|
84658
|
+
init_chunk_DP3B4MQJ();
|
|
84659
|
+
init_chunk_RZ6M7L3U();
|
|
84660
|
+
init_chunk_DAIKIZVB();
|
|
84661
84661
|
}
|
|
84662
84662
|
});
|
|
84663
84663
|
|
|
@@ -130567,14 +130567,14 @@ var init_chunk_WWACQNRQ = __esm({
|
|
|
130567
130567
|
}
|
|
130568
130568
|
});
|
|
130569
130569
|
|
|
130570
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
130570
|
+
// node_modules/@x402/svm/dist/esm/chunk-PQ2KWLVO.mjs
|
|
130571
130571
|
var ExactSvmSchemeV1;
|
|
130572
|
-
var
|
|
130573
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
130572
|
+
var init_chunk_PQ2KWLVO = __esm({
|
|
130573
|
+
"node_modules/@x402/svm/dist/esm/chunk-PQ2KWLVO.mjs"() {
|
|
130574
130574
|
"use strict";
|
|
130575
130575
|
init_chunk_WIPN332D();
|
|
130576
|
-
|
|
130577
|
-
|
|
130576
|
+
init_chunk_RZ6M7L3U();
|
|
130577
|
+
init_chunk_DAIKIZVB();
|
|
130578
130578
|
init_src2();
|
|
130579
130579
|
init_src3();
|
|
130580
130580
|
init_index_node39();
|
|
@@ -130702,15 +130702,15 @@ var init_facilitator = __esm({
|
|
|
130702
130702
|
}
|
|
130703
130703
|
});
|
|
130704
130704
|
|
|
130705
|
-
// node_modules/@x402/svm/dist/esm/chunk-
|
|
130705
|
+
// node_modules/@x402/svm/dist/esm/chunk-RCDWMK2L.mjs
|
|
130706
130706
|
var addressEncoder, compiledMessageDecoder, compiledMessageDecoder2;
|
|
130707
|
-
var
|
|
130708
|
-
"node_modules/@x402/svm/dist/esm/chunk-
|
|
130707
|
+
var init_chunk_RCDWMK2L = __esm({
|
|
130708
|
+
"node_modules/@x402/svm/dist/esm/chunk-RCDWMK2L.mjs"() {
|
|
130709
130709
|
"use strict";
|
|
130710
|
-
|
|
130711
|
-
|
|
130712
|
-
|
|
130713
|
-
|
|
130710
|
+
init_chunk_7TSGYOB2();
|
|
130711
|
+
init_chunk_L56Y5KBE();
|
|
130712
|
+
init_chunk_RZ6M7L3U();
|
|
130713
|
+
init_chunk_DAIKIZVB();
|
|
130714
130714
|
init_index_node39();
|
|
130715
130715
|
init_facilitator();
|
|
130716
130716
|
init_index_node39();
|
|
@@ -130755,15 +130755,15 @@ function registerExactSvmScheme(client, config2) {
|
|
|
130755
130755
|
var init_client3 = __esm({
|
|
130756
130756
|
"node_modules/@x402/svm/dist/esm/exact/client/index.mjs"() {
|
|
130757
130757
|
"use strict";
|
|
130758
|
-
|
|
130758
|
+
init_chunk_2P7IHAQJ();
|
|
130759
130759
|
init_chunk_WWACQNRQ();
|
|
130760
|
-
|
|
130760
|
+
init_chunk_PQ2KWLVO();
|
|
130761
130761
|
init_chunk_WIPN332D();
|
|
130762
|
-
|
|
130763
|
-
|
|
130764
|
-
|
|
130765
|
-
|
|
130766
|
-
|
|
130762
|
+
init_chunk_RCDWMK2L();
|
|
130763
|
+
init_chunk_7TSGYOB2();
|
|
130764
|
+
init_chunk_L56Y5KBE();
|
|
130765
|
+
init_chunk_RZ6M7L3U();
|
|
130766
|
+
init_chunk_DAIKIZVB();
|
|
130767
130767
|
init_utils9();
|
|
130768
130768
|
}
|
|
130769
130769
|
});
|
|
@@ -130778,13 +130778,13 @@ var init_v1 = __esm({
|
|
|
130778
130778
|
"node_modules/@x402/svm/dist/esm/v1/index.mjs"() {
|
|
130779
130779
|
"use strict";
|
|
130780
130780
|
init_chunk_WWACQNRQ();
|
|
130781
|
-
|
|
130781
|
+
init_chunk_PQ2KWLVO();
|
|
130782
130782
|
init_chunk_WIPN332D();
|
|
130783
|
-
|
|
130784
|
-
|
|
130785
|
-
|
|
130786
|
-
|
|
130787
|
-
|
|
130783
|
+
init_chunk_RCDWMK2L();
|
|
130784
|
+
init_chunk_7TSGYOB2();
|
|
130785
|
+
init_chunk_L56Y5KBE();
|
|
130786
|
+
init_chunk_RZ6M7L3U();
|
|
130787
|
+
init_chunk_DAIKIZVB();
|
|
130788
130788
|
}
|
|
130789
130789
|
});
|
|
130790
130790
|
|
|
@@ -261218,7 +261218,7 @@ var require_axios = __commonJS({
|
|
|
261218
261218
|
function getEnv2(key3) {
|
|
261219
261219
|
return process.env[key3.toLowerCase()] || process.env[key3.toUpperCase()] || "";
|
|
261220
261220
|
}
|
|
261221
|
-
var VERSION4 = "1.21.
|
|
261221
|
+
var VERSION4 = "1.21.1";
|
|
261222
261222
|
function parseProtocol2(url4) {
|
|
261223
261223
|
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url4);
|
|
261224
261224
|
return match && match[1].toLowerCase() || "";
|
|
@@ -264426,8 +264426,11 @@ var require_axios = __commonJS({
|
|
|
264426
264426
|
throw new CanceledError3(null, config2);
|
|
264427
264427
|
}
|
|
264428
264428
|
}
|
|
264429
|
-
function
|
|
264430
|
-
return
|
|
264429
|
+
function resolveClock2() {
|
|
264430
|
+
return typeof performance !== "undefined" && utils$1.isFunction(performance.now) ? () => performance.now() : Date.now;
|
|
264431
|
+
}
|
|
264432
|
+
function elapsedSince2(now2, start) {
|
|
264433
|
+
return Math.max(0, Math.round(now2() - start));
|
|
264431
264434
|
}
|
|
264432
264435
|
function dispatchRequest2(_config) {
|
|
264433
264436
|
const config2 = utils$1.toSafeFlatObject(_config);
|
|
@@ -264438,10 +264441,11 @@ var require_axios = __commonJS({
|
|
|
264438
264441
|
config2.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
264439
264442
|
}
|
|
264440
264443
|
const adapter2 = adapters.getAdapter(config2.adapter || defaults2.adapter, config2);
|
|
264441
|
-
const
|
|
264444
|
+
const now2 = resolveClock2();
|
|
264445
|
+
const start = now2();
|
|
264442
264446
|
return adapter2(config2).then(function onAdapterResolution(response) {
|
|
264443
264447
|
throwIfCancellationRequested2(config2);
|
|
264444
|
-
response.duration = elapsedSince2(start);
|
|
264448
|
+
response.duration = elapsedSince2(now2, start);
|
|
264445
264449
|
config2.response = response;
|
|
264446
264450
|
try {
|
|
264447
264451
|
response.data = transformData2.call(config2, config2.transformResponse, response);
|
|
@@ -264454,7 +264458,7 @@ var require_axios = __commonJS({
|
|
|
264454
264458
|
if (!isCancel3(reason)) {
|
|
264455
264459
|
throwIfCancellationRequested2(config2);
|
|
264456
264460
|
if (reason && reason.response) {
|
|
264457
|
-
reason.response.duration = elapsedSince2(start);
|
|
264461
|
+
reason.response.duration = elapsedSince2(now2, start);
|
|
264458
264462
|
config2.response = reason.response;
|
|
264459
264463
|
try {
|
|
264460
264464
|
reason.response.data = transformData2.call(config2, config2.transformResponse, reason.response);
|
|
@@ -282626,53 +282630,60 @@ var SpendPolicyConflictError = class extends Error {
|
|
|
282626
282630
|
};
|
|
282627
282631
|
var FileSpendControlStorage = class {
|
|
282628
282632
|
spendingFile;
|
|
282629
|
-
constructor() {
|
|
282630
|
-
this.spendingFile = path.join(WALLET_DIR, "spending.json");
|
|
282633
|
+
constructor(spendingFile) {
|
|
282634
|
+
this.spendingFile = spendingFile ?? path.join(WALLET_DIR, "spending.json");
|
|
282631
282635
|
}
|
|
282632
282636
|
load() {
|
|
282637
|
+
let raw;
|
|
282633
282638
|
try {
|
|
282634
|
-
|
|
282635
|
-
|
|
282636
|
-
|
|
282637
|
-
|
|
282638
|
-
|
|
282639
|
-
|
|
282640
|
-
|
|
282641
|
-
|
|
282642
|
-
|
|
282643
|
-
|
|
282644
|
-
|
|
282645
|
-
|
|
282646
|
-
|
|
282647
|
-
|
|
282648
|
-
|
|
282649
|
-
|
|
282650
|
-
|
|
282651
|
-
|
|
282652
|
-
|
|
282653
|
-
|
|
282654
|
-
|
|
282655
|
-
|
|
282656
|
-
|
|
282657
|
-
|
|
282658
|
-
|
|
282659
|
-
|
|
282660
|
-
|
|
282661
|
-
|
|
282662
|
-
|
|
282663
|
-
|
|
282664
|
-
|
|
282639
|
+
raw = readTextFileSync(this.spendingFile);
|
|
282640
|
+
} catch (err) {
|
|
282641
|
+
const code = err?.code;
|
|
282642
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
282643
|
+
return null;
|
|
282644
|
+
}
|
|
282645
|
+
throw new UnreadableSpendPolicyError(err);
|
|
282646
|
+
}
|
|
282647
|
+
try {
|
|
282648
|
+
const data = JSON.parse(raw);
|
|
282649
|
+
const rawLimits = data.limits ?? {};
|
|
282650
|
+
const rawHistory = data.history ?? [];
|
|
282651
|
+
const limits = {};
|
|
282652
|
+
for (const key3 of ["perRequest", "hourly", "daily", "session"]) {
|
|
282653
|
+
const val = rawLimits[key3];
|
|
282654
|
+
if (typeof val === "number" && val > 0 && Number.isFinite(val)) {
|
|
282655
|
+
limits[key3] = val;
|
|
282656
|
+
}
|
|
282657
|
+
}
|
|
282658
|
+
for (const key3 of POLICY_LISTS) {
|
|
282659
|
+
if (!Object.prototype.hasOwnProperty.call(rawLimits, key3)) continue;
|
|
282660
|
+
const val = rawLimits[key3];
|
|
282661
|
+
if (!isValidPolicyValues(val)) {
|
|
282662
|
+
throw new MalformedSpendPolicyError(key3);
|
|
282663
|
+
}
|
|
282664
|
+
if (val.length === 0) continue;
|
|
282665
|
+
limits[key3] = normalizePolicyValues(key3, val);
|
|
282666
|
+
}
|
|
282667
|
+
const history = [];
|
|
282668
|
+
if (Array.isArray(rawHistory)) {
|
|
282669
|
+
for (const r2 of rawHistory) {
|
|
282670
|
+
if (typeof r2?.timestamp === "number" && typeof r2?.amount === "number" && Number.isFinite(r2.timestamp) && Number.isFinite(r2.amount) && r2.amount >= 0) {
|
|
282671
|
+
history.push({
|
|
282672
|
+
timestamp: r2.timestamp,
|
|
282673
|
+
amount: r2.amount,
|
|
282674
|
+
model: typeof r2.model === "string" ? r2.model : void 0,
|
|
282675
|
+
action: typeof r2.action === "string" ? r2.action : void 0
|
|
282676
|
+
});
|
|
282665
282677
|
}
|
|
282666
282678
|
}
|
|
282667
|
-
return { limits, history };
|
|
282668
282679
|
}
|
|
282680
|
+
return { limits, history };
|
|
282669
282681
|
} catch (err) {
|
|
282670
282682
|
if (err instanceof MalformedSpendPolicyError) {
|
|
282671
282683
|
throw err;
|
|
282672
282684
|
}
|
|
282673
282685
|
throw new UnreadableSpendPolicyError(err);
|
|
282674
282686
|
}
|
|
282675
|
-
return null;
|
|
282676
282687
|
}
|
|
282677
282688
|
save(data) {
|
|
282678
282689
|
try {
|
|
@@ -282760,6 +282771,8 @@ var SpendControl = class {
|
|
|
282760
282771
|
diskLimits = {};
|
|
282761
282772
|
/** Set when spending.json held an unusable policy list: refuse every payment. */
|
|
282762
282773
|
policyFileBroken;
|
|
282774
|
+
/** Whether persisted history loaded successfully; when false, recovery from an initial failure restores history. */
|
|
282775
|
+
initialHistoryLoaded = false;
|
|
282763
282776
|
storage;
|
|
282764
282777
|
now;
|
|
282765
282778
|
constructor(options) {
|
|
@@ -282825,7 +282838,7 @@ var SpendControl = class {
|
|
|
282825
282838
|
data = this.storage.load();
|
|
282826
282839
|
} catch (err) {
|
|
282827
282840
|
if (err instanceof UnreadableSpendPolicyError) {
|
|
282828
|
-
console.error(`${err.message}
|
|
282841
|
+
console.error(`${err.message}: keeping the limits already in effect`);
|
|
282829
282842
|
return;
|
|
282830
282843
|
}
|
|
282831
282844
|
if (!(err instanceof MalformedSpendPolicyError)) throw err;
|
|
@@ -282833,6 +282846,13 @@ var SpendControl = class {
|
|
|
282833
282846
|
console.error(`[ClawRouter] ${err.message}`);
|
|
282834
282847
|
return;
|
|
282835
282848
|
}
|
|
282849
|
+
if (!this.initialHistoryLoaded) {
|
|
282850
|
+
if (data) {
|
|
282851
|
+
this.history = data.history;
|
|
282852
|
+
this.cleanup();
|
|
282853
|
+
}
|
|
282854
|
+
this.initialHistoryLoaded = true;
|
|
282855
|
+
}
|
|
282836
282856
|
this.policyFileBroken = void 0;
|
|
282837
282857
|
this.limits = data ? cloneLimits(data.limits) : {};
|
|
282838
282858
|
this.diskLimits = cloneLimits(this.limits);
|
|
@@ -283160,19 +283180,15 @@ var SpendControl = class {
|
|
|
283160
283180
|
try {
|
|
283161
283181
|
data = this.storage.load();
|
|
283162
283182
|
} catch (err) {
|
|
283163
|
-
if (err instanceof UnreadableSpendPolicyError) {
|
|
283183
|
+
if (err instanceof UnreadableSpendPolicyError || err instanceof MalformedSpendPolicyError) {
|
|
283184
|
+
this.policyFileBroken = err.message;
|
|
283185
|
+
console.error(`[ClawRouter] ${err.message}`);
|
|
283164
283186
|
console.error(
|
|
283165
|
-
|
|
283187
|
+
"[ClawRouter] All paid requests will be refused until spending.json is repaired. Free models are unaffected."
|
|
283166
283188
|
);
|
|
283167
283189
|
return;
|
|
283168
283190
|
}
|
|
283169
|
-
|
|
283170
|
-
this.policyFileBroken = err.message;
|
|
283171
|
-
console.error(`[ClawRouter] ${err.message}`);
|
|
283172
|
-
console.error(
|
|
283173
|
-
"[ClawRouter] All paid requests will be refused until spending.json is repaired. Free models are unaffected."
|
|
283174
|
-
);
|
|
283175
|
-
return;
|
|
283191
|
+
throw err;
|
|
283176
283192
|
}
|
|
283177
283193
|
if (data) {
|
|
283178
283194
|
this.limits = cloneLimits(data.limits);
|
|
@@ -283180,6 +283196,7 @@ var SpendControl = class {
|
|
|
283180
283196
|
this.history = data.history;
|
|
283181
283197
|
this.cleanup();
|
|
283182
283198
|
}
|
|
283199
|
+
this.initialHistoryLoaded = true;
|
|
283183
283200
|
}
|
|
283184
283201
|
};
|
|
283185
283202
|
var sharedControlHost = () => process;
|
|
@@ -283610,7 +283627,7 @@ function createPermit2Nonce() {
|
|
|
283610
283627
|
return BigInt(toHex(randomBytes9)).toString();
|
|
283611
283628
|
}
|
|
283612
283629
|
|
|
283613
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
283630
|
+
// node_modules/@x402/evm/dist/esm/chunk-5AIYL4HT.mjs
|
|
283614
283631
|
var EVM_NETWORK_CHAIN_ID_MAP = {
|
|
283615
283632
|
ethereum: 1,
|
|
283616
283633
|
sepolia: 11155111,
|
|
@@ -283635,7 +283652,9 @@ var EVM_NETWORK_CHAIN_ID_MAP = {
|
|
|
283635
283652
|
stable: 988,
|
|
283636
283653
|
"stable-testnet": 2201,
|
|
283637
283654
|
celo: 42220,
|
|
283638
|
-
flare: 14
|
|
283655
|
+
flare: 14,
|
|
283656
|
+
hemi: 43111,
|
|
283657
|
+
"hemi-testnet": 743111
|
|
283639
283658
|
};
|
|
283640
283659
|
var NETWORKS = Object.keys(EVM_NETWORK_CHAIN_ID_MAP);
|
|
283641
283660
|
function getEvmChainIdV1(network) {
|
|
@@ -283720,7 +283739,7 @@ var DEFAULT_MAX_PRIORITY_FEE_PER_GAS = 100000000n;
|
|
|
283720
283739
|
var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
283721
283740
|
var x402ExactPermit2ProxyAddress = "0x402085c248EeA27D92E8b30b2C58ed07f9E20001";
|
|
283722
283741
|
|
|
283723
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
283742
|
+
// node_modules/@x402/evm/dist/esm/chunk-AB46Q4WU.mjs
|
|
283724
283743
|
var EIP2612_GAS_SPONSORING_KEY = "eip2612GasSponsoring";
|
|
283725
283744
|
var ERC20_APPROVAL_GAS_SPONSORING_KEY = "erc20ApprovalGasSponsoring";
|
|
283726
283745
|
var ERC20_APPROVAL_GAS_SPONSORING_VERSION = "1";
|
|
@@ -283956,7 +283975,7 @@ async function trySignErc20ApprovalExtension(signer, options, requirements, cont
|
|
|
283956
283975
|
};
|
|
283957
283976
|
}
|
|
283958
283977
|
|
|
283959
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
283978
|
+
// node_modules/@x402/evm/dist/esm/chunk-6XWQF37J.mjs
|
|
283960
283979
|
var DEFAULT_ASSETS = {
|
|
283961
283980
|
"eip155:8453": [
|
|
283962
283981
|
{
|
|
@@ -284271,8 +284290,39 @@ var DEFAULT_ASSETS = {
|
|
|
284271
284290
|
decimals: 6,
|
|
284272
284291
|
symbol: "USDC"
|
|
284273
284292
|
}
|
|
284274
|
-
]
|
|
284293
|
+
],
|
|
284275
284294
|
// Arc Testnet USDC (EIP-3009 supported)
|
|
284295
|
+
"eip155:4663": [
|
|
284296
|
+
{
|
|
284297
|
+
asset: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
284298
|
+
name: "Global Dollar",
|
|
284299
|
+
version: "1",
|
|
284300
|
+
decimals: 6,
|
|
284301
|
+
symbol: "USDG"
|
|
284302
|
+
}
|
|
284303
|
+
],
|
|
284304
|
+
// Robinhood Chain mainnet USDG (EIP-3009 supported)
|
|
284305
|
+
"eip155:43111": [
|
|
284306
|
+
{
|
|
284307
|
+
asset: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
|
|
284308
|
+
name: "Bridged USDC (Stargate)",
|
|
284309
|
+
version: "2",
|
|
284310
|
+
decimals: 6,
|
|
284311
|
+
symbol: "USDC.e"
|
|
284312
|
+
}
|
|
284313
|
+
],
|
|
284314
|
+
// Hemi mainnet USDC.e (EIP-3009 supported)
|
|
284315
|
+
"eip155:743111": [
|
|
284316
|
+
{
|
|
284317
|
+
asset: "0xD47971C7F5B1067d25cd45d30b2c9eb60de96443",
|
|
284318
|
+
name: "USDC.e",
|
|
284319
|
+
version: "1",
|
|
284320
|
+
decimals: 6,
|
|
284321
|
+
symbol: "USDC.e",
|
|
284322
|
+
assetTransferMethod: "permit2"
|
|
284323
|
+
}
|
|
284324
|
+
]
|
|
284325
|
+
// Hemi testnet USDC.e (no EIP-3009, no EIP-2612)
|
|
284276
284326
|
};
|
|
284277
284327
|
function resolveNetworkKey(network) {
|
|
284278
284328
|
if (network in DEFAULT_ASSETS) {
|
|
@@ -284294,7 +284344,7 @@ var findDefaultAsset = (asset, network) => {
|
|
|
284294
284344
|
return assets.find((entry) => entry.asset.toLowerCase() === normalized);
|
|
284295
284345
|
};
|
|
284296
284346
|
|
|
284297
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284347
|
+
// node_modules/@x402/evm/dist/esm/chunk-X42JDBHW.mjs
|
|
284298
284348
|
var ExactEvmSchemeV1 = class {
|
|
284299
284349
|
/**
|
|
284300
284350
|
* Creates a new ExactEvmClientV1 instance.
|
|
@@ -284376,7 +284426,7 @@ var ExactEvmSchemeV1 = class {
|
|
|
284376
284426
|
}
|
|
284377
284427
|
};
|
|
284378
284428
|
|
|
284379
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284429
|
+
// node_modules/@x402/evm/dist/esm/chunk-QKR4OFMY.mjs
|
|
284380
284430
|
async function createPermit2PayloadForProxy(proxyAddress, signer, x402Version2, paymentRequirements) {
|
|
284381
284431
|
const now2 = Math.floor(Date.now() / 1e3);
|
|
284382
284432
|
const nonce = createPermit2Nonce();
|
|
@@ -284428,7 +284478,7 @@ async function signPermit2Authorization(signer, permit2Authorization, requiremen
|
|
|
284428
284478
|
});
|
|
284429
284479
|
}
|
|
284430
284480
|
|
|
284431
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284481
|
+
// node_modules/@x402/evm/dist/esm/chunk-H3CLVT6Z.mjs
|
|
284432
284482
|
var MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
284433
284483
|
async function createPermit2Payload(signer, x402Version2, paymentRequirements) {
|
|
284434
284484
|
return createPermit2PayloadForProxy(
|
|
@@ -284439,7 +284489,7 @@ async function createPermit2Payload(signer, x402Version2, paymentRequirements) {
|
|
|
284439
284489
|
);
|
|
284440
284490
|
}
|
|
284441
284491
|
|
|
284442
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284492
|
+
// node_modules/@x402/evm/dist/esm/chunk-374U7QOG.mjs
|
|
284443
284493
|
init_utils9();
|
|
284444
284494
|
async function createEIP3009Payload(signer, x402Version2, paymentRequirements) {
|
|
284445
284495
|
const nonce = createNonce();
|
|
@@ -284579,7 +284629,7 @@ function registerExactEvmScheme(client, config2) {
|
|
|
284579
284629
|
return client;
|
|
284580
284630
|
}
|
|
284581
284631
|
|
|
284582
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284632
|
+
// node_modules/@x402/evm/dist/esm/chunk-BBPWOJXX.mjs
|
|
284583
284633
|
var SALT_BINDING_TYPEHASH = keccak256(
|
|
284584
284634
|
toBytes(
|
|
284585
284635
|
"x402AuthCaptureSaltBinding(address receiverAuthorizer,address policy,uint256 saltNonce)"
|
|
@@ -284591,7 +284641,7 @@ var PAYMENT_INFO_TYPEHASH = keccak256(
|
|
|
284591
284641
|
)
|
|
284592
284642
|
);
|
|
284593
284643
|
|
|
284594
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284644
|
+
// node_modules/@x402/evm/dist/esm/chunk-7DJ4WEQ5.mjs
|
|
284595
284645
|
var CHANNEL_CONFIG_TYPEHASH = keccak256(
|
|
284596
284646
|
toBytes(
|
|
284597
284647
|
"ChannelConfig(address payer,address payerAuthorizer,address receiver,address receiverAuthorizer,address token,uint40 withdrawDelay,bytes32 salt)"
|
|
@@ -284599,7 +284649,7 @@ var CHANNEL_CONFIG_TYPEHASH = keccak256(
|
|
|
284599
284649
|
);
|
|
284600
284650
|
var UINT96_MASK = (1n << 96n) - 1n;
|
|
284601
284651
|
|
|
284602
|
-
// node_modules/@x402/evm/dist/esm/chunk-
|
|
284652
|
+
// node_modules/@x402/evm/dist/esm/chunk-AEYKXGQA.mjs
|
|
284603
284653
|
init_http3();
|
|
284604
284654
|
init_http3();
|
|
284605
284655
|
init_client();
|
|
@@ -290429,12 +290479,28 @@ function shortenPaths(messages) {
|
|
|
290429
290479
|
|
|
290430
290480
|
// src/compression/layers/json-compact.ts
|
|
290431
290481
|
function compactJson(jsonString) {
|
|
290482
|
+
if (typeof jsonString !== "string") return jsonString;
|
|
290432
290483
|
try {
|
|
290433
|
-
|
|
290434
|
-
return JSON.stringify(parsed);
|
|
290484
|
+
JSON.parse(jsonString);
|
|
290435
290485
|
} catch {
|
|
290436
290486
|
return jsonString;
|
|
290437
290487
|
}
|
|
290488
|
+
let out = "";
|
|
290489
|
+
let start = 0;
|
|
290490
|
+
let inString = false;
|
|
290491
|
+
for (let i = 0; i < jsonString.length; i++) {
|
|
290492
|
+
const ch = jsonString[i];
|
|
290493
|
+
if (inString) {
|
|
290494
|
+
if (ch === "\\") i++;
|
|
290495
|
+
else if (ch === '"') inString = false;
|
|
290496
|
+
} else if (ch === '"') {
|
|
290497
|
+
inString = true;
|
|
290498
|
+
} else if (ch === " " || ch === " " || ch === "\n" || ch === "\r") {
|
|
290499
|
+
out += jsonString.slice(start, i);
|
|
290500
|
+
start = i + 1;
|
|
290501
|
+
}
|
|
290502
|
+
}
|
|
290503
|
+
return out + jsonString.slice(start);
|
|
290438
290504
|
}
|
|
290439
290505
|
function looksLikeJson(str) {
|
|
290440
290506
|
const trimmed = str.trim();
|
|
@@ -292213,6 +292279,9 @@ var SHARE_PRESETS = [
|
|
|
292213
292279
|
function isSharePreset(s3) {
|
|
292214
292280
|
return SHARE_PRESETS.includes(s3);
|
|
292215
292281
|
}
|
|
292282
|
+
var TELEGRAM_MAX_LEN = 4096;
|
|
292283
|
+
var TELEGRAM_SUFFIX_RESERVE = 24;
|
|
292284
|
+
var TELEGRAM_CHUNK_CONTENT_LIMIT = TELEGRAM_MAX_LEN - TELEGRAM_SUFFIX_RESERVE;
|
|
292216
292285
|
var PH_BOLD = "__CR_PH_BOLD_";
|
|
292217
292286
|
var PH_LINK = "__CR_PH_LINK_";
|
|
292218
292287
|
var PH_END = "__";
|
|
@@ -292673,20 +292742,44 @@ var ClientDisconnectedError = class extends Error {
|
|
|
292673
292742
|
this.name = "ClientDisconnectedError";
|
|
292674
292743
|
}
|
|
292675
292744
|
};
|
|
292676
|
-
|
|
292745
|
+
function isClientAbortError(err, res) {
|
|
292746
|
+
if (err instanceof ClientDisconnectedError) return true;
|
|
292747
|
+
if (!(err instanceof Error)) return false;
|
|
292748
|
+
const clientGone = res.destroyed && !res.writableEnded;
|
|
292749
|
+
return clientGone && (err.name === "AbortError" || err.message.includes("aborted"));
|
|
292750
|
+
}
|
|
292751
|
+
async function readBodyWithTimeout(body, timeoutMs = MODEL_BODY_READ_TIMEOUT_MS, signal, abortError = () => new ClientDisconnectedError()) {
|
|
292677
292752
|
if (!body) return [];
|
|
292753
|
+
if (signal?.aborted) {
|
|
292754
|
+
await body.cancel().catch(() => {
|
|
292755
|
+
});
|
|
292756
|
+
throw abortError();
|
|
292757
|
+
}
|
|
292678
292758
|
const reader = body.getReader();
|
|
292679
292759
|
const chunks = [];
|
|
292680
292760
|
let timer2;
|
|
292761
|
+
let abortHandler;
|
|
292681
292762
|
try {
|
|
292682
292763
|
while (true) {
|
|
292764
|
+
if (signal?.aborted) {
|
|
292765
|
+
throw abortError();
|
|
292766
|
+
}
|
|
292767
|
+
const abortPromise = signal ? new Promise((_, reject) => {
|
|
292768
|
+
abortHandler = () => reject(abortError());
|
|
292769
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
292770
|
+
}) : null;
|
|
292683
292771
|
const result = await Promise.race([
|
|
292684
292772
|
reader.read(),
|
|
292685
292773
|
new Promise((_, reject) => {
|
|
292686
292774
|
timer2 = setTimeout(() => reject(new Error("Body read timeout")), timeoutMs);
|
|
292687
|
-
})
|
|
292775
|
+
}),
|
|
292776
|
+
...abortPromise ? [abortPromise] : []
|
|
292688
292777
|
]);
|
|
292689
292778
|
clearTimeout(timer2);
|
|
292779
|
+
if (signal && abortHandler) {
|
|
292780
|
+
signal.removeEventListener("abort", abortHandler);
|
|
292781
|
+
abortHandler = void 0;
|
|
292782
|
+
}
|
|
292690
292783
|
if (result.done) break;
|
|
292691
292784
|
chunks.push(result.value);
|
|
292692
292785
|
}
|
|
@@ -292696,6 +292789,9 @@ async function readBodyWithTimeout(body, timeoutMs = MODEL_BODY_READ_TIMEOUT_MS)
|
|
|
292696
292789
|
throw err;
|
|
292697
292790
|
} finally {
|
|
292698
292791
|
clearTimeout(timer2);
|
|
292792
|
+
if (signal && abortHandler) {
|
|
292793
|
+
signal.removeEventListener("abort", abortHandler);
|
|
292794
|
+
}
|
|
292699
292795
|
reader.releaseLock();
|
|
292700
292796
|
}
|
|
292701
292797
|
return chunks;
|
|
@@ -293776,9 +293872,15 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
293776
293872
|
headers["user-agent"] = USER_AGENT;
|
|
293777
293873
|
console.log(`[ClawRouter] ${requestLabel} request: ${req.method} ${req.url}`);
|
|
293778
293874
|
const clientAbort = new AbortController();
|
|
293779
|
-
|
|
293780
|
-
if (!res.writableEnded
|
|
293781
|
-
|
|
293875
|
+
const onClientDisconnect = () => {
|
|
293876
|
+
if (!res.writableEnded && !clientAbort.signal.aborted) {
|
|
293877
|
+
clientAbort.abort();
|
|
293878
|
+
}
|
|
293879
|
+
};
|
|
293880
|
+
res.on("close", onClientDisconnect);
|
|
293881
|
+
if ((res.destroyed || req.socket?.destroyed) && !res.writableEnded) {
|
|
293882
|
+
onClientDisconnect();
|
|
293883
|
+
}
|
|
293782
293884
|
publishDispatchCost(0);
|
|
293783
293885
|
const upstream = await payFetch(upstreamUrl, {
|
|
293784
293886
|
method: req.method ?? "POST",
|
|
@@ -293820,7 +293922,7 @@ async function proxyPaidApiRequest(req, res, apiBase, payFetch, getActualPayment
|
|
|
293820
293922
|
res.end();
|
|
293821
293923
|
}
|
|
293822
293924
|
} else {
|
|
293823
|
-
const chunks = upstream.body ? await readBodyWithTimeout(upstream.body, ERROR_BODY_READ_TIMEOUT_MS) : [];
|
|
293925
|
+
const chunks = upstream.body ? await readBodyWithTimeout(upstream.body, ERROR_BODY_READ_TIMEOUT_MS, clientAbort.signal) : [];
|
|
293824
293926
|
res.writeHead(upstream.status, responseHeaders);
|
|
293825
293927
|
for (const chunk of chunks) {
|
|
293826
293928
|
safeWrite(res, Buffer.from(chunk));
|
|
@@ -295168,13 +295270,18 @@ async function startProxy(options) {
|
|
|
295168
295270
|
);
|
|
295169
295271
|
} catch (err) {
|
|
295170
295272
|
if (refuseOverCostCap(res, err)) return;
|
|
295171
|
-
const
|
|
295172
|
-
options.onError?.(
|
|
295173
|
-
if (
|
|
295273
|
+
const clientGone = isClientAbortError(err, res);
|
|
295274
|
+
if (!clientGone) options.onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
295275
|
+
if (clientGone) {
|
|
295276
|
+
if (!res.writableEnded) res.destroy();
|
|
295277
|
+
} else if (!res.headersSent) {
|
|
295174
295278
|
res.writeHead(502, { "Content-Type": "application/json" });
|
|
295175
295279
|
res.end(
|
|
295176
295280
|
JSON.stringify({
|
|
295177
|
-
error: {
|
|
295281
|
+
error: {
|
|
295282
|
+
message: `Partner proxy error: ${err instanceof Error ? err.message : String(err)}`,
|
|
295283
|
+
type: "partner_error"
|
|
295284
|
+
}
|
|
295178
295285
|
})
|
|
295179
295286
|
);
|
|
295180
295287
|
} else if (!res.writableEnded) {
|
|
@@ -295203,18 +295310,25 @@ async function startProxy(options) {
|
|
|
295203
295310
|
);
|
|
295204
295311
|
} catch (err) {
|
|
295205
295312
|
if (refuseOverCostCap(res, err)) return;
|
|
295206
|
-
const
|
|
295207
|
-
options.onError?.(
|
|
295208
|
-
if (
|
|
295313
|
+
const clientGone = isClientAbortError(err, res);
|
|
295314
|
+
if (!clientGone) options.onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
295315
|
+
if (clientGone) {
|
|
295316
|
+
if (!res.writableEnded) res.destroy();
|
|
295317
|
+
} else if (!res.headersSent) {
|
|
295209
295318
|
res.writeHead(502, { "Content-Type": "application/json" });
|
|
295210
295319
|
res.end(
|
|
295211
295320
|
JSON.stringify({
|
|
295212
|
-
error: {
|
|
295321
|
+
error: {
|
|
295322
|
+
message: `Account API error: ${err instanceof Error ? err.message : String(err)}`,
|
|
295323
|
+
type: "account_error"
|
|
295324
|
+
}
|
|
295213
295325
|
})
|
|
295214
295326
|
);
|
|
295215
295327
|
} else if (!res.writableEnded) {
|
|
295216
295328
|
res.end();
|
|
295217
295329
|
}
|
|
295330
|
+
} finally {
|
|
295331
|
+
paymentStore.getStore()?.sessionSpend?.release();
|
|
295218
295332
|
}
|
|
295219
295333
|
return;
|
|
295220
295334
|
}
|
|
@@ -296747,6 +296861,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
296747
296861
|
} else {
|
|
296748
296862
|
clearInterval(heartbeatInterval);
|
|
296749
296863
|
heartbeatInterval = void 0;
|
|
296864
|
+
onClientClose();
|
|
296750
296865
|
}
|
|
296751
296866
|
}, HEARTBEAT_INTERVAL_MS);
|
|
296752
296867
|
}
|
|
@@ -296776,7 +296891,7 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
296776
296891
|
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
296777
296892
|
const globalController = new AbortController();
|
|
296778
296893
|
const timeoutId = setTimeout(() => globalController.abort(), timeoutMs);
|
|
296779
|
-
const clientDisconnected = () => res.destroyed && !res.writableEnded;
|
|
296894
|
+
const clientDisconnected = () => (res.destroyed || req.socket?.destroyed === true) && !res.writableEnded;
|
|
296780
296895
|
const abortError = () => clientDisconnected() ? new ClientDisconnectedError() : new Error(`Request timed out after ${timeoutMs}ms`);
|
|
296781
296896
|
const onClientClose = () => {
|
|
296782
296897
|
if (!res.writableEnded && !globalController.signal.aborted) {
|
|
@@ -296785,7 +296900,9 @@ async function proxyRequest(req, res, apiBase, payFetch, options, routerOpts, de
|
|
|
296785
296900
|
}
|
|
296786
296901
|
};
|
|
296787
296902
|
res.on("close", onClientClose);
|
|
296788
|
-
if (
|
|
296903
|
+
if (clientDisconnected()) {
|
|
296904
|
+
onClientClose();
|
|
296905
|
+
}
|
|
296789
296906
|
try {
|
|
296790
296907
|
let modelsToTry;
|
|
296791
296908
|
const excludeList = options.excludeModels ?? loadExcludeList();
|
|
@@ -297433,7 +297550,12 @@ data: [DONE]
|
|
|
297433
297550
|
const responseChunks = [];
|
|
297434
297551
|
if (headersSentEarly) {
|
|
297435
297552
|
if (upstream.body) {
|
|
297436
|
-
const chunks = await readBodyWithTimeout(
|
|
297553
|
+
const chunks = await readBodyWithTimeout(
|
|
297554
|
+
upstream.body,
|
|
297555
|
+
MODEL_BODY_READ_TIMEOUT_MS,
|
|
297556
|
+
globalController.signal,
|
|
297557
|
+
abortError
|
|
297558
|
+
);
|
|
297437
297559
|
const jsonBody = Buffer.concat(chunks);
|
|
297438
297560
|
const jsonStr = jsonBody.toString();
|
|
297439
297561
|
try {
|
|
@@ -297564,7 +297686,9 @@ data: [DONE]
|
|
|
297564
297686
|
responseChunks.push(Buffer.from(finishData));
|
|
297565
297687
|
}
|
|
297566
297688
|
}
|
|
297567
|
-
} catch {
|
|
297689
|
+
} catch (err) {
|
|
297690
|
+
if (err instanceof ClientDisconnectedError) throw err;
|
|
297691
|
+
if (globalController.signal.aborted) throw abortError();
|
|
297568
297692
|
const errPayload = JSON.stringify({
|
|
297569
297693
|
error: {
|
|
297570
297694
|
message: `Upstream response could not be parsed: ${jsonStr.slice(0, 200)}`,
|
|
@@ -297652,7 +297776,12 @@ data: [DONE]
|
|
|
297652
297776
|
}
|
|
297653
297777
|
const bodyParts = [];
|
|
297654
297778
|
if (upstream.body) {
|
|
297655
|
-
const chunks = await readBodyWithTimeout(
|
|
297779
|
+
const chunks = await readBodyWithTimeout(
|
|
297780
|
+
upstream.body,
|
|
297781
|
+
MODEL_BODY_READ_TIMEOUT_MS,
|
|
297782
|
+
globalController.signal,
|
|
297783
|
+
abortError
|
|
297784
|
+
);
|
|
297656
297785
|
for (const chunk of chunks) {
|
|
297657
297786
|
bodyParts.push(Buffer.from(chunk));
|
|
297658
297787
|
}
|
|
@@ -299322,7 +299451,7 @@ var AMOY_CONTRACTS = {
|
|
|
299322
299451
|
conditionalTokens: "0x69308FB512518e39F9b16112fA8d994F4e2Bf8bB",
|
|
299323
299452
|
exchangeV2: "0xE111180000d2663C0091e4f400237545B87B996B",
|
|
299324
299453
|
negRiskExchangeV2: "0xe2222d279d744050d28e00520010520000310F59",
|
|
299325
|
-
exchangeV3: "
|
|
299454
|
+
exchangeV3: "0xe3333700cA9d93003F00f0F71f8515005F6c00Aa"
|
|
299326
299455
|
};
|
|
299327
299456
|
var MATIC_CONTRACTS = {
|
|
299328
299457
|
exchange: "0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E",
|
|
@@ -302372,7 +302501,7 @@ import { resolve as resolvePath } from "path";
|
|
|
302372
302501
|
import zlib from "zlib";
|
|
302373
302502
|
|
|
302374
302503
|
// node_modules/axios/lib/env/data.js
|
|
302375
|
-
var VERSION2 = "1.21.
|
|
302504
|
+
var VERSION2 = "1.21.1";
|
|
302376
302505
|
|
|
302377
302506
|
// node_modules/axios/lib/helpers/parseProtocol.js
|
|
302378
302507
|
function parseProtocol(url3) {
|
|
@@ -305873,8 +306002,11 @@ function throwIfCancellationRequested(config2) {
|
|
|
305873
306002
|
throw new CanceledError_default(null, config2);
|
|
305874
306003
|
}
|
|
305875
306004
|
}
|
|
305876
|
-
function
|
|
305877
|
-
return
|
|
306005
|
+
function resolveClock() {
|
|
306006
|
+
return typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
|
|
306007
|
+
}
|
|
306008
|
+
function elapsedSince(now2, start) {
|
|
306009
|
+
return Math.max(0, Math.round(now2() - start));
|
|
305878
306010
|
}
|
|
305879
306011
|
function dispatchRequest(_config) {
|
|
305880
306012
|
const config2 = utils_default.toSafeFlatObject(_config);
|
|
@@ -305885,11 +306017,12 @@ function dispatchRequest(_config) {
|
|
|
305885
306017
|
config2.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
305886
306018
|
}
|
|
305887
306019
|
const adapter2 = adapters_default.getAdapter(config2.adapter || defaults_default.adapter, config2);
|
|
305888
|
-
const
|
|
306020
|
+
const now2 = resolveClock();
|
|
306021
|
+
const start = now2();
|
|
305889
306022
|
return adapter2(config2).then(
|
|
305890
306023
|
function onAdapterResolution(response) {
|
|
305891
306024
|
throwIfCancellationRequested(config2);
|
|
305892
|
-
response.duration = elapsedSince(start);
|
|
306025
|
+
response.duration = elapsedSince(now2, start);
|
|
305893
306026
|
config2.response = response;
|
|
305894
306027
|
try {
|
|
305895
306028
|
response.data = transformData.call(config2, config2.transformResponse, response);
|
|
@@ -305903,7 +306036,7 @@ function dispatchRequest(_config) {
|
|
|
305903
306036
|
if (!isCancel(reason)) {
|
|
305904
306037
|
throwIfCancellationRequested(config2);
|
|
305905
306038
|
if (reason && reason.response) {
|
|
305906
|
-
reason.response.duration = elapsedSince(start);
|
|
306039
|
+
reason.response.duration = elapsedSince(now2, start);
|
|
305907
306040
|
config2.response = reason.response;
|
|
305908
306041
|
try {
|
|
305909
306042
|
reason.response.data = transformData.call(
|
|
@@ -312550,6 +312683,6 @@ js-sha3/src/sha3.js:
|
|
|
312550
312683
|
*)
|
|
312551
312684
|
|
|
312552
312685
|
axios/dist/node/axios.cjs:
|
|
312553
|
-
(*! Axios v1.21.
|
|
312686
|
+
(*! Axios v1.21.1 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
312554
312687
|
*/
|
|
312555
312688
|
//# sourceMappingURL=index.js.map
|