@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
|
-
import { ByteCount, TurboChunkingMode, TurboLogger, TurboUploadDataItemResponse, UploadSignedDataItemParams } from '../types.js';
|
|
2
|
+
import { ByteCount, TurboChunkingMode, TurboLogger, TurboUploadDataItemResponse, UploadSignedDataItemParams, X402RequestCredentials } from '../types.js';
|
|
3
3
|
import { TurboHTTPService } from './http.js';
|
|
4
4
|
export declare const defaultMaxChunkConcurrency = 5;
|
|
5
5
|
export declare const maxChunkByteCount: number;
|
|
@@ -13,12 +13,32 @@ export declare class ChunkedUploader {
|
|
|
13
13
|
private chunkByteCount;
|
|
14
14
|
private readonly maxChunkConcurrency;
|
|
15
15
|
private readonly maxFinalizeMs;
|
|
16
|
+
/**
|
|
17
|
+
* The upload id of an x402 upload we have ALREADY PAID FOR.
|
|
18
|
+
*
|
|
19
|
+
* `uploadFile` retries a failed upload up to 6 times, and a retry re-enters
|
|
20
|
+
* `upload()` on this same instance. Without this memo each retry opens a
|
|
21
|
+
* NEW paid upload, so one 12 MiB upload whose finalization timed out billed
|
|
22
|
+
* the customer five times over — observed, not theoretical. The payment is
|
|
23
|
+
* bound to an upload id, so a retry must resume THAT upload, never buy
|
|
24
|
+
* another. Deliberately not reset on failure: re-paying is never the right
|
|
25
|
+
* recovery, and an upload that cannot be resumed is refunded server-side.
|
|
26
|
+
*/
|
|
27
|
+
private paidUploadId;
|
|
16
28
|
private readonly http;
|
|
17
29
|
private readonly token;
|
|
18
30
|
private readonly logger;
|
|
19
31
|
readonly shouldUseChunkUploader: boolean;
|
|
20
32
|
private maxBacklogQueue;
|
|
21
|
-
|
|
33
|
+
private x402;
|
|
34
|
+
private x402RefundIdentity;
|
|
35
|
+
/**
|
|
36
|
+
* The size declared at create. For x402 this is what gets PAID FOR, so it
|
|
37
|
+
* must be the real serialized size — the service reconciles against the bytes
|
|
38
|
+
* that actually arrive and penalises an under-declaration.
|
|
39
|
+
*/
|
|
40
|
+
private dataItemByteCount;
|
|
41
|
+
constructor({ http, token, maxChunkConcurrency, maxFinalizeMs, chunkByteCount, logger, chunkingMode, dataItemByteCount, x402, x402RefundIdentity, }: {
|
|
22
42
|
maxFinalizeMs?: number;
|
|
23
43
|
http: TurboHTTPService;
|
|
24
44
|
token: string;
|
|
@@ -27,12 +47,37 @@ export declare class ChunkedUploader {
|
|
|
27
47
|
maxChunkConcurrency?: number;
|
|
28
48
|
chunkingMode?: TurboChunkingMode;
|
|
29
49
|
dataItemByteCount: ByteCount;
|
|
50
|
+
/** Pay for this upload with x402 instead of Turbo Credits. */
|
|
51
|
+
x402?: X402RequestCredentials;
|
|
52
|
+
/**
|
|
53
|
+
* The TURBO wallet credited if the upload delivers fewer bytes than were
|
|
54
|
+
* paid for. Deliberately not derived from the x402 signer: the wallet that
|
|
55
|
+
* PAYS in USDC and the wallet that receives Turbo Credits are allowed to
|
|
56
|
+
* differ, and silently conflating them would send a refund to the wrong
|
|
57
|
+
* place.
|
|
58
|
+
*/
|
|
59
|
+
x402RefundIdentity?: {
|
|
60
|
+
address: string;
|
|
61
|
+
signatureType: number;
|
|
62
|
+
};
|
|
30
63
|
});
|
|
31
64
|
private shouldChunkUpload;
|
|
32
65
|
private assertChunkParams;
|
|
33
66
|
/**
|
|
34
67
|
* Initialize or resume an upload session, returning the upload ID.
|
|
35
68
|
*/
|
|
69
|
+
/**
|
|
70
|
+
* Open a multipart upload paid for with x402.
|
|
71
|
+
*
|
|
72
|
+
* The bundler settles the payment at CREATE, before accepting a single chunk
|
|
73
|
+
* — so an unpaid upload never consumes storage. That is why the size is
|
|
74
|
+
* declared here and the money moves here, not at finalize.
|
|
75
|
+
*
|
|
76
|
+
* The 402 handshake is delegated to `wrapFetchWithPayment`, the same
|
|
77
|
+
* mechanism the single-shot x402 POST already uses, so the signer and the
|
|
78
|
+
* spend cap behave identically on both paths.
|
|
79
|
+
*/
|
|
80
|
+
private initPaidUpload;
|
|
36
81
|
private initUpload;
|
|
37
82
|
upload({ dataItemSizeFactory, dataItemStreamFactory, dataItemOpts, signal, events, }: UploadSignedDataItemParams): Promise<TurboUploadDataItemResponse>;
|
|
38
83
|
private toGiB;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunked.d.ts","sourceRoot":"","sources":["../../../src/common/chunked.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,WAAW,EAEX,2BAA2B,EAC3B,0BAA0B,
|
|
1
|
+
{"version":3,"file":"chunked.d.ts","sourceRoot":"","sources":["../../../src/common/chunked.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EACL,SAAS,EAET,iBAAiB,EACjB,WAAW,EAEX,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAK7C,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAK5C,eAAO,MAAM,iBAAi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AAC,iBAAiB;IAoBzB,OAAO,CAAC,iBAAiB;IAwDzB;;OAEG;IACH;;;;;;;;;;OAUG;YACW,cAAc;YAwCd,UAAU;IAwBX,MAAM,CAAC,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,MAAM,EACN,MAAM,GACP,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAwHpE,OAAO,CAAC,KAAK;YAIC,cAAc;CAoG7B;AAED;;;GAGG;AACH,wBAAuB,eAAe,CACpC,MAAM,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,EAC7C,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAMvC;AACD,wBAAuB,uBAAuB,CAC5C,MAAM,EAAE,QAAQ,EAChB,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAkDvC;AAED,wBAAuB,6BAA6B,CAClD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,cAAc,EAAE,MAAM,GACrB,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAyDvC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ChainFolderUploadIndexParams, ComposeFolderUploadIndexParams, TurboFolderUploadIndex } from '../types.js';
|
|
17
|
+
/**
|
|
18
|
+
* An in-memory folder index.
|
|
19
|
+
*
|
|
20
|
+
* On its own it only deduplicates identical files within a single
|
|
21
|
+
* `uploadFolder` call, which `uploadFolder` already does. Its real use is as
|
|
22
|
+
* the writable floor of a {@link composeFolderIndex} stack, or seeded from a
|
|
23
|
+
* mapping the caller persisted itself.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createMemoryFolderIndex(seed?: Record<string, string>): TurboFolderUploadIndex;
|
|
26
|
+
/**
|
|
27
|
+
* Rebuilds a folder index by sweeping the uploader's own past uploads over a
|
|
28
|
+
* gateway's GraphQL endpoint, filtering on the `File-SHA256` tag that
|
|
29
|
+
* index-backed uploads always write.
|
|
30
|
+
*
|
|
31
|
+
* Read only, and the only layer that survives a fresh checkout on a machine
|
|
32
|
+
* that has never deployed before -- a CI runner, most obviously.
|
|
33
|
+
*
|
|
34
|
+
* Known limitation: gateways index an upload minutes after it lands, so two
|
|
35
|
+
* machines deploying the same new file at the same moment will each pay for it
|
|
36
|
+
* once. The manifest is correct either way; only the bill is affected, and only
|
|
37
|
+
* for genuinely new bytes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createChainFolderIndex({ owner, appName, gatewayUrl, hashTagName, maxPages, pageSize, timeoutMs, fetchImpl, logger, }: ChainFolderUploadIndexParams): TurboFolderUploadIndex;
|
|
40
|
+
/**
|
|
41
|
+
* Layers folder indexes: reads fall through in order, writes go to every layer
|
|
42
|
+
* that is not read only.
|
|
43
|
+
*
|
|
44
|
+
* The usual stack is a local cache in front of a chain index -- the cache
|
|
45
|
+
* answers instantly on a developer machine, and the chain index is what a CI
|
|
46
|
+
* runner with an empty working directory falls back to.
|
|
47
|
+
*
|
|
48
|
+
* A layer that throws is skipped, not propagated. That is the whole point of
|
|
49
|
+
* stacking them: a full disk under the file layer must not stop the memory
|
|
50
|
+
* layer from holding ids the run has already paid for, and an unreachable
|
|
51
|
+
* gateway must not stop the local cache from answering.
|
|
52
|
+
*/
|
|
53
|
+
export declare function composeFolderIndex(layers: (TurboFolderUploadIndex | undefined)[], { logger }?: ComposeFolderUploadIndexParams): TurboFolderUploadIndex;
|
|
54
|
+
//# sourceMappingURL=folderIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folderIndex.d.ts","sourceRoot":"","sources":["../../../src/common/folderIndex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,4BAA4B,EAC5B,8BAA8B,EAC9B,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAkIrB;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAChC,sBAAsB,CAmBxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,OAAO,EACP,UAAkC,EAClC,WAAgC,EAChC,QAAa,EACb,QAAc,EACd,SAAkB,EAClB,SAAiB,EACjB,MAAM,GACP,EAAE,4BAA4B,GAAG,sBAAsB,CAkLvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,CAAC,sBAAsB,GAAG,SAAS,CAAC,EAAE,EAC9C,EAAE,MAAM,EAAE,GAAE,8BAAmC,GAC9C,sBAAsB,CAsIxB"}
|
|
@@ -21,6 +21,18 @@ export interface RetryConfig {
|
|
|
21
21
|
onRetry: (retryCount: number, error: unknown) => void;
|
|
22
22
|
}
|
|
23
23
|
export declare const defaultRetryConfig: (logger?: TurboLogger) => RetryConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Canonical x402 upload routes on the upload service.
|
|
26
|
+
*
|
|
27
|
+
* These were previously `/x402/data-item/{signed,unsigned}`. The service
|
|
28
|
+
* renamed them to `/x402/upload/*` and kept a `data-item/signed` alias, but not
|
|
29
|
+
* a `data-item/unsigned` one — so every unsigned x402 upload 404ed. Both
|
|
30
|
+
* canonical paths are served by all released upload-service versions.
|
|
31
|
+
*/
|
|
32
|
+
export declare const x402UploadEndpoints: {
|
|
33
|
+
readonly signed: "/x402/upload/signed";
|
|
34
|
+
readonly unsigned: "/x402/upload/unsigned";
|
|
35
|
+
};
|
|
24
36
|
export declare class TurboHTTPService implements TurboHTTPServiceInterface {
|
|
25
37
|
protected baseURL: string;
|
|
26
38
|
protected logger: TurboLogger;
|
|
@@ -30,19 +42,30 @@ export declare class TurboHTTPService implements TurboHTTPServiceInterface {
|
|
|
30
42
|
retryConfig: RetryConfig;
|
|
31
43
|
logger: TurboLogger;
|
|
32
44
|
});
|
|
33
|
-
get<T>({ endpoint, signal, allowedStatuses, headers, }: {
|
|
45
|
+
get<T>({ endpoint, signal, allowedStatuses, headers, x402Options, }: {
|
|
34
46
|
endpoint: `/${string}`;
|
|
35
47
|
signal?: AbortSignal;
|
|
36
48
|
allowedStatuses?: number[];
|
|
37
49
|
headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Pay for this GET with x402. Used by the chunked uploader's create call,
|
|
52
|
+
* which the bundler answers with a 402 because a multipart upload is paid
|
|
53
|
+
* for BEFORE any chunk is accepted.
|
|
54
|
+
*
|
|
55
|
+
* Delegates to the same `wrapFetchWithPayment` the POST path uses, so the
|
|
56
|
+
* signer, the spend cap and the retry semantics are identical rather than
|
|
57
|
+
* a second implementation that can drift.
|
|
58
|
+
*/
|
|
59
|
+
x402Options?: X402RequestCredentials;
|
|
38
60
|
}): Promise<T>;
|
|
39
|
-
post<T>({ endpoint, signal, allowedStatuses, headers, data, x402Options, }: {
|
|
61
|
+
post<T>({ endpoint, signal, allowedStatuses, headers, data, x402Options, retry, }: {
|
|
40
62
|
endpoint: `/${string}`;
|
|
41
63
|
signal?: AbortSignal;
|
|
42
64
|
allowedStatuses?: number[];
|
|
43
65
|
headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
|
|
44
66
|
data: Readable | Buffer | ReadableStream | Uint8Array;
|
|
45
67
|
x402Options?: X402RequestCredentials;
|
|
68
|
+
retry?: boolean;
|
|
46
69
|
}): Promise<T>;
|
|
47
70
|
private tryRequest;
|
|
48
71
|
private withRetry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAMrB,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACvD;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,WAQzD,CAAC;AAOH,qBAAa,gBAAiB,YAAW,yBAAyB;IAChE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEvB,EACV,GAAG,EACH,MAAM,EACN,WAAwC,GACzC,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,WAAW,CAAC;QACzB,MAAM,EAAE,WAAW,CAAC;KACrB;IAMK,GAAG,CAAC,CAAC,EAAE,EACX,QAAQ,EACR,MAAM,EACN,eAA4B,EAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/http.ts"],"names":[],"mappings":"AAAA;;;;;;;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AwCR,IAAI,CAAC,CAAC,EAAE,EACZ,QAAQ,EACR,MAAM,EACN,eAA4B,EAC5B,OAAO,EACP,IAAI,EACJ,WAAW,EACX,KAAY,GACb,EAAE;QACD,QAAQ,EAAE,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAC;QACtD,WAAW,CAAC,EAAE,sBAAsB,CAAC;QAIrC,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,OAAO,CAAC,CAAC,CAAC;YAmCA,UAAU;YA6BV,SAAS;YAsCT,QAAQ;CA+CvB"}
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export * from './upload.js';
|
|
17
|
+
export * from './folderIndex.js';
|
|
17
18
|
export * from './payment.js';
|
|
19
|
+
export * from './arnsActions.js';
|
|
18
20
|
export * from './turbo.js';
|
|
19
21
|
export * from './currency.js';
|
|
20
22
|
export * from './token/index.js';
|
|
23
|
+
export * from '../utils/errors.js';
|
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Currency, GetCreditShareApprovalsResponse, TokenTools, TokenType, TurboAuthenticatedPaymentServiceConfiguration, TurboAuthenticatedPaymentServiceInterface, TurboBalanceResponse, TurboCheckoutSessionParams, TurboCheckoutSessionResponse, TurboCountriesResponse, TurboCryptoFundResponse, TurboCurrenciesResponse, TurboDataItemSigner, TurboFiatEstimateForBytesResponse, TurboFiatToArResponse, TurboFundWithTokensParams, TurboLogger, TurboPaymentIntentParams, TurboPaymentIntentResponse, TurboPriceResponse, TurboRatesResponse, TurboSignedRequestHeaders, TurboSubmitFundTxResponse, TurboTokenPriceForBytesResponse, TurboUnauthenticatedPaymentServiceConfiguration, TurboUnauthenticatedPaymentServiceInterface, TurboWincForFiatParams, TurboWincForFiatResponse, TurboWincForTokenParams, TurboWincForTokenResponse, UserAddress } from '../types.js';
|
|
1
|
+
import { ArNSAction, ArNSActionCompleted, ArNSActionPriceResponse, ArNSActionResult, ArNSFiatPurchaseQuoteParams, ArNSFiatPurchaseQuoteResponse, ArNSNameType, ArNSOwnerSigner, ArNSPriceParams, ArNSPriceResponse, ArNSPurchaseParams, ArNSPurchaseStatusResponse, AuthenticatedArNSFiatPurchaseQuoteParams, Currency, GetCreditShareApprovalsResponse, TokenTools, TokenType, TurboArNSNamesResponse, TurboAuthenticatedPaymentServiceConfiguration, TurboAuthenticatedPaymentServiceInterface, TurboBalanceResponse, TurboCheckoutSessionParams, TurboCheckoutSessionResponse, TurboCountriesResponse, TurboCryptoFundResponse, TurboCurrenciesResponse, TurboDataItemSigner, TurboFiatEstimateForBytesResponse, TurboFiatToArResponse, TurboFreeStatusResponse, TurboFundWithTokensParams, TurboLogger, TurboPaymentHistoryParams, TurboPaymentHistoryResponse, TurboPaymentIntentParams, TurboPaymentIntentResponse, TurboPriceResponse, TurboRatesResponse, TurboSignedRequestHeaders, TurboSubmitFundTxResponse, TurboTokenPriceForBytesResponse, TurboUnauthenticatedPaymentServiceConfiguration, TurboUnauthenticatedPaymentServiceInterface, TurboWincForFiatParams, TurboWincForFiatResponse, TurboWincForTokenParams, TurboWincForTokenResponse, UserAddress } from '../types.js';
|
|
2
2
|
import { TurboHTTPService } from './http.js';
|
|
3
3
|
export declare const developmentPaymentServiceURL = "https://payment.ardrive.dev";
|
|
4
4
|
export declare const defaultPaymentServiceURL = "https://payment.ardrive.io";
|
|
@@ -9,6 +9,19 @@ export declare class TurboUnauthenticatedPaymentService implements TurboUnauthen
|
|
|
9
9
|
private url;
|
|
10
10
|
constructor({ url, logger, retryConfig, token, }: TurboUnauthenticatedPaymentServiceConfiguration);
|
|
11
11
|
getBalance(address: string): Promise<TurboBalanceResponse>;
|
|
12
|
+
getFreeStatus(address: string): Promise<TurboFreeStatusResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the ArNS names a wallet owns or controls -- both custodial names
|
|
15
|
+
* bought via Turbo's ArNS-with-credits feature (Turbo may spawn and hold
|
|
16
|
+
* the ANT on the caller's behalf, depending on the buy) and self-custody
|
|
17
|
+
* names, in one list. See `TurboArNSName` for field semantics, including
|
|
18
|
+
* the `custodial` flag distinguishing the two.
|
|
19
|
+
*
|
|
20
|
+
* To read a name's current records or lease/expiration state, use
|
|
21
|
+
* `@ar.io/sdk` directly against the returned `antId` -- it talks to the
|
|
22
|
+
* chain directly and needs no round-trip through this SDK/backend.
|
|
23
|
+
*/
|
|
24
|
+
getArNSNames(address: string): Promise<TurboArNSNamesResponse>;
|
|
12
25
|
getFiatRates(): Promise<TurboRatesResponse>;
|
|
13
26
|
getFiatToAR({ currency, }: {
|
|
14
27
|
currency: Currency;
|
|
@@ -20,6 +33,60 @@ export declare class TurboUnauthenticatedPaymentService implements TurboUnauthen
|
|
|
20
33
|
}): Promise<TurboPriceResponse[]>;
|
|
21
34
|
getWincForFiat({ amount, promoCodes, nativeAddress, }: TurboWincForFiatParams): Promise<TurboWincForFiatResponse>;
|
|
22
35
|
getWincForToken({ tokenAmount, }: TurboWincForTokenParams): Promise<TurboWincForTokenResponse>;
|
|
36
|
+
getArNSPriceForName(params: ArNSPriceParams): Promise<ArNSPriceResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Preview the flat credits margin one of the eight non-purchase actions
|
|
39
|
+
* (everything except Buy-Name/Extend-Lease/Upgrade-Name/
|
|
40
|
+
* Increase-Undername-Limit) will debit, without creating it. Those four
|
|
41
|
+
* purchase actions are priced by `getArNSPriceForName` instead — their
|
|
42
|
+
* cost is dominated by the ARIO purchase, not this margin, so this route
|
|
43
|
+
* rejects them.
|
|
44
|
+
*
|
|
45
|
+
* No signature required: this mirrors `getArNSPriceForName`'s read-only,
|
|
46
|
+
* unauthenticated shape rather than `getArNSActionStatus`'s (which happens
|
|
47
|
+
* to live on the authenticated client today despite needing no signature
|
|
48
|
+
* either).
|
|
49
|
+
*/
|
|
50
|
+
getArNSActionPrice(action: ArNSAction): Promise<ArNSActionPriceResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Fail fast (client-side) on malformed ArNS requests so JS callers that bypass
|
|
53
|
+
* the compile-time intent unions get a clear `ProvidedInputError` instead of an
|
|
54
|
+
* opaque service 4xx. Enforces the required fields per intent:
|
|
55
|
+
* - `Buy-Name`: `type` ('lease' | 'permabuy'); leases also need `years`.
|
|
56
|
+
* `processId` is OPTIONAL — omit it to have the bundler custodially
|
|
57
|
+
* provision the ANT (Turbo owns it), supply it for a user-owned ANT.
|
|
58
|
+
* - `Extend-Lease`: positive `years`
|
|
59
|
+
* - `Increase-Undername-Limit`: positive `increaseQty`
|
|
60
|
+
* - `Upgrade-Name`: just `name`
|
|
61
|
+
*/
|
|
62
|
+
protected validateArNSPurchaseParams(params: ArNSPriceParams): void;
|
|
63
|
+
getArNSPurchaseStatus({ nonce, }: {
|
|
64
|
+
nonce: string;
|
|
65
|
+
}): Promise<ArNSPurchaseStatusResponse>;
|
|
66
|
+
protected buildArNSPurchaseQuery(input: ArNSPurchaseParams): string;
|
|
67
|
+
/**
|
|
68
|
+
* Quote a fiat (Stripe) ArNS purchase — buy a name with a credit card in one
|
|
69
|
+
* step, with no Turbo Credits top-up in between.
|
|
70
|
+
*
|
|
71
|
+
* Returns the recorded `purchaseQuote` (its `nonce` is what
|
|
72
|
+
* `getArNSPurchaseStatus` polls) plus the Stripe `paymentSession` to complete
|
|
73
|
+
* payment with. For `payment-intent`, confirm client-side with
|
|
74
|
+
* `stripe.confirmCardPayment(paymentSession.client_secret, ...)`, then poll
|
|
75
|
+
* the nonce until the purchase reports success or failure.
|
|
76
|
+
*
|
|
77
|
+
* Throws {@link FiatPaymentsDisabledError} when the service has Stripe turned
|
|
78
|
+
* off (normal in the testnet sandbox) so callers can fall back to the
|
|
79
|
+
* credit-paid path without string-matching a generic 503.
|
|
80
|
+
*/
|
|
81
|
+
getArNSFiatPurchaseQuote(params: ArNSFiatPurchaseQuoteParams): Promise<ArNSFiatPurchaseQuoteResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Query string for a fiat quote. Distinct from `buildArNSPurchaseQuery`
|
|
84
|
+
* because this route takes `uiMode` + its paired URLs and has no `paidBy`
|
|
85
|
+
* (fiat has no delegated payer), and because promo codes must be REPEATED
|
|
86
|
+
* params here: the service reads them with `parseQueryParams`, which treats a
|
|
87
|
+
* comma-joined string as one code rather than several.
|
|
88
|
+
*/
|
|
89
|
+
protected buildArNSFiatQuoteQuery(params: ArNSFiatPurchaseQuoteParams, promoCodes: string[]): string;
|
|
23
90
|
protected appendPromoCodesToQuery(promoCodes: string[]): string;
|
|
24
91
|
getTurboCryptoWallets(): Promise<Record<TokenType, string>>;
|
|
25
92
|
protected getCheckout({ amount, owner, promoCodes, uiMode, ...callbackUrls }: TurboCheckoutSessionParams, type?: 'checkout-session' | 'payment-intent', headers?: TurboSignedRequestHeaders): Promise<TurboCheckoutSessionResponse>;
|
|
@@ -44,6 +111,229 @@ export declare class TurboAuthenticatedPaymentService extends TurboUnauthenticat
|
|
|
44
111
|
protected readonly tokenTools: TokenTools | undefined;
|
|
45
112
|
constructor({ url, retryConfig, signer, logger, token, tokenTools, }: TurboAuthenticatedPaymentServiceConfiguration);
|
|
46
113
|
getBalance(userAddress?: string): Promise<TurboBalanceResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Quote a fiat (Stripe) ArNS purchase. `address` defaults to this signer's
|
|
116
|
+
* native address — the wallet that will own the name — so the common case
|
|
117
|
+
* needs no address at all. Pass one explicitly to buy on another wallet's
|
|
118
|
+
* behalf; the route takes the destination as a path param and requires no
|
|
119
|
+
* signature, which is why it is available unauthenticated too.
|
|
120
|
+
*/
|
|
121
|
+
getArNSFiatPurchaseQuote(params: AuthenticatedArNSFiatPurchaseQuoteParams): Promise<ArNSFiatPurchaseQuoteResponse>;
|
|
122
|
+
getFreeStatus(userAddress?: string): Promise<TurboFreeStatusResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* The signer's OWN completed top-up history (crypto + fiat), merged newest
|
|
125
|
+
* first and keyset-paginated. This is a SIGNED GET: unlike `getBalance` /
|
|
126
|
+
* `getFreeStatus` (which name a wallet by `?address=`), payment history is
|
|
127
|
+
* self-scoped and returns only the rows belonging to the signing wallet — the
|
|
128
|
+
* service reads the address from the signature, never a query param.
|
|
129
|
+
*
|
|
130
|
+
* We sign the bare nonce (no action-binding of `limit`/`cursor`) to match the
|
|
131
|
+
* service's `verifySignature` middleware; the pagination params ride in the
|
|
132
|
+
* query string. Pass `cursor` from a prior response to fetch the next page.
|
|
133
|
+
*/
|
|
134
|
+
getPaymentHistory({ limit, cursor, }?: TurboPaymentHistoryParams): Promise<TurboPaymentHistoryResponse>;
|
|
135
|
+
/**
|
|
136
|
+
* Buy / extend / upgrade an ArNS name, paying with the signer's Turbo credit
|
|
137
|
+
* balance. The bundler performs the on-chain ARIO purchase and debits credits;
|
|
138
|
+
* a `402` (FailedRequestError.status === 402) indicates insufficient credits.
|
|
139
|
+
*/
|
|
140
|
+
/**
|
|
141
|
+
* Create an action. Returns `completed` or `awaiting-signature`.
|
|
142
|
+
*
|
|
143
|
+
* Credits are debited HERE, not at `/sign`. Capture the returned `nonce`
|
|
144
|
+
* before prompting for a signature: it is the idempotency key, and polling
|
|
145
|
+
* it is how you resume. Never re-create an action to "retry" — that debits
|
|
146
|
+
* a second time. An abandoned action is refunded automatically.
|
|
147
|
+
*/
|
|
148
|
+
createArNSAction(action: ArNSAction, params?: Record<string, unknown>, ownerProof?: {
|
|
149
|
+
owner: ArNSOwnerSigner;
|
|
150
|
+
message: string;
|
|
151
|
+
}): Promise<ArNSActionResult>;
|
|
152
|
+
/**
|
|
153
|
+
* Submit the owner-signed transaction for an `awaiting-signature` action.
|
|
154
|
+
*
|
|
155
|
+
* `signedTransaction` is the FULL serialized transaction, base64 — not just
|
|
156
|
+
* the signature. Replaying a completed action returns `alreadyCompleted:
|
|
157
|
+
* true` rather than buying twice, so this is safe to call again if a
|
|
158
|
+
* response is lost.
|
|
159
|
+
*/
|
|
160
|
+
signArNSAction(nonce: string, signedTransaction: string): Promise<ArNSActionCompleted>;
|
|
161
|
+
/**
|
|
162
|
+
* Status of an action by nonce. Open — no signature required — so it works
|
|
163
|
+
* from a status page or callback handler that never holds the payer's key.
|
|
164
|
+
*
|
|
165
|
+
* Terminal success carries `messageId`; terminal failure carries
|
|
166
|
+
* `failedDate`.
|
|
167
|
+
*/
|
|
168
|
+
getArNSActionStatus(nonce: string): Promise<ArNSActionResult & {
|
|
169
|
+
failedDate?: string;
|
|
170
|
+
}>;
|
|
171
|
+
/**
|
|
172
|
+
* Run an action to a terminal state, signing if the server asks for it.
|
|
173
|
+
*
|
|
174
|
+
* This is the two-shape branch, once, in one place — so callers cannot
|
|
175
|
+
* hardcode which actions need a signature and break when a customer
|
|
176
|
+
* exercises ownership.
|
|
177
|
+
*/
|
|
178
|
+
private completeArNSAction;
|
|
179
|
+
/**
|
|
180
|
+
* Buy a name. The ANT is minted straight to `owner` — Turbo never holds it.
|
|
181
|
+
*
|
|
182
|
+
* This is the ONLY action that always needs the owner's signature:
|
|
183
|
+
* `ario_ant::initialize` is the one instruction in the whole lifecycle that
|
|
184
|
+
* requires the ANT owner's key. The customer signs once, here, and never
|
|
185
|
+
* again unless they change controllers or transfer the name.
|
|
186
|
+
*
|
|
187
|
+
* The owner needs a Solana key to sign with, NOT a funded one — Turbo pays
|
|
188
|
+
* every lamport of fee and rent.
|
|
189
|
+
*/
|
|
190
|
+
buyArNSName({ name, owner, type, years, paidBy, onNonce, }: {
|
|
191
|
+
name: string;
|
|
192
|
+
owner: ArNSOwnerSigner;
|
|
193
|
+
type?: ArNSNameType;
|
|
194
|
+
years?: number;
|
|
195
|
+
paidBy?: UserAddress | UserAddress[];
|
|
196
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
197
|
+
}): Promise<ArNSActionCompleted>;
|
|
198
|
+
/** Extend a lease. Permissionless on chain — no owner signature needed. */
|
|
199
|
+
extendArNSLease({ name, years, paidBy, onNonce, }: {
|
|
200
|
+
name: string;
|
|
201
|
+
years: number;
|
|
202
|
+
paidBy?: UserAddress | UserAddress[];
|
|
203
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
204
|
+
}): Promise<ArNSActionCompleted>;
|
|
205
|
+
/** Upgrade a lease to a permanent name. No owner signature needed. */
|
|
206
|
+
upgradeArNSName({ name, paidBy, onNonce, }: {
|
|
207
|
+
name: string;
|
|
208
|
+
paidBy?: UserAddress | UserAddress[];
|
|
209
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
210
|
+
}): Promise<ArNSActionCompleted>;
|
|
211
|
+
/** Raise the undername limit. No owner signature needed. */
|
|
212
|
+
increaseArNSUndernameLimit({ name, increaseQty, paidBy, onNonce, }: {
|
|
213
|
+
name: string;
|
|
214
|
+
increaseQty: number;
|
|
215
|
+
paidBy?: UserAddress | UserAddress[];
|
|
216
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
217
|
+
}): Promise<ArNSActionCompleted>;
|
|
218
|
+
/**
|
|
219
|
+
* Point a name (or undername) at an Arweave transaction.
|
|
220
|
+
*
|
|
221
|
+
* Costs a small credit margin — never SOL, which Turbo sponsors. Completes in one call while Turbo is
|
|
222
|
+
* a controller of the ANT, and returns `awaiting-signature` once the customer
|
|
223
|
+
* has revoked Turbo, at which point `owner` signs it themselves. Both paths
|
|
224
|
+
* are handled here.
|
|
225
|
+
*
|
|
226
|
+
* The owner proof is required EITHER WAY: Turbo is directing its own
|
|
227
|
+
* controller authority over an asset someone else owns, so nothing on chain
|
|
228
|
+
* records the owner's consent and we demand it. It is a MESSAGE signature,
|
|
229
|
+
* not a transaction — cheap and offline, but still a wallet prompt.
|
|
230
|
+
*/
|
|
231
|
+
setArNSRecord({ antId, owner, transactionId, undername, ttlSeconds, onNonce, }: {
|
|
232
|
+
antId: string;
|
|
233
|
+
owner: ArNSOwnerSigner;
|
|
234
|
+
transactionId: string;
|
|
235
|
+
undername?: string;
|
|
236
|
+
ttlSeconds?: number;
|
|
237
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
238
|
+
}): Promise<ArNSActionCompleted>;
|
|
239
|
+
/** Remove a record (an undername). Costs credits, never SOL. */
|
|
240
|
+
removeArNSRecord({ antId, owner, undername, onNonce, }: {
|
|
241
|
+
antId: string;
|
|
242
|
+
owner: ArNSOwnerSigner;
|
|
243
|
+
undername: string;
|
|
244
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
245
|
+
}): Promise<ArNSActionCompleted>;
|
|
246
|
+
/**
|
|
247
|
+
* Edit a RECORD's metadata — its display name, logo, description, keywords.
|
|
248
|
+
*
|
|
249
|
+
* Costs a small credit margin (never SOL), and is owner-or-controller on
|
|
250
|
+
* chain, so it behaves exactly like
|
|
251
|
+
* {@link setArNSRecord}: Turbo-alone while it is a controller, owner-signed
|
|
252
|
+
* after a revoke.
|
|
253
|
+
*
|
|
254
|
+
* Fields are TRI-STATE. Omit one to leave it unchanged; pass `null` to clear
|
|
255
|
+
* it. Those are bound distinctly by the owner proof, so "clear the
|
|
256
|
+
* description" and "set it to empty" are different authorizations.
|
|
257
|
+
*
|
|
258
|
+
* Note this is RECORD metadata. ANT-level metadata (the ANT's own name,
|
|
259
|
+
* ticker, description, keywords, logo) is NOT sponsored and stays on the
|
|
260
|
+
* direct-signer path via `@ar.io/sdk`.
|
|
261
|
+
*/
|
|
262
|
+
setArNSRecordMetadata({ antId, owner, undername, displayName, recordLogo, recordDescription, recordKeywords, onNonce, }: {
|
|
263
|
+
antId: string;
|
|
264
|
+
owner: ArNSOwnerSigner;
|
|
265
|
+
undername?: string;
|
|
266
|
+
displayName?: string | null;
|
|
267
|
+
recordLogo?: string | null;
|
|
268
|
+
recordDescription?: string | null;
|
|
269
|
+
recordKeywords?: string[] | null;
|
|
270
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
271
|
+
}): Promise<ArNSActionCompleted>;
|
|
272
|
+
/** Clear a record's metadata. Costs credits, never SOL; same two-shape rules. */
|
|
273
|
+
removeArNSRecordMetadata({ antId, owner, undername, onNonce, }: {
|
|
274
|
+
antId: string;
|
|
275
|
+
owner: ArNSOwnerSigner;
|
|
276
|
+
undername: string;
|
|
277
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
278
|
+
}): Promise<ArNSActionCompleted>;
|
|
279
|
+
/**
|
|
280
|
+
* Hand ONE record to another address.
|
|
281
|
+
*
|
|
282
|
+
* Distinct from {@link transferArNSAnt}, which hands over the whole ANT and
|
|
283
|
+
* every record on it. Confusing the two gives away far more than intended.
|
|
284
|
+
*/
|
|
285
|
+
transferArNSRecord({ antId, owner, undername, target, onNonce, }: {
|
|
286
|
+
antId: string;
|
|
287
|
+
owner: ArNSOwnerSigner;
|
|
288
|
+
undername: string;
|
|
289
|
+
target: string;
|
|
290
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
291
|
+
}): Promise<ArNSActionCompleted>;
|
|
292
|
+
/**
|
|
293
|
+
* Grant controller rights on the ANT. Omit `target` for Turbo itself, which
|
|
294
|
+
* is what makes `setArNSRecord` a single call.
|
|
295
|
+
*
|
|
296
|
+
* Owner-signed: changing an ANT's access control is an owner-only
|
|
297
|
+
* instruction. Costs a small credit margin; Turbo funds the ACL page growth
|
|
298
|
+
* in SOL.
|
|
299
|
+
*/
|
|
300
|
+
addArNSController({ antId, owner, target, onNonce, }: {
|
|
301
|
+
antId: string;
|
|
302
|
+
owner: ArNSOwnerSigner;
|
|
303
|
+
target?: string;
|
|
304
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
305
|
+
}): Promise<ArNSActionCompleted>;
|
|
306
|
+
/**
|
|
307
|
+
* Revoke controller rights — the escape hatch that keeps "Turbo is not a
|
|
308
|
+
* custodian" honest.
|
|
309
|
+
*
|
|
310
|
+
* Always available, and needs nothing from Turbo but the fee. Costs a small
|
|
311
|
+
* credit margin rather than SOL.
|
|
312
|
+
* After revoking, `setArNSRecord` keeps working: it simply starts returning
|
|
313
|
+
* `awaiting-signature` so the owner signs their own record writes.
|
|
314
|
+
*/
|
|
315
|
+
removeArNSController({ antId, owner, target, onNonce, }: {
|
|
316
|
+
antId: string;
|
|
317
|
+
owner: ArNSOwnerSigner;
|
|
318
|
+
target?: string;
|
|
319
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
320
|
+
}): Promise<ArNSActionCompleted>;
|
|
321
|
+
/**
|
|
322
|
+
* Hand the ANT to a new owner. Irreversible: after this lands, `owner` no
|
|
323
|
+
* longer controls the name. Owner-signed, and sponsored like the rest.
|
|
324
|
+
*/
|
|
325
|
+
transferArNSAnt({ antId, owner, target, onNonce, }: {
|
|
326
|
+
antId: string;
|
|
327
|
+
owner: ArNSOwnerSigner;
|
|
328
|
+
target: string;
|
|
329
|
+
onNonce?: (nonce: string) => void | Promise<void>;
|
|
330
|
+
}): Promise<ArNSActionCompleted>;
|
|
331
|
+
/**
|
|
332
|
+
* Defaults to the signer's own address when `userAddress` is omitted
|
|
333
|
+
* (`null`/`undefined`). Passing `''` does NOT trigger this default --
|
|
334
|
+
* mirrors `getBalance`'s existing behavior above.
|
|
335
|
+
*/
|
|
336
|
+
getArNSNames(userAddress?: string): Promise<TurboArNSNamesResponse>;
|
|
47
337
|
getCreditShareApprovals({ userAddress, }: {
|
|
48
338
|
userAddress?: string;
|
|
49
339
|
}): Promise<GetCreditShareApprovalsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,QAAQ,EACR,+BAA+B,EAE/B,UAAU,EACV,SAAS,EAET,6CAA6C,EAC7C,yCAAyC,EACzC,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,iCAAiC,EACjC,qBAAqB,EACrB,yBAAyB,EAEzB,WAAW,EACX,wBAAwB,EACxB,0BAA0B,EAE1B,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,+BAA+B,EAC/B,+CAA+C,EAC/C,2CAA2C,EAC3C,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,2BAA2B,EAC3B,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EAEf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,wCAAwC,EACxC,QAAQ,EACR,+BAA+B,EAE/B,UAAU,EACV,SAAS,EAET,sBAAsB,EACtB,6CAA6C,EAC7C,yCAAyC,EACzC,oBAAoB,EACpB,0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AAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,eAAe,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACnD,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAShC;;;;OAIG;IACU,YAAY,CACvB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,sBAAsB,CAAC;IAKrB,uBAAuB,CAAC,EACnC,WAAW,GACZ,EAAE;QACD,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAK/B,cAAc,CAAC,EAC1B,MAAM,EACN,UAAe,GAChB,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQhD,qBAAqB,CAChC,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,4BAA4B,CAAC;YAI1B,sBAAsB;IAYvB,eAAe,CAAC,EAC3B,aAAiB,EACjB,WAAW,EAAE,YAAY,EACzB,6BAA6B,GAC9B,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA0DhE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer as ArbundleSigner } from '@dha-team/arbundles';
|
|
2
2
|
import { Signer as x402Signer } from 'x402-fetch';
|
|
3
|
-
import { FileStreamFactory, NativeAddress, SendTxWithSignerParams, TokenType, TurboDataItemSigner, TurboDataItemSignerParams, TurboFileFactory, TurboLogger, TurboSignedDataItemFactory, TurboSigner, WalletAdapter } from '../types.js';
|
|
3
|
+
import { FileStreamFactory, NativeAddress, SendTxWithSignerParams, TokenType, TurboDataItemSigner, TurboDataItemSignerParams, TurboFileFactory, TurboLogger, TurboSignedDataItemFactory, TurboSignedRequestHeaders, TurboSigner, WalletAdapter } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Abstract class for signing TurboDataItems.
|
|
6
6
|
*/
|
|
@@ -12,16 +12,22 @@ export declare abstract class TurboDataItemAbstractSigner implements TurboDataIt
|
|
|
12
12
|
constructor({ signer, logger, token, walletAdapter, }: TurboDataItemSignerParams);
|
|
13
13
|
abstract signDataItem({ fileStreamFactory, fileSizeFactory, dataItemOpts, emitter, }: TurboFileFactory<FileStreamFactory>): Promise<TurboSignedDataItemFactory>;
|
|
14
14
|
private ownerToNativeAddress;
|
|
15
|
-
generateSignedRequestHeaders(): Promise<
|
|
16
|
-
'x-public-key': string;
|
|
17
|
-
'x-nonce': string;
|
|
18
|
-
'x-signature': string;
|
|
19
|
-
}>;
|
|
15
|
+
generateSignedRequestHeaders(nonce?: string, additionalData?: string): Promise<TurboSignedRequestHeaders>;
|
|
20
16
|
getPublicKey(): Promise<Buffer>;
|
|
21
17
|
getNativeAddress(): Promise<NativeAddress>;
|
|
22
18
|
/** Let the signer handle sending tx for better compat with cross chain libraries/web wallets */
|
|
23
19
|
sendTransaction({ target, amount, gatewayUrl, turboCreditDestinationAddress, }: SendTxWithSignerParams): Promise<string>;
|
|
24
20
|
signData(dataToSign: Uint8Array): Promise<Uint8Array>;
|
|
25
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds the wallet client x402-fetch signs payment authorizations with.
|
|
24
|
+
*
|
|
25
|
+
* The chain matters because `wrapFetchWithPayment` maps `walletClient.chain.id`
|
|
26
|
+
* to a network name and prefers the matching entry in the service's `accepts`
|
|
27
|
+
* list. The upload service advertises Base mainnet (`base`), and x402 support
|
|
28
|
+
* here is limited to `base-usdc`, so mainnet is the correct default. Callers
|
|
29
|
+
* needing another network can supply their own signer via
|
|
30
|
+
* `X402Funding({ signer })`.
|
|
31
|
+
*/
|
|
26
32
|
export declare function makeX402Signer(arbundlesSigner: ArbundleSigner): Promise<x402Signer>;
|
|
27
33
|
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/common/signer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAkB/D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,SAAS,EACT,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,0BAA0B,EAC1B,WAAW,EACX,aAAa,EAGd,MAAM,aAAa,CAAC;AAUrB;;GAEG;AACH,8BAAsB,2BACpB,YAAW,mBAAmB;IAEvB,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEhD,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;gBAEf,EACV,MAAM,EACN,MAAuB,EACvB,KAAK,EACL,aAAa,GACd,EAAE,yBAAyB;IAO5B,QAAQ,CAAC,YAAY,CAAC,EACpB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,OAAO,GACR,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAE5E,OAAO,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/common/signer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAkB/D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,SAAS,EACT,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,0BAA0B,EAC1B,yBAAyB,EACzB,WAAW,EACX,aAAa,EAGd,MAAM,aAAa,CAAC;AAUrB;;GAEG;AACH,8BAAsB,2BACpB,YAAW,mBAAmB;IAEvB,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEhD,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;gBAEf,EACV,MAAM,EACN,MAAuB,EACvB,KAAK,EACL,aAAa,GACd,EAAE,yBAAyB;IAO5B,QAAQ,CAAC,YAAY,CAAC,EACpB,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,OAAO,GACR,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAE5E,OAAO,CAAC,oBAAoB;IA+Bf,4BAA4B,CAGvC,KAAK,GAAE,MAAwC,EAM/C,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,yBAAyB,CAAC;IAexB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI/B,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;IAOvD,gGAAgG;IACnF,eAAe,CAAC,EAC3B,MAAM,EACN,MAAM,EACN,UAAU,EACV,6BAA6B,GAC9B,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuF9B,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBnE;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,eAAe,EAAE,cAAc,GAC9B,OAAO,CAAC,UAAU,CAAC,CAsCrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/token/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAEL,YAAY,EACZ,SAAS,EAEV,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/token/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAEL,YAAY,EACZ,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAUxB,eAAO,MAAM,eAAe,EAAE,YAepB,CAAC;AAMX,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAYxC,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,SAAS,EACT,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK,CAa/B,CAAC;AAEX,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE7D;AAED,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|