@arkade-os/sdk 0.3.9 → 0.3.10
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/providers/ark.js +6 -2
- package/dist/cjs/wallet/wallet.js +17 -1
- package/dist/esm/providers/ark.js +6 -2
- package/dist/esm/wallet/wallet.js +17 -1
- package/dist/types/wallet/index.d.ts +1 -0
- package/package.json +113 -123
|
@@ -50,8 +50,12 @@ class RestArkProvider {
|
|
|
50
50
|
fees: {
|
|
51
51
|
intentFee: {
|
|
52
52
|
...fromServer.fees?.intentFee,
|
|
53
|
-
onchainInput: BigInt(
|
|
54
|
-
|
|
53
|
+
onchainInput: BigInt(
|
|
54
|
+
// split(".")[0] to remove the decimal part
|
|
55
|
+
(fromServer.fees?.intentFee?.onchainInput ?? "0").split(".")[0] ?? 0),
|
|
56
|
+
onchainOutput: BigInt(
|
|
57
|
+
// split(".")[0] to remove the decimal part
|
|
58
|
+
(fromServer.fees?.intentFee?.onchainOutput ?? "0").split(".")[0] ?? 0),
|
|
55
59
|
},
|
|
56
60
|
txFeeRate: fromServer?.fees?.txFeeRate ?? "",
|
|
57
61
|
},
|
|
@@ -550,7 +550,23 @@ class Wallet extends ReadonlyWallet {
|
|
|
550
550
|
const virtualCoins = await this.getVirtualCoins({
|
|
551
551
|
withRecoverable: false,
|
|
552
552
|
});
|
|
553
|
-
|
|
553
|
+
let selected;
|
|
554
|
+
if (params.selectedVtxos) {
|
|
555
|
+
const selectedVtxoSum = params.selectedVtxos
|
|
556
|
+
.map((v) => v.value)
|
|
557
|
+
.reduce((a, b) => a + b, 0);
|
|
558
|
+
if (selectedVtxoSum < params.amount) {
|
|
559
|
+
throw new Error("Selected VTXOs do not cover specified amount");
|
|
560
|
+
}
|
|
561
|
+
const changeAmount = selectedVtxoSum - params.amount;
|
|
562
|
+
selected = {
|
|
563
|
+
inputs: params.selectedVtxos,
|
|
564
|
+
changeAmount: BigInt(changeAmount),
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
selected = selectVirtualCoins(virtualCoins, params.amount);
|
|
569
|
+
}
|
|
554
570
|
const selectedLeaf = this.offchainTapscript.forfeit();
|
|
555
571
|
if (!selectedLeaf) {
|
|
556
572
|
throw new Error("Selected leaf not found");
|
|
@@ -46,8 +46,12 @@ export class RestArkProvider {
|
|
|
46
46
|
fees: {
|
|
47
47
|
intentFee: {
|
|
48
48
|
...fromServer.fees?.intentFee,
|
|
49
|
-
onchainInput: BigInt(
|
|
50
|
-
|
|
49
|
+
onchainInput: BigInt(
|
|
50
|
+
// split(".")[0] to remove the decimal part
|
|
51
|
+
(fromServer.fees?.intentFee?.onchainInput ?? "0").split(".")[0] ?? 0),
|
|
52
|
+
onchainOutput: BigInt(
|
|
53
|
+
// split(".")[0] to remove the decimal part
|
|
54
|
+
(fromServer.fees?.intentFee?.onchainOutput ?? "0").split(".")[0] ?? 0),
|
|
51
55
|
},
|
|
52
56
|
txFeeRate: fromServer?.fees?.txFeeRate ?? "",
|
|
53
57
|
},
|
|
@@ -511,7 +511,23 @@ export class Wallet extends ReadonlyWallet {
|
|
|
511
511
|
const virtualCoins = await this.getVirtualCoins({
|
|
512
512
|
withRecoverable: false,
|
|
513
513
|
});
|
|
514
|
-
|
|
514
|
+
let selected;
|
|
515
|
+
if (params.selectedVtxos) {
|
|
516
|
+
const selectedVtxoSum = params.selectedVtxos
|
|
517
|
+
.map((v) => v.value)
|
|
518
|
+
.reduce((a, b) => a + b, 0);
|
|
519
|
+
if (selectedVtxoSum < params.amount) {
|
|
520
|
+
throw new Error("Selected VTXOs do not cover specified amount");
|
|
521
|
+
}
|
|
522
|
+
const changeAmount = selectedVtxoSum - params.amount;
|
|
523
|
+
selected = {
|
|
524
|
+
inputs: params.selectedVtxos,
|
|
525
|
+
changeAmount: BigInt(changeAmount),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
selected = selectVirtualCoins(virtualCoins, params.amount);
|
|
530
|
+
}
|
|
515
531
|
const selectedLeaf = this.offchainTapscript.forfeit();
|
|
516
532
|
if (!selectedLeaf) {
|
|
517
533
|
throw new Error("Selected leaf not found");
|
package/package.json
CHANGED
|
@@ -1,130 +1,120 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"./adapters/expo": {
|
|
18
|
-
"types": "./dist/types/adapters/expo.d.ts",
|
|
19
|
-
"import": "./dist/esm/adapters/expo.js",
|
|
20
|
-
"require": "./dist/cjs/adapters/expo.js",
|
|
21
|
-
"default": "./dist/esm/adapters/expo.js"
|
|
22
|
-
},
|
|
23
|
-
"./adapters/localStorage": {
|
|
24
|
-
"types": "./dist/types/adapters/localStorage.d.ts",
|
|
25
|
-
"import": "./dist/esm/adapters/localStorage.js",
|
|
26
|
-
"require": "./dist/cjs/adapters/localStorage.js",
|
|
27
|
-
"default": "./dist/esm/adapters/localStorage.js"
|
|
28
|
-
},
|
|
29
|
-
"./adapters/fileSystem": {
|
|
30
|
-
"types": "./dist/types/adapters/fileSystem.d.ts",
|
|
31
|
-
"import": "./dist/esm/adapters/fileSystem.js",
|
|
32
|
-
"require": "./dist/cjs/adapters/fileSystem.js",
|
|
33
|
-
"default": "./dist/esm/adapters/fileSystem.js"
|
|
34
|
-
},
|
|
35
|
-
"./adapters/indexedDB": {
|
|
36
|
-
"types": "./dist/types/adapters/indexedDB.d.ts",
|
|
37
|
-
"import": "./dist/esm/adapters/indexedDB.js",
|
|
38
|
-
"require": "./dist/cjs/adapters/indexedDB.js",
|
|
39
|
-
"default": "./dist/esm/adapters/indexedDB.js"
|
|
40
|
-
},
|
|
41
|
-
"./adapters/asyncStorage": {
|
|
42
|
-
"types": "./dist/types/adapters/asyncStorage.d.ts",
|
|
43
|
-
"import": "./dist/esm/adapters/asyncStorage.js",
|
|
44
|
-
"require": "./dist/cjs/adapters/asyncStorage.js",
|
|
45
|
-
"default": "./dist/esm/adapters/asyncStorage.js"
|
|
46
|
-
}
|
|
2
|
+
"name": "@arkade-os/sdk",
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"description": "Bitcoin wallet SDK with Taproot and Ark integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cjs/index.js",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"require": "./dist/cjs/index.js",
|
|
15
|
+
"default": "./dist/esm/index.js"
|
|
47
16
|
},
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
"./adapters/expo": {
|
|
18
|
+
"types": "./dist/types/adapters/expo.d.ts",
|
|
19
|
+
"import": "./dist/esm/adapters/expo.js",
|
|
20
|
+
"require": "./dist/cjs/adapters/expo.js",
|
|
21
|
+
"default": "./dist/esm/adapters/expo.js"
|
|
54
22
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"build:browser": "node scripts/build-browser.js",
|
|
61
|
-
"docs:build": "pnpm run build:types && pnpm typedoc",
|
|
62
|
-
"docs:open": "open ./docs/index.html",
|
|
63
|
-
"test": "vitest run",
|
|
64
|
-
"test:master": "ARK_ENV=master vitest run",
|
|
65
|
-
"test:unit": "vitest run --exclude test/e2e",
|
|
66
|
-
"test:setup": "node test/setup.js",
|
|
67
|
-
"test:setup-docker": "node test/setup.js docker",
|
|
68
|
-
"test:build-docker": "docker compose -f docker-compose.yml build --no-cache",
|
|
69
|
-
"test:up-docker": "docker compose -f docker-compose.yml up -d",
|
|
70
|
-
"test:down-docker": "docker compose -f docker-compose.yml down",
|
|
71
|
-
"test:integration": "vitest run test/e2e/**",
|
|
72
|
-
"test:integration-docker": "ARK_ENV=docker vitest run test/e2e/**",
|
|
73
|
-
"test:watch": "vitest",
|
|
74
|
-
"test:coverage": "vitest run --coverage",
|
|
75
|
-
"test:sw": "pnpm run build:browser && node test/serviceWorker/serve.js",
|
|
76
|
-
"expo:web:install": "cd examples/expo-demo && pnpm install",
|
|
77
|
-
"expo:web": "cd examples/expo-demo && pnpm start",
|
|
78
|
-
"format": "prettier --write src test examples",
|
|
79
|
-
"lint": "prettier --check src test examples",
|
|
80
|
-
"audit": "pnpm audit",
|
|
81
|
-
"preinstall": "npx only-allow pnpm",
|
|
82
|
-
"prepare": "husky",
|
|
83
|
-
"prepublishOnly": "pnpm run build",
|
|
84
|
-
"release": "bash scripts/release.sh",
|
|
85
|
-
"release:dry-run": "bash scripts/release.sh --dry-run",
|
|
86
|
-
"release:cleanup": "bash scripts/release.sh --cleanup"
|
|
23
|
+
"./adapters/localStorage": {
|
|
24
|
+
"types": "./dist/types/adapters/localStorage.d.ts",
|
|
25
|
+
"import": "./dist/esm/adapters/localStorage.js",
|
|
26
|
+
"require": "./dist/cjs/adapters/localStorage.js",
|
|
27
|
+
"default": "./dist/esm/adapters/localStorage.js"
|
|
87
28
|
},
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"bip68": "1.0.4"
|
|
29
|
+
"./adapters/fileSystem": {
|
|
30
|
+
"types": "./dist/types/adapters/fileSystem.d.ts",
|
|
31
|
+
"import": "./dist/esm/adapters/fileSystem.js",
|
|
32
|
+
"require": "./dist/cjs/adapters/fileSystem.js",
|
|
33
|
+
"default": "./dist/esm/adapters/fileSystem.js"
|
|
94
34
|
},
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"eventsource": "4.0.0",
|
|
101
|
-
"glob": "11.0.3",
|
|
102
|
-
"husky": "9.1.7",
|
|
103
|
-
"prettier": "3.6.2",
|
|
104
|
-
"rimraf": "^6.0.1",
|
|
105
|
-
"typedoc": "^0.28.12",
|
|
106
|
-
"typescript": "5.9.2",
|
|
107
|
-
"vitest": "3.2.4"
|
|
35
|
+
"./adapters/indexedDB": {
|
|
36
|
+
"types": "./dist/types/adapters/indexedDB.d.ts",
|
|
37
|
+
"import": "./dist/esm/adapters/indexedDB.js",
|
|
38
|
+
"require": "./dist/cjs/adapters/indexedDB.js",
|
|
39
|
+
"default": "./dist/esm/adapters/indexedDB.js"
|
|
108
40
|
},
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"sdk",
|
|
115
|
-
"arkade"
|
|
116
|
-
],
|
|
117
|
-
"author": "Ark Labs",
|
|
118
|
-
"license": "MIT",
|
|
119
|
-
"packageManager": "pnpm@10.20.0",
|
|
120
|
-
"engines": {
|
|
121
|
-
"node": ">=20.0.0"
|
|
122
|
-
},
|
|
123
|
-
"pnpm": {
|
|
124
|
-
"overrides": {
|
|
125
|
-
"esbuild": ">=0.25.0",
|
|
126
|
-
"brace-expansion": ">=2.0.2",
|
|
127
|
-
"minimatch": "9.0.3"
|
|
128
|
-
}
|
|
41
|
+
"./adapters/asyncStorage": {
|
|
42
|
+
"types": "./dist/types/adapters/asyncStorage.d.ts",
|
|
43
|
+
"import": "./dist/esm/adapters/asyncStorage.js",
|
|
44
|
+
"require": "./dist/cjs/adapters/asyncStorage.js",
|
|
45
|
+
"default": "./dist/esm/adapters/asyncStorage.js"
|
|
129
46
|
}
|
|
130
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist"
|
|
50
|
+
],
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@noble/curves": "2.0.0",
|
|
57
|
+
"@noble/secp256k1": "3.0.0",
|
|
58
|
+
"@scure/base": "2.0.0",
|
|
59
|
+
"@scure/btc-signer": "2.0.1",
|
|
60
|
+
"bip68": "1.0.4"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/node": "24.3.1",
|
|
64
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
65
|
+
"esbuild": "^0.25.9",
|
|
66
|
+
"expo": "~52.0.47",
|
|
67
|
+
"eventsource": "4.0.0",
|
|
68
|
+
"glob": "11.0.3",
|
|
69
|
+
"husky": "9.1.7",
|
|
70
|
+
"prettier": "3.6.2",
|
|
71
|
+
"rimraf": "^6.0.1",
|
|
72
|
+
"typedoc": "^0.28.12",
|
|
73
|
+
"typescript": "5.9.2",
|
|
74
|
+
"vitest": "3.2.4"
|
|
75
|
+
},
|
|
76
|
+
"keywords": [
|
|
77
|
+
"bitcoin",
|
|
78
|
+
"wallet",
|
|
79
|
+
"taproot",
|
|
80
|
+
"ark",
|
|
81
|
+
"sdk",
|
|
82
|
+
"arkade"
|
|
83
|
+
],
|
|
84
|
+
"author": "Ark Labs",
|
|
85
|
+
"license": "MIT",
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=20.0.0"
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"build": "rimraf dist && pnpm run build:esm && node scripts/add-extensions.js && pnpm run build:cjs && pnpm run build:types && node scripts/generate-package-files.js",
|
|
91
|
+
"build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm",
|
|
92
|
+
"build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs",
|
|
93
|
+
"build:types": "tsc -p tsconfig.json --outDir dist/types --emitDeclarationOnly",
|
|
94
|
+
"build:browser": "node scripts/build-browser.js",
|
|
95
|
+
"docs:build": "pnpm run build:types && pnpm typedoc",
|
|
96
|
+
"docs:open": "open ./docs/index.html",
|
|
97
|
+
"test": "vitest run",
|
|
98
|
+
"test:master": "ARK_ENV=master vitest run",
|
|
99
|
+
"test:unit": "vitest run --exclude test/e2e",
|
|
100
|
+
"test:setup": "node test/setup.js",
|
|
101
|
+
"test:setup-docker": "node test/setup.js docker",
|
|
102
|
+
"test:build-docker": "docker compose -f docker-compose.yml build --no-cache",
|
|
103
|
+
"test:up-docker": "docker compose -f docker-compose.yml up -d",
|
|
104
|
+
"test:down-docker": "docker compose -f docker-compose.yml down",
|
|
105
|
+
"test:integration": "vitest run test/e2e/**",
|
|
106
|
+
"test:integration-docker": "ARK_ENV=docker vitest run test/e2e/**",
|
|
107
|
+
"test:watch": "vitest",
|
|
108
|
+
"test:coverage": "vitest run --coverage",
|
|
109
|
+
"test:sw": "pnpm run build:browser && node test/serviceWorker/serve.js",
|
|
110
|
+
"expo:web:install": "cd examples/expo-demo && pnpm install",
|
|
111
|
+
"expo:web": "cd examples/expo-demo && pnpm start",
|
|
112
|
+
"format": "prettier --write src test examples",
|
|
113
|
+
"lint": "prettier --check src test examples",
|
|
114
|
+
"audit": "pnpm audit",
|
|
115
|
+
"preinstall": "npx only-allow pnpm",
|
|
116
|
+
"release": "bash scripts/release.sh",
|
|
117
|
+
"release:dry-run": "bash scripts/release.sh --dry-run",
|
|
118
|
+
"release:cleanup": "bash scripts/release.sh --cleanup"
|
|
119
|
+
}
|
|
120
|
+
}
|