@mysten-incubation/suipay-buyer 0.3.0-dev.0 → 0.3.0-dev.1
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-JBDYVEX2.js} +271 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{native-transfer-GD3KlVqG.d.ts → native-transfer-By0qZ2Jy.d.ts} +31 -1
- package/dist/native-transfer.d.ts +1 -1
- package/dist/native-transfer.js +1 -1
- package/package.json +3 -3
|
@@ -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",
|
|
@@ -2097,6 +2097,39 @@ var SERVICE_CODES = {
|
|
|
2097
2097
|
nextAction: "none",
|
|
2098
2098
|
user: null,
|
|
2099
2099
|
logOnly: true
|
|
2100
|
+
},
|
|
2101
|
+
// What a process started with: network, posture, rails, gas pool. Healthy.
|
|
2102
|
+
"service.boot": {
|
|
2103
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2104
|
+
status: null,
|
|
2105
|
+
title: "Service started",
|
|
2106
|
+
paymentState: "not_charged",
|
|
2107
|
+
retry: "never",
|
|
2108
|
+
nextAction: "none",
|
|
2109
|
+
user: null,
|
|
2110
|
+
logOnly: true
|
|
2111
|
+
},
|
|
2112
|
+
// A background worker started, stopped, swept or retried on schedule. Healthy.
|
|
2113
|
+
"service.lifecycle": {
|
|
2114
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2115
|
+
status: null,
|
|
2116
|
+
title: "Background work progressed",
|
|
2117
|
+
paymentState: "not_charged",
|
|
2118
|
+
retry: "never",
|
|
2119
|
+
nextAction: "none",
|
|
2120
|
+
user: null,
|
|
2121
|
+
logOnly: true
|
|
2122
|
+
},
|
|
2123
|
+
// Detail about healthy traffic an operator may want when reading a trace.
|
|
2124
|
+
"service.diagnostic": {
|
|
2125
|
+
surfaces: ["gateway", "seller", "indexer"],
|
|
2126
|
+
status: null,
|
|
2127
|
+
title: "Diagnostic detail",
|
|
2128
|
+
paymentState: "not_charged",
|
|
2129
|
+
retry: "never",
|
|
2130
|
+
nextAction: "none",
|
|
2131
|
+
user: null,
|
|
2132
|
+
logOnly: true
|
|
2100
2133
|
}
|
|
2101
2134
|
};
|
|
2102
2135
|
|
|
@@ -2797,6 +2830,233 @@ function newTraceId(randomBytes = cryptoRandomBytes) {
|
|
|
2797
2830
|
return /^0+$/.test(hex) ? newTraceId(randomBytes) : hex;
|
|
2798
2831
|
}
|
|
2799
2832
|
|
|
2833
|
+
// ../core/dist/errors/context-allowlist.js
|
|
2834
|
+
var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
2835
|
+
// Settlement and request identifiers.
|
|
2836
|
+
"txDigest",
|
|
2837
|
+
"digest",
|
|
2838
|
+
"challengeId",
|
|
2839
|
+
"paymentId",
|
|
2840
|
+
"paymentHash",
|
|
2841
|
+
"paymentKey",
|
|
2842
|
+
"paymentState",
|
|
2843
|
+
"requestId",
|
|
2844
|
+
"traceId",
|
|
2845
|
+
"clientId",
|
|
2846
|
+
"serviceId",
|
|
2847
|
+
"configId",
|
|
2848
|
+
"seedId",
|
|
2849
|
+
"grantId",
|
|
2850
|
+
"grantObjectId",
|
|
2851
|
+
"sameGrantObjectId",
|
|
2852
|
+
"verifiedGrant",
|
|
2853
|
+
"poolObjectId",
|
|
2854
|
+
"packageId",
|
|
2855
|
+
"activePackageId",
|
|
2856
|
+
"expectedPackageId",
|
|
2857
|
+
"actualPackageId",
|
|
2858
|
+
"mandateId",
|
|
2859
|
+
"session",
|
|
2860
|
+
"coinId",
|
|
2861
|
+
"coinIds",
|
|
2862
|
+
"id",
|
|
2863
|
+
"dedupeKey",
|
|
2864
|
+
"hook",
|
|
2865
|
+
// Addresses (public on chain).
|
|
2866
|
+
"owner",
|
|
2867
|
+
"payTo",
|
|
2868
|
+
"recipient",
|
|
2869
|
+
"delegateAddress",
|
|
2870
|
+
// Codes, kinds and states.
|
|
2871
|
+
"code",
|
|
2872
|
+
"innerCode",
|
|
2873
|
+
"requestedCode",
|
|
2874
|
+
"failureCode",
|
|
2875
|
+
"oauthError",
|
|
2876
|
+
"errorKind",
|
|
2877
|
+
"kind",
|
|
2878
|
+
"mode",
|
|
2879
|
+
"effectiveMode",
|
|
2880
|
+
"state",
|
|
2881
|
+
"outcome",
|
|
2882
|
+
"status",
|
|
2883
|
+
"httpStatus",
|
|
2884
|
+
"reason",
|
|
2885
|
+
"action",
|
|
2886
|
+
"stage",
|
|
2887
|
+
"paid",
|
|
2888
|
+
"delivery",
|
|
2889
|
+
"sellerStatus",
|
|
2890
|
+
"sellerCode",
|
|
2891
|
+
"bindingCode",
|
|
2892
|
+
"errorName",
|
|
2893
|
+
"gasStationStatus",
|
|
2894
|
+
"readFailure",
|
|
2895
|
+
"refusal",
|
|
2896
|
+
"refusedAs",
|
|
2897
|
+
"registryCode",
|
|
2898
|
+
"sessionDecision",
|
|
2899
|
+
"settleCode",
|
|
2900
|
+
"signedRequest",
|
|
2901
|
+
"signerCode",
|
|
2902
|
+
"consentCode",
|
|
2903
|
+
"publicReason",
|
|
2904
|
+
"details",
|
|
2905
|
+
"event",
|
|
2906
|
+
"eventType",
|
|
2907
|
+
"surface",
|
|
2908
|
+
"scope",
|
|
2909
|
+
"field",
|
|
2910
|
+
"header",
|
|
2911
|
+
"dependency",
|
|
2912
|
+
"network",
|
|
2913
|
+
"rails",
|
|
2914
|
+
"shard",
|
|
2915
|
+
"metric",
|
|
2916
|
+
"alarm",
|
|
2917
|
+
"alert",
|
|
2918
|
+
"from",
|
|
2919
|
+
"to",
|
|
2920
|
+
"expected",
|
|
2921
|
+
"required",
|
|
2922
|
+
"violated",
|
|
2923
|
+
"diverged",
|
|
2924
|
+
"replaced",
|
|
2925
|
+
"suppressed",
|
|
2926
|
+
"unknown",
|
|
2927
|
+
"verified",
|
|
2928
|
+
"verification",
|
|
2929
|
+
"simulation",
|
|
2930
|
+
"isNew",
|
|
2931
|
+
"needsTopup",
|
|
2932
|
+
"operatorCapSet",
|
|
2933
|
+
"wantAgent",
|
|
2934
|
+
"wantGrant",
|
|
2935
|
+
"wantPool",
|
|
2936
|
+
"limitedBy",
|
|
2937
|
+
"peer",
|
|
2938
|
+
// Counts, amounts and timings.
|
|
2939
|
+
"amount",
|
|
2940
|
+
"scanned",
|
|
2941
|
+
"deleted",
|
|
2942
|
+
"intents",
|
|
2943
|
+
"policies",
|
|
2944
|
+
"connections",
|
|
2945
|
+
"events",
|
|
2946
|
+
"maxQueueSize",
|
|
2947
|
+
"bytes",
|
|
2948
|
+
"sha256",
|
|
2949
|
+
"ts",
|
|
2950
|
+
"count",
|
|
2951
|
+
"countRaw",
|
|
2952
|
+
"matchingCount",
|
|
2953
|
+
"registry_field_count",
|
|
2954
|
+
"applied",
|
|
2955
|
+
"attempt",
|
|
2956
|
+
"attempts",
|
|
2957
|
+
"cap",
|
|
2958
|
+
"max",
|
|
2959
|
+
"maxChallenges",
|
|
2960
|
+
"MAX_GAS_COIN_PAGES",
|
|
2961
|
+
"pagesScanned",
|
|
2962
|
+
"size",
|
|
2963
|
+
"free",
|
|
2964
|
+
"used",
|
|
2965
|
+
"fill",
|
|
2966
|
+
"limits",
|
|
2967
|
+
"refills",
|
|
2968
|
+
"refilled",
|
|
2969
|
+
"split",
|
|
2970
|
+
"unconfirmed",
|
|
2971
|
+
"spent",
|
|
2972
|
+
"reserveAfter",
|
|
2973
|
+
"claimedUntilMs",
|
|
2974
|
+
"repaired",
|
|
2975
|
+
"splits",
|
|
2976
|
+
"spend",
|
|
2977
|
+
"reserve",
|
|
2978
|
+
"reserveBalance",
|
|
2979
|
+
"ownerDailyMist",
|
|
2980
|
+
"ownerHourlyMist",
|
|
2981
|
+
"ownerIdentityDailyMist",
|
|
2982
|
+
"delegateDailyMist",
|
|
2983
|
+
"delegateHourlyMist",
|
|
2984
|
+
"delegateIdentityDailyMist",
|
|
2985
|
+
"consecutiveFailures",
|
|
2986
|
+
"failuresInARow",
|
|
2987
|
+
"epochReadFailures",
|
|
2988
|
+
"daysRemaining",
|
|
2989
|
+
"deadline",
|
|
2990
|
+
"delay",
|
|
2991
|
+
"delayMs",
|
|
2992
|
+
"ageMs",
|
|
2993
|
+
"timeoutMs",
|
|
2994
|
+
"nowMs",
|
|
2995
|
+
"switchedAtMs",
|
|
2996
|
+
"observeUntil",
|
|
2997
|
+
"window",
|
|
2998
|
+
"checkpointSeq",
|
|
2999
|
+
"eventSeq",
|
|
3000
|
+
"sampleSubjects",
|
|
3001
|
+
// Operator-facing error text. Redacted and length-capped like every string.
|
|
3002
|
+
"error",
|
|
3003
|
+
"errors",
|
|
3004
|
+
"err",
|
|
3005
|
+
"lastError",
|
|
3006
|
+
"outcomeError",
|
|
3007
|
+
"detail",
|
|
3008
|
+
"raw",
|
|
3009
|
+
"value"
|
|
3010
|
+
]);
|
|
3011
|
+
var MAX_CONTEXT_STRING = 512;
|
|
3012
|
+
var MAX_CONTEXT_ARRAY = 32;
|
|
3013
|
+
var MAX_CONTEXT_DEPTH = 4;
|
|
3014
|
+
function filterContext(context) {
|
|
3015
|
+
let dropped = 0;
|
|
3016
|
+
const filterValue = (value2, depth) => {
|
|
3017
|
+
if (typeof value2 === "bigint")
|
|
3018
|
+
return value2.toString();
|
|
3019
|
+
if (value2 === null || typeof value2 !== "object")
|
|
3020
|
+
return value2;
|
|
3021
|
+
if (depth >= MAX_CONTEXT_DEPTH) {
|
|
3022
|
+
dropped += 1;
|
|
3023
|
+
return void 0;
|
|
3024
|
+
}
|
|
3025
|
+
if (Array.isArray(value2)) {
|
|
3026
|
+
return value2.slice(0, MAX_CONTEXT_ARRAY).map((item) => filterValue(item, depth + 1));
|
|
3027
|
+
}
|
|
3028
|
+
if (value2 instanceof Date)
|
|
3029
|
+
return value2.toISOString();
|
|
3030
|
+
return filterObject(value2, depth + 1);
|
|
3031
|
+
};
|
|
3032
|
+
const filterObject = (object, depth) => {
|
|
3033
|
+
const out = {};
|
|
3034
|
+
for (const [key, value2] of Object.entries(object)) {
|
|
3035
|
+
if (!CONTEXT_ALLOWLIST.has(key)) {
|
|
3036
|
+
dropped += 1;
|
|
3037
|
+
continue;
|
|
3038
|
+
}
|
|
3039
|
+
const kept = filterValue(value2, depth);
|
|
3040
|
+
if (kept !== void 0)
|
|
3041
|
+
out[key] = kept;
|
|
3042
|
+
}
|
|
3043
|
+
return out;
|
|
3044
|
+
};
|
|
3045
|
+
const value = filterObject(context, 0);
|
|
3046
|
+
return { value, dropped };
|
|
3047
|
+
}
|
|
3048
|
+
function capContextStrings(value) {
|
|
3049
|
+
if (typeof value === "string") {
|
|
3050
|
+
return value.length > MAX_CONTEXT_STRING ? `${value.slice(0, MAX_CONTEXT_STRING)}\u2026` : value;
|
|
3051
|
+
}
|
|
3052
|
+
if (Array.isArray(value))
|
|
3053
|
+
return value.map(capContextStrings);
|
|
3054
|
+
if (value !== null && typeof value === "object") {
|
|
3055
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, capContextStrings(v)]));
|
|
3056
|
+
}
|
|
3057
|
+
return value;
|
|
3058
|
+
}
|
|
3059
|
+
|
|
2800
3060
|
// ../core/dist/errors/log.js
|
|
2801
3061
|
var MAX_CAUSE_DEPTH = 5;
|
|
2802
3062
|
function causeChain(error) {
|
|
@@ -2847,6 +3107,7 @@ function safeStringify(value) {
|
|
|
2847
3107
|
function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
|
|
2848
3108
|
const wantStack = context.withStack ?? (context.httpStatus !== void 0 && context.httpStatus >= 500);
|
|
2849
3109
|
const stack = wantStack && error instanceof Error && error.stack ? redactSecrets(error.stack) : void 0;
|
|
3110
|
+
const filtered = context.context ? filterContext(context.context) : void 0;
|
|
2850
3111
|
return {
|
|
2851
3112
|
level: context.level ?? "error",
|
|
2852
3113
|
time: now.toISOString(),
|
|
@@ -2858,10 +3119,12 @@ function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
|
|
|
2858
3119
|
trace_id: context.traceId || newTraceId(),
|
|
2859
3120
|
cause: error === void 0 ? [] : causeChain(error),
|
|
2860
3121
|
...stack ? { stack } : {},
|
|
2861
|
-
...
|
|
3122
|
+
...filtered ? { context: capContextStrings(redactValue(filtered.value)) } : {},
|
|
3123
|
+
...filtered && filtered.dropped > 0 ? { context_dropped: filtered.dropped } : {}
|
|
2862
3124
|
};
|
|
2863
3125
|
}
|
|
2864
3126
|
var stderrWriter = (line) => console.error(line);
|
|
3127
|
+
var lineShipper = null;
|
|
2865
3128
|
function logError(context, error, write = stderrWriter) {
|
|
2866
3129
|
let line;
|
|
2867
3130
|
let traceId = "";
|
|
@@ -2882,6 +3145,12 @@ function logError(context, error, write = stderrWriter) {
|
|
|
2882
3145
|
write(line);
|
|
2883
3146
|
} catch {
|
|
2884
3147
|
}
|
|
3148
|
+
if (write === stderrWriter && lineShipper) {
|
|
3149
|
+
try {
|
|
3150
|
+
lineShipper.enqueue(line, context.level ?? "error");
|
|
3151
|
+
} catch {
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
2885
3154
|
}
|
|
2886
3155
|
|
|
2887
3156
|
// ../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-By0qZ2Jy.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-By0qZ2Jy.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";
|
|
@@ -469,6 +469,36 @@ declare const ERRORS: {
|
|
|
469
469
|
readonly user: null;
|
|
470
470
|
readonly logOnly: true;
|
|
471
471
|
};
|
|
472
|
+
readonly 'service.boot': {
|
|
473
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
474
|
+
readonly status: null;
|
|
475
|
+
readonly title: "Service started";
|
|
476
|
+
readonly paymentState: "not_charged";
|
|
477
|
+
readonly retry: "never";
|
|
478
|
+
readonly nextAction: "none";
|
|
479
|
+
readonly user: null;
|
|
480
|
+
readonly logOnly: true;
|
|
481
|
+
};
|
|
482
|
+
readonly 'service.lifecycle': {
|
|
483
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
484
|
+
readonly status: null;
|
|
485
|
+
readonly title: "Background work progressed";
|
|
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.diagnostic': {
|
|
493
|
+
readonly surfaces: readonly ["gateway", "seller", "indexer"];
|
|
494
|
+
readonly status: null;
|
|
495
|
+
readonly title: "Diagnostic detail";
|
|
496
|
+
readonly paymentState: "not_charged";
|
|
497
|
+
readonly retry: "never";
|
|
498
|
+
readonly nextAction: "none";
|
|
499
|
+
readonly user: null;
|
|
500
|
+
readonly logOnly: true;
|
|
501
|
+
};
|
|
472
502
|
readonly 'limit.concurrency_exceeded': {
|
|
473
503
|
readonly surfaces: readonly ["gateway"];
|
|
474
504
|
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-By0qZ2Jy.js';
|
package/dist/native-transfer.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mysten-incubation/suipay-buyer",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SuiPay buyer SDK — delegated spend-account pay plus a typed /v1 control-plane client.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsup": "^8.0.0",
|
|
41
41
|
"typescript": "^6.0.3",
|
|
42
42
|
"vitest": "^4.1.10",
|
|
43
|
-
"@cmdoss/suipay-
|
|
44
|
-
"@cmdoss/suipay-
|
|
43
|
+
"@cmdoss/suipay-core": "0.1.0",
|
|
44
|
+
"@cmdoss/suipay-sdk": "0.1.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|