@ardrive/turbo-sdk 1.42.0 → 1.43.0-alpha.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.
Files changed (99) hide show
  1. package/lib/cjs/cli/cli.js +97 -0
  2. package/lib/cjs/cli/commands/arns.js +475 -0
  3. package/lib/cjs/cli/commands/freeStatus.js +47 -0
  4. package/lib/cjs/cli/commands/index.js +3 -0
  5. package/lib/cjs/cli/commands/paymentHistory.js +25 -0
  6. package/lib/cjs/cli/options.js +202 -1
  7. package/lib/cjs/common/arnsActions.js +125 -0
  8. package/lib/cjs/common/chunked.js +51 -1
  9. package/lib/cjs/common/folderIndex.js +401 -0
  10. package/lib/cjs/common/http.js +40 -6
  11. package/lib/cjs/common/index.js +7 -0
  12. package/lib/cjs/common/payment.js +548 -2
  13. package/lib/cjs/common/signer.js +27 -6
  14. package/lib/cjs/common/token/index.js +0 -11
  15. package/lib/cjs/common/turbo.js +162 -0
  16. package/lib/cjs/common/upload.js +314 -31
  17. package/lib/cjs/node/folderIndex.js +132 -0
  18. package/lib/cjs/node/index.js +1 -0
  19. package/lib/cjs/node/upload.js +7 -0
  20. package/lib/cjs/types.js +53 -3
  21. package/lib/cjs/utils/common.js +0 -4
  22. package/lib/cjs/utils/errors.js +38 -1
  23. package/lib/cjs/utils/folderIndex.js +88 -0
  24. package/lib/cjs/utils/uuid.js +31 -0
  25. package/lib/cjs/web/signer.js +4 -2
  26. package/lib/esm/cli/cli.js +99 -2
  27. package/lib/esm/cli/commands/arns.js +450 -0
  28. package/lib/esm/cli/commands/freeStatus.js +44 -0
  29. package/lib/esm/cli/commands/index.js +3 -0
  30. package/lib/esm/cli/commands/paymentHistory.js +22 -0
  31. package/lib/esm/cli/options.js +201 -0
  32. package/lib/esm/common/arnsActions.js +114 -0
  33. package/lib/esm/common/chunked.js +51 -1
  34. package/lib/esm/common/folderIndex.js +396 -0
  35. package/lib/esm/common/http.js +39 -5
  36. package/lib/esm/common/index.js +7 -0
  37. package/lib/esm/common/payment.js +548 -2
  38. package/lib/esm/common/signer.js +28 -7
  39. package/lib/esm/common/token/index.js +1 -12
  40. package/lib/esm/common/turbo.js +162 -0
  41. package/lib/esm/common/upload.js +316 -33
  42. package/lib/esm/node/folderIndex.js +129 -0
  43. package/lib/esm/node/index.js +1 -0
  44. package/lib/esm/node/upload.js +7 -0
  45. package/lib/esm/types.js +52 -2
  46. package/lib/esm/utils/common.js +0 -4
  47. package/lib/esm/utils/errors.js +35 -0
  48. package/lib/esm/utils/folderIndex.js +81 -0
  49. package/lib/esm/utils/uuid.js +28 -0
  50. package/lib/esm/web/signer.js +4 -2
  51. package/lib/types/cli/commands/arns.d.ts +147 -0
  52. package/lib/types/cli/commands/arns.d.ts.map +1 -0
  53. package/lib/types/cli/commands/freeStatus.d.ts +3 -0
  54. package/lib/types/cli/commands/freeStatus.d.ts.map +1 -0
  55. package/lib/types/cli/commands/index.d.ts +3 -0
  56. package/lib/types/cli/commands/index.d.ts.map +1 -1
  57. package/lib/types/cli/commands/paymentHistory.d.ts +18 -0
  58. package/lib/types/cli/commands/paymentHistory.d.ts.map +1 -0
  59. package/lib/types/cli/options.d.ts +423 -0
  60. package/lib/types/cli/options.d.ts.map +1 -1
  61. package/lib/types/cli/types.d.ts +78 -0
  62. package/lib/types/cli/types.d.ts.map +1 -1
  63. package/lib/types/common/arnsActions.d.ts +58 -0
  64. package/lib/types/common/arnsActions.d.ts.map +1 -0
  65. package/lib/types/common/chunked.d.ts +47 -2
  66. package/lib/types/common/chunked.d.ts.map +1 -1
  67. package/lib/types/common/folderIndex.d.ts +54 -0
  68. package/lib/types/common/folderIndex.d.ts.map +1 -0
  69. package/lib/types/common/http.d.ts +25 -2
  70. package/lib/types/common/http.d.ts.map +1 -1
  71. package/lib/types/common/index.d.ts +3 -0
  72. package/lib/types/common/index.d.ts.map +1 -1
  73. package/lib/types/common/payment.d.ts +291 -1
  74. package/lib/types/common/payment.d.ts.map +1 -1
  75. package/lib/types/common/signer.d.ts +12 -6
  76. package/lib/types/common/signer.d.ts.map +1 -1
  77. package/lib/types/common/token/index.d.ts.map +1 -1
  78. package/lib/types/common/turbo.d.ts +183 -1
  79. package/lib/types/common/turbo.d.ts.map +1 -1
  80. package/lib/types/common/upload.d.ts +41 -0
  81. package/lib/types/common/upload.d.ts.map +1 -1
  82. package/lib/types/node/folderIndex.d.ts +28 -0
  83. package/lib/types/node/folderIndex.d.ts.map +1 -0
  84. package/lib/types/node/index.d.ts +1 -0
  85. package/lib/types/node/index.d.ts.map +1 -1
  86. package/lib/types/node/upload.d.ts +1 -0
  87. package/lib/types/node/upload.d.ts.map +1 -1
  88. package/lib/types/types.d.ts +694 -3
  89. package/lib/types/types.d.ts.map +1 -1
  90. package/lib/types/utils/common.d.ts.map +1 -1
  91. package/lib/types/utils/errors.d.ts +29 -0
  92. package/lib/types/utils/errors.d.ts.map +1 -1
  93. package/lib/types/utils/folderIndex.d.ts +47 -0
  94. package/lib/types/utils/folderIndex.d.ts.map +1 -0
  95. package/lib/types/utils/uuid.d.ts +7 -0
  96. package/lib/types/utils/uuid.d.ts.map +1 -0
  97. package/lib/types/web/signer.d.ts +1 -1
  98. package/lib/types/web/signer.d.ts.map +1 -1
  99. package/package.json +1 -1
