@ardrive/turbo-sdk 1.42.0-alpha.7 → 1.42.0-alpha.9

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.
@@ -18,6 +18,7 @@ import { arNSPurchaseIntents, fiatCurrencyTypes, isCurrency, } from '../types.js
18
18
  import { isAnyValidUserAddress } from '../utils/common.js';
19
19
  import { FailedRequestError, FiatPaymentsDisabledError, InsufficientCreditsError, ProvidedInputError, } from '../utils/errors.js';
20
20
  import { uuidV4 } from '../utils/uuid.js';
21
+ import { arNSOwnerProofHeaders, buildArNSCustodyMessage, } from './arnsActions.js';
21
22
  import { defaultRetryConfig } from './http.js';
22
23
  import { TurboHTTPService } from './http.js';
23
24
  import { Logger } from './logger.js';
@@ -59,6 +60,22 @@ export class TurboUnauthenticatedPaymentService {
59
60
  // and coerce a missing field (e.g. a 404 body) to `null`.
60
61
  return { bytesRemaining: status?.bytesRemaining ?? null };
61
62
  }
63
+ /**
64
+ * Returns the ArNS names a wallet owns or controls -- both custodial names
65
+ * bought via Turbo's ArNS-with-credits feature (Turbo may spawn and hold
66
+ * the ANT on the caller's behalf, depending on the buy) and self-custody
67
+ * names, in one list. See `TurboArNSName` for field semantics, including
68
+ * the `custodial` flag distinguishing the two.
69
+ *
70
+ * To read a name's current records or lease/expiration state, use
71
+ * `@ar.io/sdk` directly against the returned `antId` -- it talks to the
72
+ * chain directly and needs no round-trip through this SDK/backend.
73
+ */
74
+ getArNSNames(address) {
75
+ return this.httpService.get({
76
+ endpoint: `/arns/my-names/${encodeURIComponent(address)}`,
77
+ });
78
+ }
62
79
  getFiatRates() {
63
80
  return this.httpService.get({
64
81
  endpoint: '/rates',
@@ -107,9 +124,18 @@ export class TurboUnauthenticatedPaymentService {
107
124
  // `async` so a validation failure surfaces as a rejected promise (consistent
108
125
  // with `purchaseArNSName`) rather than a synchronous throw.
109
126
  this.validateArNSPurchaseParams(params);
110
- return this.httpService.get({
127
+ const price = await this.httpService.get({
111
128
  endpoint: `/arns/price/${params.intent.toLowerCase()}/${params.name}${this.buildArNSPurchaseQuery(params)}`,
112
129
  });
130
+ // Normalize the figure to charge into ONE field. `winc` is the name only
131
+ // and excludes the ANT spawn surcharge — for a Buy-Name that surcharge can
132
+ // exceed the name's own price, so a caller reading `winc` silently
133
+ // under-quotes every purchase. Surfacing `wincTotal` makes the correct
134
+ // field the obvious one.
135
+ return {
136
+ ...price,
137
+ wincTotal: price.wincTotalWithAntSpawn ?? price.winc,
138
+ };
113
139
  }
114
140
  /**
115
141
  * Fail fast (client-side) on malformed ArNS requests so JS callers that bypass
@@ -490,112 +516,221 @@ export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymen
490
516
  * balance. The bundler performs the on-chain ARIO purchase and debits credits;
491
517
  * a `402` (FailedRequestError.status === 402) indicates insufficient credits.
492
518
  */
493
- async purchaseArNSName(params) {
494
- this.validateArNSPurchaseParams(params);
495
- // The bundler requires the signed nonce to be a UUID; it also doubles as
496
- // the idempotency + status-lookup key (`getArNSPurchaseStatus`).
519
+ // ===== ArNS actions — the sponsored surface =====
520
+ //
521
+ // Every ArNS operation is an ACTION, and an action has exactly one of two
522
+ // shapes, chosen by the SERVER rather than the caller: either Turbo already
523
+ // holds the authority (`completed`), or the ANT owner must sign a transaction
524
+ // Turbo has already fee-payer-signed (`awaiting-signature`).
525
+ //
526
+ // The shape is not stable per action, which is why callers must branch on
527
+ // `status` and never on which action they asked for: `set-record` completes
528
+ // alone while Turbo is a controller, and degrades to `awaiting-signature`
529
+ // the moment the customer revokes Turbo.
530
+ //
531
+ // This replaced `/arns/purchase/{intent}/{name}`, `/arns/transfer/{antId}`
532
+ // and `/arns/manage/*`, which were deleted along with Turbo-custodial ANTs.
533
+ // Turbo now takes custody of nothing: every ANT is minted straight to the
534
+ // customer.
535
+ /**
536
+ * Create an action. Returns `completed` or `awaiting-signature`.
537
+ *
538
+ * Credits are debited HERE, not at `/sign`. Capture the returned `nonce`
539
+ * before prompting for a signature: it is the idempotency key, and polling
540
+ * it is how you resume. Never re-create an action to "retry" — that debits
541
+ * a second time. An abandoned action is refunded automatically.
542
+ */
543
+ async createArNSAction(action, params = {}, ownerProof) {
497
544
  const nonce = uuidV4();
498
- const headers = await this.signer.generateSignedRequestHeaders(nonce);
499
- let response;
545
+ const headers = {
546
+ ...(await this.signer.generateSignedRequestHeaders(nonce)),
547
+ 'content-type': 'application/json',
548
+ };
549
+ // Record actions carry a SECOND signature, from the ANT owner's Solana key
550
+ // over a different message. It travels in its own `x-owner-*` headers
551
+ // because two signatures cannot share one header set.
552
+ if (ownerProof !== undefined) {
553
+ Object.assign(headers, await arNSOwnerProofHeaders(ownerProof.owner, ownerProof.message, uuidV4()));
554
+ }
500
555
  try {
501
- response = await this.httpService.post({
502
- endpoint: `/arns/purchase/${params.intent.toLowerCase()}/${params.name}${this.buildArNSPurchaseQuery(params)}`,
556
+ return await this.httpService.post({
557
+ endpoint: `/arns/actions/${action}`,
503
558
  headers,
504
- // Params travel in the query string + signed headers; the service reads
505
- // no body, but the HTTP layer requires a `data` field.
506
- data: Buffer.from([]),
507
- // Non-idempotent signed write: the nonce is single-use, so a retried
508
- // (but already-landed) purchase would 4xx as "already exists". Poll
509
- // status by nonce instead of retrying.
559
+ data: Buffer.from(JSON.stringify(params)),
560
+ // Non-idempotent signed write that has already debited. A blind retry
561
+ // risks paying twice for one name; poll the nonce instead.
510
562
  retry: false,
511
563
  });
512
564
  }
513
565
  catch (error) {
514
- // Surface a credit shortfall as a typed, catchable error so callers can
515
- // prompt a top-up. The `nonce` is the idempotency key: after topping up,
516
- // retry the same purchase (a fresh nonce is fine — the service dedupes by
517
- // the on-chain effect, and a captured nonce lets you poll status).
518
566
  if (error instanceof FailedRequestError && error.status === 402) {
519
567
  throw new InsufficientCreditsError(error.message);
520
568
  }
521
569
  throw error;
522
570
  }
523
- // Normalize both nonce fields to the one we signed so callers can poll with
524
- // either `response.nonce` or `response.purchaseReceipt.nonce`.
525
- return {
526
- ...response,
527
- nonce,
528
- purchaseReceipt: { ...response.purchaseReceipt, nonce },
529
- };
530
571
  }
531
- buyArNSName(params) {
532
- return this.purchaseArNSName({
533
- ...params,
534
- intent: 'Buy-Name',
572
+ /**
573
+ * Submit the owner-signed transaction for an `awaiting-signature` action.
574
+ *
575
+ * `signedTransaction` is the FULL serialized transaction, base64 — not just
576
+ * the signature. Replaying a completed action returns `alreadyCompleted:
577
+ * true` rather than buying twice, so this is safe to call again if a
578
+ * response is lost.
579
+ */
580
+ async signArNSAction(nonce, signedTransaction) {
581
+ return this.httpService.post({
582
+ endpoint: `/arns/actions/${nonce}/sign`,
583
+ headers: {
584
+ ...(await this.signer.generateSignedRequestHeaders(uuidV4())),
585
+ 'content-type': 'application/json',
586
+ },
587
+ data: Buffer.from(JSON.stringify({ transaction: signedTransaction })),
588
+ retry: false,
535
589
  });
536
590
  }
537
- extendArNSLease(params) {
538
- return this.purchaseArNSName({ ...params, intent: 'Extend-Lease' });
539
- }
540
- increaseArNSUndernameLimit(params) {
541
- return this.purchaseArNSName({
542
- ...params,
543
- intent: 'Increase-Undername-Limit',
591
+ /**
592
+ * Status of an action by nonce. Open — no signature required — so it works
593
+ * from a status page or callback handler that never holds the payer's key.
594
+ *
595
+ * Terminal success carries `messageId`; terminal failure carries
596
+ * `failedDate`.
597
+ */
598
+ async getArNSActionStatus(nonce) {
599
+ return this.httpService.get({
600
+ endpoint: `/arns/actions/${nonce}`,
544
601
  });
545
602
  }
546
- upgradeArNSName(params) {
547
- return this.purchaseArNSName({ ...params, intent: 'Upgrade-Name' });
548
- }
549
- // ---- ArNS ANT custody: self-custody exit + manage records ----
550
- // Canonical ACTION-BOUND message. MUST match the bundler's
551
- // buildArNSCustodyMessage byte-for-byte (newline-delimited) or every signature
552
- // is rejected. The bundler reconstructs this from the request and verifies the
553
- // signature over `message + nonce`, so a captured signature can't be replayed
554
- // against a different operation/params.
555
- buildArNSCustodyMessage(action, fields) {
556
- return ['arns', action, ...fields].join('\n');
603
+ /**
604
+ * Run an action to a terminal state, signing if the server asks for it.
605
+ *
606
+ * This is the two-shape branch, once, in one place — so callers cannot
607
+ * hardcode which actions need a signature and break when a customer
608
+ * exercises ownership.
609
+ */
610
+ async completeArNSAction(action, params, owner, opts = {}, ownerProofMessage) {
611
+ const created = await this.createArNSAction(action, params, owner !== undefined && ownerProofMessage !== undefined
612
+ ? { owner, message: ownerProofMessage }
613
+ : undefined);
614
+ // Fires before any wallet prompt: the action is already debited, so the
615
+ // caller needs the nonce persisted even if the user walks away here.
616
+ await opts.onNonce?.(created.nonce);
617
+ if (created.status === 'completed')
618
+ return created;
619
+ if (owner === undefined) {
620
+ throw new Error(`ArNS action "${action}" requires the ANT owner's signature, but no owner signer was provided. ` +
621
+ `Pass \`owner\`, or drive createArNSAction/signArNSAction yourself. ` +
622
+ `Nonce ${created.nonce} is already debited — poll it rather than re-creating.`);
623
+ }
624
+ const signed = await owner.signTransaction(created.transaction);
625
+ return this.signArNSAction(created.nonce, signed);
557
626
  }
558
627
  /**
559
- * Self-custody exit: move a Turbo-custodied ANT to a Solana pubkey you control.
560
- * Authenticated with an action-bound, single-use signature.
628
+ * Buy a name. The ANT is minted straight to `owner` — Turbo never holds it.
629
+ *
630
+ * This is the ONLY action that always needs the owner's signature:
631
+ * `ario_ant::initialize` is the one instruction in the whole lifecycle that
632
+ * requires the ANT owner's key. The customer signs once, here, and never
633
+ * again unless they change controllers or transfer the name.
634
+ *
635
+ * The owner needs a Solana key to sign with, NOT a funded one — Turbo pays
636
+ * every lamport of fee and rent.
561
637
  */
562
- async transferArNSAnt({ antId, target, }) {
563
- const nonce = uuidV4();
564
- const headers = await this.signer.generateSignedRequestHeaders(nonce, this.buildArNSCustodyMessage('transfer', [antId, target]));
565
- return this.httpService.post({
566
- endpoint: `/arns/transfer/${antId}?target=${encodeURIComponent(target)}`,
567
- headers,
568
- data: Buffer.from([]),
569
- retry: false, // single-use action-bound nonce; don't re-POST on 5xx
570
- });
638
+ async buyArNSName({ name, owner, type = 'lease', years, paidBy, onNonce, }) {
639
+ return this.completeArNSAction('buy-name', {
640
+ name,
641
+ ownerAddress: await owner.getAddress(),
642
+ type,
643
+ ...(years !== undefined ? { years } : {}),
644
+ ...(paidBy !== undefined ? { paidBy } : {}),
645
+ }, owner, { onNonce });
646
+ }
647
+ /** Extend a lease. Permissionless on chain — no owner signature needed. */
648
+ async extendArNSLease({ name, years, paidBy, onNonce, }) {
649
+ return this.completeArNSAction('extend-lease', { name, years, ...(paidBy !== undefined ? { paidBy } : {}) }, undefined, { onNonce });
650
+ }
651
+ /** Upgrade a lease to a permanent name. No owner signature needed. */
652
+ async upgradeArNSName({ name, paidBy, onNonce, }) {
653
+ return this.completeArNSAction('upgrade-name', { name, ...(paidBy !== undefined ? { paidBy } : {}) }, undefined, { onNonce });
654
+ }
655
+ /** Raise the undername limit. No owner signature needed. */
656
+ async increaseArNSUndernameLimit({ name, increaseQty, paidBy, onNonce, }) {
657
+ return this.completeArNSAction('increase-undername-limit', { name, increaseQty, ...(paidBy !== undefined ? { paidBy } : {}) }, undefined, { onNonce });
571
658
  }
572
- /** Set a resolution record on a custodied ANT (undername defaults to '@'). */
573
- async setArNSRecord({ antId, undername = '@', transactionId, ttlSeconds, }) {
574
- const nonce = uuidV4();
575
- const headers = await this.signer.generateSignedRequestHeaders(nonce, this.buildArNSCustodyMessage('set-record', [
659
+ /**
660
+ * Point a name (or undername) at an Arweave transaction.
661
+ *
662
+ * Free — Turbo sponsors the Solana fee. Completes in one call while Turbo is
663
+ * a controller of the ANT, and returns `awaiting-signature` once the customer
664
+ * has revoked Turbo, at which point `owner` signs it themselves. Both paths
665
+ * are handled here.
666
+ *
667
+ * The owner proof is required EITHER WAY: Turbo is directing its own
668
+ * controller authority over an asset someone else owns, so nothing on chain
669
+ * records the owner's consent and we demand it. It is a MESSAGE signature,
670
+ * not a transaction — cheap and offline, but still a wallet prompt.
671
+ */
672
+ async setArNSRecord({ antId, owner, transactionId, undername = '@', ttlSeconds = 3600, onNonce, }) {
673
+ return this.completeArNSAction('set-record', {
674
+ antId,
675
+ ownerAddress: await owner.getAddress(),
676
+ transactionId,
677
+ undername,
678
+ ttlSeconds,
679
+ }, owner, { onNonce }, buildArNSCustodyMessage('set-record', [
576
680
  antId,
577
681
  undername,
578
682
  transactionId,
579
683
  String(ttlSeconds),
580
684
  ]));
581
- const query = `?undername=${encodeURIComponent(undername)}&transactionId=${transactionId}&ttlSeconds=${ttlSeconds}`;
582
- return this.httpService.post({
583
- endpoint: `/arns/manage/${antId}/set-record${query}`,
584
- headers,
585
- data: Buffer.from([]),
586
- retry: false, // single-use action-bound nonce; don't re-POST on 5xx
587
- });
588
685
  }
589
- /** Remove a resolution record (an undername) from a custodied ANT. */
590
- async removeArNSRecord({ antId, undername, }) {
591
- const nonce = uuidV4();
592
- const headers = await this.signer.generateSignedRequestHeaders(nonce, this.buildArNSCustodyMessage('remove-record', [antId, undername]));
593
- return this.httpService.post({
594
- endpoint: `/arns/manage/${antId}/remove-record?undername=${encodeURIComponent(undername)}`,
595
- headers,
596
- data: Buffer.from([]),
597
- retry: false, // single-use action-bound nonce; don't re-POST on 5xx
598
- });
686
+ /** Remove a record (an undername). Free; same two-shape rules as setArNSRecord. */
687
+ async removeArNSRecord({ antId, owner, undername, onNonce, }) {
688
+ return this.completeArNSAction('remove-record', { antId, ownerAddress: await owner.getAddress(), undername }, owner, { onNonce }, buildArNSCustodyMessage('remove-record', [antId, undername]));
689
+ }
690
+ /**
691
+ * Grant controller rights on the ANT. Omit `target` for Turbo itself, which
692
+ * is what makes `setArNSRecord` a single call.
693
+ *
694
+ * Owner-signed: changing an ANT's access control is an owner-only
695
+ * instruction. Free to the customer — Turbo funds the ACL page growth.
696
+ */
697
+ async addArNSController({ antId, owner, target, onNonce, }) {
698
+ return this.completeArNSAction('add-controller', {
699
+ antId,
700
+ ownerAddress: await owner.getAddress(),
701
+ ...(target !== undefined ? { target } : {}),
702
+ }, owner, { onNonce });
703
+ }
704
+ /**
705
+ * Revoke controller rights — the escape hatch that keeps "Turbo is not a
706
+ * custodian" honest.
707
+ *
708
+ * Always available, always free, and needs nothing from Turbo but the fee.
709
+ * After revoking, `setArNSRecord` keeps working: it simply starts returning
710
+ * `awaiting-signature` so the owner signs their own record writes.
711
+ */
712
+ async removeArNSController({ antId, owner, target, onNonce, }) {
713
+ return this.completeArNSAction('remove-controller', {
714
+ antId,
715
+ ownerAddress: await owner.getAddress(),
716
+ ...(target !== undefined ? { target } : {}),
717
+ }, owner, { onNonce });
718
+ }
719
+ /**
720
+ * Hand the ANT to a new owner. Irreversible: after this lands, `owner` no
721
+ * longer controls the name. Owner-signed, and sponsored like the rest.
722
+ */
723
+ async transferArNSAnt({ antId, owner, target, onNonce, }) {
724
+ return this.completeArNSAction('transfer', { antId, ownerAddress: await owner.getAddress(), target }, owner, { onNonce });
725
+ }
726
+ /**
727
+ * Defaults to the signer's own address when `userAddress` is omitted
728
+ * (`null`/`undefined`). Passing `''` does NOT trigger this default --
729
+ * mirrors `getBalance`'s existing behavior above.
730
+ */
731
+ async getArNSNames(userAddress) {
732
+ userAddress ??= await this.signer.getNativeAddress();
733
+ return super.getArNSNames(userAddress);
599
734
  }
600
735
  async getCreditShareApprovals({ userAddress, }) {
601
736
  userAddress ??= await this.signer.getNativeAddress();
@@ -66,6 +66,19 @@ export class TurboUnauthenticatedClient {
66
66
  getArNSPurchaseStatus(p) {
67
67
  return this.paymentService.getArNSPurchaseStatus(p);
68
68
  }
69
+ /**
70
+ * Returns the ArNS names a wallet owns or controls via Turbo's custodial
71
+ * ArNS-with-credits feature. `custodial: true` on a returned name means
72
+ * Turbo still holds/manages its ANT (transfer/manage routes apply);
73
+ * `custodial: false` means self-custody (or an already-completed exit) and
74
+ * is informational only.
75
+ *
76
+ * To read a name's current records or lease/expiration state, use
77
+ * `@ar.io/sdk` directly against the returned `antId`.
78
+ */
79
+ getArNSNames(address) {
80
+ return this.paymentService.getArNSNames(address);
81
+ }
69
82
  /**
70
83
  * Quote a fiat (Stripe) ArNS purchase — buy a name with a credit card in one
71
84
  * step, no Turbo Credits top-up in between. Complete the returned
@@ -197,16 +210,22 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
197
210
  getPaymentHistory(params) {
198
211
  return this.paymentService.getPaymentHistory(params);
199
212
  }
200
- /**
201
- * Buys, extends, or upgrades an ArNS name, paying with the signer's Turbo
202
- * credit balance. Poll {@link getArNSPurchaseStatus} with the returned nonce.
203
- */
204
- purchaseArNSName(params) {
205
- return this.paymentService.purchaseArNSName(params);
213
+ // ===== ArNS actions (sponsored) =====
214
+ //
215
+ // Thin delegations. The two-shape branch and the owner-proof construction
216
+ // live in the payment service; see its comments for why callers must branch
217
+ // on `status` rather than on which action they asked for.
218
+ /** Create an action. Debits credits HERE — capture the nonce before signing. */
219
+ createArNSAction(action, params, ownerProof) {
220
+ return this.paymentService.createArNSAction(action, params, ownerProof);
206
221
  }
207
- /** Buys a new ArNS name (lease or permabuy). */
208
- buyArNSName(params) {
209
- return this.paymentService.buyArNSName(params);
222
+ /** Submit the owner-signed transaction (FULL serialized tx, base64). */
223
+ signArNSAction(nonce, signedTransaction) {
224
+ return this.paymentService.signArNSAction(nonce, signedTransaction);
225
+ }
226
+ /** Status by nonce — open, needs no signature. Use it to resume. */
227
+ getArNSActionStatus(nonce) {
228
+ return this.paymentService.getArNSActionStatus(nonce);
210
229
  }
211
230
  /**
212
231
  * Quote a fiat (Stripe) ArNS purchase for this signer's wallet — a credit-card
@@ -220,27 +239,53 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
220
239
  getArNSFiatPurchaseQuote(params) {
221
240
  return this.paymentService.getArNSFiatPurchaseQuote(params);
222
241
  }
223
- /** Extends the lease on an existing ArNS name. */
242
+ /**
243
+ * Buy a name. The ANT is minted straight to `owner`; Turbo never holds it.
244
+ * The only action that always needs the owner's signature — once, ever.
245
+ */
246
+ buyArNSName(params) {
247
+ return this.paymentService.buyArNSName(params);
248
+ }
249
+ /** Extend a lease. No owner signature needed. */
224
250
  extendArNSLease(params) {
225
251
  return this.paymentService.extendArNSLease(params);
226
252
  }
227
- /** Increases the undername limit on an existing ArNS name. */
253
+ /** Raise the undername limit. No owner signature needed. */
228
254
  increaseArNSUndernameLimit(params) {
229
255
  return this.paymentService.increaseArNSUndernameLimit(params);
230
256
  }
231
- /** Upgrades an ArNS lease to a permabuy. */
257
+ /** Upgrade a lease to a permanent name. No owner signature needed. */
232
258
  upgradeArNSName(params) {
233
259
  return this.paymentService.upgradeArNSName(params);
234
260
  }
235
- transferArNSAnt(params) {
236
- return this.paymentService.transferArNSAnt(params);
237
- }
261
+ /** Point a name (or undername) at data. Free; handles both shapes. */
238
262
  setArNSRecord(params) {
239
263
  return this.paymentService.setArNSRecord(params);
240
264
  }
265
+ /** Remove a record. Free; handles both shapes. */
241
266
  removeArNSRecord(params) {
242
267
  return this.paymentService.removeArNSRecord(params);
243
268
  }
269
+ /** Grant controller rights — omit `target` for Turbo itself. Free. */
270
+ addArNSController(params) {
271
+ return this.paymentService.addArNSController(params);
272
+ }
273
+ /** Revoke controller rights. Always available, always free. */
274
+ removeArNSController(params) {
275
+ return this.paymentService.removeArNSController(params);
276
+ }
277
+ /** Hand the ANT to a new owner. Irreversible. Free. */
278
+ transferArNSAnt(params) {
279
+ return this.paymentService.transferArNSAnt(params);
280
+ }
281
+ /**
282
+ * Returns the ArNS names owned or controlled by the connected signer's
283
+ * wallet (or the given `userAddress`) via Turbo's custodial
284
+ * ArNS-with-credits feature.
285
+ */
286
+ getArNSNames(userAddress) {
287
+ return this.paymentService.getArNSNames(userAddress);
288
+ }
244
289
  /**
245
290
  * Returns a list of all credit share approvals for the user.
246
291
  */
package/lib/esm/types.js CHANGED
@@ -99,6 +99,25 @@ export const arNSPurchaseIntents = [
99
99
  'Increase-Undername-Limit',
100
100
  'Upgrade-Name',
101
101
  ];
102
+ // ===== ArNS actions (sponsored — the current bundler surface) =====
103
+ /**
104
+ * The nine sponsored ArNS actions.
105
+ *
106
+ * NOT included, because the bundler does not sponsor them: `primary-name`,
107
+ * `release-name`, `reassign`, and ANT metadata (name/description/keywords/logo).
108
+ * Those stay on the direct-signer path and cost the user SOL.
109
+ */
110
+ export const arNSActions = [
111
+ 'buy-name',
112
+ 'extend-lease',
113
+ 'upgrade-name',
114
+ 'increase-undername-limit',
115
+ 'set-record',
116
+ 'remove-record',
117
+ 'add-controller',
118
+ 'remove-controller',
119
+ 'transfer',
120
+ ];
102
121
  // ===== ArNS purchases paid with fiat (Stripe) — no Turbo Credits in between ====
103
122
  /**
104
123
  * Stripe integration mode for a fiat ArNS purchase quote.
@@ -1,4 +1,5 @@
1
- import { ArNSFiatPurchaseQuoteParams, ArNSFiatPurchaseQuoteResponse, ArNSNameType, ArNSPriceParams, ArNSPriceResponse, ArNSPurchaseResponse, ArNSPurchaseStatusResponse } from '../../types.js';
1
+ import { ArNSFiatPurchaseQuoteParams, ArNSFiatPurchaseQuoteResponse, ArNSNameType, ArNSPriceParams, ArNSPriceResponse, ArNSPurchaseStatusResponse } from '../../types.js';
2
+ import { ArNSActionCompleted, ArNSOwnerSigner } from '../../types.js';
2
3
  import { ArNSFiatQuoteOptions, ArNSPriceOptions, ArNSPurchaseOptions, ArNSPurchaseStatusOptions, RemoveArNSRecordOptions, SetArNSRecordOptions, TransferArNSAntOptions } from '../types.js';
3
4
  export type ArNSPriceClient = {
4
5
  getArNSPriceForName(params: ArNSPriceParams): Promise<ArNSPriceResponse>;
@@ -11,56 +12,44 @@ export type ArNSStatusClient = {
11
12
  export type ArNSPurchaseClient = {
12
13
  buyArNSName(params: {
13
14
  name: string;
14
- type: ArNSNameType;
15
+ owner: ArNSOwnerSigner;
16
+ type?: ArNSNameType;
15
17
  years?: number;
16
- processId?: string;
17
18
  paidBy?: string[];
18
- }): Promise<ArNSPurchaseResponse>;
19
+ }): Promise<ArNSActionCompleted>;
19
20
  extendArNSLease(params: {
20
21
  name: string;
21
22
  years: number;
22
23
  paidBy?: string[];
23
- }): Promise<ArNSPurchaseResponse>;
24
+ }): Promise<ArNSActionCompleted>;
24
25
  increaseArNSUndernameLimit(params: {
25
26
  name: string;
26
27
  increaseQty: number;
27
28
  paidBy?: string[];
28
- }): Promise<ArNSPurchaseResponse>;
29
+ }): Promise<ArNSActionCompleted>;
29
30
  upgradeArNSName(params: {
30
31
  name: string;
31
32
  paidBy?: string[];
32
- }): Promise<ArNSPurchaseResponse>;
33
+ }): Promise<ArNSActionCompleted>;
33
34
  };
34
35
  export type ArNSCustodyClient = {
35
36
  transferArNSAnt(params: {
36
37
  antId: string;
38
+ owner: ArNSOwnerSigner;
37
39
  target: string;
38
- }): Promise<{
39
- antId: string;
40
- target: string;
41
- name?: string;
42
- messageId: string;
43
- }>;
40
+ }): Promise<ArNSActionCompleted>;
44
41
  setArNSRecord(params: {
45
42
  antId: string;
46
- undername?: string;
43
+ owner: ArNSOwnerSigner;
47
44
  transactionId: string;
48
- ttlSeconds: number;
49
- }): Promise<{
50
- antId: string;
51
- undername: string;
52
- transactionId: string;
53
- ttlSeconds: number;
54
- messageId: string;
55
- }>;
45
+ undername?: string;
46
+ ttlSeconds?: number;
47
+ }): Promise<ArNSActionCompleted>;
56
48
  removeArNSRecord(params: {
57
49
  antId: string;
50
+ owner: ArNSOwnerSigner;
58
51
  undername: string;
59
- }): Promise<{
60
- antId: string;
61
- undername: string;
62
- messageId: string;
63
- }>;
52
+ }): Promise<ArNSActionCompleted>;
64
53
  };
65
54
  export declare function requiredNameFromOptions(options: {
66
55
  name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"arns.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/arns.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,0BAA0B,EAE3B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB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