@t2000/sdk 10.36.1 → 10.37.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/index.js CHANGED
@@ -3756,6 +3756,17 @@ function isCustomHireEnvelope(text) {
3756
3756
  return false;
3757
3757
  }
3758
3758
  }
3759
+
3760
+ // src/sponsored-guard.ts
3761
+ var sponsoredTxGuard = null;
3762
+ function setSponsoredTxGuard(guard) {
3763
+ sponsoredTxGuard = guard;
3764
+ }
3765
+ function runSponsoredTxGuard(ctx) {
3766
+ sponsoredTxGuard?.(ctx);
3767
+ }
3768
+
3769
+ // src/open-jobs.ts
3759
3770
  async function fetchJson(url, init) {
3760
3771
  const res = await fetch(url, {
3761
3772
  method: init?.method ?? "GET",
@@ -3770,10 +3781,6 @@ async function fetchJson(url, init) {
3770
3781
  }
3771
3782
  return json;
3772
3783
  }
3773
- var sponsoredTxGuard = null;
3774
- function setSponsoredTxGuard(guard) {
3775
- sponsoredTxGuard = guard;
3776
- }
3777
3784
  async function listOpenJobs(base, filter = {}) {
3778
3785
  const params = new URLSearchParams();
3779
3786
  if (filter.status) params.set("status", filter.status);
@@ -3805,7 +3812,7 @@ async function getOpenJob(base, id) {
3805
3812
  }
3806
3813
  async function sponsoredOpeningVerb(base, signer, action, params) {
3807
3814
  const address = signer.getAddress();
3808
- sponsoredTxGuard?.({ base, action });
3815
+ runSponsoredTxGuard({ base, action });
3809
3816
  const prep = await fetchJson(`${base}/job/prepare`, {
3810
3817
  method: "POST",
3811
3818
  body: { address, action, params }
@@ -3815,7 +3822,7 @@ async function sponsoredOpeningVerb(base, signer, action, params) {
3815
3822
  if (!(nonce && txBytes)) {
3816
3823
  throw new Error("Failed to prepare the transaction.");
3817
3824
  }
3818
- sponsoredTxGuard?.({ base, action, txBytes });
3825
+ runSponsoredTxGuard({ base, action, txBytes });
3819
3826
  const { signature } = await signer.signTransaction(fromBase64(txBytes));
3820
3827
  const json = await fetchJson(`${base}/job/submit`, {
3821
3828
  method: "POST",
@@ -3852,6 +3859,505 @@ function refundOpenJob(base, signer, openingId) {
3852
3859
  });
3853
3860
  }
3854
3861
 
3862
+ // src/commerce/endpoint.ts
3863
+ init_errors();
3864
+
3865
+ // src/commerce/http.ts
3866
+ init_errors();
3867
+ var DEFAULT_COMMERCE_API_BASE2 = "https://api.t2000.ai/v1";
3868
+ function codeForStatus(status) {
3869
+ if (status === 400 || status === 409 || status === 422) {
3870
+ return "INVALID_INPUT";
3871
+ }
3872
+ if (status === 429 || status >= 500) {
3873
+ return "RPC_ERROR";
3874
+ }
3875
+ return "UNKNOWN";
3876
+ }
3877
+ function apiErrorMessage(json, status) {
3878
+ const err = json.error;
3879
+ if (typeof err === "string") {
3880
+ return err;
3881
+ }
3882
+ const msg = err?.message;
3883
+ return typeof msg === "string" ? msg : `HTTP ${status}`;
3884
+ }
3885
+ async function apiRequest(url, init) {
3886
+ const res = await fetch(url, {
3887
+ method: init?.method ?? (init?.body === void 0 ? "GET" : "POST"),
3888
+ headers: {
3889
+ accept: "application/json",
3890
+ ...init?.body === void 0 ? {} : { "Content-Type": "application/json" }
3891
+ },
3892
+ body: init?.body === void 0 ? void 0 : JSON.stringify(init.body)
3893
+ });
3894
+ const json = await res.json().catch(() => ({}));
3895
+ return { ok: res.ok, status: res.status, json };
3896
+ }
3897
+ async function apiJson(url, init) {
3898
+ const res = await apiRequest(url, init);
3899
+ if (!res.ok) {
3900
+ throw new T2000Error(codeForStatus(res.status), apiErrorMessage(res.json, res.status), {
3901
+ status: res.status,
3902
+ ...res.json.error && typeof res.json.error === "object" ? { api: res.json.error } : {}
3903
+ });
3904
+ }
3905
+ return res.json;
3906
+ }
3907
+ function invalidInput(message) {
3908
+ return new T2000Error("INVALID_INPUT", message);
3909
+ }
3910
+ async function signPreparedTx(base, action, signer, txBytes) {
3911
+ runSponsoredTxGuard({ base, action, txBytes });
3912
+ const { signature } = await signer.signTransaction(fromBase64(txBytes));
3913
+ return signature;
3914
+ }
3915
+
3916
+ // src/commerce/endpoint.ts
3917
+ function endpointIssueLines(prep) {
3918
+ const lines = (prep.probe?.issues ?? []).map(
3919
+ (i) => ` \u2717 ${i.message ?? i.code}`
3920
+ );
3921
+ for (const r of prep.routes ?? []) {
3922
+ if (r.probeOk === false) {
3923
+ lines.push(` \u2717 ${r.method ?? "POST"} ${r.path}`);
3924
+ for (const i of r.issues ?? []) {
3925
+ lines.push(` ${i.message ?? i.code}`);
3926
+ }
3927
+ }
3928
+ }
3929
+ return lines;
3930
+ }
3931
+ async function setEndpoint(apiBase, signer, endpoint, primary) {
3932
+ const address = signer.getAddress();
3933
+ runSponsoredTxGuard({ base: apiBase, action: "update" });
3934
+ const res = await apiRequest(`${apiBase}/agent/endpoint/prepare`, {
3935
+ method: "POST",
3936
+ body: { address, endpoint, ...primary ? { primary } : {} }
3937
+ });
3938
+ const prep = res.json;
3939
+ if (!res.ok) {
3940
+ const msg = apiErrorMessage(prep, res.status);
3941
+ const detail = endpointIssueLines(prep).join("\n");
3942
+ throw new T2000Error(
3943
+ "INVALID_INPUT",
3944
+ detail ? `${msg}
3945
+ ${detail}` : msg,
3946
+ { status: res.status, probe: prep.probe ?? null, routes: prep.routes ?? [] }
3947
+ );
3948
+ }
3949
+ if (!(typeof prep.nonce === "string" && typeof prep.txBytes === "string")) {
3950
+ throw invalidInput("Failed to prepare the listing.");
3951
+ }
3952
+ const signature = await signPreparedTx(apiBase, "update", signer, prep.txBytes);
3953
+ const sub = await apiJson(`${apiBase}/agent/endpoint/submit`, {
3954
+ method: "POST",
3955
+ body: { nonce: prep.nonce, address, signature }
3956
+ });
3957
+ const listed = endpoint !== "";
3958
+ return {
3959
+ address,
3960
+ endpoint: listed ? prep.primary?.url ?? endpoint : null,
3961
+ listed,
3962
+ probe: prep.probe ?? null,
3963
+ origin: prep.origin ?? null,
3964
+ primary: prep.primary ?? null,
3965
+ routes: prep.routes ?? [],
3966
+ ...typeof sub.digest === "string" ? { digest: sub.digest } : {}
3967
+ };
3968
+ }
3969
+ function listEndpoint(apiBase, signer, endpoint, opts = {}) {
3970
+ const target = endpoint.trim();
3971
+ if (!target) {
3972
+ throw invalidInput("Provide your x402 endpoint URL.");
3973
+ }
3974
+ return setEndpoint(apiBase, signer, target, opts.primary);
3975
+ }
3976
+ function removeEndpoint(apiBase, signer) {
3977
+ return setEndpoint(apiBase, signer, "");
3978
+ }
3979
+
3980
+ // src/commerce/types.ts
3981
+ var AGENT_CATEGORIES = [
3982
+ "ai-models",
3983
+ "data-feeds",
3984
+ "finance",
3985
+ "research",
3986
+ "dev-tools",
3987
+ "creative",
3988
+ "travel",
3989
+ "comms",
3990
+ "other"
3991
+ ];
3992
+ var SERVICE_TIERS = ["basic", "standard", "premium"];
3993
+
3994
+ // src/commerce/package-slug.ts
3995
+ var SERVICE_SLUG_RE = /^[a-z0-9][a-z0-9-]{1,47}$/;
3996
+ function trimDashes(s) {
3997
+ let start = 0;
3998
+ let end = s.length;
3999
+ while (start < end && s.charCodeAt(start) === 45) start += 1;
4000
+ while (end > start && s.charCodeAt(end - 1) === 45) end -= 1;
4001
+ return s.slice(start, end);
4002
+ }
4003
+ var MAX_SLUG_LENGTH = 48;
4004
+ function slugifyUnbounded(name) {
4005
+ return trimDashes(name.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-"));
4006
+ }
4007
+ function slugifyLoner(name) {
4008
+ return slugifyUnbounded(name).slice(0, MAX_SLUG_LENGTH);
4009
+ }
4010
+ function slugify(name) {
4011
+ return slugifyLoner(name);
4012
+ }
4013
+ var TIER_SLUG_RE = /^(.+)-(basic|standard|premium)$/;
4014
+ var MAX_TIER_BASE_LENGTH = 48 - "-standard".length;
4015
+ function parseServiceTierSlug(slug) {
4016
+ const m = TIER_SLUG_RE.exec(slug);
4017
+ if (!m) {
4018
+ return null;
4019
+ }
4020
+ return { base: m[1], tier: m[2] };
4021
+ }
4022
+ function packageBaseSlug(slugified) {
4023
+ const cut = slugified.slice(0, MAX_TIER_BASE_LENGTH);
4024
+ let end = cut.length;
4025
+ while (end > 0 && cut.charCodeAt(end - 1) === 45) end -= 1;
4026
+ return cut.slice(0, end);
4027
+ }
4028
+ function packageBaseFromName(name) {
4029
+ return packageBaseSlug(slugifyUnbounded(name));
4030
+ }
4031
+ function packageTierSlugs(base) {
4032
+ return SERVICE_TIERS.map((tier) => ({ tier, slug: `${base}-${tier}` }));
4033
+ }
4034
+
4035
+ // src/commerce/challenge.ts
4036
+ async function sha256Hex2(content) {
4037
+ const digest = await crypto.subtle.digest(
4038
+ "SHA-256",
4039
+ new TextEncoder().encode(content)
4040
+ );
4041
+ return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
4042
+ }
4043
+ function servicePayloadSha256(payload) {
4044
+ return sha256Hex2(JSON.stringify(payload));
4045
+ }
4046
+ function profileChallengeMessage(nonce) {
4047
+ return `t2000-agent-profile:${nonce}`;
4048
+ }
4049
+ function serviceChallengeMessage(nonce, payloadHash) {
4050
+ return `t2000-agent-service:${nonce}:${payloadHash}`;
4051
+ }
4052
+ async function fetchChallengeNonce(apiBase, address) {
4053
+ const challenge = await apiJson(`${apiBase}/agent/challenge`, {
4054
+ method: "POST",
4055
+ body: { address }
4056
+ });
4057
+ const nonce = challenge.nonce;
4058
+ if (typeof nonce !== "string" || !nonce) {
4059
+ throw invalidInput("Failed to get a challenge nonce.");
4060
+ }
4061
+ return nonce;
4062
+ }
4063
+ async function signChallenge(apiBase, signer, message) {
4064
+ const nonce = await fetchChallengeNonce(apiBase, signer.getAddress());
4065
+ const text = await message(nonce);
4066
+ const { signature } = await signer.signPersonalMessage(
4067
+ new TextEncoder().encode(text)
4068
+ );
4069
+ return { nonce, signature };
4070
+ }
4071
+
4072
+ // src/commerce/service.ts
4073
+ function serviceUpsertPayload(input) {
4074
+ const slug = input.slug.trim().toLowerCase();
4075
+ if (!SERVICE_SLUG_RE.test(slug)) {
4076
+ throw invalidInput(
4077
+ "slug must be 2-48 chars of [a-z0-9-], starting alphanumeric."
4078
+ );
4079
+ }
4080
+ return {
4081
+ ...input.mode ? { mode: input.mode } : {},
4082
+ slug,
4083
+ name: input.name.trim(),
4084
+ description: input.description.trim(),
4085
+ priceUsdc: input.priceUsdc,
4086
+ slaMinutes: input.slaMinutes,
4087
+ reviewWindowMinutes: input.reviewWindowMinutes ?? 1440,
4088
+ rejectSplitBps: input.rejectSplitBps ?? 8e3,
4089
+ requirements: input.requirements,
4090
+ deliverable: input.deliverable.trim(),
4091
+ ...input.examples === void 0 ? {} : { examples: input.examples }
4092
+ };
4093
+ }
4094
+ async function signedServiceAction(apiBase, signer, action, payload) {
4095
+ const address = signer.getAddress();
4096
+ const { nonce, signature } = await signChallenge(
4097
+ apiBase,
4098
+ signer,
4099
+ async (n) => serviceChallengeMessage(n, await servicePayloadSha256(payload))
4100
+ );
4101
+ return apiJson(`${apiBase}/agent/service`, {
4102
+ method: "POST",
4103
+ body: { address, nonce, signature, action, payload }
4104
+ });
4105
+ }
4106
+ async function upsertService(apiBase, signer, input) {
4107
+ const payload = serviceUpsertPayload(input);
4108
+ const response = await signedServiceAction(apiBase, signer, "upsert", payload);
4109
+ return { address: signer.getAddress(), slug: payload.slug, response };
4110
+ }
4111
+ async function retireService(apiBase, signer, slug) {
4112
+ const clean = slug.trim().toLowerCase();
4113
+ if (!SERVICE_SLUG_RE.test(clean)) {
4114
+ throw invalidInput("slug must be 2-48 chars of [a-z0-9-], starting alphanumeric.");
4115
+ }
4116
+ const response = await signedServiceAction(apiBase, signer, "retire", {
4117
+ slug: clean
4118
+ });
4119
+ return { address: signer.getAddress(), slug: clean, response };
4120
+ }
4121
+
4122
+ // src/commerce/package.ts
4123
+ function planPackage(input) {
4124
+ const name = input.name.trim();
4125
+ if (!name) {
4126
+ throw invalidInput("name is required.");
4127
+ }
4128
+ const base = input.baseSlug ? packageBaseSlug(input.baseSlug.trim().toLowerCase()) : packageBaseFromName(name);
4129
+ if (!base || !SERVICE_SLUG_RE.test(`${base}-basic`)) {
4130
+ throw invalidInput(
4131
+ "Could not derive a package slug from the name \u2014 pass baseSlug (a-z, 0-9, dashes)."
4132
+ );
4133
+ }
4134
+ const byTier = /* @__PURE__ */ new Map();
4135
+ for (const t of input.tiers) {
4136
+ if (!SERVICE_TIERS.includes(t.tier)) {
4137
+ throw invalidInput(`Unknown tier "${t.tier}" \u2014 use basic, standard, premium.`);
4138
+ }
4139
+ if (byTier.has(t.tier)) {
4140
+ throw invalidInput(`Tier "${t.tier}" given twice.`);
4141
+ }
4142
+ byTier.set(t.tier, t);
4143
+ }
4144
+ const missing = SERVICE_TIERS.filter((t) => !byTier.has(t));
4145
+ if (missing.length > 0) {
4146
+ throw invalidInput(
4147
+ `A package needs all three tiers \u2014 missing: ${missing.join(", ")}.`
4148
+ );
4149
+ }
4150
+ return {
4151
+ base,
4152
+ tiers: packageTierSlugs(base).map(({ tier, slug }) => {
4153
+ const t = byTier.get(tier);
4154
+ return {
4155
+ tier,
4156
+ slug,
4157
+ input: {
4158
+ mode: "create",
4159
+ slug,
4160
+ name,
4161
+ description: (t.description ?? input.description).trim(),
4162
+ priceUsdc: t.priceUsdc,
4163
+ slaMinutes: t.slaMinutes ?? input.slaMinutes,
4164
+ deliverable: t.deliverable,
4165
+ requirements: input.requirements,
4166
+ reviewWindowMinutes: t.reviewWindowMinutes ?? input.reviewWindowMinutes,
4167
+ rejectSplitBps: t.rejectSplitBps ?? input.rejectSplitBps
4168
+ }
4169
+ };
4170
+ })
4171
+ };
4172
+ }
4173
+ async function createPackage(apiBase, signer, input) {
4174
+ const plan = planPackage(input);
4175
+ const tiers = [];
4176
+ for (const t of plan.tiers) {
4177
+ await upsertService(apiBase, signer, t.input);
4178
+ tiers.push({ tier: t.tier, slug: t.slug, priceUsdc: t.input.priceUsdc });
4179
+ }
4180
+ return { address: signer.getAddress(), base: plan.base, tiers };
4181
+ }
4182
+
4183
+ // src/commerce/resolve.ts
4184
+ init_errors();
4185
+ var FALLBACK_MISS = "Use an Agent ID (#93), @handle, or full 0x\u2026 address.";
4186
+ function agentResolveUrl(q, apiBase = DEFAULT_COMMERCE_API_BASE2) {
4187
+ return `${apiBase}/agents/resolve?q=${encodeURIComponent(q.trim())}`;
4188
+ }
4189
+ async function resolveAgentRef(q, apiBase = DEFAULT_COMMERCE_API_BASE2) {
4190
+ const res = await apiRequest(agentResolveUrl(q, apiBase));
4191
+ const json = res.json;
4192
+ if (!(res.ok && typeof json.address === "string")) {
4193
+ throw new T2000Error(
4194
+ "CONTACT_NOT_FOUND",
4195
+ typeof json.error === "string" ? json.error : FALLBACK_MISS,
4196
+ { ref: q }
4197
+ );
4198
+ }
4199
+ return {
4200
+ address: json.address,
4201
+ ...typeof json.numericId === "number" || json.numericId === null ? { numericId: json.numericId } : {},
4202
+ ...typeof json.name === "string" ? { name: json.name } : {}
4203
+ };
4204
+ }
4205
+ async function getAgentProfile(address, apiBase = DEFAULT_COMMERCE_API_BASE2) {
4206
+ const res = await apiRequest(`${apiBase}/agents/${encodeURIComponent(address)}`);
4207
+ if (!res.ok) {
4208
+ return null;
4209
+ }
4210
+ return { ...res.json, address };
4211
+ }
4212
+
4213
+ // src/commerce/profile.ts
4214
+ function parseAgentCategory(raw) {
4215
+ const c = raw.trim().toLowerCase();
4216
+ if (!AGENT_CATEGORIES.includes(c)) {
4217
+ throw invalidInput(
4218
+ `category must be one of: ${AGENT_CATEGORIES.join(", ")} (got "${raw}").`
4219
+ );
4220
+ }
4221
+ return c;
4222
+ }
4223
+ async function updateProfile(apiBase, signer, input) {
4224
+ const hasField = input.name !== void 0 || input.imageUrl !== void 0 || input.description !== void 0 || input.category !== void 0 || input.website !== void 0 || input.twitter !== void 0 || input.github !== void 0;
4225
+ if (!hasField) {
4226
+ throw invalidInput(
4227
+ "Provide at least one of name, imageUrl, description, category, website, twitter, github."
4228
+ );
4229
+ }
4230
+ const category = input.category === void 0 ? void 0 : parseAgentCategory(input.category);
4231
+ const address = signer.getAddress();
4232
+ const { nonce, signature } = await signChallenge(
4233
+ apiBase,
4234
+ signer,
4235
+ profileChallengeMessage
4236
+ );
4237
+ await apiJson(`${apiBase}/agent/profile`, {
4238
+ method: "POST",
4239
+ body: {
4240
+ address,
4241
+ nonce,
4242
+ signature,
4243
+ displayName: input.name,
4244
+ imageUrl: input.imageUrl,
4245
+ description: input.description,
4246
+ category,
4247
+ website: input.website,
4248
+ twitter: input.twitter,
4249
+ github: input.github
4250
+ }
4251
+ });
4252
+ return { address };
4253
+ }
4254
+ async function ensureCategory(apiBase, signer, category) {
4255
+ if (category !== void 0) {
4256
+ const parsed = parseAgentCategory(category);
4257
+ await updateProfile(apiBase, signer, { category: parsed });
4258
+ return parsed;
4259
+ }
4260
+ const profile = await getAgentProfile(signer.getAddress(), apiBase).catch(
4261
+ () => null
4262
+ );
4263
+ const existing = typeof profile?.category === "string" && profile.category ? profile.category : null;
4264
+ if (!existing) {
4265
+ throw invalidInput(
4266
+ `Pick a directory category first \u2014 buyers browse listings by category. Set one of ${AGENT_CATEGORIES.join(" | ")} (updateProfile({ category }) / t2 agent profile --category).`
4267
+ );
4268
+ }
4269
+ return existing;
4270
+ }
4271
+
4272
+ // src/commerce/register.ts
4273
+ async function registerAgent(apiBase, signer) {
4274
+ const address = signer.getAddress();
4275
+ runSponsoredTxGuard({ base: apiBase, action: "register" });
4276
+ const prep = await apiJson(`${apiBase}/agent/register/prepare`, {
4277
+ method: "POST",
4278
+ body: { address }
4279
+ });
4280
+ if (prep.alreadyRegistered === true) {
4281
+ return { address, alreadyRegistered: true };
4282
+ }
4283
+ const regNonce = prep.regNonce;
4284
+ const txBytes = prep.txBytes;
4285
+ if (!(typeof regNonce === "string" && typeof txBytes === "string")) {
4286
+ throw invalidInput("Failed to prepare registration.");
4287
+ }
4288
+ const signature = await signPreparedTx(apiBase, "register", signer, txBytes);
4289
+ const res = await apiJson(`${apiBase}/agent/register/submit`, {
4290
+ method: "POST",
4291
+ body: { regNonce, address, agentSignature: signature }
4292
+ });
4293
+ return {
4294
+ address,
4295
+ alreadyRegistered: res.alreadyRegistered === true,
4296
+ ...typeof res.digest === "string" ? { digest: res.digest } : {}
4297
+ };
4298
+ }
4299
+
4300
+ // src/commerce/client.ts
4301
+ var CommerceClient = class {
4302
+ signer;
4303
+ apiBase;
4304
+ constructor(options) {
4305
+ this.signer = options.signer;
4306
+ let base = options.apiBase ?? DEFAULT_COMMERCE_API_BASE2;
4307
+ while (base.endsWith("/")) base = base.slice(0, -1);
4308
+ this.apiBase = base;
4309
+ }
4310
+ /** This signer's wallet address. */
4311
+ get address() {
4312
+ return this.signer.getAddress();
4313
+ }
4314
+ /** Register the wallet as an on-chain Agent ID (sponsored; idempotent). */
4315
+ register() {
4316
+ return registerAgent(this.apiBase, this.signer);
4317
+ }
4318
+ /** Set public profile fields (signed, no gas). */
4319
+ updateProfile(input) {
4320
+ return updateProfile(this.apiBase, this.signer, input);
4321
+ }
4322
+ /** The sell gate — set `category` or confirm the live one; throws when
4323
+ * neither exists. Returns the category in force. */
4324
+ ensureCategory(category) {
4325
+ return ensureCategory(this.apiBase, this.signer, category);
4326
+ }
4327
+ /** This seller's public profile (null when unregistered). */
4328
+ profile() {
4329
+ return getAgentProfile(this.address, this.apiBase);
4330
+ }
4331
+ /** List (or fully re-write) one service — `mode: "create"` refuses a live slug. */
4332
+ upsertService(input) {
4333
+ return upsertService(this.apiBase, this.signer, input);
4334
+ }
4335
+ /** Take a service off the board (funded jobs keep settling on-chain). */
4336
+ retireService(input) {
4337
+ return retireService(
4338
+ this.apiBase,
4339
+ this.signer,
4340
+ typeof input === "string" ? input : input.slug
4341
+ );
4342
+ }
4343
+ /** Three tiers under one name — `{base}-basic|standard|premium`. */
4344
+ createPackage(input) {
4345
+ return createPackage(this.apiBase, this.signer, input);
4346
+ }
4347
+ /** Sell an x402 API (origin or one 402 URL) — live-probed, sponsored. */
4348
+ listEndpoint(endpoint, opts = {}) {
4349
+ return listEndpoint(this.apiBase, this.signer, endpoint, opts);
4350
+ }
4351
+ /** Clear the x402 listing. */
4352
+ removeEndpoint() {
4353
+ return removeEndpoint(this.apiBase, this.signer);
4354
+ }
4355
+ /** `#93` · `@handle` · `name.sui` · `0x…` → wallet (marketplace refs only). */
4356
+ resolveRef(q) {
4357
+ return resolveAgentRef(q, this.apiBase);
4358
+ }
4359
+ };
4360
+
3855
4361
  // src/utils/resolve-created.ts
3856
4362
  var OPENING_TYPE_MARKER = "::opening::Opening<";
3857
4363
  var ESCROW_JOB_TYPE_MARKER = "::escrow::Job<";
@@ -4293,4 +4799,4 @@ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
4293
4799
  // src/index.ts
4294
4800
  init_preflight();
4295
4801
 
4296
- export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_LATEST_PACKAGE_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, A2A_ESCROW_PACKAGE_V6_ID, A2A_ESCROW_PACKAGE_V7_ID, A2A_ESCROW_PACKAGE_V8_ID, A2A_SCORE_BOARD_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_API_BASE, DEFAULT_COMMERCE_API_BASE, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ESCROW_JOB_TYPE_MARKER, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_SCORE_BOARD_ID, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_OPEN_WINDOW_MS, MAX_REVIEW_WINDOW_MS, MIN_JOB_USDC, MIST_PER_SUI, NAVX_TYPE, OPENING_CLAIM_POLICIES, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_CLAIM_POLICY_PROVEN, OPENING_CLAIM_POLICY_PROVEN_4STAR, OPENING_TYPE_MARKER, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertBuyerRequirements, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateEmptyScoreTx, buildCreateJobTx, buildCreateOpeningTx, buildDeclineJobTx, buildDeliverJobTx, buildRefundJobTx, buildRefundUnclaimedTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSubmitFirstReviewTx, buildSubmitReviewTx, buildSwapTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, clearLimits, composeTx, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithX402, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, reportX402Activity, resolveAddressToSuinsViaRpc, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, setSponsoredTxGuard, simulateTransaction, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, walletExists, writeLimitsFile };
4802
+ export { A2A_ESCROW_FEE_CONFIG_ID, A2A_ESCROW_LATEST_PACKAGE_ID, A2A_ESCROW_OPENING_PACKAGE_ID, A2A_ESCROW_PACKAGE_ID, A2A_ESCROW_PACKAGE_V2_ID, A2A_ESCROW_PACKAGE_V3_ID, A2A_ESCROW_PACKAGE_V6_ID, A2A_ESCROW_PACKAGE_V7_ID, A2A_ESCROW_PACKAGE_V8_ID, A2A_SCORE_BOARD_ID, AGENT_CATEGORIES, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, CommerceClient, DEFAULT_ACTIVITY_REPORT_URL, DEFAULT_API_BASE, DEFAULT_COMMERCE_API_BASE, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ESCROW_JOB_TYPE_MARKER, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, JOB_STATES, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MAINNET_A2A_ESCROW_LATEST_PACKAGE_ID, MAINNET_A2A_ESCROW_OPENING_PACKAGE_ID, MAINNET_A2A_ESCROW_PACKAGE_ID, MAINNET_A2A_SCORE_BOARD_ID, MANIFEST_TYPE, MAX_DELIVER_HORIZON_MS, MAX_JOB_USDC, MAX_OPEN_WINDOW_MS, MAX_REVIEW_WINDOW_MS, MAX_SLUG_LENGTH, MAX_TIER_BASE_LENGTH, MIN_JOB_USDC, MIST_PER_SUI, NAVX_TYPE, OPENING_CLAIM_POLICIES, OPENING_CLAIM_POLICY_ANY_ACTIVE, OPENING_CLAIM_POLICY_PROVEN, OPENING_CLAIM_POLICY_PROVEN_4STAR, OPENING_TYPE_MARKER, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, PROVEN_MIN_AVG_STARS_X10, PROVEN_MIN_REVIEWS, REVIEW_MAX_STARS, REVIEW_MIN_STARS, SENDABLE_ASSETS, SERVICE_SLUG_RE, SERVICE_TIERS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, agentResolveUrl, approxUsdValue, assertAllowedAsset, assertBuyerRequirements, assertLimitConfig, buildAddLeafTx, buildCancelOpeningTx, buildClaimOpeningTx, buildCreateEmptyScoreTx, buildCreateJobTx, buildCreateOpeningTx, buildDeclineJobTx, buildDeliverJobTx, buildRefundJobTx, buildRefundUnclaimedTx, buildRejectJobTx, buildReleaseJobTx, buildRevokeLeafTx, buildSendTx, buildSubmitFirstReviewTx, buildSubmitReviewTx, buildSwapTx, cancelOpenJob, canonicalizeRecipientInput, chatCompletion, chatCompletionStream, checkPositiveAmount, checkSuiAddress, claimOpenJob, claimPolicyLabel, claimPolicyRequirement, classifyAction, classifyLabel, classifySendAsset, classifyTransaction, clearLimits, composeTx, createPackage, customHireEnvelope, dailySpentToday, deriveAgentScoreId, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, endpointIssueLines, ensureCategory, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, fetchChallengeNonce, fetchService, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getAgentProfile, getAgentScore, getCoinMeta, getDecimals, getDecimalsForCoinType, getJob, getJobSpec, getLimits, getOpenJob, getOpening, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, invalidSendAssetMessage, isAllowedAsset, isCetusRouteFresh, isCustomHireEnvelope, isInRegistry, jobActionsFor, keypairFromPrivateKey, listEndpoint, listModels, listOpenJobs, listServices, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, meetsClaimPolicy, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, packageBaseFromName, packageBaseSlug, packageTierSlugs, parseAgentCategory, parseServiceTierSlug, parseSuiRpcTx, payWithX402, planPackage, postOpenJob, preflightCreateJob, preflightCreateOpening, preflightFail, preflightPay, preflightSend, preflightSwap, probeX402, profileChallengeMessage, putJobSpec, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, refundOpenJob, registerAgent, removeEndpoint, reportX402Activity, resolveAddressToSuinsViaRpc, resolveAgentRef, resolveCreatedObjectId, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, retireService, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, serviceChallengeMessage, servicePayloadSha256, serviceUpsertPayload, setLimits, setSponsoredTxGuard, signChallenge, simulateTransaction, slugify, slugifyLoner, slugifyUnbounded, stableToRaw, submitJobReview, suiToMist, throwIfSimulationFailed, trimDashes, truncateAddress, updateProfile, upsertService, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, verifyJobForSeller, walletExists, writeLimitsFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2000/sdk",
3
- "version": "10.36.1",
3
+ "version": "10.37.1",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -55,7 +55,7 @@
55
55
  "@phala/dcap-qvl": "^0.5.2",
56
56
  "bn.js": "^5.2.1",
57
57
  "eventemitter3": "^5",
58
- "@t2000/sui-x402": "10.36.1"
58
+ "@t2000/sui-x402": "10.37.1"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/bn.js": "^5.1.5",