package/lib/cjs/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validChunkingModes = exports.isJWK = exports.isWebUploadFolderParams = exports.isNodeUploadFolderParams = exports.multipartFinalizedStatus = exports.multipartFailedStatus = exports.multipartPendingStatus = exports.X402Funding = exports.OnDemandFunding = exports.ExistingBalanceFunding = exports.supportedEvmSignerTokens = exports.tokenTypes = exports.fiatCurrencyTypes = void 0;
3
+ exports.arNSFiatPurchaseMethods = exports.arNSActions = exports.arNSPurchaseIntents = exports.validChunkingModes = exports.isJWK = exports.isWebUploadFolderParams = exports.isNodeUploadFolderParams = exports.multipartFinalizedStatus = exports.multipartFailedStatus = exports.multipartPendingStatus = exports.X402Funding = exports.OnDemandFunding = exports.ExistingBalanceFunding = exports.supportedEvmSignerTokens = exports.tokenTypes = exports.fiatCurrencyTypes = void 0;
4
4
  exports.isCurrency = isCurrency;
5
5
  exports.isKyvePrivateKey = isKyvePrivateKey;
6
6
  exports.isEthPrivateKey = isEthPrivateKey;
@@ -25,7 +25,6 @@ function isCurrency(currency) {
25
25
  exports.tokenTypes = [
26
26
  'arweave',
27
27
  'ario',
28
- 'base-ario',
29
28
  'solana',
30
29
  'ethereum',
31
30
  'kyve',
@@ -44,7 +43,6 @@ exports.supportedEvmSignerTokens = new Set([
44
43
  'polygon-usdc',
45
44
  'usdc',
46
45
  'base-usdc',
47
- 'base-ario',
48
46
  ]);
49
47
  class ExistingBalanceFunding {
50
48
  }
@@ -108,3 +106,55 @@ function isEthereumWalletAdapter(walletAdapter) {
108
106
  return 'getSigner' in walletAdapter;
109
107
  }
110
108
  exports.validChunkingModes = ['force', 'disabled', 'auto'];
109
+ // ===== ArNS purchases paid with Turbo credits (via the bundler REST API) =====
110
+ exports.arNSPurchaseIntents = [
111
+ 'Buy-Name',
112
+ 'Extend-Lease',
113
+ 'Increase-Undername-Limit',
114
+ 'Upgrade-Name',
115
+ ];
116
+ // ===== ArNS actions (sponsored — the current bundler surface) =====
117
+ /**
118
+ * The twelve sponsored ArNS actions.
119
+ *
120
+ * Sponsorship covers these twelve and NOTHING else. Everything else in the
121
+ * ArNS, ANT and core programs stays on the direct-signer path and costs the
122
+ * user SOL — notably `BuyReturnedName` (auctions, deliberately excluded: the
123
+ * premium is unbounded), `ClaimReservedName`, the primary-name flow (which
124
+ * lives in the ario core program), release/reassign, and ANT-LEVEL metadata.
125
+ * Note ANT-level metadata is distinct from RECORD-level metadata, which
126
+ * `set-record-metadata` does sponsor.
127
+ */
128
+ exports.arNSActions = [
129
+ 'buy-name',
130
+ 'extend-lease',
131
+ 'upgrade-name',
132
+ 'increase-undername-limit',
133
+ 'set-record',
134
+ 'remove-record',
135
+ 'add-controller',
136
+ 'remove-controller',
137
+ 'transfer',
138
+ // Record-scoped. Owner-or-controller on chain, so these follow set-record's
139
+ // degrade-on-revoke shape rather than needing a signature every time.
140
+ 'set-record-metadata',
141
+ 'remove-record-metadata',
142
+ 'transfer-record',
143
+ ];
144
+ // ===== ArNS purchases paid with fiat (Stripe) — no Turbo Credits in between ====
145
+ /**
146
+ * Stripe integration mode for a fiat ArNS purchase quote.
147
+ *
148
+ * - `payment-intent` — returns a Stripe PaymentIntent. Confirm it client-side
149
+ * with `stripe.confirmCardPayment(paymentSession.client_secret, ...)`.
150
+ * - `checkout-session` — returns a Stripe Checkout Session to redirect to
151
+ * (`uiMode: 'hosted'`) or embed (`uiMode: 'embedded'`).
152
+ *
153
+ * Widened with `string & Record<never, never>` so a method added service-side is
154
+ * still callable without an SDK bump, while the known values keep autocomplete.
155
+ * (`string & {}` is the usual idiom but trips the `ban-types` lint rule.)
156
+ */
157
+ exports.arNSFiatPurchaseMethods = [
158
+ 'payment-intent',
159
+ 'checkout-session',
160
+ ];
@@ -50,7 +50,6 @@ const baseMainnetRpc = 'https://mainnet.base.org';
50
50
  exports.tokenToDevGatewayMap = {
51
51
  arweave: 'https://turbo-gateway.com', // No arweave test net
52
52
  ario: 'https://api.devnet.solana.com',
53
- 'base-ario': baseMainnetRpc, // No base-ario test net contract deployed
54
53
  solana: 'https://api.devnet.solana.com',
55
54
  ethereum: ethTestnetRpc,
56
55
  'base-eth': baseTestnetRpc,
@@ -64,7 +63,6 @@ exports.tokenToDevGatewayMap = {
64
63
  exports.defaultProdGatewayUrls = {
65
64
  arweave: 'https://turbo-gateway.com',
66
65
  ario: 'https://api.mainnet-beta.solana.com',
67
- 'base-ario': baseMainnetRpc,
68
66
  solana: 'https://api.mainnet-beta.solana.com',
69
67
  ethereum: 'https://cloudflare-eth.com/',
70
68
  'base-eth': baseMainnetRpc,
@@ -102,7 +100,6 @@ function createTurboSigner({ signer: clientProvidedSigner, privateKey: clientPro
102
100
  case 'base-eth':
103
101
  case 'usdc':
104
102
  case 'base-usdc':
105
- case 'base-ario':
106
103
  case 'polygon-usdc':
107
104
  if (!(0, types_js_1.isEthPrivateKey)(clientProvidedPrivateKey)) {
108
105
  throw new Error('A valid Ethereum private key must be provided for EthereumSigner.');
@@ -167,7 +164,6 @@ function isValidUserAddress(address, type) {
167
164
  case 'matic':
168
165
  case 'pol':
169
166
  case 'base-usdc':
170
- case 'base-ario':
171
167
  case 'usdc':
172
168
  case 'polygon-usdc':
173
169
  return isValidECDSAAddress(address);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbortError = exports.ProvidedInputError = exports.FailedRequestError = exports.UnauthenticatedRequestError = exports.BaseError = void 0;
3
+ exports.AbortError = exports.FiatPaymentsDisabledError = exports.InsufficientCreditsError = exports.ProvidedInputError = exports.FailedRequestError = exports.UnauthenticatedRequestError = exports.BaseError = void 0;
4
4
  /**
5
5
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
6
  *
@@ -42,6 +42,43 @@ class ProvidedInputError extends BaseError {
42
42
  }
43
43
  }
44
44
  exports.ProvidedInputError = ProvidedInputError;
45
+ /**
46
+ * Raised when a credit-paid operation (e.g. an ArNS purchase) is rejected by the
47
+ * service because the paying wallet does not hold enough Turbo credits. Maps the
48
+ * bundler's HTTP `402 Payment Required` response to a typed, catchable error so
49
+ * callers can prompt a top-up without string-matching on messages.
50
+ *
51
+ * Recovery: top up the balance, then retry the SAME operation reusing the
52
+ * captured `nonce` (the nonce is the idempotency key), or mint a fresh request.
53
+ */
54
+ class InsufficientCreditsError extends BaseError {
55
+ constructor(message) {
56
+ super(message ??
57
+ 'Insufficient Turbo credits to complete this purchase. Top up your balance and retry.');
58
+ /** Always the HTTP status that produced this error. */
59
+ this.status = 402;
60
+ }
61
+ }
62
+ exports.InsufficientCreditsError = InsufficientCreditsError;
63
+ /**
64
+ * Raised when the payment service has fiat (Stripe) payments switched off, which
65
+ * it signals with `503` and the body "Fiat (Stripe) ArNS payments are disabled".
66
+ * This is a normal state in the testnet sandbox, not an outage.
67
+ *
68
+ * Distinguished from a generic `503` deliberately: the same status is also used
69
+ * for internal errors (body "Internal Server Error: ..."), so status alone is
70
+ * ambiguous. Recovery: fall back to the credit-paid path (`buyArNSName` and
71
+ * friends), or surface fiat checkout as unavailable.
72
+ */
73
+ class FiatPaymentsDisabledError extends BaseError {
74
+ constructor(message) {
75
+ super(message ??
76
+ 'Fiat (Stripe) payments are disabled on this payment service. Use the credit-paid purchase path instead.');
77
+ /** Always the HTTP status that produced this error. */
78
+ this.status = 503;
79
+ }
80
+ }
81
+ exports.FiatPaymentsDisabledError = FiatPaymentsDisabledError;
45
82
  class AbortError extends BaseError {
46
83
  constructor(message = 'Request was aborted') {
47
84
  super(message);
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.contentHashTagName = void 0;
19
+ exports.isValidContentHash = isValidContentHash;
20
+ exports.isValidFolderIndexKey = isValidFolderIndexKey;
21
+ exports.contentHashFromFolderIndexKey = contentHashFromFolderIndexKey;
22
+ exports.folderIndexKey = folderIndexKey;
23
+ /**
24
+ * Internals shared by the folder index layers and by `uploadFolder`. Not part
25
+ * of the package's public surface.
26
+ */
27
+ /** Tag carrying the sha-256 of a file's own bytes, as lowercase hex. */
28
+ exports.contentHashTagName = 'File-SHA256';
29
+ const contentHashRegex = /^[0-9a-f]{64}$/;
30
+ const folderIndexKeyRegex = /^[0-9a-f]{64}\.[0-9a-f]{64}$/;
31
+ /** True for a lowercase hex sha-256 digest of a file's bytes. */
32
+ function isValidContentHash(hash) {
33
+ return hash !== undefined && contentHashRegex.test(hash);
34
+ }
35
+ /**
36
+ * A folder index key is `<sha-256 of the bytes>.<sha-256 of the tags>`.
37
+ *
38
+ * Both halves matter. Keying on the bytes alone would reuse an item whose tags
39
+ * are not the ones the caller asked for: an empty `a.css` and an empty `b.js`
40
+ * hash identically, and reusing one for the other would serve JavaScript as
41
+ * `text/css`. Keying on the tags as well means a reused data item is always
42
+ * exactly the data item this call would otherwise have created.
43
+ *
44
+ * The bytes half is kept in the clear so a layer that queries a gateway can
45
+ * recover it and filter on the `File-SHA256` tag.
46
+ */
47
+ function isValidFolderIndexKey(key) {
48
+ return key !== undefined && folderIndexKeyRegex.test(key);
49
+ }
50
+ /** The bytes half of a folder index key. */
51
+ function contentHashFromFolderIndexKey(key) {
52
+ return key.slice(0, 64);
53
+ }
54
+ async function sha256Hex(data) {
55
+ const digest = await crypto.subtle.digest('SHA-256', data);
56
+ return Buffer.from(digest).toString('hex');
57
+ }
58
+ /**
59
+ * Canonical encoding of a tag set: the same tags in a different order encode
60
+ * identically, because two data items that differ only in tag order are the
61
+ * same item as far as reuse goes.
62
+ *
63
+ * The sort compares code units rather than using `localeCompare`, which is not
64
+ * a total order over distinct strings and depends on the host's ICU data --
65
+ * NFC and NFD spellings of the same word compare equal without being equal, and
66
+ * two locales disagree on where an accented letter sorts. Either would let one
67
+ * tag set hash differently on two machines, which costs a reuse.
68
+ *
69
+ * The encoding has to be injective, not merely stable. An ANS-104 tag name and
70
+ * value are arbitrary byte arrays, so a delimiter-joined string collides: with
71
+ * a 0x00/0x01 join, a single tag whose value embeds both delimiters encodes
72
+ * exactly like two separate tags. A collision here is a wrong reuse, which is
73
+ * the one failure the composite key exists to make impossible. JSON escapes
74
+ * the delimiters, so no value can forge a record boundary.
75
+ */
76
+ function canonicalTags(tags) {
77
+ const pairs = tags
78
+ .map((tag) => [tag.name, tag.value])
79
+ .sort(([aName, aValue], [bName, bValue]) => {
80
+ const [a, b] = aName === bName ? [aValue, bValue] : [aName, bName];
81
+ return a < b ? -1 : a > b ? 1 : 0;
82
+ });
83
+ return new TextEncoder().encode(JSON.stringify(pairs));
84
+ }
85
+ /** The folder index key for a file with these bytes and these final tags. */
86
+ async function folderIndexKey({ contentHash, tags, }) {
87
+ return `${contentHash}.${await sha256Hex(canonicalTags(tags))}`;
88
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uuidV4 = uuidV4;
4
+ /**
5
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const crypto_1 = require("crypto");
20
+ /**
21
+ * RFC 4122 version 4 UUID, derived from `randomBytes` (already used across the
22
+ * SDK in both the node and web builds). Avoids depending on
23
+ * `crypto.randomUUID`, whose availability varies by runtime/polyfill.
24
+ */
25
+ function uuidV4() {
26
+ const bytes = (0, crypto_1.randomBytes)(16);
27
+ bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
28
+ bytes[8] = (bytes[8] & 0x3f) | 0x80; // RFC 4122 variant
29
+ const hex = bytes.toString('hex');
30
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
31
+ }
@@ -64,9 +64,11 @@ class TurboWebArweaveSigner extends signer_js_1.TurboDataItemAbstractSigner {
64
64
  dataItemSizeFactory: () => signedDataItemSize,
65
65
  };
66
66
  }
67
- async generateSignedRequestHeaders() {
67
+ async generateSignedRequestHeaders(nonce, additionalData) {
68
68
  await this.setPublicKey();
69
- return super.generateSignedRequestHeaders();
69
+ // Pass through the caller's nonce + action-binding data (previously dropped,
70
+ // which would override a route-required UUID nonce and the H-2 binding).
71
+ return super.generateSignedRequestHeaders(nonce, additionalData);
70
72
  }
71
73
  async signData(dataToSign) {
72
74
  await this.setPublicKey();
@@ -20,14 +20,15 @@ import { DataItem } from '@dha-team/arbundles';
20
20
  import { program } from 'commander';
21
21
  import { readFileSync, readdirSync } from 'fs';
22
22
  import { version } from '../version.js';
23
+ import { addArNSController, arnsActionPrice, arnsActionStatus, arnsFiatQuote, arnsPrice, arnsPurchaseStatus, buyArNSName, extendArNSLease, increaseArNSUndernames, removeArNSController, removeArNSRecord, removeArNSRecordMetadata, setArNSRecord, setArNSRecordMetadata, transferArNSAnt, transferArNSRecord, upgradeArNSName, } from './commands/arns.js';
23
24
  import { fiatEstimate } from './commands/fiatEstimate.js';
24
- import { balance, cryptoFund, price, topUp, uploadFile, uploadFolder, } from './commands/index.js';
25
+ import { balance, cryptoFund, freeStatus, paymentHistory, price, topUp, uploadFile, uploadFolder, } from './commands/index.js';
25
26
  import { listShares } from './commands/listShares.js';
26
27
  import { revokeCredits } from './commands/revokeCredits.js';
27
28
  import { shareCredits } from './commands/shareCredits.js';
28
29
  import { tokenPrice } from './commands/tokenPrice.js';
29
30
  import { x402UploadUnsignedFile } from './commands/x402UploadUnsignedData.js';
30
- import { globalOptions, listSharesOptions, optionMap, revokeCreditsOptions, shareCreditsOptions, uploadFileOptions, uploadFolderOptions, walletOptions, } from './options.js';
31
+ import { addArNSControllerOptions, arnsActionPriceOptions, arnsActionStatusOptions, arnsFiatQuoteOptions, arnsPriceOptions, arnsPurchaseStatusOptions, buyArNSNameOptions, extendArNSLeaseOptions, globalOptions, increaseArNSUndernamesOptions, listSharesOptions, optionMap, removeArNSControllerOptions, removeArNSRecordMetadataOptions, removeArNSRecordOptions, revokeCreditsOptions, setArNSRecordMetadataOptions, setArNSRecordOptions, shareCreditsOptions, transferArNSAntOptions, transferArNSRecordOptions, upgradeArNSNameOptions, uploadFileOptions, uploadFolderOptions, walletOptions, } from './options.js';
31
32
  import { applyOptions, runCommand } from './utils.js';
32
33
  applyOptions(program
33
34
  .name('turbo')
@@ -37,6 +38,16 @@ applyOptions(program
37
38
  applyOptions(program.command('balance').description('Get balance of a Turbo address'), [optionMap.address, ...walletOptions]).action(async (_commandOptions, command) => {
38
39
  await runCommand(command, balance);
39
40
  });
41
+ applyOptions(program
42
+ .command('free-status')
43
+ .description('Get the free-tier upload allowance remaining for a Turbo address'), [optionMap.address, ...walletOptions]).action(async (_commandOptions, command) => {
44
+ await runCommand(command, freeStatus);
45
+ });
46
+ applyOptions(program
47
+ .command('payment-history')
48
+ .description("Get the signing wallet's own top-up (payment) history"), [...walletOptions, optionMap.limit, optionMap.cursor]).action(async (_commandOptions, command) => {
49
+ await runCommand(command, paymentHistory);
50
+ });
40
51
  applyOptions(program.command('top-up').description('Top up a Turbo address with Fiat'), [...walletOptions, optionMap.address, optionMap.value, optionMap.currency]).action(async (_commandOptions, command) => {
41
52
  await runCommand(command, topUp);
42
53
  });
@@ -84,6 +95,92 @@ applyOptions(program
84
95
  .description('Lists all given or received Turbo credit share approvals for specified address or connected wallet'), listSharesOptions).action(async (_commandOptions, command) => {
85
96
  await runCommand(command, listShares);
86
97
  });
98
+ applyOptions(program
99
+ .command('arns-price')
100
+ .description('Get the Turbo Credit (winc + mARIO) price to buy, extend, increase undernames, or upgrade an ArNS name'), arnsPriceOptions).action(async (_commandOptions, command) => {
101
+ await runCommand(command, arnsPrice);
102
+ });
103
+ applyOptions(program
104
+ .command('arns-fiat-quote')
105
+ .description('Quote an ArNS purchase paid by credit card (Stripe) - no credits needed'), arnsFiatQuoteOptions).action(async (_commandOptions, command) => {
106
+ await runCommand(command, arnsFiatQuote);
107
+ });
108
+ applyOptions(program
109
+ .command('buy-arns-name')
110
+ .description('Buy an ArNS name (lease or permabuy) with Turbo Credits'), buyArNSNameOptions).action(async (_commandOptions, command) => {
111
+ await runCommand(command, buyArNSName);
112
+ });
113
+ applyOptions(program
114
+ .command('extend-arns-lease')
115
+ .description('Extend an ArNS name lease with Turbo Credits'), extendArNSLeaseOptions).action(async (_commandOptions, command) => {
116
+ await runCommand(command, extendArNSLease);
117
+ });
118
+ applyOptions(program
119
+ .command('increase-arns-undernames')
120
+ .description('Increase the undername limit of an ArNS name with Turbo Credits'), increaseArNSUndernamesOptions).action(async (_commandOptions, command) => {
121
+ await runCommand(command, increaseArNSUndernames);
122
+ });
123
+ applyOptions(program
124
+ .command('upgrade-arns-name')
125
+ .description('Upgrade an ArNS leased name to a permabuy with Turbo Credits'), upgradeArNSNameOptions).action(async (_commandOptions, command) => {
126
+ await runCommand(command, upgradeArNSName);
127
+ });
128
+ applyOptions(program
129
+ .command('arns-purchase-status')
130
+ .description('Get the status of an ArNS purchase by its nonce'), arnsPurchaseStatusOptions).action(async (_commandOptions, command) => {
131
+ await runCommand(command, arnsPurchaseStatus);
132
+ });
133
+ applyOptions(program
134
+ .command('arns-action-status')
135
+ .description('Get the status of a credit-paid ArNS action by its nonce (buy, extend, upgrade, and the non-purchase actions)'), arnsActionStatusOptions).action(async (_commandOptions, command) => {
136
+ await runCommand(command, arnsActionStatus);
137
+ });
138
+ applyOptions(program
139
+ .command('transfer-arns-ant')
140
+ .description('Transfer a Turbo-custodied ANT to a Solana pubkey you control'), transferArNSAntOptions).action(async (_commandOptions, command) => {
141
+ await runCommand(command, transferArNSAnt);
142
+ });
143
+ applyOptions(program
144
+ .command('set-arns-record')
145
+ .description('Set a resolution record on a Turbo-custodied ANT'), setArNSRecordOptions).action(async (_commandOptions, command) => {
146
+ await runCommand(command, setArNSRecord);
147
+ });
148
+ applyOptions(program
149
+ .command('remove-arns-record')
150
+ .description('Remove a resolution record (undername) from a Turbo-custodied ANT'), removeArNSRecordOptions).action(async (_commandOptions, command) => {
151
+ await runCommand(command, removeArNSRecord);
152
+ });
153
+ applyOptions(program
154
+ .command('add-arns-controller')
155
+ .description('Grant controller rights on a Turbo-custodied ANT'), addArNSControllerOptions).action(async (_commandOptions, command) => {
156
+ await runCommand(command, addArNSController);
157
+ });
158
+ applyOptions(program
159
+ .command('remove-arns-controller')
160
+ .description('Revoke controller rights on a Turbo-custodied ANT'), removeArNSControllerOptions).action(async (_commandOptions, command) => {
161
+ await runCommand(command, removeArNSController);
162
+ });
163
+ applyOptions(program
164
+ .command('transfer-arns-record')
165
+ .description('Transfer one record (undername) on a Turbo-custodied ANT to another address'), transferArNSRecordOptions).action(async (_commandOptions, command) => {
166
+ await runCommand(command, transferArNSRecord);
167
+ });
168
+ applyOptions(program
169
+ .command('set-arns-record-metadata')
170
+ .description("Set a record's display name, logo, description, or keywords on a Turbo-custodied ANT"), setArNSRecordMetadataOptions).action(async (_commandOptions, command) => {
171
+ await runCommand(command, setArNSRecordMetadata);
172
+ });
173
+ applyOptions(program
174
+ .command('remove-arns-record-metadata')
175
+ .description("Clear a record's metadata on a Turbo-custodied ANT"), removeArNSRecordMetadataOptions).action(async (_commandOptions, command) => {
176
+ await runCommand(command, removeArNSRecordMetadata);
177
+ });
178
+ applyOptions(program
179
+ .command('arns-action-price')
180
+ .description('Preview the Turbo Credit price of a non-purchase ArNS action (set-record, remove-record, ' +
181
+ 'set-record-metadata, remove-record-metadata, transfer-record, add-controller, remove-controller, transfer)'), arnsActionPriceOptions).action(async (_commandOptions, command) => {
182
+ await runCommand(command, arnsActionPrice);
183
+ });
87
184
  applyOptions(program
88
185
  .command('inspect-data-items')
89
186
  .description('Lists all given or received Turbo credit share approvals for specified address or connected wallet'), [optionMap.folderPath]).action(async (_commandOptions, command) => {