@chironbuilder/ootle-sdk 0.1.10 → 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-patched/package.json +1 -1
- package/vendor/ootle-wasm-patched/README.md +58 -89
- package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +15 -0
- package/vendor/ootle-wasm-patched/ootle_wasm.js +2 -2
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +73 -30
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +22 -20
- package/vendor/ootle-wasm-patched/package.json +5 -2
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,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O,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,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,iC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,CAAC,IAAI,CAAC,CAM9E;AAED;;0GAE0G;AAC1G,wBAAgB,kBAAkB,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",
|
|
@@ -1,128 +1,97 @@
|
|
|
1
1
|
# ootle-wasm
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Rust → WASM library providing client-side crypto operations for Tari Ootle L2.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Architecture
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## API
|
|
12
|
-
|
|
13
|
-
All keys and signatures are **`Uint8Array`** (raw 32-byte values).
|
|
14
|
-
|
|
15
|
-
### `generateKeypair()`
|
|
7
|
+
- `core/` — Pure Rust library. All crypto/encoding logic lives here. Testable natively with `cargo test`.
|
|
8
|
+
- `wasm/` — Thin `wasm-bindgen` shell. Accepts JSON strings, calls core, returns results.
|
|
16
9
|
|
|
17
|
-
|
|
10
|
+
## Prerequisites
|
|
18
11
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
```bash
|
|
13
|
+
# Install wasm-pack
|
|
14
|
+
cargo install wasm-pack
|
|
15
|
+
|
|
16
|
+
# (Optional) Install wasm-opt for size optimisation
|
|
17
|
+
# macOS:
|
|
18
|
+
brew install binaryen
|
|
19
|
+
# or via cargo:
|
|
20
|
+
cargo install wasm-opt
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
## Build
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
### Native (tests only)
|
|
30
26
|
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const publicKey = publicKeyFromSecretKey(secretKey);
|
|
35
|
-
// publicKey: Uint8Array (32 bytes)
|
|
27
|
+
```bash
|
|
28
|
+
cargo test -p ootle-wasm-core
|
|
36
29
|
```
|
|
37
30
|
|
|
38
|
-
###
|
|
31
|
+
### WASM
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
```bash
|
|
34
|
+
# Build for bundler (webpack, vite, rollup, esbuild)
|
|
35
|
+
wasm-pack build crates/ootle_wasm/wasm --target bundler --release --out-dir ../../../pkg
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
-
|
|
37
|
+
# Build for Node.js
|
|
38
|
+
wasm-pack build crates/ootle_wasm/wasm --target nodejs --release --out-dir ../../../pkg
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const hash = hashUnsignedTransaction(
|
|
49
|
-
JSON.stringify(unsignedTransaction),
|
|
50
|
-
sealSignerPublicKey,
|
|
51
|
-
);
|
|
40
|
+
# Build for web (no bundler)
|
|
41
|
+
wasm-pack build crates/ootle_wasm/wasm --target web --release --out-dir ../../../pkg
|
|
52
42
|
```
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
The output goes to `pkg/` at the repo root containing:
|
|
55
45
|
|
|
56
|
-
|
|
46
|
+
- `ootle_wasm_bg.wasm` — the WASM binary
|
|
47
|
+
- `ootle_wasm.js` — JS glue code
|
|
48
|
+
- `ootle_wasm.d.ts` — TypeScript type definitions
|
|
57
49
|
|
|
58
|
-
|
|
59
|
-
import { schnorrSign } from "@tari-project/ootle-wasm";
|
|
50
|
+
### Size optimisation (optional)
|
|
60
51
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// signature: Uint8Array (32 bytes)
|
|
52
|
+
```bash
|
|
53
|
+
wasm-opt -Oz --strip-debug --strip-producers pkg/ootle_wasm_bg.wasm -o pkg/ootle_wasm_bg.wasm
|
|
64
54
|
```
|
|
65
55
|
|
|
66
|
-
###
|
|
67
|
-
|
|
68
|
-
BOR-encode a signed `Transaction` into a base64 `TransactionEnvelope` string, ready to submit to the network.
|
|
56
|
+
### Debug build (with panic hook)
|
|
69
57
|
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const envelope = borEncodeTransaction(JSON.stringify(transaction));
|
|
58
|
+
```bash
|
|
59
|
+
wasm-pack build crates/ootle_wasm/wasm --target bundler --dev --out-dir ../../../pkg -- --features debug
|
|
74
60
|
```
|
|
75
61
|
|
|
76
|
-
##
|
|
62
|
+
## WASM Exports
|
|
77
63
|
|
|
78
|
-
|
|
64
|
+
| Function | Signature | Description |
|
|
65
|
+
|---------------------------|-----------------------------------------------------------------------------|-----------------------------------------------------|
|
|
66
|
+
| `borEncodeTransaction` | `(transactionJson: string) → string` | BOR-encode a Transaction JSON → base64 envelope |
|
|
67
|
+
| `hashUnsignedTransaction` | `(unsignedTxJson: string, sealSignerPubKeyHex: string) → Uint8Array` | Hash an unsigned transaction for signing (64 bytes) |
|
|
68
|
+
| `schnorrSign` | `(secretKeyHex: string, message: Uint8Array) → { public_nonce, signature }` | Schnorr-sign a message |
|
|
69
|
+
| `generateKeypair` | `() → { secret_key, public_key }` | Generate a random Ristretto keypair |
|
|
70
|
+
| `publicKeyFromSecretKey` | `(secretKeyHex: string) → string` | Derive public key from secret key |
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
import { generateKeypair, publicKeyFromSecretKey } from "@tari-project/ootle-wasm";
|
|
72
|
+
All keys and signatures are lowercase hex-encoded strings.
|
|
82
73
|
|
|
83
|
-
|
|
84
|
-
const { secret_key, public_key } = generateKeypair();
|
|
85
|
-
console.log("Public key:", public_key.toHex());
|
|
86
|
-
|
|
87
|
-
// Load a key from a hex string
|
|
88
|
-
const restored = Uint8Array.fromHex("a1b2c3...");
|
|
89
|
-
const derivedPublicKey = publicKeyFromSecretKey(restored);
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Full example
|
|
74
|
+
## Usage from JS/TS
|
|
93
75
|
|
|
94
76
|
```typescript
|
|
95
|
-
import {
|
|
77
|
+
import init, {
|
|
96
78
|
generateKeypair,
|
|
97
|
-
publicKeyFromSecretKey,
|
|
98
|
-
hashUnsignedTransaction,
|
|
99
79
|
schnorrSign,
|
|
80
|
+
hashUnsignedTransaction,
|
|
100
81
|
borEncodeTransaction,
|
|
101
|
-
|
|
82
|
+
publicKeyFromSecretKey,
|
|
83
|
+
} from './pkg/ootle_wasm.js';
|
|
102
84
|
|
|
103
|
-
//
|
|
104
|
-
|
|
85
|
+
// Initialise the WASM module
|
|
86
|
+
await init();
|
|
105
87
|
|
|
106
|
-
//
|
|
107
|
-
const
|
|
108
|
-
/* ... UnsignedTransactionV1 fields ... */
|
|
109
|
-
};
|
|
88
|
+
// Generate a keypair
|
|
89
|
+
const { secret_key, public_key } = generateKeypair();
|
|
110
90
|
|
|
111
|
-
//
|
|
112
|
-
const
|
|
91
|
+
// Hash an unsigned transaction for signing
|
|
92
|
+
const unsignedTxJson = JSON.stringify(unsignedTransaction);
|
|
93
|
+
const hash = hashUnsignedTransaction(unsignedTxJson, sealSignerPublicKeyHex);
|
|
113
94
|
|
|
114
|
-
//
|
|
95
|
+
// Sign the hash
|
|
115
96
|
const { public_nonce, signature } = schnorrSign(secret_key, hash);
|
|
116
|
-
|
|
117
|
-
// 5. Assemble the signed transaction and BOR-encode
|
|
118
|
-
const signedTx = {
|
|
119
|
-
/* ... Transaction with signature attached ... */
|
|
120
|
-
};
|
|
121
|
-
const envelope = borEncodeTransaction(JSON.stringify(signedTx));
|
|
122
|
-
|
|
123
|
-
// 6. Submit envelope to the Ootle network
|
|
124
97
|
```
|
|
125
|
-
|
|
126
|
-
## License
|
|
127
|
-
|
|
128
|
-
BSD-3-Clause
|
|
@@ -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.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./ootle_wasm.d.ts" */
|
|
2
|
-
|
|
3
2
|
import * as wasm from "./ootle_wasm_bg.wasm";
|
|
4
3
|
import { __wbg_set_wasm } from "./ootle_wasm_bg.js";
|
|
4
|
+
|
|
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";
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class DecryptedOutputResult {
|
|
5
5
|
static __wrap(ptr) {
|
|
6
|
-
ptr = ptr >>> 0;
|
|
7
6
|
const obj = Object.create(DecryptedOutputResult.prototype);
|
|
8
7
|
obj.__wbg_ptr = ptr;
|
|
9
8
|
DecryptedOutputResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -38,7 +37,7 @@ export class DecryptedOutputResult {
|
|
|
38
37
|
const ret = wasm.__wbg_get_decryptedoutputresult_memo_json(this.__wbg_ptr);
|
|
39
38
|
let v1;
|
|
40
39
|
if (ret[0] !== 0) {
|
|
41
|
-
v1 = getStringFromWasm0(ret[0], ret[1])
|
|
40
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
42
41
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
43
42
|
}
|
|
44
43
|
return v1;
|
|
@@ -85,7 +84,6 @@ if (Symbol.dispose) DecryptedOutputResult.prototype[Symbol.dispose] = DecryptedO
|
|
|
85
84
|
*/
|
|
86
85
|
export class KeypairResult {
|
|
87
86
|
static __wrap(ptr) {
|
|
88
|
-
ptr = ptr >>> 0;
|
|
89
87
|
const obj = Object.create(KeypairResult.prototype);
|
|
90
88
|
obj.__wbg_ptr = ptr;
|
|
91
89
|
KeypairResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -143,7 +141,6 @@ if (Symbol.dispose) KeypairResult.prototype[Symbol.dispose] = KeypairResult.prot
|
|
|
143
141
|
*/
|
|
144
142
|
export class OotlePublicKey {
|
|
145
143
|
static __wrap(ptr) {
|
|
146
|
-
ptr = ptr >>> 0;
|
|
147
144
|
const obj = Object.create(OotlePublicKey.prototype);
|
|
148
145
|
obj.__wbg_ptr = ptr;
|
|
149
146
|
OotlePublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -186,7 +183,7 @@ export class OotlePublicKey {
|
|
|
186
183
|
set owner_key(arg0) {
|
|
187
184
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
188
185
|
const len0 = WASM_VECTOR_LEN;
|
|
189
|
-
wasm.
|
|
186
|
+
wasm.__wbg_set_ootlepublickey_owner_key(this.__wbg_ptr, ptr0, len0);
|
|
190
187
|
}
|
|
191
188
|
/**
|
|
192
189
|
* The view-only public key bytes.
|
|
@@ -195,7 +192,7 @@ export class OotlePublicKey {
|
|
|
195
192
|
set view_key(arg0) {
|
|
196
193
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
197
194
|
const len0 = WASM_VECTOR_LEN;
|
|
198
|
-
wasm.
|
|
195
|
+
wasm.__wbg_set_ootlepublickey_view_key(this.__wbg_ptr, ptr0, len0);
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
if (Symbol.dispose) OotlePublicKey.prototype[Symbol.dispose] = OotlePublicKey.prototype.free;
|
|
@@ -205,7 +202,6 @@ if (Symbol.dispose) OotlePublicKey.prototype[Symbol.dispose] = OotlePublicKey.pr
|
|
|
205
202
|
*/
|
|
206
203
|
export class OotleSecretKey {
|
|
207
204
|
static __wrap(ptr) {
|
|
208
|
-
ptr = ptr >>> 0;
|
|
209
205
|
const obj = Object.create(OotleSecretKey.prototype);
|
|
210
206
|
obj.__wbg_ptr = ptr;
|
|
211
207
|
OotleSecretKeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -248,7 +244,7 @@ export class OotleSecretKey {
|
|
|
248
244
|
set owner_key(arg0) {
|
|
249
245
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
250
246
|
const len0 = WASM_VECTOR_LEN;
|
|
251
|
-
wasm.
|
|
247
|
+
wasm.__wbg_set_ootlesecretkey_owner_key(this.__wbg_ptr, ptr0, len0);
|
|
252
248
|
}
|
|
253
249
|
/**
|
|
254
250
|
* The view-only secret key bytes.
|
|
@@ -257,7 +253,7 @@ export class OotleSecretKey {
|
|
|
257
253
|
set view_key(arg0) {
|
|
258
254
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
259
255
|
const len0 = WASM_VECTOR_LEN;
|
|
260
|
-
wasm.
|
|
256
|
+
wasm.__wbg_set_ootlesecretkey_view_key(this.__wbg_ptr, ptr0, len0);
|
|
261
257
|
}
|
|
262
258
|
}
|
|
263
259
|
if (Symbol.dispose) OotleSecretKey.prototype[Symbol.dispose] = OotleSecretKey.prototype.free;
|
|
@@ -267,7 +263,6 @@ if (Symbol.dispose) OotleSecretKey.prototype[Symbol.dispose] = OotleSecretKey.pr
|
|
|
267
263
|
*/
|
|
268
264
|
export class ParsedOotleAddress {
|
|
269
265
|
static __wrap(ptr) {
|
|
270
|
-
ptr = ptr >>> 0;
|
|
271
266
|
const obj = Object.create(ParsedOotleAddress.prototype);
|
|
272
267
|
obj.__wbg_ptr = ptr;
|
|
273
268
|
ParsedOotleAddressFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -347,7 +342,7 @@ export class ParsedOotleAddress {
|
|
|
347
342
|
set owner_key(arg0) {
|
|
348
343
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
349
344
|
const len0 = WASM_VECTOR_LEN;
|
|
350
|
-
wasm.
|
|
345
|
+
wasm.__wbg_set_parsedootleaddress_owner_key(this.__wbg_ptr, ptr0, len0);
|
|
351
346
|
}
|
|
352
347
|
/**
|
|
353
348
|
* The view-only public key bytes.
|
|
@@ -356,7 +351,7 @@ export class ParsedOotleAddress {
|
|
|
356
351
|
set view_key(arg0) {
|
|
357
352
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
358
353
|
const len0 = WASM_VECTOR_LEN;
|
|
359
|
-
wasm.
|
|
354
|
+
wasm.__wbg_set_parsedootleaddress_view_key(this.__wbg_ptr, ptr0, len0);
|
|
360
355
|
}
|
|
361
356
|
}
|
|
362
357
|
if (Symbol.dispose) ParsedOotleAddress.prototype[Symbol.dispose] = ParsedOotleAddress.prototype.free;
|
|
@@ -367,7 +362,6 @@ if (Symbol.dispose) ParsedOotleAddress.prototype[Symbol.dispose] = ParsedOotleAd
|
|
|
367
362
|
*/
|
|
368
363
|
export class SchnorrSignatureResult {
|
|
369
364
|
static __wrap(ptr) {
|
|
370
|
-
ptr = ptr >>> 0;
|
|
371
365
|
const obj = Object.create(SchnorrSignatureResult.prototype);
|
|
372
366
|
obj.__wbg_ptr = ptr;
|
|
373
367
|
SchnorrSignatureResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -407,7 +401,7 @@ export class SchnorrSignatureResult {
|
|
|
407
401
|
set public_nonce(arg0) {
|
|
408
402
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
409
403
|
const len0 = WASM_VECTOR_LEN;
|
|
410
|
-
wasm.
|
|
404
|
+
wasm.__wbg_set_schnorrsignatureresult_public_nonce(this.__wbg_ptr, ptr0, len0);
|
|
411
405
|
}
|
|
412
406
|
/**
|
|
413
407
|
* @param {Uint8Array} arg0
|
|
@@ -415,7 +409,7 @@ export class SchnorrSignatureResult {
|
|
|
415
409
|
set signature(arg0) {
|
|
416
410
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
417
411
|
const len0 = WASM_VECTOR_LEN;
|
|
418
|
-
wasm.
|
|
412
|
+
wasm.__wbg_set_schnorrsignatureresult_signature(this.__wbg_ptr, ptr0, len0);
|
|
419
413
|
}
|
|
420
414
|
}
|
|
421
415
|
if (Symbol.dispose) SchnorrSignatureResult.prototype[Symbol.dispose] = SchnorrSignatureResult.prototype.free;
|
|
@@ -425,7 +419,6 @@ if (Symbol.dispose) SchnorrSignatureResult.prototype[Symbol.dispose] = SchnorrSi
|
|
|
425
419
|
*/
|
|
426
420
|
export class StealthOutputsResult {
|
|
427
421
|
static __wrap(ptr) {
|
|
428
|
-
ptr = ptr >>> 0;
|
|
429
422
|
const obj = Object.create(StealthOutputsResult.prototype);
|
|
430
423
|
obj.__wbg_ptr = ptr;
|
|
431
424
|
StealthOutputsResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -476,7 +469,7 @@ export class StealthOutputsResult {
|
|
|
476
469
|
set aggregated_output_mask(arg0) {
|
|
477
470
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
478
471
|
const len0 = WASM_VECTOR_LEN;
|
|
479
|
-
wasm.
|
|
472
|
+
wasm.__wbg_set_stealthoutputsresult_aggregated_output_mask(this.__wbg_ptr, ptr0, len0);
|
|
480
473
|
}
|
|
481
474
|
/**
|
|
482
475
|
* JSON-serialized `StealthOutputsStatement` (the wire-format payload).
|
|
@@ -485,7 +478,7 @@ export class StealthOutputsResult {
|
|
|
485
478
|
set statement_json(arg0) {
|
|
486
479
|
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
487
480
|
const len0 = WASM_VECTOR_LEN;
|
|
488
|
-
wasm.
|
|
481
|
+
wasm.__wbg_set_stealthoutputsresult_statement_json(this.__wbg_ptr, ptr0, len0);
|
|
489
482
|
}
|
|
490
483
|
}
|
|
491
484
|
if (Symbol.dispose) StealthOutputsResult.prototype[Symbol.dispose] = StealthOutputsResult.prototype.free;
|
|
@@ -736,6 +729,28 @@ export function buildStealthTransferStatement(input_witnesses_json, revealed_inp
|
|
|
736
729
|
}
|
|
737
730
|
}
|
|
738
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
|
+
|
|
739
754
|
/**
|
|
740
755
|
* Builds a `ConfidentialWithdrawProof` for the Account template's `withdraw_confidential` /
|
|
741
756
|
* `join_confidential` methods, and returns it `tari_bor`-encoded -- ready to hex-encode and wrap
|
|
@@ -1300,6 +1315,35 @@ export function validateBalanceProofSignature(public_nonce, signature, inputs_st
|
|
|
1300
1315
|
return ret[0] !== 0;
|
|
1301
1316
|
}
|
|
1302
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
|
+
|
|
1303
1347
|
/**
|
|
1304
1348
|
* Run the same validation the engine performs on a complete `StealthTransferStatement` envelope:
|
|
1305
1349
|
* structural sanity, commitment well-formedness, range and balance-proof verification.
|
|
@@ -1321,14 +1365,14 @@ export function validateStealthTransfer(transfer_json, view_key) {
|
|
|
1321
1365
|
throw takeFromExternrefTable0(ret[0]);
|
|
1322
1366
|
}
|
|
1323
1367
|
}
|
|
1324
|
-
export function
|
|
1368
|
+
export function __wbg_Error_67e7344beaa85059(arg0, arg1) {
|
|
1325
1369
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1326
1370
|
return ret;
|
|
1327
1371
|
}
|
|
1328
|
-
export function
|
|
1372
|
+
export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
|
|
1329
1373
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1330
1374
|
}
|
|
1331
|
-
export function
|
|
1375
|
+
export function __wbg_getRandomValues_47873ea553f6780e() { return handleError(function (arg0, arg1) {
|
|
1332
1376
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1333
1377
|
}, arguments); }
|
|
1334
1378
|
export function __wbindgen_init_externref_table() {
|
|
@@ -1342,25 +1386,25 @@ export function __wbindgen_init_externref_table() {
|
|
|
1342
1386
|
}
|
|
1343
1387
|
const DecryptedOutputResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1344
1388
|
? { register: () => {}, unregister: () => {} }
|
|
1345
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedoutputresult_free(ptr
|
|
1389
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedoutputresult_free(ptr, 1));
|
|
1346
1390
|
const KeypairResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1347
1391
|
? { register: () => {}, unregister: () => {} }
|
|
1348
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_keypairresult_free(ptr
|
|
1392
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_keypairresult_free(ptr, 1));
|
|
1349
1393
|
const OotlePublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1350
1394
|
? { register: () => {}, unregister: () => {} }
|
|
1351
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_ootlepublickey_free(ptr
|
|
1395
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ootlepublickey_free(ptr, 1));
|
|
1352
1396
|
const OotleSecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1353
1397
|
? { register: () => {}, unregister: () => {} }
|
|
1354
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_ootlesecretkey_free(ptr
|
|
1398
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ootlesecretkey_free(ptr, 1));
|
|
1355
1399
|
const ParsedOotleAddressFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1356
1400
|
? { register: () => {}, unregister: () => {} }
|
|
1357
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_parsedootleaddress_free(ptr
|
|
1401
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_parsedootleaddress_free(ptr, 1));
|
|
1358
1402
|
const SchnorrSignatureResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1359
1403
|
? { register: () => {}, unregister: () => {} }
|
|
1360
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_schnorrsignatureresult_free(ptr
|
|
1404
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_schnorrsignatureresult_free(ptr, 1));
|
|
1361
1405
|
const StealthOutputsResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1362
1406
|
? { register: () => {}, unregister: () => {} }
|
|
1363
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_stealthoutputsresult_free(ptr
|
|
1407
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_stealthoutputsresult_free(ptr, 1));
|
|
1364
1408
|
|
|
1365
1409
|
function addToExternrefTable0(obj) {
|
|
1366
1410
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1374,8 +1418,7 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
1374
1418
|
}
|
|
1375
1419
|
|
|
1376
1420
|
function getStringFromWasm0(ptr, len) {
|
|
1377
|
-
|
|
1378
|
-
return decodeText(ptr, len);
|
|
1421
|
+
return decodeText(ptr >>> 0, len);
|
|
1379
1422
|
}
|
|
1380
1423
|
|
|
1381
1424
|
let cachedUint8ArrayMemory0 = null;
|
|
Binary file
|
|
@@ -5,9 +5,19 @@ export const __wbg_decryptedoutputresult_free: (a: number, b: number) => void;
|
|
|
5
5
|
export const __wbg_get_decryptedoutputresult_mask: (a: number) => [number, number];
|
|
6
6
|
export const __wbg_get_decryptedoutputresult_memo_json: (a: number) => [number, number];
|
|
7
7
|
export const __wbg_get_decryptedoutputresult_value: (a: number) => bigint;
|
|
8
|
+
export const __wbg_get_keypairresult_public_key: (a: number) => [number, number];
|
|
8
9
|
export const __wbg_get_keypairresult_secret_key: (a: number) => [number, number];
|
|
10
|
+
export const __wbg_get_ootlepublickey_owner_key: (a: number) => [number, number];
|
|
11
|
+
export const __wbg_get_ootlepublickey_view_key: (a: number) => [number, number];
|
|
12
|
+
export const __wbg_get_ootlesecretkey_owner_key: (a: number) => [number, number];
|
|
13
|
+
export const __wbg_get_ootlesecretkey_view_key: (a: number) => [number, number];
|
|
9
14
|
export const __wbg_get_parsedootleaddress_memo: (a: number) => [number, number];
|
|
10
15
|
export const __wbg_get_parsedootleaddress_network: (a: number) => number;
|
|
16
|
+
export const __wbg_get_parsedootleaddress_owner_key: (a: number) => [number, number];
|
|
17
|
+
export const __wbg_get_parsedootleaddress_view_key: (a: number) => [number, number];
|
|
18
|
+
export const __wbg_get_schnorrsignatureresult_public_nonce: (a: number) => [number, number];
|
|
19
|
+
export const __wbg_get_schnorrsignatureresult_signature: (a: number) => [number, number];
|
|
20
|
+
export const __wbg_get_stealthoutputsresult_aggregated_output_mask: (a: number) => [number, number];
|
|
11
21
|
export const __wbg_get_stealthoutputsresult_statement_json: (a: number) => [number, number];
|
|
12
22
|
export const __wbg_keypairresult_free: (a: number, b: number) => void;
|
|
13
23
|
export const __wbg_ootlepublickey_free: (a: number, b: number) => void;
|
|
@@ -19,8 +29,18 @@ export const __wbg_set_decryptedoutputresult_memo_json: (a: number, b: number, c
|
|
|
19
29
|
export const __wbg_set_decryptedoutputresult_value: (a: number, b: bigint) => void;
|
|
20
30
|
export const __wbg_set_keypairresult_public_key: (a: number, b: number, c: number) => void;
|
|
21
31
|
export const __wbg_set_keypairresult_secret_key: (a: number, b: number, c: number) => void;
|
|
32
|
+
export const __wbg_set_ootlepublickey_owner_key: (a: number, b: number, c: number) => void;
|
|
33
|
+
export const __wbg_set_ootlepublickey_view_key: (a: number, b: number, c: number) => void;
|
|
34
|
+
export const __wbg_set_ootlesecretkey_owner_key: (a: number, b: number, c: number) => void;
|
|
35
|
+
export const __wbg_set_ootlesecretkey_view_key: (a: number, b: number, c: number) => void;
|
|
22
36
|
export const __wbg_set_parsedootleaddress_memo: (a: number, b: number, c: number) => void;
|
|
23
37
|
export const __wbg_set_parsedootleaddress_network: (a: number, b: number) => void;
|
|
38
|
+
export const __wbg_set_parsedootleaddress_owner_key: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const __wbg_set_parsedootleaddress_view_key: (a: number, b: number, c: number) => void;
|
|
40
|
+
export const __wbg_set_schnorrsignatureresult_public_nonce: (a: number, b: number, c: number) => void;
|
|
41
|
+
export const __wbg_set_schnorrsignatureresult_signature: (a: number, b: number, c: number) => void;
|
|
42
|
+
export const __wbg_set_stealthoutputsresult_aggregated_output_mask: (a: number, b: number, c: number) => void;
|
|
43
|
+
export const __wbg_set_stealthoutputsresult_statement_json: (a: number, b: number, c: number) => void;
|
|
24
44
|
export const __wbg_stealthoutputsresult_free: (a: number, b: number) => void;
|
|
25
45
|
export const addTransactionSigner: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
26
46
|
export const aggregateInputMasks: (a: number, b: number) => [number, number, number, number];
|
|
@@ -29,6 +49,7 @@ export const buildScriptPathWitness: (a: number, b: number, c: number, d: number
|
|
|
29
49
|
export const buildStealthInputsStatement: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
30
50
|
export const buildStealthInputsStatementFromInputs: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
31
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];
|
|
32
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];
|
|
33
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];
|
|
34
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];
|
|
@@ -50,27 +71,8 @@ export const sealTransaction: (a: number, b: number, c: number, d: number) => [n
|
|
|
50
71
|
export const stealthDhSecret: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
51
72
|
export const unblindOutput: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
52
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];
|
|
53
75
|
export const validateStealthTransfer: (a: number, b: number, c: number, d: number) => [number, number];
|
|
54
|
-
export const __wbg_get_keypairresult_public_key: (a: number) => [number, number];
|
|
55
|
-
export const __wbg_get_ootlepublickey_owner_key: (a: number) => [number, number];
|
|
56
|
-
export const __wbg_get_ootlepublickey_view_key: (a: number) => [number, number];
|
|
57
|
-
export const __wbg_get_ootlesecretkey_owner_key: (a: number) => [number, number];
|
|
58
|
-
export const __wbg_get_ootlesecretkey_view_key: (a: number) => [number, number];
|
|
59
|
-
export const __wbg_get_parsedootleaddress_owner_key: (a: number) => [number, number];
|
|
60
|
-
export const __wbg_get_parsedootleaddress_view_key: (a: number) => [number, number];
|
|
61
|
-
export const __wbg_get_schnorrsignatureresult_public_nonce: (a: number) => [number, number];
|
|
62
|
-
export const __wbg_get_schnorrsignatureresult_signature: (a: number) => [number, number];
|
|
63
|
-
export const __wbg_get_stealthoutputsresult_aggregated_output_mask: (a: number) => [number, number];
|
|
64
|
-
export const __wbg_set_ootlepublickey_owner_key: (a: number, b: number, c: number) => void;
|
|
65
|
-
export const __wbg_set_ootlepublickey_view_key: (a: number, b: number, c: number) => void;
|
|
66
|
-
export const __wbg_set_ootlesecretkey_owner_key: (a: number, b: number, c: number) => void;
|
|
67
|
-
export const __wbg_set_ootlesecretkey_view_key: (a: number, b: number, c: number) => void;
|
|
68
|
-
export const __wbg_set_parsedootleaddress_owner_key: (a: number, b: number, c: number) => void;
|
|
69
|
-
export const __wbg_set_parsedootleaddress_view_key: (a: number, b: number, c: number) => void;
|
|
70
|
-
export const __wbg_set_schnorrsignatureresult_public_nonce: (a: number, b: number, c: number) => void;
|
|
71
|
-
export const __wbg_set_schnorrsignatureresult_signature: (a: number, b: number, c: number) => void;
|
|
72
|
-
export const __wbg_set_stealthoutputsresult_aggregated_output_mask: (a: number, b: number, c: number) => void;
|
|
73
|
-
export const __wbg_set_stealthoutputsresult_statement_json: (a: number, b: number, c: number) => void;
|
|
74
76
|
export const tari_free: (a: number) => void;
|
|
75
77
|
export const tari_alloc: (a: number) => number;
|
|
76
78
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
@@ -4,8 +4,8 @@
|
|
|
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
|
|
8
|
-
"version": "0.
|
|
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
|
+
"version": "0.41.0",
|
|
9
9
|
"license": "BSD-3-Clause",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"ootle_wasm.d.ts",
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
21
24
|
"main": "ootle_wasm.js",
|
|
22
25
|
"types": "ootle_wasm.d.ts",
|
|
23
26
|
"sideEffects": [
|