@arkade-os/sdk 0.3.0-alpha.1 → 0.3.0-alpha.4
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/dist/cjs/identity/singleKey.js +3 -0
- package/dist/cjs/providers/ark.js +53 -71
- package/dist/cjs/providers/indexer.js +45 -51
- package/dist/cjs/providers/utils.js +60 -0
- package/dist/cjs/repositories/walletRepository.js +34 -4
- package/dist/cjs/script/tapscript.js +8 -2
- package/dist/cjs/tree/signingSession.js +3 -3
- package/dist/cjs/tree/txTree.js +3 -3
- package/dist/cjs/tree/validation.js +1 -1
- package/dist/cjs/wallet/serviceWorker/utils.js +5 -5
- package/dist/cjs/wallet/wallet.js +5 -6
- package/dist/esm/identity/singleKey.js +4 -1
- package/dist/esm/providers/ark.js +53 -71
- package/dist/esm/providers/indexer.js +45 -51
- package/dist/esm/providers/utils.js +57 -0
- package/dist/esm/repositories/walletRepository.js +34 -4
- package/dist/esm/script/tapscript.js +8 -2
- package/dist/esm/tree/signingSession.js +3 -3
- package/dist/esm/tree/txTree.js +3 -3
- package/dist/esm/tree/validation.js +1 -1
- package/dist/esm/wallet/serviceWorker/utils.js +5 -5
- package/dist/esm/wallet/wallet.js +5 -6
- package/dist/types/identity/index.d.ts +3 -2
- package/dist/types/identity/singleKey.d.ts +1 -0
- package/dist/types/providers/ark.d.ts +1 -0
- package/dist/types/providers/utils.d.ts +1 -0
- package/dist/types/tree/txTree.d.ts +2 -2
- package/package.json +2 -1
|
@@ -98,10 +98,8 @@ export class Wallet {
|
|
|
98
98
|
// Save tapscripts
|
|
99
99
|
const offchainTapscript = bareVtxoTapscript;
|
|
100
100
|
// the serverUnrollScript is the one used to create output scripts of the checkpoint transactions
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
pubkeys: [serverPubKey],
|
|
104
|
-
});
|
|
101
|
+
const rawCheckpointExitClosure = hex.decode(info.checkpointExitClosure);
|
|
102
|
+
const serverUnrollScript = CSVMultisigTapscript.decode(rawCheckpointExitClosure);
|
|
105
103
|
// parse the server forfeit address
|
|
106
104
|
// server is expecting funds to be sent to this address
|
|
107
105
|
const forfeitAddress = Address(network).decode(info.forfeitAddress);
|
|
@@ -167,8 +165,9 @@ export class Wallet {
|
|
|
167
165
|
}
|
|
168
166
|
async getVtxos(filter) {
|
|
169
167
|
const address = await this.getAddress();
|
|
170
|
-
// Try to get from cache first
|
|
171
|
-
const cachedVtxos = await this.walletRepository.getVtxos(address);
|
|
168
|
+
// Try to get from cache first first (optional fast path)
|
|
169
|
+
// const cachedVtxos = await this.walletRepository.getVtxos(address);
|
|
170
|
+
// if (cachedVtxos.length) return cachedVtxos;
|
|
172
171
|
// For now, always fetch fresh data from provider and update cache
|
|
173
172
|
// In future, we can add cache invalidation logic based on timestamps
|
|
174
173
|
const spendableVtxos = await this.getVirtualCoins(filter);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Transaction } from "@scure/btc-signer/transaction.js";
|
|
2
2
|
import { SignerSession } from "../tree/signingSession";
|
|
3
3
|
export interface Identity {
|
|
4
|
-
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
5
|
-
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
6
4
|
signerSession(): SignerSession;
|
|
5
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
6
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
7
7
|
signMessage(message: string): Promise<Uint8Array>;
|
|
8
|
+
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
8
9
|
}
|
|
9
10
|
export * from "./singleKey";
|
|
@@ -32,6 +32,7 @@ export declare class SingleKey implements Identity {
|
|
|
32
32
|
*/
|
|
33
33
|
toHex(): string;
|
|
34
34
|
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
35
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
35
36
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
36
37
|
signerSession(): SignerSession;
|
|
37
38
|
signMessage(message: string): Promise<Uint8Array>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function eventSourceIterator(eventSource: EventSource): AsyncGenerator<MessageEvent, void, unknown>;
|
|
@@ -13,7 +13,7 @@ export type TxTreeNode = {
|
|
|
13
13
|
* TxTree is a graph of bitcoin transactions.
|
|
14
14
|
* It is used to represent batch tree created during settlement session
|
|
15
15
|
*/
|
|
16
|
-
export declare class TxTree
|
|
16
|
+
export declare class TxTree {
|
|
17
17
|
readonly root: Transaction;
|
|
18
18
|
readonly children: Map<number, TxTree>;
|
|
19
19
|
constructor(root: Transaction, children?: Map<number, TxTree>);
|
|
@@ -24,5 +24,5 @@ export declare class TxTree implements Iterable<TxTree> {
|
|
|
24
24
|
get txid(): string;
|
|
25
25
|
find(txid: string): TxTree | null;
|
|
26
26
|
update(txid: string, fn: (tx: Transaction) => void): void;
|
|
27
|
-
|
|
27
|
+
iterator(): Generator<TxTree, void, unknown>;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkade-os/sdk",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.4",
|
|
4
4
|
"description": "Bitcoin wallet SDK with Taproot and Ark integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@types/node": "24.3.1",
|
|
59
59
|
"@vitest/coverage-v8": "3.2.4",
|
|
60
60
|
"esbuild": "^0.25.9",
|
|
61
|
+
"eventsource": "4.0.0",
|
|
61
62
|
"glob": "11.0.3",
|
|
62
63
|
"husky": "9.1.7",
|
|
63
64
|
"prettier": "3.6.2",
|