@arkade-os/sdk 0.4.14 → 0.4.16
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/README.md +287 -215
- package/dist/cjs/arkfee/estimator.js +1 -1
- package/dist/cjs/arkfee/types.js +2 -1
- package/dist/cjs/arknote/index.js +43 -4
- package/dist/cjs/bip322/index.js +1 -1
- package/dist/cjs/contracts/arkcontract.js +1 -1
- package/dist/cjs/contracts/contractManager.js +40 -24
- package/dist/cjs/contracts/contractWatcher.js +29 -22
- package/dist/cjs/contracts/handlers/default.js +1 -1
- package/dist/cjs/contracts/handlers/delegate.js +1 -1
- package/dist/cjs/contracts/handlers/helpers.js +25 -1
- package/dist/cjs/contracts/handlers/vhtlc.js +2 -4
- package/dist/cjs/extension/asset/assetGroup.js +92 -5
- package/dist/cjs/extension/asset/assetId.js +67 -3
- package/dist/cjs/extension/asset/assetInput.js +18 -0
- package/dist/cjs/extension/asset/assetOutput.js +15 -0
- package/dist/cjs/extension/asset/assetRef.js +66 -0
- package/dist/cjs/extension/asset/metadata.js +15 -0
- package/dist/cjs/extension/asset/packet.js +4 -1
- package/dist/cjs/extension/index.js +1 -1
- package/dist/cjs/forfeit.js +14 -0
- package/dist/cjs/identity/index.js +6 -0
- package/dist/cjs/identity/seedIdentity.js +5 -5
- package/dist/cjs/identity/singleKey.js +4 -0
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/intent/index.js +28 -12
- package/dist/cjs/providers/ark.js +3 -2
- package/dist/cjs/providers/delegator.js +20 -1
- package/dist/cjs/providers/expoArk.js +2 -2
- package/dist/cjs/providers/indexer.js +2 -2
- package/dist/cjs/providers/onchain.js +2 -1
- package/dist/cjs/repositories/realm/schemas.js +2 -2
- package/dist/cjs/repositories/realm/types.js +1 -1
- package/dist/cjs/script/address.js +37 -6
- package/dist/cjs/script/base.js +70 -1
- package/dist/cjs/script/default.js +3 -0
- package/dist/cjs/script/delegate.js +4 -0
- package/dist/cjs/script/tapscript.js +25 -4
- package/dist/cjs/script/vhtlc.js +35 -27
- package/dist/cjs/storage/fileSystem.js +1 -1
- package/dist/cjs/storage/inMemory.js +1 -1
- package/dist/cjs/storage/indexedDB.js +1 -1
- package/dist/cjs/storage/localStorage.js +1 -1
- package/dist/cjs/tree/validation.js +1 -1
- package/dist/cjs/utils/arkTransaction.js +5 -5
- package/dist/cjs/utils/bip21.js +16 -3
- package/dist/cjs/utils/syncCursors.js +4 -4
- package/dist/cjs/utils/transaction.js +1 -1
- package/dist/cjs/utils/transactionHistory.js +11 -11
- package/dist/cjs/utils/unknownFields.js +3 -3
- package/dist/cjs/wallet/asset-manager.js +4 -4
- package/dist/cjs/wallet/batch.js +5 -5
- package/dist/cjs/wallet/delegator.js +9 -8
- package/dist/cjs/wallet/expo/background.js +3 -3
- package/dist/cjs/wallet/expo/wallet.js +7 -7
- package/dist/cjs/wallet/index.js +43 -0
- package/dist/cjs/wallet/onchain.js +43 -5
- package/dist/cjs/wallet/ramps.js +44 -14
- package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +22 -22
- package/dist/cjs/wallet/serviceWorker/wallet.js +28 -24
- package/dist/cjs/wallet/unroll.js +12 -8
- package/dist/cjs/wallet/utils.js +1 -1
- package/dist/cjs/wallet/vtxo-manager.js +123 -82
- package/dist/cjs/wallet/wallet.js +231 -98
- package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +1 -1
- package/dist/cjs/worker/expo/processors/contractPollProcessor.js +2 -2
- package/dist/cjs/worker/expo/taskRunner.js +3 -3
- package/dist/cjs/worker/messageBus.js +3 -0
- package/dist/esm/arkfee/estimator.js +1 -1
- package/dist/esm/arkfee/types.js +2 -1
- package/dist/esm/arknote/index.js +43 -4
- package/dist/esm/bip322/index.js +1 -1
- package/dist/esm/contracts/arkcontract.js +1 -1
- package/dist/esm/contracts/contractManager.js +40 -24
- package/dist/esm/contracts/contractWatcher.js +29 -22
- package/dist/esm/contracts/handlers/default.js +1 -1
- package/dist/esm/contracts/handlers/delegate.js +1 -1
- package/dist/esm/contracts/handlers/helpers.js +24 -1
- package/dist/esm/contracts/handlers/vhtlc.js +3 -5
- package/dist/esm/extension/asset/assetGroup.js +92 -5
- package/dist/esm/extension/asset/assetId.js +67 -3
- package/dist/esm/extension/asset/assetInput.js +18 -0
- package/dist/esm/extension/asset/assetOutput.js +15 -0
- package/dist/esm/extension/asset/assetRef.js +66 -0
- package/dist/esm/extension/asset/metadata.js +15 -0
- package/dist/esm/extension/asset/packet.js +4 -1
- package/dist/esm/extension/index.js +1 -1
- package/dist/esm/forfeit.js +14 -0
- package/dist/esm/identity/index.js +5 -0
- package/dist/esm/identity/seedIdentity.js +5 -5
- package/dist/esm/identity/singleKey.js +4 -0
- package/dist/esm/index.js +3 -2
- package/dist/esm/intent/index.js +28 -12
- package/dist/esm/providers/ark.js +3 -2
- package/dist/esm/providers/delegator.js +20 -1
- package/dist/esm/providers/expoArk.js +2 -2
- package/dist/esm/providers/indexer.js +2 -2
- package/dist/esm/providers/onchain.js +2 -1
- package/dist/esm/repositories/realm/schemas.js +2 -2
- package/dist/esm/repositories/realm/types.js +1 -1
- package/dist/esm/script/address.js +37 -6
- package/dist/esm/script/base.js +70 -1
- package/dist/esm/script/default.js +3 -0
- package/dist/esm/script/delegate.js +4 -0
- package/dist/esm/script/tapscript.js +25 -4
- package/dist/esm/script/vhtlc.js +35 -27
- package/dist/esm/storage/fileSystem.js +1 -1
- package/dist/esm/storage/inMemory.js +1 -1
- package/dist/esm/storage/indexedDB.js +1 -1
- package/dist/esm/storage/localStorage.js +1 -1
- package/dist/esm/tree/validation.js +1 -1
- package/dist/esm/utils/arkTransaction.js +5 -5
- package/dist/esm/utils/bip21.js +16 -3
- package/dist/esm/utils/syncCursors.js +4 -4
- package/dist/esm/utils/transaction.js +1 -1
- package/dist/esm/utils/transactionHistory.js +11 -11
- package/dist/esm/utils/unknownFields.js +3 -3
- package/dist/esm/wallet/asset-manager.js +4 -4
- package/dist/esm/wallet/batch.js +5 -5
- package/dist/esm/wallet/delegator.js +9 -8
- package/dist/esm/wallet/expo/background.js +3 -3
- package/dist/esm/wallet/expo/wallet.js +7 -7
- package/dist/esm/wallet/index.js +43 -0
- package/dist/esm/wallet/onchain.js +43 -5
- package/dist/esm/wallet/ramps.js +44 -14
- package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +22 -22
- package/dist/esm/wallet/serviceWorker/wallet.js +28 -24
- package/dist/esm/wallet/unroll.js +12 -8
- package/dist/esm/wallet/utils.js +1 -1
- package/dist/esm/wallet/vtxo-manager.js +122 -81
- package/dist/esm/wallet/wallet.js +232 -99
- package/dist/esm/worker/expo/asyncStorageTaskQueue.js +1 -1
- package/dist/esm/worker/expo/processors/contractPollProcessor.js +2 -2
- package/dist/esm/worker/expo/taskRunner.js +3 -3
- package/dist/esm/worker/messageBus.js +3 -0
- package/dist/types/arkfee/estimator.d.ts +1 -1
- package/dist/types/arkfee/types.d.ts +2 -1
- package/dist/types/arknote/index.d.ts +44 -4
- package/dist/types/bip322/index.d.ts +1 -1
- package/dist/types/contracts/arkcontract.d.ts +1 -1
- package/dist/types/contracts/contractManager.d.ts +40 -63
- package/dist/types/contracts/contractWatcher.d.ts +39 -18
- package/dist/types/contracts/handlers/default.d.ts +1 -1
- package/dist/types/contracts/handlers/delegate.d.ts +1 -1
- package/dist/types/contracts/handlers/helpers.d.ts +11 -1
- package/dist/types/contracts/types.d.ts +36 -26
- package/dist/types/extension/asset/assetGroup.d.ts +92 -1
- package/dist/types/extension/asset/assetId.d.ts +67 -3
- package/dist/types/extension/asset/assetInput.d.ts +18 -0
- package/dist/types/extension/asset/assetOutput.d.ts +15 -0
- package/dist/types/extension/asset/assetRef.d.ts +66 -0
- package/dist/types/extension/asset/metadata.d.ts +15 -0
- package/dist/types/extension/asset/packet.d.ts +4 -1
- package/dist/types/extension/index.d.ts +1 -1
- package/dist/types/forfeit.d.ts +14 -0
- package/dist/types/identity/index.d.ts +36 -0
- package/dist/types/identity/seedIdentity.d.ts +10 -8
- package/dist/types/identity/singleKey.d.ts +4 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/intent/index.d.ts +19 -6
- package/dist/types/providers/ark.d.ts +40 -2
- package/dist/types/providers/delegator.d.ts +54 -1
- package/dist/types/providers/expoArk.d.ts +2 -2
- package/dist/types/providers/indexer.d.ts +105 -2
- package/dist/types/providers/onchain.d.ts +62 -1
- package/dist/types/repositories/realm/schemas.d.ts +2 -2
- package/dist/types/repositories/realm/types.d.ts +2 -2
- package/dist/types/repositories/walletRepository.d.ts +16 -0
- package/dist/types/script/address.d.ts +35 -2
- package/dist/types/script/base.d.ts +66 -1
- package/dist/types/script/default.d.ts +3 -0
- package/dist/types/script/delegate.d.ts +4 -0
- package/dist/types/script/tapscript.d.ts +17 -2
- package/dist/types/script/vhtlc.d.ts +35 -27
- package/dist/types/storage/fileSystem.d.ts +1 -1
- package/dist/types/storage/inMemory.d.ts +1 -1
- package/dist/types/storage/index.d.ts +1 -1
- package/dist/types/storage/indexedDB.d.ts +1 -1
- package/dist/types/storage/localStorage.d.ts +1 -1
- package/dist/types/utils/arkTransaction.d.ts +3 -3
- package/dist/types/utils/bip21.d.ts +17 -0
- package/dist/types/utils/syncCursors.d.ts +4 -4
- package/dist/types/utils/transaction.d.ts +1 -1
- package/dist/types/utils/transactionHistory.d.ts +3 -3
- package/dist/types/utils/unknownFields.d.ts +5 -5
- package/dist/types/wallet/asset-manager.d.ts +3 -3
- package/dist/types/wallet/batch.d.ts +27 -7
- package/dist/types/wallet/delegator.d.ts +10 -0
- package/dist/types/wallet/expo/background.d.ts +4 -4
- package/dist/types/wallet/expo/wallet.d.ts +10 -10
- package/dist/types/wallet/index.d.ts +457 -25
- package/dist/types/wallet/onchain.d.ts +42 -4
- package/dist/types/wallet/ramps.d.ts +40 -10
- package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +4 -4
- package/dist/types/wallet/serviceWorker/wallet.d.ts +71 -33
- package/dist/types/wallet/unroll.d.ts +8 -6
- package/dist/types/wallet/vtxo-manager.d.ts +146 -93
- package/dist/types/wallet/wallet.d.ts +91 -33
- package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +1 -1
- package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +1 -1
- package/dist/types/worker/expo/taskRunner.d.ts +6 -6
- package/dist/types/worker/messageBus.d.ts +5 -3
- package/package.json +18 -10
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import { Transaction } from "../utils/transaction";
|
|
2
2
|
import { SignerSession } from "../tree/signingSession";
|
|
3
3
|
export interface Identity extends ReadonlyIdentity {
|
|
4
|
+
/** Returns a signer session used for musig2 tree signing flows. */
|
|
4
5
|
signerSession(): SignerSession;
|
|
6
|
+
/** Sign an arbitrary message using the requested signature type. */
|
|
5
7
|
signMessage(message: Uint8Array, signatureType: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
8
|
+
/**
|
|
9
|
+
* Sign the provided transaction inputs.
|
|
10
|
+
*
|
|
11
|
+
* @param tx - Transaction to sign
|
|
12
|
+
* @param inputIndexes - Optional input indexes to sign. When omitted, the implementation should sign every signable input.
|
|
13
|
+
*/
|
|
6
14
|
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
7
15
|
}
|
|
8
16
|
export interface ReadonlyIdentity {
|
|
17
|
+
/** Returns the x-only public key used by Taproot scripts. */
|
|
9
18
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
19
|
+
/** Returns the compressed public key for this identity. */
|
|
10
20
|
compressedPublicKey(): Promise<Uint8Array>;
|
|
11
21
|
}
|
|
22
|
+
/** A single PSBT signing request within a batch. */
|
|
23
|
+
export interface SignRequest {
|
|
24
|
+
tx: Transaction;
|
|
25
|
+
inputIndexes?: number[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Identity that supports signing multiple PSBTs in a single wallet interaction.
|
|
29
|
+
* Browser wallet providers that support batch signing (e.g. Xverse, UniSat, OKX)
|
|
30
|
+
* should implement this interface to reduce the number of confirmation popups
|
|
31
|
+
* from N+1 to 1 during Arkade send transactions.
|
|
32
|
+
*
|
|
33
|
+
* Contract: implementations MUST return exactly one `Transaction` per request,
|
|
34
|
+
* in the same order as the input array. The SDK validates this at runtime and
|
|
35
|
+
* will throw if the lengths do not match.
|
|
36
|
+
*/
|
|
37
|
+
export interface BatchSignableIdentity extends Identity {
|
|
38
|
+
/**
|
|
39
|
+
* Sign multiple transactions in a single wallet interaction.
|
|
40
|
+
*
|
|
41
|
+
* @param requests - Transactions and optional input indexes to sign
|
|
42
|
+
* @returns Signed transactions in the same order as the input requests
|
|
43
|
+
*/
|
|
44
|
+
signMultiple(requests: SignRequest[]): Promise<Transaction[]>;
|
|
45
|
+
}
|
|
46
|
+
/** Type guard for identities that support batch signing. */
|
|
47
|
+
export declare function isBatchSignable(identity: Identity): identity is BatchSignableIdentity;
|
|
12
48
|
export * from "./singleKey";
|
|
13
49
|
export * from "./seedIdentity";
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { Identity, ReadonlyIdentity } from ".";
|
|
2
2
|
import { Transaction } from "../utils/transaction";
|
|
3
3
|
import { SignerSession } from "../tree/signingSession";
|
|
4
|
-
/**
|
|
4
|
+
/** Used for default BIP86 derivation with network selection. */
|
|
5
5
|
export interface NetworkOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Mainnet (coin type 0) or testnet (coin type 1).
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue `true`
|
|
9
10
|
*/
|
|
10
11
|
isMainnet?: boolean;
|
|
11
12
|
}
|
|
12
|
-
/**
|
|
13
|
+
/** Used for custom output descriptor derivation. */
|
|
13
14
|
export interface DescriptorOptions {
|
|
14
15
|
/** Custom output descriptor that determines the derivation path. */
|
|
15
16
|
descriptor: string;
|
|
16
17
|
}
|
|
17
|
-
/** Either default BIP86 derivation (with optional network) or a custom descriptor. */
|
|
18
|
+
/** Either default BIP86 derivation (with optional network selection) or a custom descriptor. */
|
|
18
19
|
export type SeedIdentityOptions = NetworkOptions | DescriptorOptions;
|
|
20
|
+
/** Used for deriving an identity from a BIP39 mnemonic. */
|
|
19
21
|
export type MnemonicOptions = SeedIdentityOptions & {
|
|
20
22
|
/** Optional BIP39 passphrase for additional seed entropy. */
|
|
21
23
|
passphrase?: string;
|
|
@@ -29,7 +31,7 @@ export type MnemonicOptions = SeedIdentityOptions & {
|
|
|
29
31
|
* format is HD-ready, allowing future support for multiple addresses
|
|
30
32
|
* and change derivation.
|
|
31
33
|
*
|
|
32
|
-
* Prefer this (or
|
|
34
|
+
* Prefer this (or @see MnemonicIdentity) over `SingleKey` for new
|
|
33
35
|
* integrations — `SingleKey` exists for backward compatibility with
|
|
34
36
|
* raw nsec-style keys.
|
|
35
37
|
*
|
|
@@ -61,7 +63,7 @@ export declare class SeedIdentity implements Identity {
|
|
|
61
63
|
* @param seed - 64-byte seed (typically from mnemonicToSeedSync)
|
|
62
64
|
* @param opts - Network selection or custom descriptor.
|
|
63
65
|
*/
|
|
64
|
-
static fromSeed(seed: Uint8Array, opts
|
|
66
|
+
static fromSeed(seed: Uint8Array, opts?: SeedIdentityOptions): SeedIdentity;
|
|
65
67
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
66
68
|
compressedPublicKey(): Promise<Uint8Array>;
|
|
67
69
|
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
@@ -77,7 +79,7 @@ export declare class SeedIdentity implements Identity {
|
|
|
77
79
|
*
|
|
78
80
|
* This is the most user-friendly identity type — recommended for wallet
|
|
79
81
|
* applications where users manage their own backup phrase. Extends
|
|
80
|
-
*
|
|
82
|
+
* @see SeedIdentity with mnemonic validation and optional passphrase
|
|
81
83
|
* support.
|
|
82
84
|
*
|
|
83
85
|
* @example
|
|
@@ -99,7 +101,7 @@ export declare class MnemonicIdentity extends SeedIdentity {
|
|
|
99
101
|
* @param phrase - BIP39 mnemonic phrase (12 or 24 words)
|
|
100
102
|
* @param opts - Network selection or custom descriptor, plus optional passphrase
|
|
101
103
|
*/
|
|
102
|
-
static fromMnemonic(phrase: string, opts
|
|
104
|
+
static fromMnemonic(phrase: string, opts?: MnemonicOptions): MnemonicIdentity;
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* Watch-only identity from an output descriptor.
|
|
@@ -22,8 +22,11 @@ import { SignerSession } from "../tree/signingSession";
|
|
|
22
22
|
export declare class SingleKey implements Identity {
|
|
23
23
|
private key;
|
|
24
24
|
private constructor();
|
|
25
|
+
/** Create a signing identity from raw private key bytes. */
|
|
25
26
|
static fromPrivateKey(privateKey: Uint8Array): SingleKey;
|
|
27
|
+
/** Create a signing identity from a hex-encoded private key. */
|
|
26
28
|
static fromHex(privateKeyHex: string): SingleKey;
|
|
29
|
+
/** Create a signing identity with a freshly generated random private key. */
|
|
27
30
|
static fromRandomBytes(): SingleKey;
|
|
28
31
|
/**
|
|
29
32
|
* Export the private key as a hex string.
|
|
@@ -40,6 +43,7 @@ export declare class SingleKey implements Identity {
|
|
|
40
43
|
}
|
|
41
44
|
export declare class ReadonlySingleKey implements ReadonlyIdentity {
|
|
42
45
|
private readonly publicKey;
|
|
46
|
+
/** Create a readonly identity from a compressed public key. */
|
|
43
47
|
constructor(publicKey: Uint8Array);
|
|
44
48
|
/**
|
|
45
49
|
* Create a ReadonlySingleKey from a compressed public key.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Transaction } from "./utils/transaction";
|
|
|
2
2
|
import { SingleKey, ReadonlySingleKey } from "./identity/singleKey";
|
|
3
3
|
import { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity } from "./identity/seedIdentity";
|
|
4
4
|
import type { SeedIdentityOptions, MnemonicOptions, NetworkOptions, DescriptorOptions } from "./identity/seedIdentity";
|
|
5
|
-
import { Identity, ReadonlyIdentity } from "./identity";
|
|
5
|
+
import { Identity, ReadonlyIdentity, BatchSignableIdentity, SignRequest, isBatchSignable } from "./identity";
|
|
6
6
|
import { ArkAddress } from "./script/address";
|
|
7
7
|
import { VHTLC } from "./script/vhtlc";
|
|
8
8
|
import { DefaultVtxo } from "./script/default";
|
|
@@ -50,5 +50,5 @@ import { IContractManager } from "./contracts/contractManager";
|
|
|
50
50
|
import { closeDatabase, openDatabase } from "./repositories/indexedDB/manager";
|
|
51
51
|
import { WalletMessageHandler, WalletNotInitializedError, ReadonlyWalletError, DelegatorNotConfiguredError } from "./wallet/serviceWorker/wallet-message-handler";
|
|
52
52
|
import { MESSAGE_BUS_NOT_INITIALIZED, MessageBusNotInitializedError, ServiceWorkerTimeoutError } from "./worker/errors";
|
|
53
|
-
export { Wallet, ReadonlyWallet, SingleKey, ReadonlySingleKey, SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, OnchainWallet, Ramps, VtxoManager, DelegatorManagerImpl, RestDelegatorProvider, ESPLORA_URL, EsploraProvider, RestArkProvider, RestIndexerProvider, ArkAddress, DefaultVtxo, DelegateVtxo, VtxoScript, VHTLC, TxType, IndexerTxType, ChainTxType, SettlementEventType, setupServiceWorker, MessageBus, WalletMessageHandler, WalletNotInitializedError, ReadonlyWalletError, DelegatorNotConfiguredError, MESSAGE_BUS_NOT_INITIALIZED, MessageBusNotInitializedError, ServiceWorkerTimeoutError, ServiceWorkerWallet, ServiceWorkerReadonlyWallet, DEFAULT_MESSAGE_TIMEOUTS, decodeTapscript, MultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CLTVMultisigTapscript, TapTreeCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, setArkPsbtField, getArkPsbtFields, CosignerPublicKey, VtxoTreeExpiry, VtxoTaprootTree, ConditionWitness, buildOffchainTx, verifyTapscriptSignatures, waitForIncomingFunds, hasBoardingTxExpired, combineTapscriptSigs, isVtxoExpiringSoon, isValidArkAddress, ArkNote, networks, closeDatabase, openDatabase, IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, Intent, BIP322, TxTree, P2A, Unroll, Transaction, ArkError, maybeArkError, Batch, validateVtxoTxGraph, validateConnectorsTxGraph, buildForfeitTx, isRecoverable, isSpendable, isSubdust, isExpired, getSequence, ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, };
|
|
54
|
-
export type { Identity, ReadonlyIdentity, IWallet, IReadonlyWallet, BaseWalletConfig, WalletConfig, ReadonlyWalletConfig, ProviderClass, ArkTransaction, Coin, ExtendedCoin, ExtendedVirtualCoin, WalletBalance, SendBitcoinParams, SettleParams, Status, VirtualStatus, Outpoint, VirtualCoin, TxKey, TapscriptType, ArkTxInput, OffchainTx, TapLeaves, IncomingFunds, SeedIdentityOptions, MnemonicOptions, NetworkOptions, DescriptorOptions, IndexerProvider, PageResponse, BatchInfo, ChainTx, CommitmentTx, TxHistoryRecord, Vtxo, VtxoChain, Tx, OnchainProvider, ArkProvider, SettlementEvent, FeeInfo, ArkInfo, SignedIntent, Output, TxNotification, ExplorerTransaction, BatchFinalizationEvent, BatchFinalizedEvent, BatchFailedEvent, TreeSigningStartedEvent, TreeNoncesEvent, BatchStartedEvent, TreeTxEvent, TreeSignatureEvent, ScheduledSession, PaginationOptions, SubscriptionResponse, SubscriptionHeartbeat, SubscriptionEvent, Network, NetworkName, ArkTapscript, RelativeTimelock, EncodedVtxoScript, TapLeafScript, SignerSession, TreeNonces, TreePartialSigs, GetVtxosFilter, SettlementConfig, IVtxoManager, Asset, Recipient, IssuanceParams, IssuanceResult, ReissuanceParams, BurnParams, AssetDetails, AssetMetadata, KnownMetadata, Nonces, PartialSig, ArkPsbtFieldCoder, TxTreeNode, AnchorBumper, StorageConfig, Contract, ContractVtxo, ContractState, ContractEvent, ContractEventCallback, ContractBalance, ContractWithVtxos, ContractHandler, IContractManager, PathSelection, PathContext, ContractManagerConfig, CreateContractParams, ContractWatcherConfig, ParsedArkContract, DefaultContractParams, DelegateContractParams, VHTLCContractParams, MessageHandler, RequestEnvelope, ResponseEnvelope, MessageTimeouts, IDelegatorManager, DelegatorProvider, DelegateInfo, DelegateOptions, WalletRepository, ContractRepository, MigrationStatus, };
|
|
53
|
+
export { Wallet, ReadonlyWallet, SingleKey, ReadonlySingleKey, SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, isBatchSignable, OnchainWallet, Ramps, VtxoManager, DelegatorManagerImpl, RestDelegatorProvider, ESPLORA_URL, EsploraProvider, RestArkProvider, RestIndexerProvider, ArkAddress, DefaultVtxo, DelegateVtxo, VtxoScript, VHTLC, TxType, IndexerTxType, ChainTxType, SettlementEventType, setupServiceWorker, MessageBus, WalletMessageHandler, WalletNotInitializedError, ReadonlyWalletError, DelegatorNotConfiguredError, MESSAGE_BUS_NOT_INITIALIZED, MessageBusNotInitializedError, ServiceWorkerTimeoutError, ServiceWorkerWallet, ServiceWorkerReadonlyWallet, DEFAULT_MESSAGE_TIMEOUTS, decodeTapscript, MultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CLTVMultisigTapscript, TapTreeCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, setArkPsbtField, getArkPsbtFields, CosignerPublicKey, VtxoTreeExpiry, VtxoTaprootTree, ConditionWitness, buildOffchainTx, verifyTapscriptSignatures, waitForIncomingFunds, hasBoardingTxExpired, combineTapscriptSigs, isVtxoExpiringSoon, isValidArkAddress, ArkNote, networks, closeDatabase, openDatabase, IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, Intent, BIP322, TxTree, P2A, Unroll, Transaction, ArkError, maybeArkError, Batch, validateVtxoTxGraph, validateConnectorsTxGraph, buildForfeitTx, isRecoverable, isSpendable, isSubdust, isExpired, getSequence, ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, };
|
|
54
|
+
export type { Identity, ReadonlyIdentity, BatchSignableIdentity, SignRequest, IWallet, IReadonlyWallet, BaseWalletConfig, WalletConfig, ReadonlyWalletConfig, ProviderClass, ArkTransaction, Coin, ExtendedCoin, ExtendedVirtualCoin, WalletBalance, SendBitcoinParams, SettleParams, Status, VirtualStatus, Outpoint, VirtualCoin, TxKey, TapscriptType, ArkTxInput, OffchainTx, TapLeaves, IncomingFunds, SeedIdentityOptions, MnemonicOptions, NetworkOptions, DescriptorOptions, IndexerProvider, PageResponse, BatchInfo, ChainTx, CommitmentTx, TxHistoryRecord, Vtxo, VtxoChain, Tx, OnchainProvider, ArkProvider, SettlementEvent, FeeInfo, ArkInfo, SignedIntent, Output, TxNotification, ExplorerTransaction, BatchFinalizationEvent, BatchFinalizedEvent, BatchFailedEvent, TreeSigningStartedEvent, TreeNoncesEvent, BatchStartedEvent, TreeTxEvent, TreeSignatureEvent, ScheduledSession, PaginationOptions, SubscriptionResponse, SubscriptionHeartbeat, SubscriptionEvent, Network, NetworkName, ArkTapscript, RelativeTimelock, EncodedVtxoScript, TapLeafScript, SignerSession, TreeNonces, TreePartialSigs, GetVtxosFilter, SettlementConfig, IVtxoManager, Asset, Recipient, IssuanceParams, IssuanceResult, ReissuanceParams, BurnParams, AssetDetails, AssetMetadata, KnownMetadata, Nonces, PartialSig, ArkPsbtFieldCoder, TxTreeNode, AnchorBumper, StorageConfig, Contract, ContractVtxo, ContractState, ContractEvent, ContractEventCallback, ContractBalance, ContractWithVtxos, ContractHandler, IContractManager, PathSelection, PathContext, ContractManagerConfig, CreateContractParams, ContractWatcherConfig, ParsedArkContract, DefaultContractParams, DelegateContractParams, VHTLCContractParams, MessageHandler, RequestEnvelope, ResponseEnvelope, MessageTimeouts, IDelegatorManager, DelegatorProvider, DelegateInfo, DelegateOptions, WalletRepository, ContractRepository, MigrationStatus, };
|
|
@@ -5,10 +5,11 @@ import { ExtendedCoin } from "../wallet";
|
|
|
5
5
|
* Intent proof implementation for Bitcoin message signing.
|
|
6
6
|
*
|
|
7
7
|
* Intent proof defines a standard for signing Bitcoin messages as well as proving
|
|
8
|
-
* ownership of
|
|
9
|
-
* validating Intent proof.
|
|
8
|
+
* ownership of outputs.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
10
|
+
* This namespace provides utilities for creating and validating Intent proof.
|
|
11
|
+
*
|
|
12
|
+
* It is greatly inspired by BIP322.
|
|
12
13
|
* @see https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
@@ -30,15 +31,21 @@ export declare namespace Intent {
|
|
|
30
31
|
* Creates a new Intent proof unsigned transaction.
|
|
31
32
|
*
|
|
32
33
|
* This function constructs a special transaction that can be signed to prove
|
|
33
|
-
* ownership of
|
|
34
|
+
* ownership of onchain and virtual outputs. The proof includes the message to be
|
|
34
35
|
* signed and the inputs/outputs that demonstrate ownership.
|
|
35
36
|
*
|
|
36
37
|
* @param message - The Intent message to be signed, either raw string of Message object
|
|
37
|
-
* @param
|
|
38
|
+
* @param ins - Array of transaction inputs to prove ownership of
|
|
38
39
|
* @param outputs - Optional array of transaction outputs
|
|
39
40
|
* @returns An unsigned Intent proof transaction
|
|
40
41
|
*/
|
|
41
42
|
function create(message: string | Message, ins: (TransactionInput | ExtendedCoin)[], outputs?: TransactionOutput[]): Proof;
|
|
43
|
+
/**
|
|
44
|
+
* Compute the fee paid by an intent proof transaction.
|
|
45
|
+
*
|
|
46
|
+
* @param proof - Intent proof transaction
|
|
47
|
+
* @returns The fee in satoshis
|
|
48
|
+
*/
|
|
42
49
|
function fee(proof: Proof): number;
|
|
43
50
|
type RegisterMessage = {
|
|
44
51
|
type: "register";
|
|
@@ -56,6 +63,12 @@ export declare namespace Intent {
|
|
|
56
63
|
expire_at: number;
|
|
57
64
|
};
|
|
58
65
|
type Message = RegisterMessage | DeleteMessage | GetPendingTxMessage;
|
|
66
|
+
/**
|
|
67
|
+
* Serialize an intent message to the canonical JSON string used for signing.
|
|
68
|
+
*
|
|
69
|
+
* @param message - Intent message payload
|
|
70
|
+
* @returns Canonical string form of the message
|
|
71
|
+
*/
|
|
59
72
|
function encodeMessage(message: Message): string;
|
|
60
73
|
}
|
|
61
74
|
export declare const OP_RETURN_EMPTY_PKSCRIPT: Uint8Array<ArrayBuffer>;
|
|
@@ -68,6 +81,6 @@ export declare const TAG_INTENT_PROOF = "ark-intent-proof-message";
|
|
|
68
81
|
*
|
|
69
82
|
* @param message - The message to embed
|
|
70
83
|
* @param pkScript - The scriptPubKey of the signer's address
|
|
71
|
-
* @param tag - Tagged-hash tag (defaults to the
|
|
84
|
+
* @param tag - Tagged-hash tag (defaults to the Arkade intent proof tag)
|
|
72
85
|
*/
|
|
73
86
|
export declare function craftToSpendTx(message: string, pkScript: Uint8Array, tag?: string): Transaction;
|
|
@@ -3,8 +3,11 @@ import { TreeNonces, TreePartialSigs } from "../tree/signingSession";
|
|
|
3
3
|
import { Vtxo } from "./indexer";
|
|
4
4
|
import type { IntentFeeConfig } from "../arkfee";
|
|
5
5
|
import { Intent } from "../intent";
|
|
6
|
+
/** Output requested during settlement or transaction submission. */
|
|
6
7
|
export type Output = {
|
|
8
|
+
/** Destination address, either onchain or Arkade (offchain). */
|
|
7
9
|
address: string;
|
|
10
|
+
/** Amount to send in satoshis. */
|
|
8
11
|
amount: bigint;
|
|
9
12
|
};
|
|
10
13
|
export declare enum SettlementEventType {
|
|
@@ -44,6 +47,7 @@ export type TreeNoncesEvent = {
|
|
|
44
47
|
id: string;
|
|
45
48
|
topic: string[];
|
|
46
49
|
txid: string;
|
|
50
|
+
/** Musig2 public nonces keyed by cosigner public key. */
|
|
47
51
|
nonces: TreeNonces;
|
|
48
52
|
};
|
|
49
53
|
export type BatchStartedEvent = {
|
|
@@ -108,53 +112,87 @@ export interface ArkInfo {
|
|
|
108
112
|
sessionDuration: bigint;
|
|
109
113
|
signerPubkey: string;
|
|
110
114
|
unilateralExitDelay: bigint;
|
|
115
|
+
/**
|
|
116
|
+
* Maximum boarding input amount.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* `-1` means unlimited, while `0` disables boarding.
|
|
120
|
+
*/
|
|
111
121
|
utxoMaxAmount: bigint;
|
|
112
122
|
utxoMinAmount: bigint;
|
|
113
123
|
version: string;
|
|
124
|
+
/**
|
|
125
|
+
* Maximum virtual output amount.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* `-1` means unlimited.
|
|
129
|
+
*/
|
|
114
130
|
vtxoMaxAmount: bigint;
|
|
115
131
|
vtxoMinAmount: bigint;
|
|
116
132
|
}
|
|
133
|
+
/** Signed intent payload sent to the Arkade server. */
|
|
117
134
|
export interface SignedIntent<T extends Intent.Message> {
|
|
135
|
+
/** Base64-encoded signed proof transaction. */
|
|
118
136
|
proof: string;
|
|
137
|
+
/** Intent message payload associated with the proof. */
|
|
119
138
|
message: T;
|
|
120
139
|
}
|
|
140
|
+
/** Transaction notification emitted by the Arkade server stream. */
|
|
121
141
|
export interface TxNotification {
|
|
142
|
+
/** Transaction id. */
|
|
122
143
|
txid: string;
|
|
144
|
+
/** Raw transaction payload. */
|
|
123
145
|
tx: string;
|
|
146
|
+
/** Virtual outputs spent by the transaction. */
|
|
124
147
|
spentVtxos: Vtxo[];
|
|
148
|
+
/** Virtual outputs made spendable by the transaction. */
|
|
125
149
|
spendableVtxos: Vtxo[];
|
|
150
|
+
/** Optional checkpoint transactions associated with the notification. */
|
|
126
151
|
checkpointTxs?: Record<string, {
|
|
127
152
|
txid: string;
|
|
128
153
|
tx: string;
|
|
129
154
|
}>;
|
|
130
155
|
}
|
|
131
156
|
export interface ArkProvider {
|
|
157
|
+
/** Fetch Arkade server configuration and fee settings. */
|
|
132
158
|
getInfo(): Promise<ArkInfo>;
|
|
159
|
+
/** Submit a signed Arkade transaction and its checkpoint transactions. */
|
|
133
160
|
submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
|
|
134
161
|
arkTxid: string;
|
|
135
162
|
finalArkTx: string;
|
|
136
163
|
signedCheckpointTxs: string[];
|
|
137
164
|
}>;
|
|
165
|
+
/** Finalize a previously submitted Arkade transaction. */
|
|
138
166
|
finalizeTx(arkTxid: string, finalCheckpointTxs: string[]): Promise<void>;
|
|
167
|
+
/** Register a signed intent with the Arkade server. */
|
|
139
168
|
registerIntent(intent: SignedIntent<Intent.RegisterMessage>): Promise<string>;
|
|
169
|
+
/** Delete a previously registered intent. */
|
|
140
170
|
deleteIntent(intent: SignedIntent<Intent.DeleteMessage>): Promise<void>;
|
|
171
|
+
/** Confirm an already registered intent id. */
|
|
141
172
|
confirmRegistration(intentId: string): Promise<void>;
|
|
173
|
+
/** Submit musig2 tree nonces for a batch signing session. */
|
|
142
174
|
submitTreeNonces(batchId: string, pubkey: string, nonces: TreeNonces): Promise<void>;
|
|
175
|
+
/** Submit musig2 partial signatures for a batch signing session. */
|
|
143
176
|
submitTreeSignatures(batchId: string, pubkey: string, signatures: TreePartialSigs): Promise<void>;
|
|
177
|
+
/** Submit signed forfeit transactions for cooperative settlement. */
|
|
144
178
|
submitSignedForfeitTxs(signedForfeitTxs: string[], signedCommitmentTx?: string): Promise<void>;
|
|
179
|
+
/** Open the settlement event stream for the given topics. */
|
|
145
180
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
181
|
+
/** Stream transaction notifications emitted by the Arkade server. */
|
|
146
182
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{
|
|
147
183
|
commitmentTx?: TxNotification;
|
|
148
184
|
arkTx?: TxNotification;
|
|
149
185
|
}>;
|
|
186
|
+
/** Fetch pending transactions for a signed get-pending-tx intent. */
|
|
150
187
|
getPendingTxs(intent: SignedIntent<Intent.GetPendingTxMessage>): Promise<PendingTx[]>;
|
|
151
188
|
}
|
|
152
189
|
/**
|
|
153
|
-
* REST-based
|
|
190
|
+
* REST-based Arkade provider implementation.
|
|
191
|
+
*
|
|
154
192
|
* @see https://buf.build/arkade-os/arkd/docs/main:ark.v1#ark.v1.ArkService
|
|
155
193
|
* @example
|
|
156
194
|
* ```typescript
|
|
157
|
-
* const provider = new RestArkProvider('https://
|
|
195
|
+
* const provider = new RestArkProvider('https://arkade.computer');
|
|
158
196
|
* const info = await provider.getInfo();
|
|
159
197
|
* ```
|
|
160
198
|
*/
|
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
import { Intent } from "../intent";
|
|
2
2
|
import { SignedIntent } from "./ark";
|
|
3
|
+
/**
|
|
4
|
+
* Delegate identity and fee information returned by `getDelegateInfo`.
|
|
5
|
+
*/
|
|
3
6
|
export interface DelegateInfo {
|
|
7
|
+
/** Delegate public key. */
|
|
4
8
|
pubkey: string;
|
|
9
|
+
/** Delegate fee amount or expression returned by the delegation service. */
|
|
5
10
|
fee: string;
|
|
11
|
+
/**
|
|
12
|
+
* Address controlled by the delegation service.
|
|
13
|
+
* Naming is confusing: should be thought of as a "delegate address".
|
|
14
|
+
*/
|
|
6
15
|
delegatorAddress: string;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Optional delegate behavior flags.
|
|
19
|
+
*/
|
|
8
20
|
export interface DelegateOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Instruct the delegate not to replace an existing delegation
|
|
23
|
+
* (meaning a signed register intent and its forfeit transactions)
|
|
24
|
+
* that already includes at least one virtual output from this request.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
27
|
+
*/
|
|
9
28
|
rejectReplace?: boolean;
|
|
10
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Provider interface for remote delegation services.
|
|
32
|
+
*/
|
|
11
33
|
export interface DelegatorProvider {
|
|
34
|
+
/**
|
|
35
|
+
* Request delegation for a signed register intent and its forfeit transactions.
|
|
36
|
+
*
|
|
37
|
+
* @param intent - Signed register intent to delegate
|
|
38
|
+
* @param forfeitTxs - Forfeit transactions associated with the delegation request
|
|
39
|
+
* @param options - Optional delegate behavior flags
|
|
40
|
+
*/
|
|
12
41
|
delegate(intent: SignedIntent<Intent.RegisterMessage>, forfeitTxs: string[], options?: DelegateOptions): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Fetch delegate metadata such as pubkey, fee, and delegate address.
|
|
44
|
+
*
|
|
45
|
+
* @returns Delegate identity and fee information
|
|
46
|
+
*/
|
|
13
47
|
getDelegateInfo(): Promise<DelegateInfo>;
|
|
14
48
|
}
|
|
15
49
|
/**
|
|
16
|
-
* REST-based
|
|
50
|
+
* REST-based delegation provider implementation.
|
|
17
51
|
* @example
|
|
18
52
|
* ```typescript
|
|
19
53
|
* const provider = new RestDelegatorProvider('https://delegator.example.com');
|
|
@@ -23,7 +57,26 @@ export interface DelegatorProvider {
|
|
|
23
57
|
*/
|
|
24
58
|
export declare class RestDelegatorProvider implements DelegatorProvider {
|
|
25
59
|
url: string;
|
|
60
|
+
/**
|
|
61
|
+
* Create a REST delegation provider targeting the given base URL.
|
|
62
|
+
*
|
|
63
|
+
* @param url - Base URL of the delegation service
|
|
64
|
+
*/
|
|
26
65
|
constructor(url: string);
|
|
66
|
+
/**
|
|
67
|
+
* Submit a delegation request to the remote delegation service.
|
|
68
|
+
*
|
|
69
|
+
* @param intent - Signed register intent to delegate
|
|
70
|
+
* @param forfeitTxs - Forfeit transactions associated with the delegation request
|
|
71
|
+
* @param options - Optional delegate behavior flags
|
|
72
|
+
* @throws Error if the remote service rejects the request
|
|
73
|
+
*/
|
|
27
74
|
delegate(intent: SignedIntent<Intent.RegisterMessage>, forfeitTxs: string[], options?: DelegateOptions): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Fetch delegate metadata exposed by the remote delegation service.
|
|
77
|
+
*
|
|
78
|
+
* @returns Delegate identity and fee information
|
|
79
|
+
* @throws Error if the remote service returns invalid data
|
|
80
|
+
*/
|
|
28
81
|
getDelegateInfo(): Promise<DelegateInfo>;
|
|
29
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RestArkProvider, SettlementEvent, TxNotification } from "./ark";
|
|
2
2
|
/**
|
|
3
|
-
* Expo-compatible
|
|
3
|
+
* Expo-compatible Arkade provider implementation using expo/fetch for SSE support.
|
|
4
4
|
* This provider works specifically in React Native/Expo environments where
|
|
5
5
|
* standard EventSource is not available but expo/fetch provides SSE capabilities.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { RestArkProvider, SettlementEvent, TxNotification } from "./ark";
|
|
|
8
8
|
* ```typescript
|
|
9
9
|
* import { ExpoArkProvider } from '@arkade-os/sdk/providers/expo';
|
|
10
10
|
*
|
|
11
|
-
* const provider = new ExpoArkProvider('https://
|
|
11
|
+
* const provider = new ExpoArkProvider('https://arkade.computer');
|
|
12
12
|
* const info = await provider.getInfo();
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
@@ -33,6 +33,7 @@ export interface ChainTx {
|
|
|
33
33
|
txid: string;
|
|
34
34
|
expiresAt: string;
|
|
35
35
|
type: ChainTxType;
|
|
36
|
+
/** IDs of the transactions in the chain used as input of the current transaction. */
|
|
36
37
|
spends: string[];
|
|
37
38
|
}
|
|
38
39
|
export interface CommitmentTx {
|
|
@@ -101,61 +102,163 @@ export interface SubscriptionHeartbeat {
|
|
|
101
102
|
export interface SubscriptionEvent extends SubscriptionResponse {
|
|
102
103
|
type: "event";
|
|
103
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Filters accepted by `IndexerProvider.getVtxos`.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* Exactly one of `scripts` or `outpoints` must be supplied.
|
|
110
|
+
*
|
|
111
|
+
* @see IndexerProvider.getVtxos
|
|
112
|
+
*/
|
|
104
113
|
export type GetVtxosOptions = PaginationOptions & {
|
|
114
|
+
/** Only return spendable virtual outputs. */
|
|
105
115
|
spendableOnly?: boolean;
|
|
116
|
+
/** Only return spent virtual outputs. */
|
|
106
117
|
spentOnly?: boolean;
|
|
118
|
+
/** Only return recoverable virtual outputs. */
|
|
107
119
|
recoverableOnly?: boolean;
|
|
120
|
+
/** Only return pending/preconfirmed virtual outputs. */
|
|
108
121
|
pendingOnly?: boolean;
|
|
122
|
+
/** Only return virtual outputs created after this timestamp. */
|
|
109
123
|
after?: number;
|
|
124
|
+
/** Only return virtual outputs created before this timestamp. */
|
|
110
125
|
before?: number;
|
|
111
126
|
} & ({
|
|
127
|
+
/** Scripts to search for matching virtual outputs. */
|
|
112
128
|
scripts: string[];
|
|
113
129
|
outpoints?: never;
|
|
114
130
|
} | {
|
|
131
|
+
/** Explicit outpoints to fetch. */
|
|
115
132
|
outpoints: Outpoint[];
|
|
116
133
|
scripts?: never;
|
|
117
134
|
});
|
|
118
135
|
export interface IndexerProvider {
|
|
136
|
+
/**
|
|
137
|
+
* Fetch the virtual output tree for a batch outpoint.
|
|
138
|
+
*
|
|
139
|
+
* @param batchOutpoint - Batch outpoint whose tree should be fetched
|
|
140
|
+
* @param opts - Optional pagination settings
|
|
141
|
+
* @returns virtual output tree nodes and optional pagination state
|
|
142
|
+
*/
|
|
119
143
|
getVtxoTree(batchOutpoint: Outpoint, opts?: PaginationOptions): Promise<{
|
|
120
144
|
vtxoTree: Tx[];
|
|
121
145
|
page?: PageResponse;
|
|
122
146
|
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Fetch the leaf outpoints for a batch virtual output tree.
|
|
149
|
+
*
|
|
150
|
+
* @param batchOutpoint - Batch outpoint whose leaf outpoints should be fetched
|
|
151
|
+
* @param opts - Optional pagination settings
|
|
152
|
+
* @returns Leaf outpoints and optional pagination state
|
|
153
|
+
*/
|
|
123
154
|
getVtxoTreeLeaves(batchOutpoint: Outpoint, opts?: PaginationOptions): Promise<{
|
|
124
155
|
leaves: Outpoint[];
|
|
125
156
|
page?: PageResponse;
|
|
126
157
|
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Fetch sweep transactions that spent a batch.
|
|
160
|
+
*
|
|
161
|
+
* @param batchOutpoint - Batch outpoint to inspect
|
|
162
|
+
* @returns Sweep transaction ids
|
|
163
|
+
*/
|
|
127
164
|
getBatchSweepTransactions(batchOutpoint: Outpoint): Promise<{
|
|
128
165
|
sweptBy: string[];
|
|
129
166
|
}>;
|
|
167
|
+
/**
|
|
168
|
+
* Fetch a commitment transaction by txid.
|
|
169
|
+
*
|
|
170
|
+
* @param txid - Commitment transaction id
|
|
171
|
+
* @returns Commitment transaction details
|
|
172
|
+
*/
|
|
130
173
|
getCommitmentTx(txid: string): Promise<CommitmentTx>;
|
|
174
|
+
/**
|
|
175
|
+
* Fetch connector transactions for a commitment transaction.
|
|
176
|
+
*
|
|
177
|
+
* @param txid - Commitment transaction id
|
|
178
|
+
* @param opts - Optional pagination settings
|
|
179
|
+
* @returns Connector transactions and optional pagination state
|
|
180
|
+
*/
|
|
131
181
|
getCommitmentTxConnectors(txid: string, opts?: PaginationOptions): Promise<{
|
|
132
182
|
connectors: Tx[];
|
|
133
183
|
page?: PageResponse;
|
|
134
184
|
}>;
|
|
185
|
+
/**
|
|
186
|
+
* Fetch forfeit transaction ids for a commitment transaction.
|
|
187
|
+
*
|
|
188
|
+
* @param txid - Commitment transaction id
|
|
189
|
+
* @param opts - Optional pagination settings
|
|
190
|
+
* @returns Forfeit transaction ids and optional pagination state
|
|
191
|
+
*/
|
|
135
192
|
getCommitmentTxForfeitTxs(txid: string, opts?: PaginationOptions): Promise<{
|
|
136
193
|
txids: string[];
|
|
137
194
|
page?: PageResponse;
|
|
138
195
|
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Open a streamed subscription for a previously created subscription id.
|
|
198
|
+
*
|
|
199
|
+
* @param subscriptionId - Subscription identifier returned by `subscribeForScripts`
|
|
200
|
+
* @param abortSignal - Signal used to terminate the stream
|
|
201
|
+
* @returns Async iterator of subscription responses
|
|
202
|
+
*/
|
|
139
203
|
getSubscription(subscriptionId: string, abortSignal: AbortSignal): AsyncIterableIterator<SubscriptionResponse>;
|
|
204
|
+
/**
|
|
205
|
+
* Fetch raw virtual transactions by txid.
|
|
206
|
+
*
|
|
207
|
+
* @param txids - Virtual transaction ids to fetch
|
|
208
|
+
* @param opts - Optional pagination settings
|
|
209
|
+
* @returns Raw virtual transactions and optional pagination state
|
|
210
|
+
*/
|
|
140
211
|
getVirtualTxs(txids: string[], opts?: PaginationOptions): Promise<{
|
|
141
212
|
txs: string[];
|
|
142
213
|
page?: PageResponse;
|
|
143
214
|
}>;
|
|
215
|
+
/**
|
|
216
|
+
* Fetch the ancestry chain for a virtual output.
|
|
217
|
+
*
|
|
218
|
+
* @param vtxoOutpoint - Virtual output outpoint to inspect
|
|
219
|
+
* @param opts - Optional pagination settings
|
|
220
|
+
* @returns Chain data and optional pagination state
|
|
221
|
+
*/
|
|
144
222
|
getVtxoChain(vtxoOutpoint: Outpoint, opts?: PaginationOptions): Promise<VtxoChain>;
|
|
223
|
+
/**
|
|
224
|
+
* Fetch virtual outputs by script set or outpoints.
|
|
225
|
+
*
|
|
226
|
+
* @param opts - Virtual output filters and pagination settings
|
|
227
|
+
* @returns Virtual outputs and optional pagination state
|
|
228
|
+
*/
|
|
145
229
|
getVtxos(opts?: GetVtxosOptions): Promise<{
|
|
146
230
|
vtxos: VirtualCoin[];
|
|
147
231
|
page?: PageResponse;
|
|
148
232
|
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Fetch metadata for a specific asset id.
|
|
235
|
+
*
|
|
236
|
+
* @param assetId - Asset identifier
|
|
237
|
+
* @returns Asset details
|
|
238
|
+
*/
|
|
149
239
|
getAssetDetails(assetId: string): Promise<AssetDetails>;
|
|
240
|
+
/**
|
|
241
|
+
* Create or extend a subscription for a set of scripts.
|
|
242
|
+
*
|
|
243
|
+
* @param scripts - Scripts to monitor
|
|
244
|
+
* @param subscriptionId - Existing subscription id to extend
|
|
245
|
+
* @returns Subscription id
|
|
246
|
+
*/
|
|
150
247
|
subscribeForScripts(scripts: string[], subscriptionId?: string): Promise<string>;
|
|
248
|
+
/**
|
|
249
|
+
* Remove some or all scripts from an existing subscription.
|
|
250
|
+
*
|
|
251
|
+
* @param subscriptionId - Subscription identifier to update
|
|
252
|
+
* @param scripts - Scripts to remove, or omit to remove all
|
|
253
|
+
*/
|
|
151
254
|
unsubscribeForScripts(subscriptionId: string, scripts?: string[]): Promise<void>;
|
|
152
255
|
}
|
|
153
256
|
/**
|
|
154
|
-
* REST-based
|
|
257
|
+
* REST-based indexer provider implementation.
|
|
155
258
|
* @see https://buf.build/arkade-os/arkd/docs/main:ark.v1#ark.v1.IndexerService
|
|
156
259
|
* @example
|
|
157
260
|
* ```typescript
|
|
158
|
-
* const provider = new RestIndexerProvider('https://
|
|
261
|
+
* const provider = new RestIndexerProvider('https://arkade.computer');
|
|
159
262
|
* const commitmentTx = await provider.getCommitmentTx("6686af8f3be3517880821f62e6c3d749b9d6713736a1d8e229a55daa659446b2");
|
|
160
263
|
* ```
|
|
161
264
|
*/
|