@chironbuilder/ootle-sdk 0.1.11 → 0.1.12
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 +109 -90
- package/dist/burnClaim.d.ts +47 -0
- package/dist/burnClaim.d.ts.map +1 -0
- package/dist/burnClaim.js +68 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/wallet.d.ts +19 -0
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +77 -2
- package/package.json +1 -1
- package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +15 -0
- package/vendor/ootle-wasm-patched/ootle_wasm.js +1 -1
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +51 -0
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +2 -0
- package/vendor/ootle-wasm-patched/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,90 +1,109 @@
|
|
|
1
|
-
# @chironbuilder/ootle-sdk
|
|
2
|
-
|
|
3
|
-
A shared TypeScript client for [Tari Ootle](https://github.com/tari-project/tari-ootle) (L2): account
|
|
4
|
-
derivation, balances, transaction building/submission with automatic input resolution, HTLCs, and
|
|
5
|
-
stealth/confidential transfers.
|
|
6
|
-
|
|
7
|
-
This is the account core extracted from two independently-built wallets that had converged on
|
|
8
|
-
(mostly) the same code by hand — [Sapient](https://github.com/chironbuilds/tari-wallet), a Chrome
|
|
9
|
-
extension, and the [Tari L1 web wallet](https://universe.tari.mw)'s Ootle L2 support — after each had
|
|
10
|
-
picked up its own fixes the other was missing. This package exists so that stops happening: one
|
|
11
|
-
wallet core, used by both, with platform-specific concerns (storage, in this case) injected rather
|
|
12
|
-
than hardcoded.
|
|
13
|
-
|
|
14
|
-
**Status: early.** Extracted and reconciled in one pass; not yet wired back into either of the two
|
|
15
|
-
wallets above (they still carry their own local copies for now). Treat `0.x` as exactly that.
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @chironbuilder/ootle-sdk
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
This package vendors two small, still-unmerged patches: `@tari-project/ootle` (a `covenant_claims`
|
|
24
|
-
serialization gap in `StealthTransferStatement.toCompactJson()`, harmless for every transfer this SDK
|
|
25
|
-
builds today but not yet upstream-fixed) and `@tari-project/ootle-wasm` (adds
|
|
26
|
-
`createConfidentialWithdrawProofLiteral`, needed for confidential-vault withdrawals and not in the
|
|
27
|
-
published `0.39.x` builds). See `vendor/*/README.md` for each. Both are tracked for removal once
|
|
28
|
-
upstream ships the real fix — check there before assuming either is still needed.
|
|
29
|
-
|
|
30
|
-
## Storage
|
|
31
|
-
|
|
32
|
-
The SDK never touches a concrete storage API directly. It reads and writes through a small
|
|
33
|
-
`KeyValueStore` interface — configure one adapter, once, before calling anything else:
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
import { configureOotleStorage } from "@chironbuilder/ootle-sdk";
|
|
37
|
-
import { chromeStorageAdapter } from "@chironbuilder/ootle-sdk/adapters";
|
|
38
|
-
// or: localStorageAdapter, inMemoryAdapter (tests)
|
|
39
|
-
|
|
40
|
-
configureOotleStorage(chromeStorageAdapter());
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Write your own adapter for any other host — it's three methods (`get`/`set`/`remove`).
|
|
44
|
-
|
|
45
|
-
This only covers what the account core itself needs (shielded outputs, pending shields, the
|
|
46
|
-
private-payment scan cursor, the known-substate-versions cache). Address books, connected-site
|
|
47
|
-
permissions, daemon connections, and a full transaction-history UI are application concerns with
|
|
48
|
-
very different shapes per host — keep those in your own app's storage layer.
|
|
49
|
-
|
|
50
|
-
## Usage
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
import { OotleAccount, toOotleNetwork } from "@chironbuilder/ootle-sdk";
|
|
54
|
-
|
|
55
|
-
const account = OotleAccount.fromSeed(entropy, /* index */ 0, "esmeralda");
|
|
56
|
-
|
|
57
|
-
const balances = await account.getBalances();
|
|
58
|
-
await account.send(recipientWalletAddress, resourceAddress, amount);
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
See `src/wallet.ts`'s doc comments for the full `OotleAccount` surface — `send`, `sendPrivately`,
|
|
62
|
-
`shield`/`unshield`, `htlcFund`/`htlcClaim`/`htlcRefund`, `claimTestnetXtr`, `execute` (the general
|
|
63
|
-
instruction-builder escape hatch, with automatic missing-input discovery and lock-contention retry).
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
1
|
+
# @chironbuilder/ootle-sdk
|
|
2
|
+
|
|
3
|
+
A shared TypeScript client for [Tari Ootle](https://github.com/tari-project/tari-ootle) (L2): account
|
|
4
|
+
derivation, balances, transaction building/submission with automatic input resolution, HTLCs, and
|
|
5
|
+
stealth/confidential transfers.
|
|
6
|
+
|
|
7
|
+
This is the account core extracted from two independently-built wallets that had converged on
|
|
8
|
+
(mostly) the same code by hand — [Sapient](https://github.com/chironbuilds/tari-wallet), a Chrome
|
|
9
|
+
extension, and the [Tari L1 web wallet](https://universe.tari.mw)'s Ootle L2 support — after each had
|
|
10
|
+
picked up its own fixes the other was missing. This package exists so that stops happening: one
|
|
11
|
+
wallet core, used by both, with platform-specific concerns (storage, in this case) injected rather
|
|
12
|
+
than hardcoded.
|
|
13
|
+
|
|
14
|
+
**Status: early.** Extracted and reconciled in one pass; not yet wired back into either of the two
|
|
15
|
+
wallets above (they still carry their own local copies for now). Treat `0.x` as exactly that.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @chironbuilder/ootle-sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This package vendors two small, still-unmerged patches: `@tari-project/ootle` (a `covenant_claims`
|
|
24
|
+
serialization gap in `StealthTransferStatement.toCompactJson()`, harmless for every transfer this SDK
|
|
25
|
+
builds today but not yet upstream-fixed) and `@tari-project/ootle-wasm` (adds
|
|
26
|
+
`createConfidentialWithdrawProofLiteral`, needed for confidential-vault withdrawals and not in the
|
|
27
|
+
published `0.39.x` builds). See `vendor/*/README.md` for each. Both are tracked for removal once
|
|
28
|
+
upstream ships the real fix — check there before assuming either is still needed.
|
|
29
|
+
|
|
30
|
+
## Storage
|
|
31
|
+
|
|
32
|
+
The SDK never touches a concrete storage API directly. It reads and writes through a small
|
|
33
|
+
`KeyValueStore` interface — configure one adapter, once, before calling anything else:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { configureOotleStorage } from "@chironbuilder/ootle-sdk";
|
|
37
|
+
import { chromeStorageAdapter } from "@chironbuilder/ootle-sdk/adapters";
|
|
38
|
+
// or: localStorageAdapter, inMemoryAdapter (tests)
|
|
39
|
+
|
|
40
|
+
configureOotleStorage(chromeStorageAdapter());
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Write your own adapter for any other host — it's three methods (`get`/`set`/`remove`).
|
|
44
|
+
|
|
45
|
+
This only covers what the account core itself needs (shielded outputs, pending shields, the
|
|
46
|
+
private-payment scan cursor, the known-substate-versions cache). Address books, connected-site
|
|
47
|
+
permissions, daemon connections, and a full transaction-history UI are application concerns with
|
|
48
|
+
very different shapes per host — keep those in your own app's storage layer.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { OotleAccount, toOotleNetwork } from "@chironbuilder/ootle-sdk";
|
|
54
|
+
|
|
55
|
+
const account = OotleAccount.fromSeed(entropy, /* index */ 0, "esmeralda");
|
|
56
|
+
|
|
57
|
+
const balances = await account.getBalances();
|
|
58
|
+
await account.send(recipientWalletAddress, resourceAddress, amount);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
See `src/wallet.ts`'s doc comments for the full `OotleAccount` surface — `send`, `sendPrivately`,
|
|
62
|
+
`shield`/`unshield`, `htlcFund`/`htlcClaim`/`htlcRefund`, `claimTestnetXtr`, `execute` (the general
|
|
63
|
+
instruction-builder escape hatch, with automatic missing-input discovery and lock-contention retry).
|
|
64
|
+
|
|
65
|
+
### Claiming a Minotari (L1) burn
|
|
66
|
+
|
|
67
|
+
A burn addressed to this account's public key (`getPublicKey()`) is claimed with `claimBurn`. Build
|
|
68
|
+
the proof from the L1 burn's claim material and its kernel merkle proof (a base node's
|
|
69
|
+
`/generate_kernel_merkle_proof`), or read a `minotari_console_wallet` proof file:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { assembleBurnClaimProof, parseConsoleWalletBurnProof } from "@chironbuilder/ootle-sdk";
|
|
73
|
+
|
|
74
|
+
const proof = assembleBurnClaimProof(l1BurnParts, kernelMerkleProof);
|
|
75
|
+
// or: const proof = parseConsoleWalletBurnProof(fileText);
|
|
76
|
+
const { claimedAmount, commitment } = await account.claimBurn(proof, /* maxFee */ 2000n);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The claimed funds arrive as a stealth output owned by this account and are recorded in its private
|
|
80
|
+
balance. Validators accept a burn only once its L1 block is well confirmed, so an early claim is
|
|
81
|
+
rejected and can be retried.
|
|
82
|
+
|
|
83
|
+
## What's in here, and what isn't
|
|
84
|
+
|
|
85
|
+
- **Account core** (`wallet.ts`): `OotleAccount`, balance/plan-resolution helpers, the transaction
|
|
86
|
+
auto-resolve retry loop.
|
|
87
|
+
- **Crypto/derivation**: `derivation.ts`, `domainHash.ts`, `componentAddress.ts`, `vault.ts`,
|
|
88
|
+
`ownershipProof.ts`, `confidential.ts`.
|
|
89
|
+
- **HTLC**: `htlc.ts`.
|
|
90
|
+
- **L1 burn claims**: `burnClaim.ts` (proof assembly) + `OotleAccount.claimBurn`.
|
|
91
|
+
- **Storage abstraction**: `storage.ts` + `adapters.ts`.
|
|
92
|
+
- **Not included**: UI, an approval/permission model for dApp connections, address books, daemon
|
|
93
|
+
(`tari_ootle_walletd`) relay support, transaction-history persistence. Those stay in each
|
|
94
|
+
consuming application.
|
|
95
|
+
|
|
96
|
+
## Developing
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install
|
|
100
|
+
npm run typecheck
|
|
101
|
+
npm test
|
|
102
|
+
npm run build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT — see [LICENSE](LICENSE). (The two wallets this was extracted from are licensed separately,
|
|
108
|
+
under PolyForm Noncommercial; this SDK is deliberately more permissive so other Ootle projects can
|
|
109
|
+
build on it without that restriction.)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MinotariBurnClaimProof } from "@tari-project/ootle-ts-bindings";
|
|
2
|
+
/** What `OotleAccount.claimBurn()` consumes -- the wallet daemon's `ClaimBurnProofContents`. */
|
|
3
|
+
export interface BurnClaimProofContents {
|
|
4
|
+
claim_proof: MinotariBurnClaimProof;
|
|
5
|
+
/** The burn output's encrypted value/mask, hex. */
|
|
6
|
+
encrypted_data: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The claim material an L1 wallet has as soon as it builds a burn (see tari_l1_wasm's
|
|
10
|
+
* `WasmSignedBurn`). Everything except the kernel merkle proof, which only exists once the burn
|
|
11
|
+
* is mined.
|
|
12
|
+
*/
|
|
13
|
+
export interface L1BurnProofParts {
|
|
14
|
+
/** The Ootle account public key `P` the burn was addressed to. */
|
|
15
|
+
claimPublicKeyHex: string;
|
|
16
|
+
commitmentHex: string;
|
|
17
|
+
ownershipNonceHex: string;
|
|
18
|
+
ownershipSignatureHex: string;
|
|
19
|
+
senderOffsetPublicKeyHex: string;
|
|
20
|
+
encryptedDataHex: string;
|
|
21
|
+
amount: bigint;
|
|
22
|
+
kernel: {
|
|
23
|
+
version: number;
|
|
24
|
+
fee: bigint;
|
|
25
|
+
lockHeight: bigint;
|
|
26
|
+
excessHex: string;
|
|
27
|
+
nonceHex: string;
|
|
28
|
+
signatureHex: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** A base node's `/generate_kernel_merkle_proof` response, passed through unchanged. */
|
|
32
|
+
export interface KernelMerkleProof {
|
|
33
|
+
/** base64 */
|
|
34
|
+
block_hash: string;
|
|
35
|
+
/** base64 */
|
|
36
|
+
encoded_merkle_proof: string;
|
|
37
|
+
leaf_index: number | string;
|
|
38
|
+
block_height?: number | null;
|
|
39
|
+
}
|
|
40
|
+
/** Joins an L1 burn's claim material with its kernel merkle proof into a claimable proof. */
|
|
41
|
+
export declare function assembleBurnClaimProof(parts: L1BurnProofParts, merkle: KernelMerkleProof): BurnClaimProofContents;
|
|
42
|
+
/**
|
|
43
|
+
* Reads a proof file written by `minotari_console_wallet` into its `burn_proofs` directory
|
|
44
|
+
* (`CompleteClaimBurnProof`). Its layout matches Ootle's except that `encrypted_data` is base64.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseConsoleWalletBurnProof(json: string | Record<string, unknown>): BurnClaimProofContents;
|
|
47
|
+
//# sourceMappingURL=burnClaim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burnClaim.d.ts","sourceRoot":"","sources":["../src/burnClaim.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,gGAAgG;AAChG,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,sBAAsB,CAAC;IACpC,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,aAAa;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa;IACb,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAUD,6FAA6F;AAC7F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,iBAAiB,GAAG,sBAAsB,CAgCjH;AASD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAc1G"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Claim proofs for Layer 1 (minotari) burns, in the exact serde shape Ootle's `ClaimBurn`
|
|
2
|
+
// instruction deserialises (`tari_engine_types::confidential::MinotariBurnClaimProof`): byte fields
|
|
3
|
+
// are hex, the merkle proof's two byte fields are base64, and every u64 is carried as a decimal
|
|
4
|
+
// string -- a burn value can exceed 2^53, and the engine accepts strings for all of them.
|
|
5
|
+
const HEX_32 = /^[0-9a-f]{64}$/;
|
|
6
|
+
function hex32(value, field) {
|
|
7
|
+
const v = value.toLowerCase();
|
|
8
|
+
if (!HEX_32.test(v))
|
|
9
|
+
throw new Error(`${field} must be 32 bytes of hex`);
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
/** Joins an L1 burn's claim material with its kernel merkle proof into a claimable proof. */
|
|
13
|
+
export function assembleBurnClaimProof(parts, merkle) {
|
|
14
|
+
if (!/^[0-9a-f]+$/i.test(parts.encryptedDataHex) || parts.encryptedDataHex.length % 2 !== 0) {
|
|
15
|
+
throw new Error("encryptedDataHex must be hex");
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
claim_proof: {
|
|
19
|
+
burn_public_key: hex32(parts.claimPublicKeyHex, "claimPublicKeyHex"),
|
|
20
|
+
commitment: hex32(parts.commitmentHex, "commitmentHex"),
|
|
21
|
+
ownership_proof: {
|
|
22
|
+
public_nonce: hex32(parts.ownershipNonceHex, "ownershipNonceHex"),
|
|
23
|
+
signature: hex32(parts.ownershipSignatureHex, "ownershipSignatureHex"),
|
|
24
|
+
},
|
|
25
|
+
encoded_merkle_proof: {
|
|
26
|
+
block_hash: merkle.block_hash,
|
|
27
|
+
encoded_merkle_proof: merkle.encoded_merkle_proof,
|
|
28
|
+
leaf_index: String(merkle.leaf_index),
|
|
29
|
+
},
|
|
30
|
+
kernel: {
|
|
31
|
+
version: parts.kernel.version,
|
|
32
|
+
fee: parts.kernel.fee.toString(),
|
|
33
|
+
lock_height: parts.kernel.lockHeight.toString(),
|
|
34
|
+
excess: hex32(parts.kernel.excessHex, "kernel.excessHex"),
|
|
35
|
+
excess_sig: {
|
|
36
|
+
public_nonce: hex32(parts.kernel.nonceHex, "kernel.nonceHex"),
|
|
37
|
+
signature: hex32(parts.kernel.signatureHex, "kernel.signatureHex"),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
value: parts.amount.toString(),
|
|
41
|
+
sender_offset_public_key: hex32(parts.senderOffsetPublicKeyHex, "senderOffsetPublicKeyHex"),
|
|
42
|
+
},
|
|
43
|
+
encrypted_data: parts.encryptedDataHex.toLowerCase(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function base64ToHex(b64) {
|
|
47
|
+
const bin = atob(b64);
|
|
48
|
+
let out = "";
|
|
49
|
+
for (let i = 0; i < bin.length; i++)
|
|
50
|
+
out += bin.charCodeAt(i).toString(16).padStart(2, "0");
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads a proof file written by `minotari_console_wallet` into its `burn_proofs` directory
|
|
55
|
+
* (`CompleteClaimBurnProof`). Its layout matches Ootle's except that `encrypted_data` is base64.
|
|
56
|
+
*/
|
|
57
|
+
export function parseConsoleWalletBurnProof(json) {
|
|
58
|
+
const file = (typeof json === "string" ? JSON.parse(json) : json);
|
|
59
|
+
if (!file.claim_proof || file.encrypted_data === undefined) {
|
|
60
|
+
throw new Error("Not a burn proof: expected `claim_proof` and `encrypted_data`");
|
|
61
|
+
}
|
|
62
|
+
const encrypted = Array.isArray(file.encrypted_data)
|
|
63
|
+
? file.encrypted_data.map((b) => b.toString(16).padStart(2, "0")).join("")
|
|
64
|
+
: /^[0-9a-f]+$/i.test(file.encrypted_data) && file.encrypted_data.length % 2 === 0
|
|
65
|
+
? file.encrypted_data.toLowerCase()
|
|
66
|
+
: base64ToHex(file.encrypted_data);
|
|
67
|
+
return { claim_proof: file.claim_proof, encrypted_data: encrypted };
|
|
68
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { TransactionExecuteOpts, WalletAccountApi } from "./accountApi.js";
|
|
2
2
|
export { ACCOUNT_TEMPLATE_ADDRESS, componentAddressFromWalletAddress, deriveAccountComponentAddress, deriveComponentAddress, } from "./componentAddress.js";
|
|
3
|
+
export type { BurnClaimProofContents, KernelMerkleProof, L1BurnProofParts } from "./burnClaim.js";
|
|
4
|
+
export { assembleBurnClaimProof, parseConsoleWalletBurnProof } from "./burnClaim.js";
|
|
3
5
|
export type { ConfidentialSumResult, ScannedStealthOutput } from "./confidential.js";
|
|
4
6
|
export { scanTransactionsForOwnedOutputs, sumConfidentialCommitments } from "./confidential.js";
|
|
5
7
|
export type { DerivedAccountKeys } from "./derivation.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEhG,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEhI,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAEpI,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,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O,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,cAAc,EACd,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Public surface. Import from the package root ("@chironbuilder/ootle-sdk") rather than reaching
|
|
2
2
|
// into individual files -- the module layout underneath is free to change; this file is not.
|
|
3
3
|
export { ACCOUNT_TEMPLATE_ADDRESS, componentAddressFromWalletAddress, deriveAccountComponentAddress, deriveComponentAddress, } from "./componentAddress.js";
|
|
4
|
+
export { assembleBurnClaimProof, parseConsoleWalletBurnProof } from "./burnClaim.js";
|
|
4
5
|
export { scanTransactionsForOwnedOutputs, sumConfidentialCommitments } from "./confidential.js";
|
|
5
6
|
export { deriveAccountKeys } from "./derivation.js";
|
|
6
7
|
export { DomainSeparatedHasher, KEY_MANAGER_DOMAIN, KEY_MANAGER_DOMAIN_VERSION, keyManagerDomainHasher } from "./domainHash.js";
|
package/dist/wallet.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ExecuteResult, IndexerGetTransactionResultResponse, Instruction, S
|
|
|
3
3
|
import { IndexerProvider } from "@tari-project/ootle-indexer";
|
|
4
4
|
import { SecretKeyWallet } from "@tari-project/ootle-secret-key-wallet";
|
|
5
5
|
import type { WalletAccountApi } from "./accountApi.js";
|
|
6
|
+
import type { BurnClaimProofContents } from "./burnClaim.js";
|
|
6
7
|
import type { ScannedStealthOutput } from "./confidential.js";
|
|
7
8
|
import { type NetworkName } from "./ootleNetwork.js";
|
|
8
9
|
import type { ShieldedOutputRecord } from "./storage.js";
|
|
@@ -711,6 +712,24 @@ export declare class OotleAccount implements WalletAccountApi {
|
|
|
711
712
|
amount: bigint;
|
|
712
713
|
memo?: string;
|
|
713
714
|
}>;
|
|
715
|
+
/**
|
|
716
|
+
* Claims a Layer 1 (minotari) burn addressed to this account, minting the burned value on
|
|
717
|
+
* Ootle as a stealth output owned by this account (recorded locally, so it shows in the private
|
|
718
|
+
* balance). `maxFee` is revealed from the claimed value to pay the fee; the rest is claimed.
|
|
719
|
+
*
|
|
720
|
+
* The burn UTXO is minted and spent within the fee instructions, and the transaction is sealed
|
|
721
|
+
* with the stealth claim secret `s = H(p·R) + p` rather than the account key: the L1 ownership
|
|
722
|
+
* proof commits the burn to `s·G`, so `s` is the only key that satisfies its spend condition.
|
|
723
|
+
* Nothing here touches the account component, so the account need not exist on-chain yet.
|
|
724
|
+
*
|
|
725
|
+
* Validators only accept a burn once its L1 block is well confirmed; claiming earlier is
|
|
726
|
+
* rejected and can simply be retried later.
|
|
727
|
+
*/
|
|
728
|
+
claimBurn(contents: BurnClaimProofContents, maxFee?: bigint, memo?: string): Promise<{
|
|
729
|
+
transactionId: string;
|
|
730
|
+
claimedAmount: bigint;
|
|
731
|
+
commitment: string;
|
|
732
|
+
}>;
|
|
714
733
|
/**
|
|
715
734
|
* This account's unspent stealth outputs, newest first, optionally filtered to one resource.
|
|
716
735
|
*
|
package/dist/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EA4BR,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,aAAa,EACb,mCAAmC,EACnC,WAAW,EAIX,mBAAmB,EACnB,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAA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AkB,IAAI,IAAI,CAEzC;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE,MAAM,EACrB,SAAS,SAAS,GACjB,OAAO,CAAC,mCAAmC,CAAC,CAwB9C;AAmBD,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,mBAAmB,EAAE,EACnC,OAAO,SAAI,EACX,YAAY,SAAM,GACjB,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAUhC;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQpG;AAmBD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5E;AAOD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGvG"}
|
package/dist/wallet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Mask, OotleWallet, StealthInput, StealthInputsStatement, StealthOutputsStatement, StealthTransfer, StealthTransferStatement, TransactionBuilder, WalletStealthAuthorizer, WasmStealthCrypto, XTR_FAUCET_CLAIM_RESOURCE_ADDRESS, XTR_FAUCET_COMPONENT_ADDRESS, XTR_FAUCET_VAULT_ADDRESS, amountLiteral, createOutput, decryptOwnedUtxo, defaultIndexerUrl, getVaultIdsForAccount, resolveMaxEpoch, resolveTransaction, resourceAddressLiteral, sealTransaction, sendTransaction, serializeUnsignedTx, signTransaction, stealthUtxoSubstateId, submitTransaction, } from "@tari-project/ootle";
|
|
1
|
+
import { Mask, OotleWallet, StealthInput, StealthInputsStatement, StealthOutputsStatement, StealthTransfer, StealthTransferStatement, TARI_RESOURCE_ADDRESS, TransactionBuilder, WalletStealthAuthorizer, WasmStealthCrypto, XTR_FAUCET_CLAIM_RESOURCE_ADDRESS, XTR_FAUCET_COMPONENT_ADDRESS, XTR_FAUCET_VAULT_ADDRESS, amountLiteral, createOutput, decryptOwnedUtxo, defaultIndexerUrl, getVaultIdsForAccount, resolveMaxEpoch, resolveTransaction, resourceAddressLiteral, sealTransaction, sendTransaction, serializeUnsignedTx, signTransaction, stealthUtxoSubstateId, submitTransaction, } from "@tari-project/ootle";
|
|
2
2
|
import { IndexerProvider } from "@tari-project/ootle-indexer";
|
|
3
3
|
import { SecretKeyWallet } from "@tari-project/ootle-secret-key-wallet";
|
|
4
|
-
import { buildScriptPathWitness, buildStealthTransferStatement, createConfidentialWithdrawProofLiteral, createStealthOutputWitness, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, stealthDhSecret, validateStealthTransfer, } from "@tari-project/ootle-wasm";
|
|
4
|
+
import { buildScriptPathWitness, burnClaimStealthSecret, buildStealthTransferStatement, createConfidentialWithdrawProofLiteral, createStealthOutputWitness, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, stealthDhSecret, validateBurnClaimOwnershipProof, validateStealthTransfer, } from "@tari-project/ootle-wasm";
|
|
5
5
|
import { componentAddressFromWalletAddress, deriveAccountComponentAddress } from "./componentAddress.js";
|
|
6
6
|
import { scanTransactionsForOwnedOutputs, sumConfidentialCommitments } from "./confidential.js";
|
|
7
7
|
import { deriveAccountKeys } from "./derivation.js";
|
|
@@ -1800,6 +1800,81 @@ export class OotleAccount {
|
|
|
1800
1800
|
await recordKnownShieldedOutput(accountId, resourceAddress, commitmentHex, decrypted.value, substateId, memo);
|
|
1801
1801
|
return { amount: decrypted.value, memo };
|
|
1802
1802
|
}
|
|
1803
|
+
/**
|
|
1804
|
+
* Claims a Layer 1 (minotari) burn addressed to this account, minting the burned value on
|
|
1805
|
+
* Ootle as a stealth output owned by this account (recorded locally, so it shows in the private
|
|
1806
|
+
* balance). `maxFee` is revealed from the claimed value to pay the fee; the rest is claimed.
|
|
1807
|
+
*
|
|
1808
|
+
* The burn UTXO is minted and spent within the fee instructions, and the transaction is sealed
|
|
1809
|
+
* with the stealth claim secret `s = H(p·R) + p` rather than the account key: the L1 ownership
|
|
1810
|
+
* proof commits the burn to `s·G`, so `s` is the only key that satisfies its spend condition.
|
|
1811
|
+
* Nothing here touches the account component, so the account need not exist on-chain yet.
|
|
1812
|
+
*
|
|
1813
|
+
* Validators only accept a burn once its L1 block is well confirmed; claiming earlier is
|
|
1814
|
+
* rejected and can simply be retried later.
|
|
1815
|
+
*/
|
|
1816
|
+
async claimBurn(contents, maxFee = 2000n, memo = "Burnt funds claimed from L1") {
|
|
1817
|
+
if (maxFee <= 0n)
|
|
1818
|
+
throw new Error(`claimBurn: maxFee must be > 0, got ${maxFee}`);
|
|
1819
|
+
const proof = contents.claim_proof;
|
|
1820
|
+
const burnCommitment = fromHex(proof.commitment);
|
|
1821
|
+
const senderOffset = fromHex(proof.sender_offset_public_key);
|
|
1822
|
+
const value = BigInt(proof.value);
|
|
1823
|
+
const stealthSecret = burnClaimStealthSecret(this.ownerSecret, senderOffset);
|
|
1824
|
+
const ownershipValid = validateBurnClaimOwnershipProof(this.network, fromHex(proof.ownership_proof.public_nonce), fromHex(proof.ownership_proof.signature), burnCommitment, value, stealthSecret);
|
|
1825
|
+
if (!ownershipValid) {
|
|
1826
|
+
throw new Error("This burn was not addressed to this account (its ownership proof does not verify).");
|
|
1827
|
+
}
|
|
1828
|
+
const crypto = new WasmStealthCrypto(this.network);
|
|
1829
|
+
const aeadKey = await crypto.deriveAeadKey(this.ownerSecret, senderOffset);
|
|
1830
|
+
const decrypted = await crypto.unblindOutput(burnCommitment, fromHex(contents.encrypted_data), aeadKey, true);
|
|
1831
|
+
if (decrypted.value !== value) {
|
|
1832
|
+
throw new Error(`claimBurn: burn proof states ${value} but the burn output holds ${decrypted.value}`);
|
|
1833
|
+
}
|
|
1834
|
+
const claimedAmount = decrypted.value - maxFee;
|
|
1835
|
+
if (claimedAmount <= 0n) {
|
|
1836
|
+
throw new Error(`claimBurn: the burn (${decrypted.value}) does not cover maxFee (${maxFee})`);
|
|
1837
|
+
}
|
|
1838
|
+
const walletAddress = await this.getWalletAddress();
|
|
1839
|
+
const output = createOutput({ destination: walletAddress, amount: claimedAmount, resourceAddress: TARI_RESOURCE_ADDRESS, memo: toMemo(memo) });
|
|
1840
|
+
const { statement: outputsStatement, outputMask } = await crypto.generateOutputsStatement([output], maxFee);
|
|
1841
|
+
// The single input is the UTXO `ClaimBurn` mints in the same transaction; the instruction
|
|
1842
|
+
// itself authorises spending it, so it carries no witness.
|
|
1843
|
+
const inputsStatement = await crypto.buildInputsStatement([new StealthInput(burnCommitment)], 0n);
|
|
1844
|
+
const inputMask = await crypto.aggregateInputMasks([decrypted.mask]);
|
|
1845
|
+
const balanceProof = await crypto.generateBalanceProofSignature(inputMask, outputMask, inputsStatement.statementJson, outputsStatement.statementJson);
|
|
1846
|
+
const statement = new StealthTransferStatement(inputsStatement, outputsStatement, balanceProof);
|
|
1847
|
+
await crypto.validateTransfer(statement);
|
|
1848
|
+
const ownCommitment = outputsStatement.parsed().outputs[0].output.commitment;
|
|
1849
|
+
const provider = await this.getProvider();
|
|
1850
|
+
const maxEpoch = await resolveMaxEpoch(provider);
|
|
1851
|
+
const builder = TransactionBuilder.new(this.network, maxEpoch)
|
|
1852
|
+
.addFeeInstruction({ ClaimBurn: { claim: proof, output_data: { encrypted_data: contents.encrypted_data } } })
|
|
1853
|
+
.addFeeInstruction({
|
|
1854
|
+
StealthTransfer: {
|
|
1855
|
+
resource_address_ref: { Address: TARI_RESOURCE_ADDRESS },
|
|
1856
|
+
statement: { __ootleRawJson: statement.toCompactJson() },
|
|
1857
|
+
revealed_input_bucket: null,
|
|
1858
|
+
},
|
|
1859
|
+
})
|
|
1860
|
+
.addFeeInstruction({ PutLastInstructionOutputOnWorkspace: { key: 0 } })
|
|
1861
|
+
.addFeeInstruction({ PayFeeFromBucket: { bucket: { id: 0, offset: null } } })
|
|
1862
|
+
.addInput({ substate_id: TARI_RESOURCE_ADDRESS, version: null });
|
|
1863
|
+
// The seal key `s` is the transaction's only signer, so it must be authorized as the main
|
|
1864
|
+
// signer; the TS builder leaves that off by default.
|
|
1865
|
+
const unsignedBody = builder.buildUnsignedTransaction();
|
|
1866
|
+
unsignedBody.is_seal_signer_authorized = true;
|
|
1867
|
+
const unsignedTx = await resolveTransaction(provider, unsignedBody);
|
|
1868
|
+
const signed = await signTransaction([], unsignedTx, {
|
|
1869
|
+
secret_key: stealthSecret,
|
|
1870
|
+
public_key: publicKeyFromSecretKey(stealthSecret),
|
|
1871
|
+
});
|
|
1872
|
+
const transactionId = await submitTransaction(provider, sealTransaction(signed));
|
|
1873
|
+
const response = await withTimeout(pollTransactionResult(provider, transactionId), 90_000, "claiming the burn");
|
|
1874
|
+
await recordKnownVersions(response);
|
|
1875
|
+
await recordKnownShieldedOutput(localAccountId(this.index), TARI_RESOURCE_ADDRESS, ownCommitment, claimedAmount, transactionId, memo);
|
|
1876
|
+
return { transactionId, claimedAmount, commitment: ownCommitment };
|
|
1877
|
+
}
|
|
1803
1878
|
/**
|
|
1804
1879
|
* This account's unspent stealth outputs, newest first, optionally filtered to one resource.
|
|
1805
1880
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chironbuilder/ootle-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Shared TypeScript client for Tari Ootle (L2): account derivation, balances, transactions, HTLCs, and stealth/confidential transfers — the account core behind Sapient and the Tari L1 web wallet's Ootle support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -221,6 +221,13 @@ export function buildStealthInputsStatementFromInputs(inputs_json: string, revea
|
|
|
221
221
|
*/
|
|
222
222
|
export function buildStealthTransferStatement(input_witnesses_json: string, revealed_input_amount_microtari: bigint, output_witnesses_json: string, revealed_output_amount_microtari: bigint): string;
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Derive the stealth claim secret `s = H(p·R) + p` for claiming an L1 (minotari) burn, from the
|
|
226
|
+
* account secret `p` and the burn's sender offset public key `R`. The claim transaction must be
|
|
227
|
+
* sealed with this key.
|
|
228
|
+
*/
|
|
229
|
+
export function burnClaimStealthSecret(account_secret: Uint8Array, sender_offset_public_key: Uint8Array): Uint8Array;
|
|
230
|
+
|
|
224
231
|
/**
|
|
225
232
|
* Builds a `ConfidentialWithdrawProof` for the Account template's `withdraw_confidential` /
|
|
226
233
|
* `join_confidential` methods, and returns it `tari_bor`-encoded -- ready to hex-encode and wrap
|
|
@@ -442,6 +449,14 @@ export function unblindOutput(output_commitment: Uint8Array, encrypted_data: Uin
|
|
|
442
449
|
*/
|
|
443
450
|
export function validateBalanceProofSignature(public_nonce: Uint8Array, signature: Uint8Array, inputs_statement_json: string, outputs_statement_json: string): boolean;
|
|
444
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Check an L1 burn's ownership proof against the stealth claim key derived from `stealth_secret`,
|
|
454
|
+
* exactly as a validator will. `false` means the claim would be rejected.
|
|
455
|
+
*
|
|
456
|
+
* `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
|
|
457
|
+
*/
|
|
458
|
+
export function validateBurnClaimOwnershipProof(network: number, ownership_nonce: Uint8Array, ownership_signature: Uint8Array, commitment: Uint8Array, value: bigint, stealth_secret: Uint8Array): boolean;
|
|
459
|
+
|
|
445
460
|
/**
|
|
446
461
|
* Run the same validation the engine performs on a complete `StealthTransferStatement` envelope:
|
|
447
462
|
* structural sanity, commitment well-formedness, range and balance-proof verification.
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./ootle_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
DecryptedOutputResult, KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, StealthOutputsResult, addTransactionSigner, aggregateInputMasks, borEncodeTransaction, buildScriptPathWitness, buildStealthInputsStatement, buildStealthInputsStatementFromInputs, buildStealthTransferStatement, createConfidentialWithdrawProofLiteral, createStealthOutputWitness, decryptElgamalViewableBalance, encryptedDataDhKdfAead, generateElgamalViewableBalanceProof, generateExtendedBulletProof, generateKeypair, generateOotleAddress, generateOotleSecretKey, generateStealthBalanceProofSignature, generateStealthOutputsStatement, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction, stealthDhSecret, unblindOutput, validateBalanceProofSignature, validateStealthTransfer
|
|
8
|
+
DecryptedOutputResult, KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, StealthOutputsResult, addTransactionSigner, aggregateInputMasks, borEncodeTransaction, buildScriptPathWitness, buildStealthInputsStatement, buildStealthInputsStatementFromInputs, buildStealthTransferStatement, burnClaimStealthSecret, createConfidentialWithdrawProofLiteral, createStealthOutputWitness, decryptElgamalViewableBalance, encryptedDataDhKdfAead, generateElgamalViewableBalanceProof, generateExtendedBulletProof, generateKeypair, generateOotleAddress, generateOotleSecretKey, generateStealthBalanceProofSignature, generateStealthOutputsStatement, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction, stealthDhSecret, unblindOutput, validateBalanceProofSignature, validateBurnClaimOwnershipProof, validateStealthTransfer
|
|
9
9
|
} from "./ootle_wasm_bg.js";
|
|
@@ -729,6 +729,28 @@ export function buildStealthTransferStatement(input_witnesses_json, revealed_inp
|
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Derive the stealth claim secret `s = H(p·R) + p` for claiming an L1 (minotari) burn, from the
|
|
734
|
+
* account secret `p` and the burn's sender offset public key `R`. The claim transaction must be
|
|
735
|
+
* sealed with this key.
|
|
736
|
+
* @param {Uint8Array} account_secret
|
|
737
|
+
* @param {Uint8Array} sender_offset_public_key
|
|
738
|
+
* @returns {Uint8Array}
|
|
739
|
+
*/
|
|
740
|
+
export function burnClaimStealthSecret(account_secret, sender_offset_public_key) {
|
|
741
|
+
const ptr0 = passArray8ToWasm0(account_secret, wasm.__wbindgen_malloc);
|
|
742
|
+
const len0 = WASM_VECTOR_LEN;
|
|
743
|
+
const ptr1 = passArray8ToWasm0(sender_offset_public_key, wasm.__wbindgen_malloc);
|
|
744
|
+
const len1 = WASM_VECTOR_LEN;
|
|
745
|
+
const ret = wasm.burnClaimStealthSecret(ptr0, len0, ptr1, len1);
|
|
746
|
+
if (ret[3]) {
|
|
747
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
748
|
+
}
|
|
749
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
750
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
751
|
+
return v3;
|
|
752
|
+
}
|
|
753
|
+
|
|
732
754
|
/**
|
|
733
755
|
* Builds a `ConfidentialWithdrawProof` for the Account template's `withdraw_confidential` /
|
|
734
756
|
* `join_confidential` methods, and returns it `tari_bor`-encoded -- ready to hex-encode and wrap
|
|
@@ -1293,6 +1315,35 @@ export function validateBalanceProofSignature(public_nonce, signature, inputs_st
|
|
|
1293
1315
|
return ret[0] !== 0;
|
|
1294
1316
|
}
|
|
1295
1317
|
|
|
1318
|
+
/**
|
|
1319
|
+
* Check an L1 burn's ownership proof against the stealth claim key derived from `stealth_secret`,
|
|
1320
|
+
* exactly as a validator will. `false` means the claim would be rejected.
|
|
1321
|
+
*
|
|
1322
|
+
* `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
|
|
1323
|
+
* @param {number} network
|
|
1324
|
+
* @param {Uint8Array} ownership_nonce
|
|
1325
|
+
* @param {Uint8Array} ownership_signature
|
|
1326
|
+
* @param {Uint8Array} commitment
|
|
1327
|
+
* @param {bigint} value
|
|
1328
|
+
* @param {Uint8Array} stealth_secret
|
|
1329
|
+
* @returns {boolean}
|
|
1330
|
+
*/
|
|
1331
|
+
export function validateBurnClaimOwnershipProof(network, ownership_nonce, ownership_signature, commitment, value, stealth_secret) {
|
|
1332
|
+
const ptr0 = passArray8ToWasm0(ownership_nonce, wasm.__wbindgen_malloc);
|
|
1333
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1334
|
+
const ptr1 = passArray8ToWasm0(ownership_signature, wasm.__wbindgen_malloc);
|
|
1335
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1336
|
+
const ptr2 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
|
|
1337
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1338
|
+
const ptr3 = passArray8ToWasm0(stealth_secret, wasm.__wbindgen_malloc);
|
|
1339
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1340
|
+
const ret = wasm.validateBurnClaimOwnershipProof(network, ptr0, len0, ptr1, len1, ptr2, len2, value, ptr3, len3);
|
|
1341
|
+
if (ret[2]) {
|
|
1342
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1343
|
+
}
|
|
1344
|
+
return ret[0] !== 0;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1296
1347
|
/**
|
|
1297
1348
|
* Run the same validation the engine performs on a complete `StealthTransferStatement` envelope:
|
|
1298
1349
|
* structural sanity, commitment well-formedness, range and balance-proof verification.
|
|
Binary file
|
|
@@ -49,6 +49,7 @@ export const buildScriptPathWitness: (a: number, b: number, c: number, d: number
|
|
|
49
49
|
export const buildStealthInputsStatement: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
50
50
|
export const buildStealthInputsStatementFromInputs: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
51
51
|
export const buildStealthTransferStatement: (a: number, b: number, c: bigint, d: number, e: number, f: bigint) => [number, number, number, number];
|
|
52
|
+
export const burnClaimStealthSecret: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
52
53
|
export const createConfidentialWithdrawProofLiteral: (a: number, b: number, c: bigint, d: number, e: number, f: bigint, g: number, h: number, i: bigint) => [number, number, number, number];
|
|
53
54
|
export const createStealthOutputWitness: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: bigint) => [number, number, number, number];
|
|
54
55
|
export const decryptElgamalViewableBalance: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: bigint, j: bigint) => [number, bigint, number, number];
|
|
@@ -70,6 +71,7 @@ export const sealTransaction: (a: number, b: number, c: number, d: number) => [n
|
|
|
70
71
|
export const stealthDhSecret: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
71
72
|
export const unblindOutput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
72
73
|
export const validateBalanceProofSignature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
74
|
+
export const validateBurnClaimOwnershipProof: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint, i: number, j: number) => [number, number, number];
|
|
73
75
|
export const validateStealthTransfer: (a: number, b: number, c: number, d: number) => [number, number];
|
|
74
76
|
export const tari_free: (a: number) => void;
|
|
75
77
|
export const tari_alloc: (a: number) => number;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"collaborators": [
|
|
5
5
|
"The Tari Development Community"
|
|
6
6
|
],
|
|
7
|
-
"description": "WASM bindings for Tari Ootle client-side crypto — thin wasm-bindgen shell over ootle-wasm-core. LOCAL VENDOR PATCH: adds createConfidentialWithdrawProofLiteral, built from tari-dan crates/ootle_wasm at commit ac73128 (v0.41.0, esmeralda V1 activation) plus the confidential.rs module added on top -- not yet in an upstream release.",
|
|
7
|
+
"description": "WASM bindings for Tari Ootle client-side crypto — thin wasm-bindgen shell over ootle-wasm-core. LOCAL VENDOR PATCH: adds createConfidentialWithdrawProofLiteral, built from tari-dan crates/ootle_wasm at commit ac73128 (v0.41.0, esmeralda V1 activation) plus the confidential.rs module and burn_claim exports (burnClaimStealthSecret, validateBurnClaimOwnershipProof) added on top -- not yet in an upstream release.",
|
|
8
8
|
"version": "0.41.0",
|
|
9
9
|
"license": "BSD-3-Clause",
|
|
10
10
|
"repository": {
|