@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.
- package/lib/cjs/cli/cli.js +97 -0
- package/lib/cjs/cli/commands/arns.js +475 -0
- package/lib/cjs/cli/commands/freeStatus.js +47 -0
- package/lib/cjs/cli/commands/index.js +3 -0
- package/lib/cjs/cli/commands/paymentHistory.js +25 -0
- package/lib/cjs/cli/options.js +202 -1
- package/lib/cjs/common/arnsActions.js +125 -0
- package/lib/cjs/common/chunked.js +51 -1
- package/lib/cjs/common/folderIndex.js +401 -0
- package/lib/cjs/common/http.js +40 -6
- package/lib/cjs/common/index.js +7 -0
- package/lib/cjs/common/payment.js +548 -2
- package/lib/cjs/common/signer.js +27 -6
- package/lib/cjs/common/token/index.js +0 -11
- package/lib/cjs/common/turbo.js +162 -0
- package/lib/cjs/common/upload.js +314 -31
- package/lib/cjs/node/folderIndex.js +132 -0
- package/lib/cjs/node/index.js +1 -0
- package/lib/cjs/node/upload.js +7 -0
- package/lib/cjs/types.js +53 -3
- package/lib/cjs/utils/common.js +0 -4
- package/lib/cjs/utils/errors.js +38 -1
- package/lib/cjs/utils/folderIndex.js +88 -0
- package/lib/cjs/utils/uuid.js +31 -0
- package/lib/cjs/web/signer.js +4 -2
- package/lib/esm/cli/cli.js +99 -2
- package/lib/esm/cli/commands/arns.js +450 -0
- package/lib/esm/cli/commands/freeStatus.js +44 -0
- package/lib/esm/cli/commands/index.js +3 -0
- package/lib/esm/cli/commands/paymentHistory.js +22 -0
- package/lib/esm/cli/options.js +201 -0
- package/lib/esm/common/arnsActions.js +114 -0
- package/lib/esm/common/chunked.js +51 -1
- package/lib/esm/common/folderIndex.js +396 -0
- package/lib/esm/common/http.js +39 -5
- package/lib/esm/common/index.js +7 -0
- package/lib/esm/common/payment.js +548 -2
- package/lib/esm/common/signer.js +28 -7
- package/lib/esm/common/token/index.js +1 -12
- package/lib/esm/common/turbo.js +162 -0
- package/lib/esm/common/upload.js +316 -33
- package/lib/esm/node/folderIndex.js +129 -0
- package/lib/esm/node/index.js +1 -0
- package/lib/esm/node/upload.js +7 -0
- package/lib/esm/types.js +52 -2
- package/lib/esm/utils/common.js +0 -4
- package/lib/esm/utils/errors.js +35 -0
- package/lib/esm/utils/folderIndex.js +81 -0
- package/lib/esm/utils/uuid.js +28 -0
- package/lib/esm/web/signer.js +4 -2
- package/lib/types/cli/commands/arns.d.ts +147 -0
- package/lib/types/cli/commands/arns.d.ts.map +1 -0
- package/lib/types/cli/commands/freeStatus.d.ts +3 -0
- package/lib/types/cli/commands/freeStatus.d.ts.map +1 -0
- package/lib/types/cli/commands/index.d.ts +3 -0
- package/lib/types/cli/commands/index.d.ts.map +1 -1
- package/lib/types/cli/commands/paymentHistory.d.ts +18 -0
- package/lib/types/cli/commands/paymentHistory.d.ts.map +1 -0
- package/lib/types/cli/options.d.ts +423 -0
- package/lib/types/cli/options.d.ts.map +1 -1
- package/lib/types/cli/types.d.ts +78 -0
- package/lib/types/cli/types.d.ts.map +1 -1
- package/lib/types/common/arnsActions.d.ts +58 -0
- package/lib/types/common/arnsActions.d.ts.map +1 -0
- package/lib/types/common/chunked.d.ts +47 -2
- package/lib/types/common/chunked.d.ts.map +1 -1
- package/lib/types/common/folderIndex.d.ts +54 -0
- package/lib/types/common/folderIndex.d.ts.map +1 -0
- package/lib/types/common/http.d.ts +25 -2
- package/lib/types/common/http.d.ts.map +1 -1
- package/lib/types/common/index.d.ts +3 -0
- package/lib/types/common/index.d.ts.map +1 -1
- package/lib/types/common/payment.d.ts +291 -1
- package/lib/types/common/payment.d.ts.map +1 -1
- package/lib/types/common/signer.d.ts +12 -6
- package/lib/types/common/signer.d.ts.map +1 -1
- package/lib/types/common/token/index.d.ts.map +1 -1
- package/lib/types/common/turbo.d.ts +183 -1
- package/lib/types/common/turbo.d.ts.map +1 -1
- package/lib/types/common/upload.d.ts +41 -0
- package/lib/types/common/upload.d.ts.map +1 -1
- package/lib/types/node/folderIndex.d.ts +28 -0
- package/lib/types/node/folderIndex.d.ts.map +1 -0
- package/lib/types/node/index.d.ts +1 -0
- package/lib/types/node/index.d.ts.map +1 -1
- package/lib/types/node/upload.d.ts +1 -0
- package/lib/types/node/upload.d.ts.map +1 -1
- package/lib/types/types.d.ts +694 -3
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils/common.d.ts.map +1 -1
- package/lib/types/utils/errors.d.ts +29 -0
- package/lib/types/utils/errors.d.ts.map +1 -1
- package/lib/types/utils/folderIndex.d.ts +47 -0
- package/lib/types/utils/folderIndex.d.ts.map +1 -0
- package/lib/types/utils/uuid.d.ts +7 -0
- package/lib/types/utils/uuid.d.ts.map +1 -0
- package/lib/types/web/signer.d.ts +1 -1
- package/lib/types/web/signer.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/types/types.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const fiatCurrencyTypes: readonly ["usd", "eur", "gbp", "cad", "a
|
|
|
33
33
|
export type Currency = (typeof fiatCurrencyTypes)[number];
|
|
34
34
|
export declare function isCurrency(currency: unknown): currency is Currency;
|
|
35
35
|
export type Country = 'United States' | 'United Kingdom' | 'Canada';
|
|
36
|
-
export declare const tokenTypes: readonly ["arweave", "ario", "
|
|
36
|
+
export declare const tokenTypes: readonly ["arweave", "ario", "solana", "ethereum", "kyve", "matic", "pol", "base-eth", "usdc", "base-usdc", "polygon-usdc"];
|
|
37
37
|
export type TokenType = (typeof tokenTypes)[number];
|
|
38
38
|
export declare const supportedEvmSignerTokens: Set<string>;
|
|
39
39
|
export type Adjustment = {
|
|
@@ -161,6 +161,102 @@ export type TurboBalanceResponse = {
|
|
|
161
161
|
receivedApprovals: CreditShareApproval[];
|
|
162
162
|
givenApprovals: CreditShareApproval[];
|
|
163
163
|
};
|
|
164
|
+
export type TurboFreeStatusResponse = {
|
|
165
|
+
/**
|
|
166
|
+
* Free-tier bytes this wallet can still upload for free, or `null` when the
|
|
167
|
+
* wallet has an unlimited allowance (an exempt/partner wallet). `0` when the
|
|
168
|
+
* free tier is disabled on the target Turbo deployment. Advisory — the
|
|
169
|
+
* authoritative free/charge decision is made at upload time, and the value is
|
|
170
|
+
* a wallet-side figure (a per-network cap may also apply). Deployment-wide
|
|
171
|
+
* free-tier config lives on the service's `/info` endpoint.
|
|
172
|
+
*/
|
|
173
|
+
bytesRemaining: number | null;
|
|
174
|
+
};
|
|
175
|
+
/** A single credited top-up settled with cryptocurrency. */
|
|
176
|
+
export type TurboCryptoPaymentHistoryItem = {
|
|
177
|
+
type: 'crypto';
|
|
178
|
+
/** ISO-8601 UTC timestamp of when the credits landed. */
|
|
179
|
+
date: string;
|
|
180
|
+
/** Winston Credits credited by this top-up. */
|
|
181
|
+
wincCredited: string;
|
|
182
|
+
tokenType: string;
|
|
183
|
+
/** On-chain token amount paid, in the token's smallest unit. */
|
|
184
|
+
tokenQuantity: string;
|
|
185
|
+
/** USD value captured at credit time (historical; not a live quote). */
|
|
186
|
+
usdEquivalent: string;
|
|
187
|
+
/** On-chain sender address; empty string on rows predating the column. */
|
|
188
|
+
senderAddress: string;
|
|
189
|
+
transactionId: string;
|
|
190
|
+
blockHeight: string;
|
|
191
|
+
};
|
|
192
|
+
/** A single credited top-up settled with fiat (e.g. a Stripe card payment). */
|
|
193
|
+
export type TurboFiatPaymentHistoryItem = {
|
|
194
|
+
type: 'fiat';
|
|
195
|
+
/** ISO-8601 UTC timestamp of when the receipt was recorded. */
|
|
196
|
+
date: string;
|
|
197
|
+
/** Winston Credits credited by this top-up. */
|
|
198
|
+
wincCredited: string;
|
|
199
|
+
paymentAmount: string;
|
|
200
|
+
currencyType: string;
|
|
201
|
+
paymentProvider: string;
|
|
202
|
+
receiptId: string;
|
|
203
|
+
giftMessage: string | null;
|
|
204
|
+
};
|
|
205
|
+
export type TurboPaymentHistoryItem = TurboCryptoPaymentHistoryItem | TurboFiatPaymentHistoryItem;
|
|
206
|
+
export type TurboPaymentHistoryResponse = {
|
|
207
|
+
/** One page of the signer's own top-ups, newest first. */
|
|
208
|
+
payments: TurboPaymentHistoryItem[];
|
|
209
|
+
/** True when more rows exist beyond this page (fetch again with `cursor`). */
|
|
210
|
+
hasMore: boolean;
|
|
211
|
+
/** Opaque cursor for the next page, or `null` on the last page. */
|
|
212
|
+
cursor: string | null;
|
|
213
|
+
};
|
|
214
|
+
export type TurboPaymentHistoryParams = {
|
|
215
|
+
/** Page size, 1-100 (default 50 on the service). */
|
|
216
|
+
limit?: number;
|
|
217
|
+
/** Opaque cursor from a prior response's `cursor` field. */
|
|
218
|
+
cursor?: string;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* A single ArNS name returned by `getArNSNames`. `custodial: true` means Turbo
|
|
222
|
+
* still holds/manages the underlying ANT on the caller's behalf (e.g. via the
|
|
223
|
+
* ArNS-with-credits purchase flow) and Turbo's transfer/manage routes apply to
|
|
224
|
+
* it; `custodial: false` means the name is self-custodied (or has already been
|
|
225
|
+
* exited from custody) and is returned for historical/informational purposes
|
|
226
|
+
* only.
|
|
227
|
+
*
|
|
228
|
+
* `intent`/`type`/`years`/`purchaseDate` describe the specific purchase
|
|
229
|
+
* receipt Turbo selected for this name and are historical/informational, NOT
|
|
230
|
+
* authoritative for the name's current on-chain state. `type`/`years` may be
|
|
231
|
+
* absent -- omitted from the response entirely, not `null` -- when the
|
|
232
|
+
* selected receipt is an action (e.g. Extend-Lease/Increase-Undername-Limit)
|
|
233
|
+
* that doesn't carry them. `antId` may be an empty string if no receipt Turbo
|
|
234
|
+
* has for this name ever carried one (e.g. the caller only ever extended a
|
|
235
|
+
* name it doesn't own -- ArNS extend/upgrade/increase-undername actions have
|
|
236
|
+
* no on-chain ownership check) -- guard for `antId === ''` before passing it
|
|
237
|
+
* to `@ar.io/sdk`.
|
|
238
|
+
*
|
|
239
|
+
* To read a name's current records or lease/expiration state, use
|
|
240
|
+
* `@ar.io/sdk` directly against the `antId` returned here.
|
|
241
|
+
*/
|
|
242
|
+
export type TurboArNSName = {
|
|
243
|
+
name: string;
|
|
244
|
+
antId: string;
|
|
245
|
+
/**
|
|
246
|
+
* The ArNS action recorded on the selected purchase receipt. Widened with
|
|
247
|
+
* `(string & {})` so new intents added server-side don't require a
|
|
248
|
+
* client-side type change, while still getting autocomplete for the known
|
|
249
|
+
* values.
|
|
250
|
+
*/
|
|
251
|
+
intent: 'Buy-Name' | 'Buy-Record' | 'Extend-Lease' | 'Upgrade-Name' | 'Increase-Undername-Limit' | (string & Record<never, never>);
|
|
252
|
+
type?: 'lease' | 'permabuy';
|
|
253
|
+
years?: number;
|
|
254
|
+
purchaseDate: string;
|
|
255
|
+
custodial: boolean;
|
|
256
|
+
};
|
|
257
|
+
export type TurboArNSNamesResponse = {
|
|
258
|
+
names: TurboArNSName[];
|
|
259
|
+
};
|
|
164
260
|
export type TurboFiatToArResponse = {
|
|
165
261
|
currency: Currency;
|
|
166
262
|
rate: number;
|
|
@@ -226,10 +322,166 @@ type FinalizedStatusResponse = {
|
|
|
226
322
|
status: 'FINALIZED';
|
|
227
323
|
receipt: TurboUploadDataItemResponse;
|
|
228
324
|
};
|
|
325
|
+
/**
|
|
326
|
+
* A map from a folder index key to a data item id, used by `uploadFolder` to
|
|
327
|
+
* skip files that are already on Arweave.
|
|
328
|
+
*
|
|
329
|
+
* A key is `<sha-256 of the bytes>.<sha-256 of the tags>`. Both halves matter:
|
|
330
|
+
* an empty `a.css` and an empty `b.js` have identical bytes but must not share
|
|
331
|
+
* a data item, or one of them is served with the other's `Content-Type`. Keying
|
|
332
|
+
* on the tags too means a reused item is always exactly the item this call
|
|
333
|
+
* would otherwise have created. Treat keys as opaque.
|
|
334
|
+
*
|
|
335
|
+
* Implement this to back an index with any store. Ready made layers ship with
|
|
336
|
+
* the SDK: `createMemoryFolderIndex`, `createChainFolderIndex`,
|
|
337
|
+
* `createFileFolderIndex` (NodeJS only) and `composeFolderIndex`.
|
|
338
|
+
*
|
|
339
|
+
* An index is a cache. `uploadFolder` treats a read that throws as a miss and
|
|
340
|
+
* carries on, so a layer is free to fail rather than degrade.
|
|
341
|
+
*/
|
|
342
|
+
export type TurboFolderUploadIndex = {
|
|
343
|
+
/** Human readable name for the layer, used in debug logs. */
|
|
344
|
+
name?: string;
|
|
345
|
+
/** When true the layer is never written to. Defaults to false. */
|
|
346
|
+
readOnly?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* The tag name this layer expects a file's content hash under.
|
|
349
|
+
*
|
|
350
|
+
* `uploadFolder` writes whatever the index declares here, so a layer that
|
|
351
|
+
* reads a non-default tag is aligned with the uploader rather than silently
|
|
352
|
+
* unable to match anything. Defaults to `File-SHA256`.
|
|
353
|
+
*/
|
|
354
|
+
hashTagName?: string;
|
|
355
|
+
/** The data item id previously uploaded for this key, if it is known. */
|
|
356
|
+
get(key: string): Promise<string | undefined> | string | undefined;
|
|
357
|
+
/** Record that `key` was uploaded as `id`. */
|
|
358
|
+
set(key: string, id: string): Promise<void> | void;
|
|
359
|
+
/**
|
|
360
|
+
* Optional bulk lookup, so a layer backed by a network can answer in one
|
|
361
|
+
* round trip instead of one request per file. `uploadFolder` calls `get` for
|
|
362
|
+
* every key first and then `resolve` once with whatever is still unknown,
|
|
363
|
+
* passing through the caller's `signal`.
|
|
364
|
+
*/
|
|
365
|
+
resolve?(keys: string[], options?: {
|
|
366
|
+
signal?: AbortSignal;
|
|
367
|
+
}): Promise<Record<string, string>>;
|
|
368
|
+
/**
|
|
369
|
+
* Optional, diagnostics only. Of these content hashes -- the bytes half of a
|
|
370
|
+
* key -- which does the layer hold under *some* tag set?
|
|
371
|
+
*
|
|
372
|
+
* A file whose bytes are already on Arweave but whose key is not is the exact
|
|
373
|
+
* signature of a per file tag that changes between deploys, and it is the one
|
|
374
|
+
* thing `uploadFolder` can say about a cost cliff that is otherwise silent.
|
|
375
|
+
* Never consulted to decide what to upload.
|
|
376
|
+
*/
|
|
377
|
+
knownContentHashes?(contentHashes: string[]): Promise<string[]> | string[];
|
|
378
|
+
/** Optional snapshot of everything the layer currently knows. */
|
|
379
|
+
entries?(): Promise<Record<string, string>> | Record<string, string>;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Whose past uploads a chain folder index sweeps.
|
|
383
|
+
*
|
|
384
|
+
* Tagged rather than a bare string on purpose. A gateway indexes an upload
|
|
385
|
+
* under the base64url sha-256 of the signer's public key, and a raw 32 byte
|
|
386
|
+
* ed25519 public key base64urls to exactly 43 characters -- the same shape as
|
|
387
|
+
* that address. There is no way to tell the two apart by inspection, and
|
|
388
|
+
* guessing wrong means the sweep matches nothing and the whole folder is
|
|
389
|
+
* re-uploaded at full price with no error at all.
|
|
390
|
+
*
|
|
391
|
+
* `await turbo.signer.getPublicKey()` is the one form every signer type can
|
|
392
|
+
* produce, so it is passed directly.
|
|
393
|
+
*/
|
|
394
|
+
export type ChainFolderUploadIndexOwner = Uint8Array | {
|
|
395
|
+
publicKey: Uint8Array | string;
|
|
396
|
+
address?: undefined;
|
|
397
|
+
} | {
|
|
398
|
+
address: string;
|
|
399
|
+
publicKey?: undefined;
|
|
400
|
+
};
|
|
401
|
+
export type ChainFolderUploadIndexParams = {
|
|
402
|
+
/**
|
|
403
|
+
* Whose past uploads to sweep. Pass `await turbo.signer.getPublicKey()`,
|
|
404
|
+
* which works for every signer type, or tag what you have as
|
|
405
|
+
* `{ publicKey }` or `{ address }`. A bare string is rejected: see
|
|
406
|
+
* {@link ChainFolderUploadIndexOwner}.
|
|
407
|
+
*/
|
|
408
|
+
owner: ChainFolderUploadIndexOwner;
|
|
409
|
+
/** Optional `App-Name` tag value, to narrow the sweep to one application. */
|
|
410
|
+
appName?: string;
|
|
411
|
+
/** Gateway to query. Defaults to `https://arweave.net`. */
|
|
412
|
+
gatewayUrl?: string;
|
|
413
|
+
/**
|
|
414
|
+
* Tag holding each file's content hash. Defaults to `File-SHA256`.
|
|
415
|
+
*
|
|
416
|
+
* `uploadFolder` writes this same tag when this index is passed to it, so the
|
|
417
|
+
* sweep and the uploader cannot drift apart. Every layer in a
|
|
418
|
+
* {@link composeFolderIndex} stack that declares one must agree.
|
|
419
|
+
*/
|
|
420
|
+
hashTagName?: string;
|
|
421
|
+
/** Maximum GraphQL pages to walk before giving up. Defaults to 20. */
|
|
422
|
+
maxPages?: number;
|
|
423
|
+
/** GraphQL page size. Defaults to 100. */
|
|
424
|
+
pageSize?: number;
|
|
425
|
+
/** Per request timeout in milliseconds. Defaults to 30_000. */
|
|
426
|
+
timeoutMs?: number;
|
|
427
|
+
/** Override the fetch implementation, e.g. in tests. */
|
|
428
|
+
fetchImpl?: typeof fetch;
|
|
429
|
+
/**
|
|
430
|
+
* Optional logger. Used to report a sweep that ran out of pages before it ran
|
|
431
|
+
* out of files, which otherwise costs money silently.
|
|
432
|
+
*/
|
|
433
|
+
logger?: TurboLogger;
|
|
434
|
+
};
|
|
435
|
+
export type ComposeFolderUploadIndexParams = {
|
|
436
|
+
/** Optional logger, used to report a layer that failed and was skipped. */
|
|
437
|
+
logger?: TurboLogger;
|
|
438
|
+
};
|
|
439
|
+
export type FileFolderUploadIndexParams = {
|
|
440
|
+
/** Path of the JSON file holding the index. Created if it does not exist. */
|
|
441
|
+
filePath: string;
|
|
442
|
+
/** Optional logger, used to report an unreadable index file. */
|
|
443
|
+
logger?: TurboLogger;
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* What an index-backed `uploadFolder` reused rather than paid for again.
|
|
447
|
+
*
|
|
448
|
+
* `uploadedFiles` counts data items that actually landed, so with
|
|
449
|
+
* `throwOnFailure: false` the three counts do not have to sum to `totalFiles`
|
|
450
|
+
* -- the difference is what failed.
|
|
451
|
+
*/
|
|
452
|
+
export type TurboFolderUploadIndexSummary = {
|
|
453
|
+
/** Every file in the folder, uploaded, reused or failed. */
|
|
454
|
+
totalFiles: number;
|
|
455
|
+
totalBytes: number;
|
|
456
|
+
/** Files that were paid for and landed. */
|
|
457
|
+
uploadedFiles: number;
|
|
458
|
+
uploadedBytes: number;
|
|
459
|
+
/** Files served from the index, or duplicated within this folder. */
|
|
460
|
+
reusedFiles: number;
|
|
461
|
+
reusedBytes: number;
|
|
462
|
+
};
|
|
229
463
|
type UploadFolderParams = {
|
|
230
464
|
dataItemOpts?: DataItemOptions;
|
|
231
465
|
maxConcurrentUploads?: number;
|
|
232
466
|
throwOnFailure?: boolean;
|
|
467
|
+
/**
|
|
468
|
+
* A folder index. When provided, every file is hashed and only the files
|
|
469
|
+
* whose bytes and tags are not already on Arweave are signed, uploaded and
|
|
470
|
+
* paid for. The manifest is assembled from the ids that were already known
|
|
471
|
+
* plus the ids of whatever this run uploaded.
|
|
472
|
+
*
|
|
473
|
+
* Files uploaded with an index in place carry an extra `File-SHA256` tag.
|
|
474
|
+
*/
|
|
475
|
+
folderIndex?: TurboFolderUploadIndex;
|
|
476
|
+
/**
|
|
477
|
+
* `dataItemOpts` for the manifest only. Defaults to `dataItemOpts`.
|
|
478
|
+
*
|
|
479
|
+
* The manifest is rewritten on every deploy, so it is where deploy varying
|
|
480
|
+
* tags such as a commit sha belong. A per file tag that changes between
|
|
481
|
+
* deploys changes every `folderIndex` key, and so re-uploads the whole
|
|
482
|
+
* folder.
|
|
483
|
+
*/
|
|
484
|
+
manifestDataItemOpts?: DataItemOptions;
|
|
233
485
|
manifestOptions?: {
|
|
234
486
|
disableManifest?: boolean;
|
|
235
487
|
fallbackFile?: string;
|
|
@@ -254,11 +506,18 @@ export type TurboRevokeCreditsParams = {
|
|
|
254
506
|
revokedAddress: string;
|
|
255
507
|
};
|
|
256
508
|
export type TurboUploadFolderResponse = {
|
|
509
|
+
/**
|
|
510
|
+
* One response per data item this call uploaded. With a `folderIndex` in
|
|
511
|
+
* place, files that were reused have no response here -- they are in the
|
|
512
|
+
* manifest and counted in `folderIndexSummary` instead.
|
|
513
|
+
*/
|
|
257
514
|
fileResponses: TurboUploadDataItemResponse[];
|
|
258
515
|
manifestResponse?: TurboUploadDataItemResponse;
|
|
259
516
|
manifest?: ArweaveManifest;
|
|
260
517
|
errors?: Error[];
|
|
261
518
|
cryptoFundResult?: TurboCryptoFundResponse;
|
|
519
|
+
/** Only present when `folderIndex` was provided. */
|
|
520
|
+
folderIndexSummary?: TurboFolderUploadIndexSummary;
|
|
262
521
|
};
|
|
263
522
|
export type ArweaveManifest = {
|
|
264
523
|
manifest: 'arweave/paths';
|
|
@@ -338,6 +597,7 @@ export type TurboSignedRequestHeaders = {
|
|
|
338
597
|
'x-public-key': string;
|
|
339
598
|
'x-nonce': string;
|
|
340
599
|
'x-signature': string;
|
|
600
|
+
'x-signature-type'?: string;
|
|
341
601
|
};
|
|
342
602
|
type TurboAuthConfiguration = {
|
|
343
603
|
signer: TurboDataItemSigner;
|
|
@@ -565,12 +825,13 @@ export interface TurboHTTPServiceInterface {
|
|
|
565
825
|
headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
|
|
566
826
|
allowedStatuses?: number[];
|
|
567
827
|
}): Promise<T>;
|
|
568
|
-
post<T>({ endpoint, signal, headers, allowedStatuses, data, }: {
|
|
828
|
+
post<T>({ endpoint, signal, headers, allowedStatuses, data, retry, }: {
|
|
569
829
|
endpoint: `/${string}`;
|
|
570
830
|
signal?: AbortSignal;
|
|
571
831
|
headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
|
|
572
832
|
allowedStatuses?: number[];
|
|
573
833
|
data: Readable | ReadableStream | Buffer;
|
|
834
|
+
retry?: boolean;
|
|
574
835
|
}): Promise<T>;
|
|
575
836
|
}
|
|
576
837
|
export type SendFundTxParams = {
|
|
@@ -594,7 +855,7 @@ export interface TurboDataItemSigner {
|
|
|
594
855
|
signDataItem({ fileStreamFactory, fileSizeFactory, dataItemOpts, emitter, }: TurboFileFactory & {
|
|
595
856
|
emitter?: TurboEventEmitter;
|
|
596
857
|
}): Promise<TurboSignedDataItemFactory>;
|
|
597
|
-
generateSignedRequestHeaders(): Promise<TurboSignedRequestHeaders>;
|
|
858
|
+
generateSignedRequestHeaders(nonce?: string, additionalData?: string): Promise<TurboSignedRequestHeaders>;
|
|
598
859
|
signData(dataToSign: Uint8Array): Promise<Uint8Array>;
|
|
599
860
|
sendTransaction(p: SendTxWithSignerParams): Promise<string>;
|
|
600
861
|
getPublicKey(): Promise<Buffer>;
|
|
@@ -602,8 +863,338 @@ export interface TurboDataItemSigner {
|
|
|
602
863
|
signer: TurboSigner;
|
|
603
864
|
walletAdapter?: WalletAdapter;
|
|
604
865
|
}
|
|
866
|
+
export declare const arNSPurchaseIntents: readonly ["Buy-Name", "Extend-Lease", "Increase-Undername-Limit", "Upgrade-Name"];
|
|
867
|
+
export type ArNSPurchaseIntent = (typeof arNSPurchaseIntents)[number];
|
|
868
|
+
export type ArNSNameType = 'lease' | 'permabuy';
|
|
869
|
+
export type ArNSBuyNameLeaseParams = {
|
|
870
|
+
intent: 'Buy-Name';
|
|
871
|
+
name: string;
|
|
872
|
+
type: 'lease';
|
|
873
|
+
/** Lease duration in years */
|
|
874
|
+
years: number;
|
|
875
|
+
/**
|
|
876
|
+
* ANT (Metaplex Core asset) the name resolves to. Optional: omit to have
|
|
877
|
+
* Turbo custodially provision the ANT (Turbo spawns + owns it — Model A);
|
|
878
|
+
* supply to point the name at a user-owned ANT (Model B).
|
|
879
|
+
*/
|
|
880
|
+
processId?: string;
|
|
881
|
+
};
|
|
882
|
+
export type ArNSBuyNamePermabuyParams = {
|
|
883
|
+
intent: 'Buy-Name';
|
|
884
|
+
name: string;
|
|
885
|
+
type: 'permabuy';
|
|
886
|
+
/**
|
|
887
|
+
* ANT (Metaplex Core asset) the name resolves to. Optional: omit to have
|
|
888
|
+
* Turbo custodially provision the ANT (Turbo spawns + owns it — Model A);
|
|
889
|
+
* supply to point the name at a user-owned ANT (Model B).
|
|
890
|
+
*/
|
|
891
|
+
processId?: string;
|
|
892
|
+
};
|
|
893
|
+
export type ArNSBuyNameParams = ArNSBuyNameLeaseParams | ArNSBuyNamePermabuyParams;
|
|
894
|
+
export type ArNSExtendLeaseParams = {
|
|
895
|
+
intent: 'Extend-Lease';
|
|
896
|
+
name: string;
|
|
897
|
+
years: number;
|
|
898
|
+
};
|
|
899
|
+
export type ArNSIncreaseUndernameLimitParams = {
|
|
900
|
+
intent: 'Increase-Undername-Limit';
|
|
901
|
+
name: string;
|
|
902
|
+
increaseQty: number;
|
|
903
|
+
};
|
|
904
|
+
export type ArNSUpgradeNameParams = {
|
|
905
|
+
intent: 'Upgrade-Name';
|
|
906
|
+
name: string;
|
|
907
|
+
};
|
|
908
|
+
export type ArNSPriceParams = ArNSBuyNameParams | ArNSExtendLeaseParams | ArNSIncreaseUndernameLimitParams | ArNSUpgradeNameParams;
|
|
909
|
+
/** Optional delegated payer address(es) whose credits cover a purchase */
|
|
910
|
+
export type ArNSPaidByParams = {
|
|
911
|
+
paidBy?: UserAddress | UserAddress[];
|
|
912
|
+
};
|
|
913
|
+
export type ArNSPriceResponse = {
|
|
914
|
+
/**
|
|
915
|
+
* Price of the NAME ONLY, in Winston credits.
|
|
916
|
+
*
|
|
917
|
+
* For a Buy-Name this EXCLUDES the ANT spawn surcharge. Quoting this figure
|
|
918
|
+
* alone under-quotes the purchase — in a real response the surcharge can be
|
|
919
|
+
* larger than the name itself. Use `wincTotalWithAntSpawn`, or the
|
|
920
|
+
* `wincTotal` convenience the SDK adds below.
|
|
921
|
+
*/
|
|
922
|
+
winc: string;
|
|
923
|
+
/** Equivalent price in mARIO */
|
|
924
|
+
mARIO: string;
|
|
925
|
+
/**
|
|
926
|
+
* Flat cost-recovery surcharge for the Solana rent Turbo fronts when minting
|
|
927
|
+
* the customer's ANT. Present only for intents that mint one (Buy-Name).
|
|
928
|
+
* Config-driven and derived per-request from live rates — never hardcode it.
|
|
929
|
+
*/
|
|
930
|
+
antSpawnSurchargeWinc?: string;
|
|
931
|
+
/** `winc` + `antSpawnSurchargeWinc`. Present only when a surcharge applies. */
|
|
932
|
+
wincTotalWithAntSpawn?: string;
|
|
933
|
+
/**
|
|
934
|
+
* The figure to charge or display, always. Added by the SDK:
|
|
935
|
+
* `wincTotalWithAntSpawn ?? winc`, so a caller cannot under-quote by
|
|
936
|
+
* reading the wrong field.
|
|
937
|
+
*/
|
|
938
|
+
wincTotal: string;
|
|
939
|
+
[key: string]: unknown;
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* The twelve sponsored ArNS actions.
|
|
943
|
+
*
|
|
944
|
+
* Sponsorship covers these twelve and NOTHING else. Everything else in the
|
|
945
|
+
* ArNS, ANT and core programs stays on the direct-signer path and costs the
|
|
946
|
+
* user SOL — notably `BuyReturnedName` (auctions, deliberately excluded: the
|
|
947
|
+
* premium is unbounded), `ClaimReservedName`, the primary-name flow (which
|
|
948
|
+
* lives in the ario core program), release/reassign, and ANT-LEVEL metadata.
|
|
949
|
+
* Note ANT-level metadata is distinct from RECORD-level metadata, which
|
|
950
|
+
* `set-record-metadata` does sponsor.
|
|
951
|
+
*/
|
|
952
|
+
export declare const arNSActions: readonly ["buy-name", "extend-lease", "upgrade-name", "increase-undername-limit", "set-record", "remove-record", "add-controller", "remove-controller", "transfer", "set-record-metadata", "remove-record-metadata", "transfer-record"];
|
|
953
|
+
export type ArNSAction = (typeof arNSActions)[number];
|
|
954
|
+
/** Turbo already held the authority — the write has landed on chain. */
|
|
955
|
+
export type ArNSActionCompleted = {
|
|
956
|
+
nonce: string;
|
|
957
|
+
action: ArNSAction;
|
|
958
|
+
status: 'completed';
|
|
959
|
+
/** Solana transaction id of the on-chain write. */
|
|
960
|
+
messageId: string;
|
|
961
|
+
antId?: string;
|
|
962
|
+
/**
|
|
963
|
+
* True when this nonce had already completed — a replayed `/sign` is
|
|
964
|
+
* reported as success rather than buying twice.
|
|
965
|
+
*/
|
|
966
|
+
alreadyCompleted?: boolean;
|
|
967
|
+
[key: string]: unknown;
|
|
968
|
+
};
|
|
969
|
+
/** Only the ANT's owner can authorize this; Turbo has already fee-payer-signed. */
|
|
970
|
+
export type ArNSActionAwaitingSignature = {
|
|
971
|
+
nonce: string;
|
|
972
|
+
action: ArNSAction;
|
|
973
|
+
status: 'awaiting-signature';
|
|
974
|
+
/**
|
|
975
|
+
* Base64 transaction, already carrying Turbo's fee-payer signature.
|
|
976
|
+
* Sign THESE BYTES — rebuilding or re-serializing invalidates Turbo's
|
|
977
|
+
* signature and the submission is rejected.
|
|
978
|
+
*/
|
|
979
|
+
transaction: string;
|
|
980
|
+
feePayer?: string;
|
|
981
|
+
antId?: string;
|
|
982
|
+
lastValidBlockHeight?: string;
|
|
983
|
+
/** The blockhash dies in ~60-90s; past this, create a new action. */
|
|
984
|
+
expiresAt?: string;
|
|
985
|
+
[key: string]: unknown;
|
|
986
|
+
};
|
|
987
|
+
/**
|
|
988
|
+
* An action has exactly one of two shapes, and THE SERVER picks which.
|
|
989
|
+
* Branch on `status`, never on which action you asked for: `set-record`
|
|
990
|
+
* completes alone while Turbo is a controller and flips to
|
|
991
|
+
* `awaiting-signature` the moment the customer revokes Turbo.
|
|
992
|
+
*/
|
|
993
|
+
export type ArNSActionResult = ArNSActionCompleted | ArNSActionAwaitingSignature;
|
|
994
|
+
/**
|
|
995
|
+
* The flat-margin credits price for one of the eight actions that don't
|
|
996
|
+
* spend ARIO (everything except Buy-Name/Extend-Lease/Upgrade-Name/
|
|
997
|
+
* Increase-Undername-Limit, which are priced by {@link getArNSPriceForName}
|
|
998
|
+
* instead since their cost is dominated by the ARIO purchase, not the margin).
|
|
999
|
+
* No signature required — this is a read-only preview of what
|
|
1000
|
+
* `createArNSAction` will debit.
|
|
1001
|
+
*/
|
|
1002
|
+
export type ArNSActionPriceResponse = {
|
|
1003
|
+
action: ArNSAction;
|
|
1004
|
+
/** What creating this action will debit, in Winston credits. */
|
|
1005
|
+
wincQty: string;
|
|
1006
|
+
[key: string]: unknown;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* The ANT owner's key — a **Solana** wallet, distinct from the Turbo payer.
|
|
1010
|
+
*
|
|
1011
|
+
* The two are deliberately separate: the payer holds credits (and may be an
|
|
1012
|
+
* Arweave or Ethereum identity), while the owner holds the ANT. They are
|
|
1013
|
+
* allowed to be different wallets, which is the normal shape for a console.
|
|
1014
|
+
*
|
|
1015
|
+
* The owner needs a key to sign with, NOT a funded account — Turbo is the fee
|
|
1016
|
+
* payer on every sponsored action, so the owner's SOL balance can stay zero
|
|
1017
|
+
* for the life of the name.
|
|
1018
|
+
*/
|
|
1019
|
+
export interface ArNSOwnerSigner {
|
|
1020
|
+
/** base58 Solana address that owns (or will own) the ANT. */
|
|
1021
|
+
getAddress(): string | Promise<string>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Sign a base64 transaction and return the signed transaction, base64.
|
|
1024
|
+
* Must return the FULL serialized transaction, not just the signature.
|
|
1025
|
+
*/
|
|
1026
|
+
signTransaction(transactionBase64: string): Promise<string>;
|
|
1027
|
+
/** Raw ed25519 signature over `message`, for the `x-owner-*` proof. */
|
|
1028
|
+
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
1029
|
+
}
|
|
1030
|
+
export type ArNSPurchaseParams = ArNSPriceParams & ArNSPaidByParams;
|
|
1031
|
+
/**
|
|
1032
|
+
* Distributive `Omit` so a discriminated union keeps its per-branch fields.
|
|
1033
|
+
* The built-in `Omit<A | B, K>` collapses to only the keys common to every
|
|
1034
|
+
* member (dropping e.g. a lease's `years`); this maps over each member instead.
|
|
1035
|
+
*/
|
|
1036
|
+
export type DistributiveOmit<T, K extends keyof never> = T extends unknown ? Omit<T, K> : never;
|
|
1037
|
+
/** `buyArNSName` params: any Buy-Name variant minus the (implied) `intent`. */
|
|
1038
|
+
export type ArNSBuyNameArgs = DistributiveOmit<ArNSBuyNameParams, 'intent'> & ArNSPaidByParams;
|
|
1039
|
+
export type ArNSPurchaseReceipt = {
|
|
1040
|
+
name: string;
|
|
1041
|
+
intent: ArNSPurchaseIntent;
|
|
1042
|
+
type?: ArNSNameType;
|
|
1043
|
+
years?: number;
|
|
1044
|
+
increaseQty?: number;
|
|
1045
|
+
processId?: string;
|
|
1046
|
+
owner: UserAddress;
|
|
1047
|
+
/** UUID that identifies this purchase (also the status-lookup key) */
|
|
1048
|
+
nonce: string;
|
|
1049
|
+
wincQty: string;
|
|
1050
|
+
mARIOQty: string;
|
|
1051
|
+
usdArRate: number;
|
|
1052
|
+
usdArioRate: number;
|
|
1053
|
+
paidBy: UserAddress[];
|
|
1054
|
+
/** Solana transaction id of the on-chain ArNS write */
|
|
1055
|
+
messageId: string;
|
|
1056
|
+
};
|
|
1057
|
+
export type ArNSPurchaseResponse = {
|
|
1058
|
+
purchaseReceipt: ArNSPurchaseReceipt;
|
|
1059
|
+
arioWriteResult: {
|
|
1060
|
+
id: string;
|
|
1061
|
+
};
|
|
1062
|
+
/** UUID nonce used for the purchase — poll `getArNSPurchaseStatus({ nonce })` with it */
|
|
1063
|
+
nonce: string;
|
|
1064
|
+
};
|
|
1065
|
+
export type ArNSPurchaseStatusResponse = ArNSPurchaseReceipt & {
|
|
1066
|
+
/** Present once the purchase has terminally failed */
|
|
1067
|
+
failedDate?: string;
|
|
1068
|
+
};
|
|
1069
|
+
/**
|
|
1070
|
+
* Stripe integration mode for a fiat ArNS purchase quote.
|
|
1071
|
+
*
|
|
1072
|
+
* - `payment-intent` — returns a Stripe PaymentIntent. Confirm it client-side
|
|
1073
|
+
* with `stripe.confirmCardPayment(paymentSession.client_secret, ...)`.
|
|
1074
|
+
* - `checkout-session` — returns a Stripe Checkout Session to redirect to
|
|
1075
|
+
* (`uiMode: 'hosted'`) or embed (`uiMode: 'embedded'`).
|
|
1076
|
+
*
|
|
1077
|
+
* Widened with `string & Record<never, never>` so a method added service-side is
|
|
1078
|
+
* still callable without an SDK bump, while the known values keep autocomplete.
|
|
1079
|
+
* (`string & {}` is the usual idiom but trips the `ban-types` lint rule.)
|
|
1080
|
+
*/
|
|
1081
|
+
export declare const arNSFiatPurchaseMethods: readonly ["payment-intent", "checkout-session"];
|
|
1082
|
+
export type ArNSFiatPurchaseMethod = (typeof arNSFiatPurchaseMethods)[number] | (string & Record<never, never>);
|
|
1083
|
+
/**
|
|
1084
|
+
* Params for a fiat (Stripe) ArNS purchase quote.
|
|
1085
|
+
*
|
|
1086
|
+
* Intent-specific fields come from the same {@link ArNSPriceParams} union the
|
|
1087
|
+
* credit-paid methods use, and the `uiMode` split reuses the checkout-session
|
|
1088
|
+
* unions, so the hosted/embedded URL pairing is enforced at compile time the
|
|
1089
|
+
* same way it is for top-ups.
|
|
1090
|
+
*
|
|
1091
|
+
* Note: the service also accepts a `Buy-Record` intent that the SDK does not
|
|
1092
|
+
* model yet — {@link arNSPurchaseIntents} carries the other four.
|
|
1093
|
+
*/
|
|
1094
|
+
export type ArNSFiatPurchaseQuoteParams = ArNSPriceParams & {
|
|
1095
|
+
/** Fiat currency to charge in. */
|
|
1096
|
+
currency: Currency;
|
|
1097
|
+
/** Address that will own the name once the purchase settles. */
|
|
1098
|
+
address: UserAddress;
|
|
1099
|
+
/** Stripe integration mode. Defaults to `payment-intent`. */
|
|
1100
|
+
method?: ArNSFiatPurchaseMethod;
|
|
1101
|
+
/** Promo codes to apply. Sent as repeated `promoCode` query params. */
|
|
1102
|
+
promoCodes?: string[];
|
|
1103
|
+
} & (TurboCheckoutSessionHostedParams | TurboCheckoutSessionEmbeddedParams);
|
|
1104
|
+
/**
|
|
1105
|
+
* Authenticated variant: `address` defaults to the signer's native address.
|
|
1106
|
+
*/
|
|
1107
|
+
export type AuthenticatedArNSFiatPurchaseQuoteParams = DistributiveOmit<ArNSFiatPurchaseQuoteParams, 'address'> & {
|
|
1108
|
+
address?: UserAddress;
|
|
1109
|
+
};
|
|
1110
|
+
/**
|
|
1111
|
+
* The quote the service recorded for this purchase. `nonce` is the key to poll
|
|
1112
|
+
* `getArNSPurchaseStatus({ nonce })` with once the card payment confirms.
|
|
1113
|
+
*
|
|
1114
|
+
* Intent-dependent fields (`type`, `years`, `increaseQty`, `processId`) are
|
|
1115
|
+
* OMITTED by the service for intents that do not use them — they are absent
|
|
1116
|
+
* keys, not `null` — so each is optional here.
|
|
1117
|
+
*/
|
|
1118
|
+
export type ArNSFiatPurchaseQuote = {
|
|
1119
|
+
name: string;
|
|
1120
|
+
intent: ArNSPurchaseIntent;
|
|
1121
|
+
/** UUID identifying this purchase; the status-lookup key. */
|
|
1122
|
+
nonce: string;
|
|
1123
|
+
owner: UserAddress;
|
|
1124
|
+
/** Credit value of the purchase, in Winston credits. */
|
|
1125
|
+
wincQty: string;
|
|
1126
|
+
/** Verified against the live service: serialized as a NUMBER, unlike wincQty. */
|
|
1127
|
+
mARIOQty: number;
|
|
1128
|
+
/** Fiat amount to be charged, in the currency's smallest unit. */
|
|
1129
|
+
paymentAmount: number;
|
|
1130
|
+
/** Amount before adjustments, in the currency's smallest unit. */
|
|
1131
|
+
quotedPaymentAmount: number;
|
|
1132
|
+
currencyType: Currency;
|
|
1133
|
+
quoteExpirationDate: string;
|
|
1134
|
+
paymentProvider: string;
|
|
1135
|
+
/** Credits left over when the charge was raised to Stripe's minimum. */
|
|
1136
|
+
excessWincAmount?: string;
|
|
1137
|
+
/** ISO timestamp the quote was recorded. */
|
|
1138
|
+
quoteCreationDate: string;
|
|
1139
|
+
/**
|
|
1140
|
+
* Rates at quote time. Verified against the live service: serialized as
|
|
1141
|
+
* STRINGS, even though they are numeric server-side.
|
|
1142
|
+
*/
|
|
1143
|
+
usdArRate?: string;
|
|
1144
|
+
usdArioRate?: string;
|
|
1145
|
+
type?: ArNSNameType;
|
|
1146
|
+
years?: number;
|
|
1147
|
+
increaseQty?: number;
|
|
1148
|
+
processId?: string;
|
|
1149
|
+
[key: string]: unknown;
|
|
1150
|
+
};
|
|
1151
|
+
/**
|
|
1152
|
+
* The Stripe object to complete payment with — a PaymentIntent or a Checkout
|
|
1153
|
+
* Session depending on `method`. Typed loosely on purpose: this is Stripe's
|
|
1154
|
+
* payload, passed through verbatim, and pinning it here would couple the SDK to
|
|
1155
|
+
* a Stripe API version.
|
|
1156
|
+
*
|
|
1157
|
+
* `client_secret` is present on a PaymentIntent and on an embedded Checkout
|
|
1158
|
+
* Session; a hosted Checkout Session exposes `url` instead.
|
|
1159
|
+
*/
|
|
1160
|
+
export type ArNSFiatPaymentSession = {
|
|
1161
|
+
id: string;
|
|
1162
|
+
client_secret?: string | null;
|
|
1163
|
+
url?: string | null;
|
|
1164
|
+
[key: string]: unknown;
|
|
1165
|
+
};
|
|
1166
|
+
export type ArNSFiatPurchaseQuoteResponse = {
|
|
1167
|
+
purchaseQuote: ArNSFiatPurchaseQuote;
|
|
1168
|
+
paymentSession: ArNSFiatPaymentSession;
|
|
1169
|
+
/** Promo/discount adjustments applied to the fiat amount. */
|
|
1170
|
+
adjustments: Adjustment[];
|
|
1171
|
+
/** Inclusive fees folded into the price. */
|
|
1172
|
+
fees: Adjustment[];
|
|
1173
|
+
};
|
|
605
1174
|
export interface TurboUnauthenticatedPaymentServiceInterface {
|
|
606
1175
|
getBalance: (address: string) => Promise<TurboBalanceResponse>;
|
|
1176
|
+
getFreeStatus: (address: string) => Promise<TurboFreeStatusResponse>;
|
|
1177
|
+
getArNSPriceForName(params: ArNSPriceParams): Promise<ArNSPriceResponse>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Preview what one of the eight non-purchase actions will debit, without
|
|
1180
|
+
* creating it. `action` must not be one of the four ARIO-purchase actions
|
|
1181
|
+
* (`buy-name`, `extend-lease`, `upgrade-name`, `increase-undername-limit`)
|
|
1182
|
+
* — use {@link getArNSPriceForName} for those.
|
|
1183
|
+
*/
|
|
1184
|
+
getArNSActionPrice(action: ArNSAction): Promise<ArNSActionPriceResponse>;
|
|
1185
|
+
getArNSPurchaseStatus(p: {
|
|
1186
|
+
nonce: string;
|
|
1187
|
+
}): Promise<ArNSPurchaseStatusResponse>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Returns the ArNS names a wallet owns or controls via Turbo's custodial
|
|
1190
|
+
* ArNS-with-credits feature. This is a read-only listing endpoint; it does
|
|
1191
|
+
* not require a signature. See `TurboArNSName` for field semantics. To
|
|
1192
|
+
* read a name's current records or lease/expiration state, use
|
|
1193
|
+
* `@ar.io/sdk` directly against the returned `antId`.
|
|
1194
|
+
*/
|
|
1195
|
+
getArNSNames: (address: string) => Promise<TurboArNSNamesResponse>;
|
|
1196
|
+
/** Fiat (Stripe) ArNS purchase quote — no Turbo Credits top-up in between. */
|
|
1197
|
+
getArNSFiatPurchaseQuote(params: ArNSFiatPurchaseQuoteParams): Promise<ArNSFiatPurchaseQuoteResponse>;
|
|
607
1198
|
getSupportedCurrencies(): Promise<TurboCurrenciesResponse>;
|
|
608
1199
|
getSupportedCountries(): Promise<TurboCountriesResponse>;
|
|
609
1200
|
getTurboCryptoWallets(): Promise<Record<TokenType, string>>;
|
|
@@ -640,10 +1231,110 @@ export type TurboFundWithTokensParams = {
|
|
|
640
1231
|
};
|
|
641
1232
|
export interface TurboAuthenticatedPaymentServiceInterface extends TurboUnauthenticatedPaymentServiceInterface {
|
|
642
1233
|
getBalance: (userAddress?: UserAddress) => Promise<TurboBalanceResponse>;
|
|
1234
|
+
/** `address` defaults to the signer's native address. */
|
|
1235
|
+
getArNSFiatPurchaseQuote(params: AuthenticatedArNSFiatPurchaseQuoteParams): Promise<ArNSFiatPurchaseQuoteResponse>;
|
|
1236
|
+
getFreeStatus: (userAddress?: UserAddress) => Promise<TurboFreeStatusResponse>;
|
|
1237
|
+
/**
|
|
1238
|
+
* The signer's OWN completed top-up history (crypto + fiat), newest first.
|
|
1239
|
+
* Signature-required and self-scoped — there is no by-address form.
|
|
1240
|
+
*/
|
|
1241
|
+
getPaymentHistory(params?: TurboPaymentHistoryParams): Promise<TurboPaymentHistoryResponse>;
|
|
1242
|
+
getArNSNames: (userAddress?: UserAddress) => Promise<TurboArNSNamesResponse>;
|
|
643
1243
|
getCreditShareApprovals(p: {
|
|
644
1244
|
userAddress?: UserAddress;
|
|
645
1245
|
}): Promise<GetCreditShareApprovalsResponse>;
|
|
646
1246
|
topUpWithTokens(p: TurboFundWithTokensParams): Promise<TurboCryptoFundResponse>;
|
|
1247
|
+
/** Create an action. Debits credits HERE, not at sign. */
|
|
1248
|
+
createArNSAction(action: ArNSAction, params?: Record<string, unknown>, ownerProof?: {
|
|
1249
|
+
owner: ArNSOwnerSigner;
|
|
1250
|
+
message: string;
|
|
1251
|
+
}): Promise<ArNSActionResult>;
|
|
1252
|
+
/** Submit the owner-signed transaction (full serialized tx, base64). */
|
|
1253
|
+
signArNSAction(nonce: string, signedTransaction: string): Promise<ArNSActionCompleted>;
|
|
1254
|
+
/** Status by nonce. Open — needs no signature. */
|
|
1255
|
+
getArNSActionStatus(nonce: string): Promise<ArNSActionResult & {
|
|
1256
|
+
failedDate?: string;
|
|
1257
|
+
}>;
|
|
1258
|
+
buyArNSName(params: {
|
|
1259
|
+
name: string;
|
|
1260
|
+
owner: ArNSOwnerSigner;
|
|
1261
|
+
type?: ArNSNameType;
|
|
1262
|
+
years?: number;
|
|
1263
|
+
paidBy?: UserAddress | UserAddress[];
|
|
1264
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1265
|
+
}): Promise<ArNSActionCompleted>;
|
|
1266
|
+
extendArNSLease(params: {
|
|
1267
|
+
name: string;
|
|
1268
|
+
years: number;
|
|
1269
|
+
paidBy?: UserAddress | UserAddress[];
|
|
1270
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1271
|
+
}): Promise<ArNSActionCompleted>;
|
|
1272
|
+
upgradeArNSName(params: {
|
|
1273
|
+
name: string;
|
|
1274
|
+
paidBy?: UserAddress | UserAddress[];
|
|
1275
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1276
|
+
}): Promise<ArNSActionCompleted>;
|
|
1277
|
+
increaseArNSUndernameLimit(params: {
|
|
1278
|
+
name: string;
|
|
1279
|
+
increaseQty: number;
|
|
1280
|
+
paidBy?: UserAddress | UserAddress[];
|
|
1281
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1282
|
+
}): Promise<ArNSActionCompleted>;
|
|
1283
|
+
setArNSRecord(params: {
|
|
1284
|
+
antId: string;
|
|
1285
|
+
owner: ArNSOwnerSigner;
|
|
1286
|
+
transactionId: string;
|
|
1287
|
+
undername?: string;
|
|
1288
|
+
ttlSeconds?: number;
|
|
1289
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1290
|
+
}): Promise<ArNSActionCompleted>;
|
|
1291
|
+
removeArNSRecord(params: {
|
|
1292
|
+
antId: string;
|
|
1293
|
+
owner: ArNSOwnerSigner;
|
|
1294
|
+
undername: string;
|
|
1295
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1296
|
+
}): Promise<ArNSActionCompleted>;
|
|
1297
|
+
addArNSController(params: {
|
|
1298
|
+
antId: string;
|
|
1299
|
+
owner: ArNSOwnerSigner;
|
|
1300
|
+
target?: string;
|
|
1301
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1302
|
+
}): Promise<ArNSActionCompleted>;
|
|
1303
|
+
removeArNSController(params: {
|
|
1304
|
+
antId: string;
|
|
1305
|
+
owner: ArNSOwnerSigner;
|
|
1306
|
+
target?: string;
|
|
1307
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1308
|
+
}): Promise<ArNSActionCompleted>;
|
|
1309
|
+
transferArNSAnt(params: {
|
|
1310
|
+
antId: string;
|
|
1311
|
+
owner: ArNSOwnerSigner;
|
|
1312
|
+
target: string;
|
|
1313
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1314
|
+
}): Promise<ArNSActionCompleted>;
|
|
1315
|
+
setArNSRecordMetadata(params: {
|
|
1316
|
+
antId: string;
|
|
1317
|
+
owner: ArNSOwnerSigner;
|
|
1318
|
+
undername?: string;
|
|
1319
|
+
displayName?: string | null;
|
|
1320
|
+
recordLogo?: string | null;
|
|
1321
|
+
recordDescription?: string | null;
|
|
1322
|
+
recordKeywords?: string[] | null;
|
|
1323
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1324
|
+
}): Promise<ArNSActionCompleted>;
|
|
1325
|
+
removeArNSRecordMetadata(params: {
|
|
1326
|
+
antId: string;
|
|
1327
|
+
owner: ArNSOwnerSigner;
|
|
1328
|
+
undername: string;
|
|
1329
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1330
|
+
}): Promise<ArNSActionCompleted>;
|
|
1331
|
+
transferArNSRecord(params: {
|
|
1332
|
+
antId: string;
|
|
1333
|
+
owner: ArNSOwnerSigner;
|
|
1334
|
+
undername: string;
|
|
1335
|
+
target: string;
|
|
1336
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
1337
|
+
}): Promise<ArNSActionCompleted>;
|
|
647
1338
|
}
|
|
648
1339
|
export interface TurboUnauthenticatedUploadServiceInterface {
|
|
649
1340
|
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, dataItemOpts, signal, events, }: TurboSignedDataItemFactory & TurboAbortSignal & TurboUploadEmitterEvents): Promise<TurboUploadDataItemResponse>;
|