@frontiercompute/zcash-ika 0.6.0 → 0.6.1
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 +20 -0
- package/dist/btc-tx-builder.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
Split-key custody for Zcash, Bitcoin, and EVM chains. The private key never exists whole. Spend policy enforced on-chain. Every action attested to Zcash.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@frontiercompute/zcash-ika)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
[](https://www.npmjs.com/package/@frontiercompute/zcash-ika)
|
|
9
|
+
[](https://github.com/Frontier-Compute/zcash-ika/blob/main/LICENSE)
|
|
6
10
|
|
|
7
11
|
## What this does
|
|
8
12
|
|
|
@@ -183,6 +187,22 @@ SUI_PRIVATE_KEY=... node dist/test-e2e.js
|
|
|
183
187
|
- [Zebra](https://github.com/ZcashFoundation/zebra) - Zcash node
|
|
184
188
|
- [Sui Move](https://docs.sui.io/concepts/sui-move-concepts) - policy enforcement
|
|
185
189
|
|
|
190
|
+
## See also
|
|
191
|
+
|
|
192
|
+
- [@frontiercompute/zcash-mcp](https://www.npmjs.com/package/@frontiercompute/zcash-mcp) - MCP server for Zcash wallets and nodes
|
|
193
|
+
- [@frontiercompute/openclaw-zap1](https://www.npmjs.com/package/@frontiercompute/openclaw-zap1) - OpenClaw attestation client for ZAP1
|
|
194
|
+
- [@frontiercompute/zap1](https://www.npmjs.com/package/@frontiercompute/zap1) - ZAP1 on-chain attestation SDK
|
|
195
|
+
- [@frontiercompute/zcash-ika](https://www.npmjs.com/package/@frontiercompute/zcash-ika) - Split-key custody for Zcash, Bitcoin, and EVM (this package)
|
|
196
|
+
|
|
197
|
+
## Related Packages
|
|
198
|
+
|
|
199
|
+
| Package | What it does |
|
|
200
|
+
|---------|-------------|
|
|
201
|
+
| [@frontiercompute/zcash-mcp](https://www.npmjs.com/package/@frontiercompute/zcash-mcp) | MCP server for Zcash (22 tools) |
|
|
202
|
+
| [@frontiercompute/openclaw-zap1](https://www.npmjs.com/package/@frontiercompute/openclaw-zap1) | OpenClaw skill for ZAP1 attestation |
|
|
203
|
+
| [@frontiercompute/zap1](https://www.npmjs.com/package/@frontiercompute/zap1) | ZAP1 attestation client |
|
|
204
|
+
| [@frontiercompute/silo-zap1](https://www.npmjs.com/package/@frontiercompute/silo-zap1) | Silo agent attestation via ZAP1 |
|
|
205
|
+
|
|
186
206
|
## License
|
|
187
207
|
|
|
188
208
|
MIT
|
package/dist/btc-tx-builder.js
CHANGED
|
@@ -245,6 +245,8 @@ export function computeBtcSighash(inputs, outputs, inputIndex, hashType = SIGHAS
|
|
|
245
245
|
export function buildUnsignedBtcTx(utxos, txOutputs, changeAddress, fee) {
|
|
246
246
|
if (utxos.length === 0)
|
|
247
247
|
throw new Error("No UTXOs provided");
|
|
248
|
+
if (fee < 0)
|
|
249
|
+
throw new Error("Fee must be non-negative");
|
|
248
250
|
// Build inputs
|
|
249
251
|
const inputs = utxos.map((u) => ({
|
|
250
252
|
prevTxid: reverseTxid(u.txid),
|
|
@@ -270,6 +272,12 @@ export function buildUnsignedBtcTx(utxos, txOutputs, changeAddress, fee) {
|
|
|
270
272
|
else if (change < 0) {
|
|
271
273
|
throw new Error(`UTXOs total ${totalInput} < outputs ${totalOutput} + fee ${fee}`);
|
|
272
274
|
}
|
|
275
|
+
// Warn on dust outputs (let the network reject them)
|
|
276
|
+
for (const out of outputs) {
|
|
277
|
+
if (out.value < 546) {
|
|
278
|
+
console.warn(`Warning: output value ${out.value} sats is below dust threshold (546)`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
273
281
|
// Compute per-input sighashes
|
|
274
282
|
const sighashes = [];
|
|
275
283
|
for (let i = 0; i < inputs.length; i++) {
|
package/dist/index.d.ts
CHANGED
|
@@ -261,6 +261,7 @@ export declare function registerAgent(config: ZcashIkaConfig, vaultId: string, a
|
|
|
261
261
|
export declare function requestSpend(config: ZcashIkaConfig, vaultId: string, agentCapId: string, amount: number, recipient: string, chain: string): Promise<{
|
|
262
262
|
approved: boolean;
|
|
263
263
|
txDigest: string;
|
|
264
|
+
error?: string;
|
|
264
265
|
}>;
|
|
265
266
|
/**
|
|
266
267
|
* Read the on-chain state of a CustodyVault.
|
package/dist/index.js
CHANGED
|
@@ -373,13 +373,18 @@ export async function sign(config, request) {
|
|
|
373
373
|
});
|
|
374
374
|
const presignIkaCoin = presignTx.object(ikaCoinId);
|
|
375
375
|
const presignSuiCoin = presignTx.splitCoins(presignTx.gas, [50_000_000]);
|
|
376
|
-
presignIkaTx.requestGlobalPresign({
|
|
376
|
+
const presignReturn = presignIkaTx.requestGlobalPresign({
|
|
377
377
|
dwalletNetworkEncryptionKeyId: dWallet.dwallet_network_encryption_key_id,
|
|
378
378
|
curve: Curve.SECP256K1,
|
|
379
379
|
signatureAlgorithm: SignatureAlgorithm.ECDSASecp256k1,
|
|
380
380
|
ikaCoin: presignIkaCoin,
|
|
381
381
|
suiCoin: presignSuiCoin,
|
|
382
382
|
});
|
|
383
|
+
// Transfer split SUI coin back and presign cap to ourselves
|
|
384
|
+
presignTx.transferObjects([presignSuiCoin], address);
|
|
385
|
+
if (presignReturn) {
|
|
386
|
+
presignTx.transferObjects([presignReturn], address);
|
|
387
|
+
}
|
|
383
388
|
const presignResult = await suiClient.signAndExecuteTransaction({
|
|
384
389
|
transaction: presignTx,
|
|
385
390
|
signer: keypair,
|
|
@@ -776,7 +781,7 @@ export async function requestSpend(config, vaultId, agentCapId, amount, recipien
|
|
|
776
781
|
options: { showEffects: true },
|
|
777
782
|
});
|
|
778
783
|
if (result.effects?.status?.status !== "success") {
|
|
779
|
-
return { approved: false, txDigest: result.digest };
|
|
784
|
+
return { approved: false, txDigest: result.digest, error: result.effects?.status?.error || "Policy violation" };
|
|
780
785
|
}
|
|
781
786
|
return { approved: true, txDigest: result.digest };
|
|
782
787
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontiercompute/zcash-ika",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Split-key custody for Zcash, Bitcoin, and EVM. 2PC-MPC signing, on-chain spend policy, transparent TX builder, ZAP1 attestation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|