@mysten-incubation/suipay-buyer 0.3.0-dev.0 → 0.3.0-dev.2
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-XSL5G2RU.js → chunk-XHHXRSY3.js} +284 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{native-transfer-GD3KlVqG.d.ts → native-transfer-BN4VEDV0.d.ts} +41 -1
- package/dist/native-transfer.d.ts +1 -1
- package/dist/native-transfer.js +1 -1
- package/package.json +1 -1
|
@@ -2077,7 +2077,7 @@ var SERVICE_CODES = {
|
|
|
2077
2077
|
},
|
|
2078
2078
|
// Boot or configuration fell back to a degraded mode instead of failing.
|
|
2079
2079
|
"service.config_degraded": {
|
|
2080
|
-
surfaces: ["gateway"],
|
|
2080
|
+
surfaces: ["gateway", "console_server"],
|
|
2081
2081
|
status: null,
|
|
2082
2082
|
title: "Service started with degraded configuration",
|
|
2083
2083
|
paymentState: "not_charged",
|
|
@@ -2086,6 +2086,19 @@ var SERVICE_CODES = {
|
|
|
2086
2086
|
user: null,
|
|
2087
2087
|
logOnly: true
|
|
2088
2088
|
},
|
|
2089
|
+
// A readiness gauge moved while the process is still serving. Not a degraded
|
|
2090
|
+
// boot: `service.config_degraded` is reserved for that, and for the sample
|
|
2091
|
+
// that actually fails closed.
|
|
2092
|
+
"service.readiness": {
|
|
2093
|
+
surfaces: ["gateway"],
|
|
2094
|
+
status: null,
|
|
2095
|
+
title: "Readiness gauge updated",
|
|
2096
|
+
paymentState: "not_charged",
|
|
2097
|
+
retry: "never",
|
|
2098
|
+
nextAction: "none",
|
|
2099
|
+
user: null,
|
|
2100
|
+
logOnly: true
|
|
2101
|
+
},
|
|
2089
2102
|
// A best-effort write (a trace event, a receipt, a delivery record) failed.
|
|
2090
2103
|
// The request it belongs to keeps its answer.
|
|
2091
2104
|
"service.bookkeeping_failed": {
|
|
@@ -2097,6 +2110,39 @@ var SERVICE_CODES = {
|
|
|
2097
2110
|
nextAction: "none",
|
|
2098
2111
|
user: null,
|
|
2099
2112
|
logOnly: true
|
|
2113
|
+
},
|
|
2114
|
+
// What a process started with: network, posture, rails, gas pool. Healthy.
|
|
2115
|
+
"service.boot": {
|
|
2116
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2117
|
+
status: null,
|
|
2118
|
+
title: "Service started",
|
|
2119
|
+
paymentState: "not_charged",
|
|
2120
|
+
retry: "never",
|
|
2121
|
+
nextAction: "none",
|
|
2122
|
+
user: null,
|
|
2123
|
+
logOnly: true
|
|
2124
|
+
},
|
|
2125
|
+
// A background worker started, stopped, swept or retried on schedule. Healthy.
|
|
2126
|
+
"service.lifecycle": {
|
|
2127
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2128
|
+
status: null,
|
|
2129
|
+
title: "Background work progressed",
|
|
2130
|
+
paymentState: "not_charged",
|
|
2131
|
+
retry: "never",
|
|
2132
|
+
nextAction: "none",
|
|
2133
|
+
user: null,
|
|
2134
|
+
logOnly: true
|
|
2135
|
+
},
|
|
2136
|
+
// Detail about healthy traffic an operator may want when reading a trace.
|
|
2137
|
+
"service.diagnostic": {
|
|
2138
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2139
|
+
status: null,
|
|
2140
|
+
title: "Diagnostic detail",
|
|
2141
|
+
paymentState: "not_charged",
|
|
2142
|
+
retry: "never",
|
|
2143
|
+
nextAction: "none",
|
|
2144
|
+
user: null,
|
|
2145
|
+
logOnly: true
|
|
2100
2146
|
}
|
|
2101
2147
|
};
|
|
2102
2148
|
|
|
@@ -2797,6 +2843,233 @@ function newTraceId(randomBytes = cryptoRandomBytes) {
|
|
|
2797
2843
|
return /^0+$/.test(hex) ? newTraceId(randomBytes) : hex;
|
|
2798
2844
|
}
|
|
2799
2845
|
|
|
2846
|
+
// ../core/dist/errors/context-allowlist.js
|
|
2847
|
+
var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
2848
|
+
// Settlement and request identifiers.
|
|
2849
|
+
"txDigest",
|
|
2850
|
+
"digest",
|
|
2851
|
+
"challengeId",
|
|
2852
|
+
"paymentId",
|
|
2853
|
+
"paymentHash",
|
|
2854
|
+
"paymentKey",
|
|
2855
|
+
"paymentState",
|
|
2856
|
+
"requestId",
|
|
2857
|
+
"traceId",
|
|
2858
|
+
"clientId",
|
|
2859
|
+
"serviceId",
|
|
2860
|
+
"configId",
|
|
2861
|
+
"seedId",
|
|
2862
|
+
"grantId",
|
|
2863
|
+
"grantObjectId",
|
|
2864
|
+
"sameGrantObjectId",
|
|
2865
|
+
"verifiedGrant",
|
|
2866
|
+
"poolObjectId",
|
|
2867
|
+
"packageId",
|
|
2868
|
+
"activePackageId",
|
|
2869
|
+
"expectedPackageId",
|
|
2870
|
+
"actualPackageId",
|
|
2871
|
+
"mandateId",
|
|
2872
|
+
"session",
|
|
2873
|
+
"coinId",
|
|
2874
|
+
"coinIds",
|
|
2875
|
+
"id",
|
|
2876
|
+
"dedupeKey",
|
|
2877
|
+
"hook",
|
|
2878
|
+
// Addresses (public on chain).
|
|
2879
|
+
"owner",
|
|
2880
|
+
"payTo",
|
|
2881
|
+
"recipient",
|
|
2882
|
+
"delegateAddress",
|
|
2883
|
+
// Codes, kinds and states.
|
|
2884
|
+
"code",
|
|
2885
|
+
"innerCode",
|
|
2886
|
+
"requestedCode",
|
|
2887
|
+
"failureCode",
|
|
2888
|
+
"oauthError",
|
|
2889
|
+
"errorKind",
|
|
2890
|
+
"kind",
|
|
2891
|
+
"mode",
|
|
2892
|
+
"effectiveMode",
|
|
2893
|
+
"state",
|
|
2894
|
+
"outcome",
|
|
2895
|
+
"status",
|
|
2896
|
+
"httpStatus",
|
|
2897
|
+
"reason",
|
|
2898
|
+
"action",
|
|
2899
|
+
"stage",
|
|
2900
|
+
"paid",
|
|
2901
|
+
"delivery",
|
|
2902
|
+
"sellerStatus",
|
|
2903
|
+
"sellerCode",
|
|
2904
|
+
"bindingCode",
|
|
2905
|
+
"errorName",
|
|
2906
|
+
"gasStationStatus",
|
|
2907
|
+
"readFailure",
|
|
2908
|
+
"refusal",
|
|
2909
|
+
"refusedAs",
|
|
2910
|
+
"registryCode",
|
|
2911
|
+
"sessionDecision",
|
|
2912
|
+
"settleCode",
|
|
2913
|
+
"signedRequest",
|
|
2914
|
+
"signerCode",
|
|
2915
|
+
"consentCode",
|
|
2916
|
+
"publicReason",
|
|
2917
|
+
"details",
|
|
2918
|
+
"event",
|
|
2919
|
+
"eventType",
|
|
2920
|
+
"surface",
|
|
2921
|
+
"scope",
|
|
2922
|
+
"field",
|
|
2923
|
+
"header",
|
|
2924
|
+
"dependency",
|
|
2925
|
+
"network",
|
|
2926
|
+
"rails",
|
|
2927
|
+
"shard",
|
|
2928
|
+
"metric",
|
|
2929
|
+
"alarm",
|
|
2930
|
+
"alert",
|
|
2931
|
+
"from",
|
|
2932
|
+
"to",
|
|
2933
|
+
"expected",
|
|
2934
|
+
"required",
|
|
2935
|
+
"violated",
|
|
2936
|
+
"diverged",
|
|
2937
|
+
"replaced",
|
|
2938
|
+
"suppressed",
|
|
2939
|
+
"unknown",
|
|
2940
|
+
"verified",
|
|
2941
|
+
"verification",
|
|
2942
|
+
"simulation",
|
|
2943
|
+
"isNew",
|
|
2944
|
+
"needsTopup",
|
|
2945
|
+
"operatorCapSet",
|
|
2946
|
+
"wantAgent",
|
|
2947
|
+
"wantGrant",
|
|
2948
|
+
"wantPool",
|
|
2949
|
+
"limitedBy",
|
|
2950
|
+
"peer",
|
|
2951
|
+
// Counts, amounts and timings.
|
|
2952
|
+
"amount",
|
|
2953
|
+
"scanned",
|
|
2954
|
+
"deleted",
|
|
2955
|
+
"intents",
|
|
2956
|
+
"policies",
|
|
2957
|
+
"connections",
|
|
2958
|
+
"events",
|
|
2959
|
+
"maxQueueSize",
|
|
2960
|
+
"bytes",
|
|
2961
|
+
"sha256",
|
|
2962
|
+
"ts",
|
|
2963
|
+
"count",
|
|
2964
|
+
"countRaw",
|
|
2965
|
+
"matchingCount",
|
|
2966
|
+
"registry_field_count",
|
|
2967
|
+
"applied",
|
|
2968
|
+
"attempt",
|
|
2969
|
+
"attempts",
|
|
2970
|
+
"cap",
|
|
2971
|
+
"max",
|
|
2972
|
+
"maxChallenges",
|
|
2973
|
+
"MAX_GAS_COIN_PAGES",
|
|
2974
|
+
"pagesScanned",
|
|
2975
|
+
"size",
|
|
2976
|
+
"free",
|
|
2977
|
+
"used",
|
|
2978
|
+
"fill",
|
|
2979
|
+
"limits",
|
|
2980
|
+
"refills",
|
|
2981
|
+
"refilled",
|
|
2982
|
+
"split",
|
|
2983
|
+
"unconfirmed",
|
|
2984
|
+
"spent",
|
|
2985
|
+
"reserveAfter",
|
|
2986
|
+
"claimedUntilMs",
|
|
2987
|
+
"repaired",
|
|
2988
|
+
"splits",
|
|
2989
|
+
"spend",
|
|
2990
|
+
"reserve",
|
|
2991
|
+
"reserveBalance",
|
|
2992
|
+
"ownerDailyMist",
|
|
2993
|
+
"ownerHourlyMist",
|
|
2994
|
+
"ownerIdentityDailyMist",
|
|
2995
|
+
"delegateDailyMist",
|
|
2996
|
+
"delegateHourlyMist",
|
|
2997
|
+
"delegateIdentityDailyMist",
|
|
2998
|
+
"consecutiveFailures",
|
|
2999
|
+
"failuresInARow",
|
|
3000
|
+
"epochReadFailures",
|
|
3001
|
+
"daysRemaining",
|
|
3002
|
+
"deadline",
|
|
3003
|
+
"delay",
|
|
3004
|
+
"delayMs",
|
|
3005
|
+
"ageMs",
|
|
3006
|
+
"timeoutMs",
|
|
3007
|
+
"nowMs",
|
|
3008
|
+
"switchedAtMs",
|
|
3009
|
+
"observeUntil",
|
|
3010
|
+
"window",
|
|
3011
|
+
"checkpointSeq",
|
|
3012
|
+
"eventSeq",
|
|
3013
|
+
"sampleSubjects",
|
|
3014
|
+
// Operator-facing error text. Redacted and length-capped like every string.
|
|
3015
|
+
"error",
|
|
3016
|
+
"errors",
|
|
3017
|
+
"err",
|
|
3018
|
+
"lastError",
|
|
3019
|
+
"outcomeError",
|
|
3020
|
+
"detail",
|
|
3021
|
+
"raw",
|
|
3022
|
+
"value"
|
|
3023
|
+
]);
|
|
3024
|
+
var MAX_CONTEXT_STRING = 512;
|
|
3025
|
+
var MAX_CONTEXT_ARRAY = 32;
|
|
3026
|
+
var MAX_CONTEXT_DEPTH = 4;
|
|
3027
|
+
function filterContext(context) {
|
|
3028
|
+
let dropped = 0;
|
|
3029
|
+
const filterValue = (value2, depth) => {
|
|
3030
|
+
if (typeof value2 === "bigint")
|
|
3031
|
+
return value2.toString();
|
|
3032
|
+
if (value2 === null || typeof value2 !== "object")
|
|
3033
|
+
return value2;
|
|
3034
|
+
if (depth >= MAX_CONTEXT_DEPTH) {
|
|
3035
|
+
dropped += 1;
|
|
3036
|
+
return void 0;
|
|
3037
|
+
}
|
|
3038
|
+
if (Array.isArray(value2)) {
|
|
3039
|
+
return value2.slice(0, MAX_CONTEXT_ARRAY).map((item) => filterValue(item, depth + 1));
|
|
3040
|
+
}
|
|
3041
|
+
if (value2 instanceof Date)
|
|
3042
|
+
return value2.toISOString();
|
|
3043
|
+
return filterObject(value2, depth + 1);
|
|
3044
|
+
};
|
|
3045
|
+
const filterObject = (object, depth) => {
|
|
3046
|
+
const out = {};
|
|
3047
|
+
for (const [key, value2] of Object.entries(object)) {
|
|
3048
|
+
if (!CONTEXT_ALLOWLIST.has(key)) {
|
|
3049
|
+
dropped += 1;
|
|
3050
|
+
continue;
|
|
3051
|
+
}
|
|
3052
|
+
const kept = filterValue(value2, depth);
|
|
3053
|
+
if (kept !== void 0)
|
|
3054
|
+
out[key] = kept;
|
|
3055
|
+
}
|
|
3056
|
+
return out;
|
|
3057
|
+
};
|
|
3058
|
+
const value = filterObject(context, 0);
|
|
3059
|
+
return { value, dropped };
|
|
3060
|
+
}
|
|
3061
|
+
function capContextStrings(value) {
|
|
3062
|
+
if (typeof value === "string") {
|
|
3063
|
+
return value.length > MAX_CONTEXT_STRING ? `${value.slice(0, MAX_CONTEXT_STRING)}\u2026` : value;
|
|
3064
|
+
}
|
|
3065
|
+
if (Array.isArray(value))
|
|
3066
|
+
return value.map(capContextStrings);
|
|
3067
|
+
if (value !== null && typeof value === "object") {
|
|
3068
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, capContextStrings(v)]));
|
|
3069
|
+
}
|
|
3070
|
+
return value;
|
|
3071
|
+
}
|
|
3072
|
+
|
|
2800
3073
|
// ../core/dist/errors/log.js
|
|
2801
3074
|
var MAX_CAUSE_DEPTH = 5;
|
|
2802
3075
|
function causeChain(error) {
|
|
@@ -2847,6 +3120,7 @@ function safeStringify(value) {
|
|
|
2847
3120
|
function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
|
|
2848
3121
|
const wantStack = context.withStack ?? (context.httpStatus !== void 0 && context.httpStatus >= 500);
|
|
2849
3122
|
const stack = wantStack && error instanceof Error && error.stack ? redactSecrets(error.stack) : void 0;
|
|
3123
|
+
const filtered = context.context ? filterContext(context.context) : void 0;
|
|
2850
3124
|
return {
|
|
2851
3125
|
level: context.level ?? "error",
|
|
2852
3126
|
time: now.toISOString(),
|
|
@@ -2858,10 +3132,12 @@ function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
|
|
|
2858
3132
|
trace_id: context.traceId || newTraceId(),
|
|
2859
3133
|
cause: error === void 0 ? [] : causeChain(error),
|
|
2860
3134
|
...stack ? { stack } : {},
|
|
2861
|
-
...
|
|
3135
|
+
...filtered ? { context: capContextStrings(redactValue(filtered.value)) } : {},
|
|
3136
|
+
...filtered && filtered.dropped > 0 ? { context_dropped: filtered.dropped } : {}
|
|
2862
3137
|
};
|
|
2863
3138
|
}
|
|
2864
3139
|
var stderrWriter = (line) => console.error(line);
|
|
3140
|
+
var lineShipper = null;
|
|
2865
3141
|
function logError(context, error, write = stderrWriter) {
|
|
2866
3142
|
let line;
|
|
2867
3143
|
let traceId = "";
|
|
@@ -2882,6 +3158,12 @@ function logError(context, error, write = stderrWriter) {
|
|
|
2882
3158
|
write(line);
|
|
2883
3159
|
} catch {
|
|
2884
3160
|
}
|
|
3161
|
+
if (write === stderrWriter && lineShipper) {
|
|
3162
|
+
try {
|
|
3163
|
+
lineShipper.enqueue(line, context.level ?? "error");
|
|
3164
|
+
} catch {
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
2885
3167
|
}
|
|
2886
3168
|
|
|
2887
3169
|
// ../core/dist/errors/suipay-error.js
|
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-BN4VEDV0.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-BN4VEDV0.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
|
@@ -450,7 +450,7 @@ declare const ERRORS: {
|
|
|
450
450
|
readonly logOnly: true;
|
|
451
451
|
};
|
|
452
452
|
readonly 'service.config_degraded': {
|
|
453
|
-
readonly surfaces: readonly ["gateway"];
|
|
453
|
+
readonly surfaces: readonly ["gateway", "console_server"];
|
|
454
454
|
readonly status: null;
|
|
455
455
|
readonly title: "Service started with degraded configuration";
|
|
456
456
|
readonly paymentState: "not_charged";
|
|
@@ -459,6 +459,16 @@ declare const ERRORS: {
|
|
|
459
459
|
readonly user: null;
|
|
460
460
|
readonly logOnly: true;
|
|
461
461
|
};
|
|
462
|
+
readonly 'service.readiness': {
|
|
463
|
+
readonly surfaces: readonly ["gateway"];
|
|
464
|
+
readonly status: null;
|
|
465
|
+
readonly title: "Readiness gauge updated";
|
|
466
|
+
readonly paymentState: "not_charged";
|
|
467
|
+
readonly retry: "never";
|
|
468
|
+
readonly nextAction: "none";
|
|
469
|
+
readonly user: null;
|
|
470
|
+
readonly logOnly: true;
|
|
471
|
+
};
|
|
462
472
|
readonly 'service.bookkeeping_failed': {
|
|
463
473
|
readonly surfaces: readonly ["gateway"];
|
|
464
474
|
readonly status: null;
|
|
@@ -469,6 +479,36 @@ declare const ERRORS: {
|
|
|
469
479
|
readonly user: null;
|
|
470
480
|
readonly logOnly: true;
|
|
471
481
|
};
|
|
482
|
+
readonly 'service.boot': {
|
|
483
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
484
|
+
readonly status: null;
|
|
485
|
+
readonly title: "Service started";
|
|
486
|
+
readonly paymentState: "not_charged";
|
|
487
|
+
readonly retry: "never";
|
|
488
|
+
readonly nextAction: "none";
|
|
489
|
+
readonly user: null;
|
|
490
|
+
readonly logOnly: true;
|
|
491
|
+
};
|
|
492
|
+
readonly 'service.lifecycle': {
|
|
493
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
494
|
+
readonly status: null;
|
|
495
|
+
readonly title: "Background work progressed";
|
|
496
|
+
readonly paymentState: "not_charged";
|
|
497
|
+
readonly retry: "never";
|
|
498
|
+
readonly nextAction: "none";
|
|
499
|
+
readonly user: null;
|
|
500
|
+
readonly logOnly: true;
|
|
501
|
+
};
|
|
502
|
+
readonly 'service.diagnostic': {
|
|
503
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
504
|
+
readonly status: null;
|
|
505
|
+
readonly title: "Diagnostic detail";
|
|
506
|
+
readonly paymentState: "not_charged";
|
|
507
|
+
readonly retry: "never";
|
|
508
|
+
readonly nextAction: "none";
|
|
509
|
+
readonly user: null;
|
|
510
|
+
readonly logOnly: true;
|
|
511
|
+
};
|
|
472
512
|
readonly 'limit.concurrency_exceeded': {
|
|
473
513
|
readonly surfaces: readonly ["gateway"];
|
|
474
514
|
readonly status: 429;
|
|
@@ -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-BN4VEDV0.js';
|
package/dist/native-transfer.js
CHANGED
package/package.json
CHANGED