@mysten-incubation/suipay-buyer 0.4.0-dev.1 → 0.4.0-dev.10
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/{chunk-BCI3TKYX.js → chunk-RWUAPD7K.js} +56 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +156 -16
- package/dist/{native-transfer-DspFvMQc.d.ts → native-transfer-DWs55Mse.d.ts} +11 -1
- package/dist/native-transfer.d.ts +1 -1
- package/dist/native-transfer.js +1 -1
- package/package.json +1 -1
|
@@ -869,7 +869,7 @@ var DELIVERY_CODES = {
|
|
|
869
869
|
user: { title: "Something went wrong", message: "No result came back from the service." }
|
|
870
870
|
},
|
|
871
871
|
"delivery.seller_timeout": {
|
|
872
|
-
surfaces: ["gateway"],
|
|
872
|
+
surfaces: ["gateway", "sdk", "mcp_local", "mcp_hosted"],
|
|
873
873
|
status: 504,
|
|
874
874
|
title: "Seller timed out after payment",
|
|
875
875
|
paymentState: "charged",
|
|
@@ -1110,6 +1110,16 @@ var INDEXER_CODES = {
|
|
|
1110
1110
|
nextAction: "contact_support",
|
|
1111
1111
|
user: null,
|
|
1112
1112
|
logOnly: true
|
|
1113
|
+
},
|
|
1114
|
+
"indexer.unsettled_delivery": {
|
|
1115
|
+
surfaces: ["indexer"],
|
|
1116
|
+
status: null,
|
|
1117
|
+
title: "Delivered call has no matching on-chain settlement",
|
|
1118
|
+
paymentState: "not_charged",
|
|
1119
|
+
retry: "never",
|
|
1120
|
+
nextAction: "contact_support",
|
|
1121
|
+
user: null,
|
|
1122
|
+
logOnly: true
|
|
1113
1123
|
}
|
|
1114
1124
|
};
|
|
1115
1125
|
|
|
@@ -2395,8 +2405,7 @@ var VALUE_PATTERNS = [
|
|
|
2395
2405
|
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,
|
|
2396
2406
|
// Sui bech32 private keys.
|
|
2397
2407
|
/suiprivkey1[0-9a-z]{20,}/gi,
|
|
2398
|
-
// JSON Web Tokens
|
|
2399
|
-
/\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}/g,
|
|
2408
|
+
// JSON Web Tokens are matched by `redactJwts`, not a regex here.
|
|
2400
2409
|
// Bearer and Payment authorization values.
|
|
2401
2410
|
/\b(Bearer|Payment|Basic)\s+[A-Za-z0-9\-._~+/=,:]{8,}(?:\s*,\s*[a-z]+="[^"]*")*/g,
|
|
2402
2411
|
// `sk-…`-style vendor keys.
|
|
@@ -2406,6 +2415,44 @@ var VALUE_PATTERNS = [
|
|
|
2406
2415
|
// Google API keys.
|
|
2407
2416
|
/\bAIza[0-9A-Za-z_-]{30,}/g
|
|
2408
2417
|
];
|
|
2418
|
+
var JWT_POSITION = 2;
|
|
2419
|
+
var WORD_CHAR = /[A-Za-z0-9_]/;
|
|
2420
|
+
var JWT_CHAR = /[A-Za-z0-9_-]/;
|
|
2421
|
+
function redactJwts(text) {
|
|
2422
|
+
if (!text.includes("eyJ"))
|
|
2423
|
+
return text;
|
|
2424
|
+
const stop = new Int32Array(text.length + 1);
|
|
2425
|
+
stop[text.length] = text.length;
|
|
2426
|
+
for (let p = text.length - 1; p >= 0; p -= 1) {
|
|
2427
|
+
stop[p] = JWT_CHAR.test(text[p]) ? stop[p + 1] : p;
|
|
2428
|
+
}
|
|
2429
|
+
const segment = (from) => from <= text.length ? stop[from] : -1;
|
|
2430
|
+
let out = "";
|
|
2431
|
+
let last = 0;
|
|
2432
|
+
let i = text.indexOf("eyJ");
|
|
2433
|
+
while (i !== -1) {
|
|
2434
|
+
let end = -1;
|
|
2435
|
+
if (i === 0 || !WORD_CHAR.test(text[i - 1])) {
|
|
2436
|
+
const first = segment(i + 3);
|
|
2437
|
+
if (first - (i + 3) >= 5 && text[first] === ".") {
|
|
2438
|
+
const second = segment(first + 1);
|
|
2439
|
+
if (second - (first + 1) >= 5 && text[second] === ".") {
|
|
2440
|
+
const third = segment(second + 1);
|
|
2441
|
+
if (third - (second + 1) >= 5)
|
|
2442
|
+
end = third;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
if (end === -1) {
|
|
2447
|
+
i = text.indexOf("eyJ", i + 1);
|
|
2448
|
+
continue;
|
|
2449
|
+
}
|
|
2450
|
+
out += text.slice(last, i) + REDACTED;
|
|
2451
|
+
last = end;
|
|
2452
|
+
i = text.indexOf("eyJ", end);
|
|
2453
|
+
}
|
|
2454
|
+
return out + text.slice(last);
|
|
2455
|
+
}
|
|
2409
2456
|
var JSON_SECRET_KEY_COLON = new RegExp(String.raw`(\\?)(["'])([\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|key)(\\\2|\2)(\s*:\s*)`, "gi");
|
|
2410
2457
|
var KEY_VALUE_PATTERN = new RegExp(String.raw`((?:(?<![\w.-])[\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|(?<![\w.-])key)\s*[:=]\s*)("(?:\\.|[^"\\])*"?|'(?:\\.|[^'\\])*'?|(?![[{])[^\s"',;&}]+)`, "gi");
|
|
2411
2458
|
var INSPECT_SECRET_KEY = new RegExp(String.raw`(?:(?<![\w.-])[\w.-]{0,64}${SECRET_KEY_SOURCE}[\w.-]{0,64}|(?<![\w.-])key)\s*[:=]\s*`, "gi");
|
|
@@ -2443,8 +2490,11 @@ function redactSecrets(text) {
|
|
|
2443
2490
|
const head = dropSplitToken(text.slice(0, REDACT_MAX_LENGTH));
|
|
2444
2491
|
out = `${head} \u2026[truncated ${text.length - head.length} chars]`;
|
|
2445
2492
|
}
|
|
2446
|
-
for (const pattern of VALUE_PATTERNS)
|
|
2493
|
+
for (const [index, pattern] of VALUE_PATTERNS.entries()) {
|
|
2494
|
+
if (index === JWT_POSITION)
|
|
2495
|
+
out = redactJwts(out);
|
|
2447
2496
|
out = out.replace(pattern, REDACTED);
|
|
2497
|
+
}
|
|
2448
2498
|
out = out.replace(URL_PATTERN, (_match, scheme, userinfo, host, path, query) => `${scheme}://${userinfo ? `${REDACTED}@` : ""}${host}${path}${query ? `?${REDACTED}` : ""}`);
|
|
2449
2499
|
out = out.replace(RELATIVE_URL_QUERY, (_m, prefix, path) => `${prefix}${path}?${REDACTED}`);
|
|
2450
2500
|
out = redactJsonSecretValues(out);
|
|
@@ -3059,9 +3109,11 @@ var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
|
3059
3109
|
"ownerDailyMist",
|
|
3060
3110
|
"ownerHourlyMist",
|
|
3061
3111
|
"ownerIdentityDailyMist",
|
|
3112
|
+
"ownerIdentityHourlyMist",
|
|
3062
3113
|
"delegateDailyMist",
|
|
3063
3114
|
"delegateHourlyMist",
|
|
3064
3115
|
"delegateIdentityDailyMist",
|
|
3116
|
+
"delegateIdentityHourlyMist",
|
|
3065
3117
|
"consecutiveFailures",
|
|
3066
3118
|
"failuresInARow",
|
|
3067
3119
|
"epochReadFailures",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ErrorCode, P as PaymentState, N as NextAction, R as Receipt, C as CodeFor, D as DelegationScope, O as Offer } from './native-transfer-
|
|
2
|
-
export { B as BuildNativeTransferInput, M as McpPaymentSigner, a as NativeTransferAccept, b as NativeTransferBuild, c as NativeTransferError, d as NativeTransferGas, e as NativeTransferSignerInput, S as SuiPayError, f as SuiPayErrorFields, g as buildMcpPaymentPayload, h as buildNativeTransferBytes, i as createNativeTransferSigner, j as inspectNativeTransfer, t as toErrorFields } from './native-transfer-
|
|
1
|
+
import { E as ErrorCode, P as PaymentState, N as NextAction, R as Receipt, C as CodeFor, D as DelegationScope, O as Offer } from './native-transfer-DWs55Mse.js';
|
|
2
|
+
export { B as BuildNativeTransferInput, M as McpPaymentSigner, a as NativeTransferAccept, b as NativeTransferBuild, c as NativeTransferError, d as NativeTransferGas, e as NativeTransferSignerInput, S as SuiPayError, f as SuiPayErrorFields, g as buildMcpPaymentPayload, h as buildNativeTransferBytes, i as createNativeTransferSigner, j as inspectNativeTransfer, t as toErrorFields } from './native-transfer-DWs55Mse.js';
|
|
3
3
|
import { SuiGrpcClient } from '@mysten/sui/grpc';
|
|
4
4
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
5
5
|
import { KeyObject } from 'node:crypto';
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
parseErrorPayload,
|
|
14
14
|
stricterPaymentState,
|
|
15
15
|
toErrorFields
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RWUAPD7K.js";
|
|
17
17
|
|
|
18
18
|
// src/mcp.ts
|
|
19
19
|
async function buildMcpPaymentPayload(paymentRequired, signer) {
|
|
@@ -2411,6 +2411,7 @@ function createSessionsApi(transport, intents) {
|
|
|
2411
2411
|
}
|
|
2412
2412
|
|
|
2413
2413
|
// ../sdk/dist/buyer/v1/discovery.js
|
|
2414
|
+
var MAX_SERVICE_PAGES = 20;
|
|
2414
2415
|
function createCatalogApi(transport) {
|
|
2415
2416
|
return {
|
|
2416
2417
|
async services() {
|
|
@@ -2426,12 +2427,31 @@ function createCatalogApi(transport) {
|
|
|
2426
2427
|
function createRegistryApi(transport) {
|
|
2427
2428
|
return {
|
|
2428
2429
|
async list() {
|
|
2429
|
-
const
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2430
|
+
const services = [];
|
|
2431
|
+
let cursor = null;
|
|
2432
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2433
|
+
for (let page = 0; page < MAX_SERVICE_PAGES; page++) {
|
|
2434
|
+
const path = cursor ? `/v1/services?cursor=${encodeURIComponent(cursor)}` : "/v1/services";
|
|
2435
|
+
const response = await transport.request(path);
|
|
2436
|
+
const { status, body } = response;
|
|
2437
|
+
if (status !== 200 || !isRecord(body) || !Array.isArray(body.services)) {
|
|
2438
|
+
return fail(response);
|
|
2439
|
+
}
|
|
2440
|
+
services.push(...asDto(body.services));
|
|
2441
|
+
const next = body.nextCursor;
|
|
2442
|
+
if (typeof next !== "string" || next === "")
|
|
2443
|
+
return ok(services);
|
|
2444
|
+
if (seen.has(next) || page + 1 >= MAX_SERVICE_PAGES) {
|
|
2445
|
+
return failLocal(502, "client.unexpected", "not_charged", {
|
|
2446
|
+
message: "the gateway catalog was truncated"
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
seen.add(next);
|
|
2450
|
+
cursor = next;
|
|
2433
2451
|
}
|
|
2434
|
-
return
|
|
2452
|
+
return failLocal(502, "client.unexpected", "not_charged", {
|
|
2453
|
+
message: "the gateway catalog was truncated"
|
|
2454
|
+
});
|
|
2435
2455
|
},
|
|
2436
2456
|
async get(id) {
|
|
2437
2457
|
const response = await transport.request(`/v1/services/${encodeURIComponent(id)}`);
|
|
@@ -2968,6 +2988,25 @@ var SERVICE_STATE_TRANSITIONS = Object.freeze([
|
|
|
2968
2988
|
to: "none",
|
|
2969
2989
|
actors: ["system"],
|
|
2970
2990
|
requires: ["reason_code"]
|
|
2991
|
+
},
|
|
2992
|
+
// System listing moves for permissionless services: auto-list after
|
|
2993
|
+
// proof-of-settle (never lifts an operator delist) and reset to unlisted
|
|
2994
|
+
// when a revision changes the published seller URL.
|
|
2995
|
+
{
|
|
2996
|
+
id: "T26",
|
|
2997
|
+
dimension: "listing",
|
|
2998
|
+
from: ["unlisted"],
|
|
2999
|
+
to: "listed",
|
|
3000
|
+
actors: ["system"],
|
|
3001
|
+
requires: ["admission_admitted"]
|
|
3002
|
+
},
|
|
3003
|
+
{
|
|
3004
|
+
id: "T27",
|
|
3005
|
+
dimension: "listing",
|
|
3006
|
+
from: ["listed"],
|
|
3007
|
+
to: "unlisted",
|
|
3008
|
+
actors: ["system"],
|
|
3009
|
+
requires: ["reason_code"]
|
|
2971
3010
|
}
|
|
2972
3011
|
]);
|
|
2973
3012
|
|
|
@@ -3180,6 +3219,38 @@ function createSpendAccountChain(options) {
|
|
|
3180
3219
|
});
|
|
3181
3220
|
const packageId = normalizeSuiAddress3(options.packageId);
|
|
3182
3221
|
const target = (fn) => `${packageId}::${MODULE}::${fn}`;
|
|
3222
|
+
let grantRevokePackageId = null;
|
|
3223
|
+
async function readGrantRevokePackageId() {
|
|
3224
|
+
if (grantRevokePackageId)
|
|
3225
|
+
return grantRevokePackageId;
|
|
3226
|
+
try {
|
|
3227
|
+
const answer = await client.movePackageService.getDatatype({
|
|
3228
|
+
packageId,
|
|
3229
|
+
moduleName: MODULE,
|
|
3230
|
+
name: "GrantRevoked"
|
|
3231
|
+
});
|
|
3232
|
+
const definingId = answer.response?.datatype?.definingId;
|
|
3233
|
+
if (!definingId?.trim()) {
|
|
3234
|
+
logError({
|
|
3235
|
+
scope: "sdk.buyer-control",
|
|
3236
|
+
code: "chain.unavailable",
|
|
3237
|
+
level: "warn",
|
|
3238
|
+
msg: "Grant revoke datatype origin lookup returned no defining id"
|
|
3239
|
+
});
|
|
3240
|
+
return null;
|
|
3241
|
+
}
|
|
3242
|
+
grantRevokePackageId = normalizeSuiAddress3(definingId);
|
|
3243
|
+
return grantRevokePackageId;
|
|
3244
|
+
} catch (err) {
|
|
3245
|
+
logError({
|
|
3246
|
+
scope: "sdk.buyer-control",
|
|
3247
|
+
code: "chain.unavailable",
|
|
3248
|
+
level: "warn",
|
|
3249
|
+
msg: "Grant revoke datatype origin lookup failed"
|
|
3250
|
+
}, err);
|
|
3251
|
+
return null;
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3183
3254
|
async function kindBytes(tx) {
|
|
3184
3255
|
return {
|
|
3185
3256
|
kindBytes: toBase64(await tx.build({ client, onlyTransactionKind: true }))
|
|
@@ -3788,6 +3859,44 @@ function createSpendAccountChain(options) {
|
|
|
3788
3859
|
return null;
|
|
3789
3860
|
}
|
|
3790
3861
|
},
|
|
3862
|
+
readGrantRevokePackageId,
|
|
3863
|
+
async findGrantRevokeTransaction({ ownerAddress, grantObjectId }) {
|
|
3864
|
+
try {
|
|
3865
|
+
const owner = normalizeSuiAddress3(ownerAddress);
|
|
3866
|
+
const grant = normalizeSuiAddress3(grantObjectId);
|
|
3867
|
+
const definingId = await readGrantRevokePackageId();
|
|
3868
|
+
if (!definingId)
|
|
3869
|
+
return null;
|
|
3870
|
+
const eventType = `${definingId}::${MODULE}::GrantRevoked`;
|
|
3871
|
+
let before = null;
|
|
3872
|
+
let inspected = 0;
|
|
3873
|
+
for (let page = 0; page < 8 && inspected < 200; page++) {
|
|
3874
|
+
const result = await client.core.listEvents({
|
|
3875
|
+
filter: { sender: owner },
|
|
3876
|
+
order: "descending",
|
|
3877
|
+
limit: Math.min(50, 200 - inspected),
|
|
3878
|
+
before
|
|
3879
|
+
});
|
|
3880
|
+
for (const event of result.events.slice(0, 200 - inspected)) {
|
|
3881
|
+
inspected++;
|
|
3882
|
+
if (event.eventType !== eventType)
|
|
3883
|
+
continue;
|
|
3884
|
+
const json = event.json;
|
|
3885
|
+
if (typeof json?.grant !== "string" || normalizeSuiAddress3(json.grant) !== grant)
|
|
3886
|
+
continue;
|
|
3887
|
+
const digest = event.transactionDigest.trim();
|
|
3888
|
+
if (digest)
|
|
3889
|
+
return digest;
|
|
3890
|
+
}
|
|
3891
|
+
if (!result.hasNextPage || !result.endCursor || result.endCursor === before)
|
|
3892
|
+
return null;
|
|
3893
|
+
before = result.endCursor;
|
|
3894
|
+
}
|
|
3895
|
+
return null;
|
|
3896
|
+
} catch {
|
|
3897
|
+
return null;
|
|
3898
|
+
}
|
|
3899
|
+
},
|
|
3791
3900
|
async readPolicyBudget({ poolObjectId, onChainPolicyId }) {
|
|
3792
3901
|
try {
|
|
3793
3902
|
const response = await client.core.getDynamicField({
|
|
@@ -6595,8 +6704,35 @@ function assertPaidMethod(method) {
|
|
|
6595
6704
|
return upper;
|
|
6596
6705
|
throw new PaidRequestError("method", `paid request method must be GET or POST, got ${method}`);
|
|
6597
6706
|
}
|
|
6707
|
+
var MAX_RAW_CONTENT_TYPE_LENGTH = 1024;
|
|
6708
|
+
var WHITESPACE = /\s/;
|
|
6709
|
+
function collapseAround(value, mark, replacement) {
|
|
6710
|
+
let out = "";
|
|
6711
|
+
let pending = "";
|
|
6712
|
+
let afterMark = false;
|
|
6713
|
+
for (const ch of value) {
|
|
6714
|
+
if (WHITESPACE.test(ch)) {
|
|
6715
|
+
if (!afterMark)
|
|
6716
|
+
pending += ch;
|
|
6717
|
+
continue;
|
|
6718
|
+
}
|
|
6719
|
+
if (ch === mark) {
|
|
6720
|
+
out += replacement;
|
|
6721
|
+
pending = "";
|
|
6722
|
+
afterMark = true;
|
|
6723
|
+
continue;
|
|
6724
|
+
}
|
|
6725
|
+
out += pending + ch;
|
|
6726
|
+
pending = "";
|
|
6727
|
+
afterMark = false;
|
|
6728
|
+
}
|
|
6729
|
+
return afterMark ? out : out + pending;
|
|
6730
|
+
}
|
|
6598
6731
|
function normalizeContentType(value) {
|
|
6599
|
-
|
|
6732
|
+
if (value.length > MAX_RAW_CONTENT_TYPE_LENGTH) {
|
|
6733
|
+
throw new PaidRequestError("invalid", `paid request content type is ${value.length} characters; max is ${MAX_RAW_CONTENT_TYPE_LENGTH}`);
|
|
6734
|
+
}
|
|
6735
|
+
const normalized = collapseAround(collapseAround(value.trim().toLowerCase(), ";", "; "), "=", "=");
|
|
6600
6736
|
if (!isOfferContentType(normalized)) {
|
|
6601
6737
|
throw new PaidRequestError("invalid", `paid request content type is malformed: ${value}`);
|
|
6602
6738
|
}
|
|
@@ -8041,6 +8177,8 @@ var DELEGATED_PAY_ERROR_CODE_SET = new Set(Object.values(DELEGATED_PAY_ERROR_COD
|
|
|
8041
8177
|
function isDelegatedPayErrorCode(value) {
|
|
8042
8178
|
return typeof value === "string" && DELEGATED_PAY_ERROR_CODE_SET.has(value);
|
|
8043
8179
|
}
|
|
8180
|
+
var DELIVERY_SELLER_TIMEOUT_DETAIL = "Gateway timed out waiting for the paid service to deliver.";
|
|
8181
|
+
var EXECUTE_TIMEOUT_DETAIL = "Gateway timed out before confirming whether payment settled; check status before retrying.";
|
|
8044
8182
|
var PUBLIC_DETAIL = {
|
|
8045
8183
|
OFFER_SECRET_REQUIRED: "offer verification material is unavailable",
|
|
8046
8184
|
CHALLENGE_TAMPERED: "offer digest does not verify",
|
|
@@ -8207,14 +8345,15 @@ function withReconcileKeys(error, extras) {
|
|
|
8207
8345
|
};
|
|
8208
8346
|
}
|
|
8209
8347
|
async function gatewayDeliveryFailure(response, log, local) {
|
|
8348
|
+
const timedOut = response.status === 504;
|
|
8210
8349
|
const result = gatewayFailure(await readGatewayAnswer(response), {
|
|
8211
|
-
code: DELEGATED_PAY_CODES[local.code],
|
|
8350
|
+
code: timedOut ? "delivery.seller_timeout" : DELEGATED_PAY_CODES[local.code],
|
|
8212
8351
|
paymentState: "charged",
|
|
8213
|
-
detail: PUBLIC_DETAIL[local.code]
|
|
8352
|
+
detail: timedOut ? DELIVERY_SELLER_TIMEOUT_DETAIL : PUBLIC_DETAIL[local.code]
|
|
8214
8353
|
}, { paymentId: local.paymentId, txDigest: local.txDigest, settlement: local.settlement });
|
|
8215
8354
|
logInternal(log, {
|
|
8216
|
-
code: "delivery.proof_rejected",
|
|
8217
|
-
msg: "gateway did not deliver after settlement",
|
|
8355
|
+
code: timedOut ? "delivery.seller_timeout" : "delivery.proof_rejected",
|
|
8356
|
+
msg: timedOut ? "gateway timed out delivering after settlement" : "gateway did not deliver after settlement",
|
|
8218
8357
|
context: {
|
|
8219
8358
|
status: response.status,
|
|
8220
8359
|
header: response.headers.get(ERROR_CODE_HEADER),
|
|
@@ -9878,22 +10017,23 @@ async function recordX402Answer(ctx, answer) {
|
|
|
9878
10017
|
if (answer.kind === "undelivered") {
|
|
9879
10018
|
const stated = parseErrorPayload(answer.answer)?.paymentState;
|
|
9880
10019
|
const charged = answer.receipt !== null || stated === "charged";
|
|
10020
|
+
const timedOut = answer.answer.status === 504;
|
|
9881
10021
|
const settlement2 = answer.receipt ? { ...ctx.settlement, txDigest: answer.receipt.txDigest } : void 0;
|
|
9882
10022
|
const result = gatewayFailure(answer.answer, charged ? {
|
|
9883
|
-
code: DELEGATED_PAY_CODES.GATEWAY_REFUSED,
|
|
10023
|
+
code: timedOut ? "delivery.seller_timeout" : DELEGATED_PAY_CODES.GATEWAY_REFUSED,
|
|
9884
10024
|
paymentState: "charged",
|
|
9885
|
-
detail: PUBLIC_DETAIL.GATEWAY_REFUSED
|
|
10025
|
+
detail: timedOut ? DELIVERY_SELLER_TIMEOUT_DETAIL : PUBLIC_DETAIL.GATEWAY_REFUSED
|
|
9886
10026
|
} : {
|
|
9887
10027
|
code: DELEGATED_PAY_CODES.EXECUTE_AMBIGUOUS,
|
|
9888
10028
|
paymentState: "unknown",
|
|
9889
|
-
detail: PUBLIC_DETAIL.EXECUTE_AMBIGUOUS
|
|
10029
|
+
detail: timedOut ? EXECUTE_TIMEOUT_DETAIL : PUBLIC_DETAIL.EXECUTE_AMBIGUOUS
|
|
9890
10030
|
}, {
|
|
9891
10031
|
paymentId,
|
|
9892
10032
|
...settlement2 ? { txDigest: settlement2.txDigest, settlement: settlement2 } : answer.txDigest ? { txDigest: answer.txDigest } : {}
|
|
9893
10033
|
});
|
|
9894
10034
|
logInternal(log, {
|
|
9895
|
-
code: "delivery.proof_rejected",
|
|
9896
|
-
msg: "gateway did not deliver against an x402 credential",
|
|
10035
|
+
code: charged && timedOut ? "delivery.seller_timeout" : "delivery.proof_rejected",
|
|
10036
|
+
msg: charged && timedOut ? "gateway timed out delivering against an x402 credential" : "gateway did not deliver against an x402 credential",
|
|
9897
10037
|
context: { status: answer.answer.status, code: result.code }
|
|
9898
10038
|
});
|
|
9899
10039
|
return completeAttempt(ledger, paymentId, result, log);
|
|
@@ -160,6 +160,16 @@ declare const ERRORS: {
|
|
|
160
160
|
readonly user: null;
|
|
161
161
|
readonly logOnly: true;
|
|
162
162
|
};
|
|
163
|
+
readonly 'indexer.unsettled_delivery': {
|
|
164
|
+
readonly surfaces: readonly ["indexer"];
|
|
165
|
+
readonly status: null;
|
|
166
|
+
readonly title: "Delivered call has no matching on-chain settlement";
|
|
167
|
+
readonly paymentState: "not_charged";
|
|
168
|
+
readonly retry: "never";
|
|
169
|
+
readonly nextAction: "contact_support";
|
|
170
|
+
readonly user: null;
|
|
171
|
+
readonly logOnly: true;
|
|
172
|
+
};
|
|
163
173
|
readonly 'client.agent_handoff_failed': {
|
|
164
174
|
readonly surfaces: readonly ["browser", "mcp_local"];
|
|
165
175
|
readonly status: null;
|
|
@@ -1252,7 +1262,7 @@ declare const ERRORS: {
|
|
|
1252
1262
|
};
|
|
1253
1263
|
};
|
|
1254
1264
|
readonly 'delivery.seller_timeout': {
|
|
1255
|
-
readonly surfaces: readonly ["gateway"];
|
|
1265
|
+
readonly surfaces: readonly ["gateway", "sdk", "mcp_local", "mcp_hosted"];
|
|
1256
1266
|
readonly status: 504;
|
|
1257
1267
|
readonly title: "Seller timed out after payment";
|
|
1258
1268
|
readonly paymentState: "charged";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@mysten/sui/client';
|
|
2
|
-
export { B as BuildNativeTransferInput, a as NativeTransferAccept, b as NativeTransferBuild, c as NativeTransferError, k as NativeTransferErrorCode, d as NativeTransferGas, e as NativeTransferSignerInput, h as buildNativeTransferBytes, i as createNativeTransferSigner, j as inspectNativeTransfer } from './native-transfer-
|
|
2
|
+
export { B as BuildNativeTransferInput, a as NativeTransferAccept, b as NativeTransferBuild, c as NativeTransferError, k as NativeTransferErrorCode, d as NativeTransferGas, e as NativeTransferSignerInput, h as buildNativeTransferBytes, i as createNativeTransferSigner, j as inspectNativeTransfer } from './native-transfer-DWs55Mse.js';
|
package/dist/native-transfer.js
CHANGED
package/package.json
CHANGED