@chironbuilder/ootle-sdk 0.1.29 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bucketStealthTransfer.d.ts +12 -0
- package/dist/bucketStealthTransfer.d.ts.map +1 -0
- package/dist/bucketStealthTransfer.js +57 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/indexerDecode.d.ts +23 -0
- package/dist/indexerDecode.d.ts.map +1 -0
- package/dist/indexerDecode.js +68 -0
- package/dist/storage.d.ts +11 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/utxoScan.d.ts +24 -39
- package/dist/utxoScan.d.ts.map +1 -1
- package/dist/utxoScan.js +136 -133
- package/dist/wallet.d.ts +28 -8
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +166 -82
- package/package.json +8 -8
- package/vendor/ootle-wasm-patched/chiron-0.49.2.patch +199 -0
- package/vendor/ootle-wasm-patched/ootle_wasm.d.ts +53 -35
- package/vendor/ootle-wasm-patched/ootle_wasm.js +1 -1
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.js +158 -45
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm +0 -0
- package/vendor/ootle-wasm-patched/ootle_wasm_bg.wasm.d.ts +15 -12
- package/vendor/ootle-wasm-patched/package.json +3 -3
- package/vendor/ootle-patched/README.md +0 -67
- package/vendor/ootle-patched/dist/index.d.ts +0 -2158
- package/vendor/ootle-patched/dist/index.js +0 -1389
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/README.md +0 -128
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/ootle_wasm.d.ts +0 -436
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/ootle_wasm.js +0 -9
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/ootle_wasm_bg.js +0 -1450
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/ootle_wasm_bg.wasm +0 -0
- package/vendor/ootle-patched/node_modules/@tari-project/ootle-wasm/package.json +0 -30
- package/vendor/ootle-patched/package.json +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chironbuilder/ootle-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@noble/curves": "^1.9.0",
|
|
43
43
|
"@noble/hashes": "^2.2.0",
|
|
44
|
-
"@tari-project/ootle": "^0.
|
|
45
|
-
"@tari-project/ootle-indexer": "^0.
|
|
46
|
-
"@tari-project/ootle-secret-key-wallet": "^0.
|
|
47
|
-
"@tari-project/ootle-ts-bindings": "^1.
|
|
48
|
-
"@tari-project/ootle-wasm": "^0.
|
|
49
|
-
"@
|
|
50
|
-
"@chironbuilder/ootle-legacy": "file:./vendor/ootle-patched"
|
|
44
|
+
"@tari-project/ootle": "^0.12.0",
|
|
45
|
+
"@tari-project/ootle-indexer": "^0.12.0",
|
|
46
|
+
"@tari-project/ootle-secret-key-wallet": "^0.12.0",
|
|
47
|
+
"@tari-project/ootle-ts-bindings": "^1.62.0",
|
|
48
|
+
"@tari-project/ootle-wasm": "^0.49.2",
|
|
49
|
+
"@tari-project/ootle-wasm-bor": "^0.49.2",
|
|
50
|
+
"@chironbuilder/ootle-wasm-legacy": "file:./vendor/ootle-wasm-patched"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/chrome": "^0.0.280",
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
diff --git a/crates/ootle_wasm/core/src/chiron.rs b/crates/ootle_wasm/core/src/chiron.rs
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..ff3072c
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/crates/ootle_wasm/core/src/chiron.rs
|
|
6
|
+
@@ -0,0 +1,96 @@
|
|
7
|
+
+// Copyright 2026 chironbuilds
|
|
8
|
+
+// SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
+
|
|
10
|
+
+//! chironbuilds additions (not upstream): L1 burn-claim key derivation/validation and a
|
|
11
|
+
+//! client-side `ConfidentialWithdrawProof` literal. Re-ported onto v0.49.2.
|
|
12
|
+
+
|
|
13
|
+
+use ootle_network::Network;
|
|
14
|
+
+use tari_crypto::{keys::PublicKey, ristretto::RistrettoPublicKey, tari_utilities::ByteArray};
|
|
15
|
+
+use tari_ootle_wallet_crypto::{MaskAndValue, StealthCryptoApi, confidential::create_withdraw_proof, kdfs};
|
|
16
|
+
+use tari_template_lib_types::{
|
|
17
|
+
+ Amount,
|
|
18
|
+
+ crypto::{RistrettoPublicKeyBytes, SchnorrSignatureBytes},
|
|
19
|
+
+};
|
|
20
|
+
+
|
|
21
|
+
+use crate::{
|
|
22
|
+
+ error::OotleWasmError,
|
|
23
|
+
+ keys::{commitment_bytes_from_bytes, public_key_from_bytes, secret_key_from_bytes},
|
|
24
|
+
+ stealth::{InputWitness, OutputWitnessJson, types::decode_secret_key},
|
|
25
|
+
+};
|
|
26
|
+
+
|
|
27
|
+
+/// `s = H(p·R) + p` (L1 `stealth_address` domain) for claiming an L1 burn.
|
|
28
|
+
+pub fn burn_claim_stealth_secret(account_secret: &[u8], sender_offset_public_key: &[u8]) -> Result<Vec<u8>, OotleWasmError> {
|
|
29
|
+
+ let p = secret_key_from_bytes(account_secret)?;
|
|
30
|
+
+ let r = public_key_from_bytes(sender_offset_public_key)?;
|
|
31
|
+
+ Ok(kdfs::burn_claim_stealth_secret(&p, &r).as_bytes().to_vec())
|
|
32
|
+
+}
|
|
33
|
+
+
|
|
34
|
+
+/// Validate a burn ownership proof against `C = s·G`, exactly as a validator does.
|
|
35
|
+
+pub fn validate_burn_claim_ownership_proof(
|
|
36
|
+
+ network_byte: u8,
|
|
37
|
+
+ ownership_nonce: &[u8],
|
|
38
|
+
+ ownership_signature: &[u8],
|
|
39
|
+
+ commitment: &[u8],
|
|
40
|
+
+ value: u64,
|
|
41
|
+
+ stealth_secret: &[u8],
|
|
42
|
+
+) -> Result<bool, OotleWasmError> {
|
|
43
|
+
+ let network = Network::try_from(network_byte).map_err(|e| OotleWasmError::InvalidNetwork(e.to_string()))?;
|
|
44
|
+
+ let s = secret_key_from_bytes(stealth_secret)?;
|
|
45
|
+
+ let claimant = RistrettoPublicKey::from_secret_key(&s);
|
|
46
|
+
+ let claimant = RistrettoPublicKeyBytes::from_bytes(claimant.as_bytes())
|
|
47
|
+
+ .map_err(|e| OotleWasmError::InvalidPublicKey(e.to_string()))?;
|
|
48
|
+
+ let Ok(sig) = SchnorrSignatureBytes::try_from_raw_parts(ownership_nonce, ownership_signature) else {
|
|
49
|
+
+ return Ok(false);
|
|
50
|
+
+ };
|
|
51
|
+
+ let commitment = commitment_bytes_from_bytes(commitment)?;
|
|
52
|
+
+ Ok(StealthCryptoApi::new().validate_burn_claim_ownership_proof(network, &sig, &commitment, value, &claimant))
|
|
53
|
+
+}
|
|
54
|
+
+
|
|
55
|
+
+/// tari_bor-encoded `ConfidentialWithdrawProof`, for use as an instruction `Literal` arg.
|
|
56
|
+
+pub fn create_confidential_withdraw_proof_literal(
|
|
57
|
+
+ inputs_json: &str,
|
|
58
|
+
+ input_revealed_amount: u64,
|
|
59
|
+
+ output_json: Option<&str>,
|
|
60
|
+
+ output_revealed_amount: u64,
|
|
61
|
+
+ change_json: Option<&str>,
|
|
62
|
+
+ change_revealed_amount: u64,
|
|
63
|
+
+) -> Result<Vec<u8>, OotleWasmError> {
|
|
64
|
+
+ let inputs: Vec<InputWitness> = serde_json::from_str(inputs_json)?;
|
|
65
|
+
+ let inputs = inputs
|
|
66
|
+
+ .into_iter()
|
|
67
|
+
+ .map(|i| {
|
|
68
|
+
+ Ok(MaskAndValue {
|
|
69
|
+
+ value: i.value,
|
|
70
|
+
+ mask: decode_secret_key(&i.mask, "mask")?,
|
|
71
|
+
+ })
|
|
72
|
+
+ })
|
|
73
|
+
+ .collect::<Result<Vec<_>, OotleWasmError>>()?;
|
|
74
|
+
+ let parse = |j: Option<&str>| -> Result<_, OotleWasmError> {
|
|
75
|
+
+ match j {
|
|
76
|
+
+ Some(s) => Ok(Some(serde_json::from_str::<OutputWitnessJson>(s)?.try_into_witness()?)),
|
|
77
|
+
+ None => Ok(None),
|
|
78
|
+
+ }
|
|
79
|
+
+ };
|
|
80
|
+
+ let output = parse(output_json)?;
|
|
81
|
+
+ let change = parse(change_json)?;
|
|
82
|
+
+ let proof = create_withdraw_proof(
|
|
83
|
+
+ &inputs,
|
|
84
|
+
+ Amount::from_u64(input_revealed_amount),
|
|
85
|
+
+ output.as_ref(),
|
|
86
|
+
+ Amount::from_u64(output_revealed_amount),
|
|
87
|
+
+ change.as_ref(),
|
|
88
|
+
+ Amount::from_u64(change_revealed_amount),
|
|
89
|
+
+ )
|
|
90
|
+
+ .map_err(|e| OotleWasmError::Stealth(e.to_string()))?;
|
|
91
|
+
+ Ok(tari_bor::encode(&proof)?)
|
|
92
|
+
+}
|
|
93
|
+
+
|
|
94
|
+
+/// Ristretto Schnorr signature (tari_crypto `RistrettoSchnorr::sign`) over `message`. Removed
|
|
95
|
+
+/// upstream in 0.48 when transaction signing moved to sr25519; kept here for off-chain,
|
|
96
|
+
+/// domain-separated ownership proofs whose verifiers expect Ristretto Schnorr.
|
|
97
|
+
+pub fn schnorr_sign(secret_key: &[u8], message: &[u8]) -> Result<(Vec<u8>, Vec<u8>), OotleWasmError> {
|
|
98
|
+
+ use tari_crypto::ristretto::RistrettoSchnorr;
|
|
99
|
+
+ let sk = secret_key_from_bytes(secret_key)?;
|
|
100
|
+
+ let sig = RistrettoSchnorr::sign(&sk, message, &mut rand::rng()).map_err(|e| OotleWasmError::Stealth(e.to_string()))?;
|
|
101
|
+
+ Ok((sig.get_public_nonce().as_bytes().to_vec(), sig.get_signature().as_bytes().to_vec()))
|
|
102
|
+
+}
|
|
103
|
+
diff --git a/crates/ootle_wasm/core/src/lib.rs b/crates/ootle_wasm/core/src/lib.rs
|
|
104
|
+
index 28cde05..ba042a8 100644
|
|
105
|
+
--- a/crates/ootle_wasm/core/src/lib.rs
|
|
106
|
+
+++ b/crates/ootle_wasm/core/src/lib.rs
|
|
107
|
+
@@ -10,3 +10,4 @@ pub mod keys;
|
|
108
|
+
pub mod sign;
|
|
109
|
+
pub mod stealth;
|
|
110
|
+
pub mod transaction;
|
|
111
|
+
+pub mod chiron;
|
|
112
|
+
diff --git a/crates/ootle_wasm/core/src/stealth/mod.rs b/crates/ootle_wasm/core/src/stealth/mod.rs
|
|
113
|
+
index 371f214..80fd771 100644
|
|
114
|
+
--- a/crates/ootle_wasm/core/src/stealth/mod.rs
|
|
115
|
+
+++ b/crates/ootle_wasm/core/src/stealth/mod.rs
|
|
116
|
+
@@ -12,7 +12,7 @@ pub mod inputs;
|
|
117
|
+
pub mod kdfs;
|
|
118
|
+
pub mod outputs;
|
|
119
|
+
pub mod transfer;
|
|
120
|
+
-mod types;
|
|
121
|
+
+pub mod types;
|
|
122
|
+
pub mod validate;
|
|
123
|
+
pub mod viewable_balance;
|
|
124
|
+
|
|
125
|
+
diff --git a/crates/ootle_wasm/wasm/src/lib.rs b/crates/ootle_wasm/wasm/src/lib.rs
|
|
126
|
+
index 5d6b467..91dfda4 100644
|
|
127
|
+
--- a/crates/ootle_wasm/wasm/src/lib.rs
|
|
128
|
+
+++ b/crates/ootle_wasm/wasm/src/lib.rs
|
|
129
|
+
@@ -646,3 +646,70 @@ pub fn decrypt_elgamal_viewable_balance(
|
|
130
|
+
)
|
|
131
|
+
.map_err(|e| JsError::new(&e.to_string()))
|
|
132
|
+
}
|
|
133
|
+
+
|
|
134
|
+
+// ---- chironbuilds additions (not upstream) ----
|
|
135
|
+
+
|
|
136
|
+
+/// Derive the stealth claim secret `s = H(p·R) + p` for claiming an L1 (minotari) burn, from the
|
|
137
|
+
+/// account secret `p` and the burn's sender offset public key `R`. The claim transaction must be
|
|
138
|
+
+/// sealed with this key.
|
|
139
|
+
+#[wasm_bindgen(js_name = "burnClaimStealthSecret")]
|
|
140
|
+
+pub fn burn_claim_stealth_secret(account_secret: &[u8], sender_offset_public_key: &[u8]) -> Result<Vec<u8>, JsError> {
|
|
141
|
+
+ ootle_wasm_core::chiron::burn_claim_stealth_secret(account_secret, sender_offset_public_key)
|
|
142
|
+
+ .map_err(|e| JsError::new(&e.to_string()))
|
|
143
|
+
+}
|
|
144
|
+
+
|
|
145
|
+
+/// Check an L1 burn ownership proof against the stealth claim key derived from `stealth_secret`,
|
|
146
|
+
+/// exactly as a validator will. `false` means the claim would be rejected.
|
|
147
|
+
+///
|
|
148
|
+
+/// `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
|
|
149
|
+
+#[wasm_bindgen(js_name = "validateBurnClaimOwnershipProof")]
|
|
150
|
+
+pub fn validate_burn_claim_ownership_proof(
|
|
151
|
+
+ network: u8,
|
|
152
|
+
+ ownership_nonce: &[u8],
|
|
153
|
+
+ ownership_signature: &[u8],
|
|
154
|
+
+ commitment: &[u8],
|
|
155
|
+
+ value: BigInt,
|
|
156
|
+
+ stealth_secret: &[u8],
|
|
157
|
+
+) -> Result<bool, JsError> {
|
|
158
|
+
+ let value = u64_arg("value", value)?;
|
|
159
|
+
+ ootle_wasm_core::chiron::validate_burn_claim_ownership_proof(
|
|
160
|
+
+ network,
|
|
161
|
+
+ ownership_nonce,
|
|
162
|
+
+ ownership_signature,
|
|
163
|
+
+ commitment,
|
|
164
|
+
+ value,
|
|
165
|
+
+ stealth_secret,
|
|
166
|
+
+ )
|
|
167
|
+
+ .map_err(|e| JsError::new(&e.to_string()))
|
|
168
|
+
+}
|
|
169
|
+
+
|
|
170
|
+
+/// tari_bor-encoded `ConfidentialWithdrawProof` (the bytes the chain decodes), for use as an
|
|
171
|
+
+/// instruction `Literal` argument. `inputs_json` is a JSON array of `{ value, mask }`;
|
|
172
|
+
+/// `output_json` / `change_json` are optional `OutputWitnessJson` objects.
|
|
173
|
+
+#[wasm_bindgen(js_name = "createConfidentialWithdrawProofLiteral")]
|
|
174
|
+
+pub fn create_confidential_withdraw_proof_literal(
|
|
175
|
+
+ inputs_json: &str,
|
|
176
|
+
+ input_revealed_amount: BigInt,
|
|
177
|
+
+ output_json: Option<String>,
|
|
178
|
+
+ output_revealed_amount: BigInt,
|
|
179
|
+
+ change_json: Option<String>,
|
|
180
|
+
+ change_revealed_amount: BigInt,
|
|
181
|
+
+) -> Result<Vec<u8>, JsError> {
|
|
182
|
+
+ ootle_wasm_core::chiron::create_confidential_withdraw_proof_literal(
|
|
183
|
+
+ inputs_json,
|
|
184
|
+
+ u64_arg("input_revealed_amount", input_revealed_amount)?,
|
|
185
|
+
+ output_json.as_deref(),
|
|
186
|
+
+ u64_arg("output_revealed_amount", output_revealed_amount)?,
|
|
187
|
+
+ change_json.as_deref(),
|
|
188
|
+
+ u64_arg("change_revealed_amount", change_revealed_amount)?,
|
|
189
|
+
+ )
|
|
190
|
+
+ .map_err(|e| JsError::new(&e.to_string()))
|
|
191
|
+
+}
|
|
192
|
+
+
|
|
193
|
+
+/// Ristretto Schnorr-sign `message` (off-chain proofs only; transactions use sr25519).
|
|
194
|
+
+#[wasm_bindgen(js_name = "schnorrSign")]
|
|
195
|
+
+pub fn schnorr_sign(secret_key: &[u8], message: &[u8]) -> Result<SchnorrSignatureResult, JsError> {
|
|
196
|
+
+ let (public_nonce, signature) =
|
|
197
|
+
+ ootle_wasm_core::chiron::schnorr_sign(secret_key, message).map_err(|e| JsError::new(&e.to_string()))?;
|
|
198
|
+
+ Ok(SchnorrSignatureResult { public_nonce, signature })
|
|
199
|
+
+}
|
|
@@ -13,12 +13,12 @@ export class DecryptedOutputResult {
|
|
|
13
13
|
*/
|
|
14
14
|
mask: Uint8Array;
|
|
15
15
|
/**
|
|
16
|
-
* JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `
|
|
16
|
+
* JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `DestinationTagAndBytes`), or `null` if
|
|
17
17
|
* the payload carried no memo or `skipMemo` was set.
|
|
18
18
|
*/
|
|
19
19
|
get memo_json(): string | undefined;
|
|
20
20
|
/**
|
|
21
|
-
* JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `
|
|
21
|
+
* JSON-encoded `Memo` (variants: `U256` / `Message` / `Bytes` / `DestinationTagAndBytes`), or `null` if
|
|
22
22
|
* the payload carried no memo or `skipMemo` was set.
|
|
23
23
|
*/
|
|
24
24
|
set memo_json(value: string | null | undefined);
|
|
@@ -81,13 +81,13 @@ export class ParsedOotleAddress {
|
|
|
81
81
|
free(): void;
|
|
82
82
|
[Symbol.dispose](): void;
|
|
83
83
|
/**
|
|
84
|
-
* Optional
|
|
84
|
+
* Optional destination tag bytes.
|
|
85
85
|
*/
|
|
86
|
-
get
|
|
86
|
+
get destination_tag(): Uint8Array | undefined;
|
|
87
87
|
/**
|
|
88
|
-
* Optional
|
|
88
|
+
* Optional destination tag bytes.
|
|
89
89
|
*/
|
|
90
|
-
set
|
|
90
|
+
set destination_tag(value: Uint8Array | null | undefined);
|
|
91
91
|
/**
|
|
92
92
|
* The network byte.
|
|
93
93
|
*/
|
|
@@ -152,6 +152,27 @@ export function addTransactionSigner(tx_json: string, signer_secret_key: Uint8Ar
|
|
|
152
152
|
*/
|
|
153
153
|
export function aggregateInputMasks(masks_concat: Uint8Array): Uint8Array;
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Seal a transaction (unsigned or unsealed JSON) with a signature from an external signer (HSM, MPC).
|
|
157
|
+
*
|
|
158
|
+
* `signature` is the 64-byte sr25519 signature (scheme in the NPM README) over the hash from
|
|
159
|
+
* `hashUnsealedTransaction`, made by the key for `seal_signer_public_key`. The seal and any
|
|
160
|
+
* authorization signatures are verified.
|
|
161
|
+
* Returns the sealed `Transaction` as a JSON string.
|
|
162
|
+
*/
|
|
163
|
+
export function attachSealSignature(tx_json: string, seal_signer_public_key: Uint8Array, signature: Uint8Array): string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Add an authorization signature from an external signer (HSM, MPC) to a transaction (unsigned or
|
|
167
|
+
* unsealed JSON).
|
|
168
|
+
*
|
|
169
|
+
* `signature` is the 64-byte sr25519 signature (scheme in the NPM README) over the hash from
|
|
170
|
+
* `hashUnsignedTransaction` for `seal_signer_public_key`, made by the key for
|
|
171
|
+
* `signer_public_key`. It is verified before it is appended.
|
|
172
|
+
* Returns the `UnsealedTransactionV1` (with the new signature appended) as a JSON string.
|
|
173
|
+
*/
|
|
174
|
+
export function attachTransactionSignature(tx_json: string, signer_public_key: Uint8Array, signature: Uint8Array, seal_signer_public_key: Uint8Array): string;
|
|
175
|
+
|
|
155
176
|
/**
|
|
156
177
|
* BOR-encode a Transaction (JSON string) → base64 string (TransactionEnvelope format).
|
|
157
178
|
*/
|
|
@@ -192,10 +213,9 @@ export function buildStealthInputsStatement(input_commitments: Uint8Array, revea
|
|
|
192
213
|
* this accepts a caller-supplied `witness` per input -- the only way to spend an output committed with
|
|
193
214
|
* `PayTo::Conditions` (e.g. claiming or refunding an HTLC-style hashlock/timelock output). Build each
|
|
194
215
|
* script-path input's witness with `buildScriptPathWitness` first; a plain key-path input can still be
|
|
195
|
-
* included in the same call
|
|
196
|
-
* (defaults to key path).
|
|
216
|
+
* included in the same call with `"witness":"KeyPath"`.
|
|
197
217
|
*
|
|
198
|
-
* `inputs_json` shape: `[{ "commitment": <hex 32 bytes>, "witness"
|
|
218
|
+
* `inputs_json` shape: `[{ "commitment": <hex 32 bytes>, "witness": <SpendWitness> }, ...]`.
|
|
199
219
|
*/
|
|
200
220
|
export function buildStealthInputsStatementFromInputs(inputs_json: string, revealed_amount_microtari: bigint): string;
|
|
201
221
|
|
|
@@ -229,20 +249,9 @@ export function buildStealthTransferStatement(input_witnesses_json: string, reve
|
|
|
229
249
|
export function burnClaimStealthSecret(account_secret: Uint8Array, sender_offset_public_key: Uint8Array): Uint8Array;
|
|
230
250
|
|
|
231
251
|
/**
|
|
232
|
-
*
|
|
233
|
-
* `
|
|
234
|
-
*
|
|
235
|
-
* types. Unlike those, this is NOT re-encoded on the JS side: the bytes are already the encoding
|
|
236
|
-
* the chain itself decodes, produced by the same derive-generated `Encode` impl.
|
|
237
|
-
*
|
|
238
|
-
* `inputs_json` is a JSON array of `{ value, mask }` for each confidential UTXO being spent — `"[]"`
|
|
239
|
-
* for a revealed-only withdrawal (depositing into the vault). `output_json` / `change_json` are each
|
|
240
|
-
* an optional JSON object (see `createStealthOutputWitness`'s `OutputWitnessJson` shape) — omit to
|
|
241
|
-
* skip that side. `*_revealed_amount` is the plaintext portion on each side; confidential and
|
|
242
|
-
* revealed amounts can be mixed on either side.
|
|
243
|
-
*
|
|
244
|
-
* Throws if `inputs_json`/`output_json`/`change_json` don't parse, or if any mask isn't a valid
|
|
245
|
-
* 32-byte Ristretto scalar.
|
|
252
|
+
* tari_bor-encoded `ConfidentialWithdrawProof` (the bytes the chain decodes), for use as an
|
|
253
|
+
* instruction `Literal` argument. `inputs_json` is a JSON array of `{ value, mask }`;
|
|
254
|
+
* `output_json` / `change_json` are optional `OutputWitnessJson` objects.
|
|
246
255
|
*/
|
|
247
256
|
export function createConfidentialWithdrawProofLiteral(inputs_json: string, input_revealed_amount: bigint, output_json: string | null | undefined, output_revealed_amount: bigint, change_json: string | null | undefined, change_revealed_amount: bigint): Uint8Array;
|
|
248
257
|
|
|
@@ -331,9 +340,9 @@ export function generateKeypair(): KeypairResult;
|
|
|
331
340
|
* Generate an Ootle address (bech32m string) from public keys.
|
|
332
341
|
*
|
|
333
342
|
* `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, etc.).
|
|
334
|
-
* `
|
|
343
|
+
* `destination_tag` is optional (max 64 bytes).
|
|
335
344
|
*/
|
|
336
|
-
export function generateOotleAddress(owner_public_key: Uint8Array, view_public_key: Uint8Array, network: number,
|
|
345
|
+
export function generateOotleAddress(owner_public_key: Uint8Array, view_public_key: Uint8Array, network: number, destination_tag?: Uint8Array | null): string;
|
|
337
346
|
|
|
338
347
|
/**
|
|
339
348
|
* Generate a new random pair of Ootle secret keys (owner + view).
|
|
@@ -377,8 +386,18 @@ export function generateStealthBalanceProofSignature(aggregated_input_mask: Uint
|
|
|
377
386
|
export function generateStealthOutputsStatement(witnesses_json: string, revealed_output_amount_microtari: bigint, revealed_receiver: Uint8Array): StealthOutputsResult;
|
|
378
387
|
|
|
379
388
|
/**
|
|
380
|
-
* Hash
|
|
381
|
-
* Returns the 64-byte
|
|
389
|
+
* Hash a transaction (unsigned or unsealed JSON) for sealing.
|
|
390
|
+
* Returns the 64-byte seal message that the seal signer must sign.
|
|
391
|
+
*
|
|
392
|
+
* The seal message covers every authorization signature, so attach all of them before hashing.
|
|
393
|
+
*/
|
|
394
|
+
export function hashUnsealedTransaction(tx_json: string): Uint8Array;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Hash a transaction (unsigned or unsealed JSON) for an authorization signature.
|
|
398
|
+
* Returns the 64-byte signing message that must be sr25519-signed.
|
|
399
|
+
*
|
|
400
|
+
* The message excludes attached signatures, so it is the same before and after `attachTransactionSignature`.
|
|
382
401
|
*
|
|
383
402
|
* `seal_signer_public_key` is the raw bytes of the seal signer's public key (account owner).
|
|
384
403
|
*/
|
|
@@ -397,7 +416,7 @@ export function ootlePublicKeyFromSecretKey(owner_key: Uint8Array, view_key: Uin
|
|
|
397
416
|
|
|
398
417
|
/**
|
|
399
418
|
* Parse a bech32m Ootle address string into its components.
|
|
400
|
-
* Returns { owner_key: Uint8Array, view_key: Uint8Array, network: number,
|
|
419
|
+
* Returns { owner_key: Uint8Array, view_key: Uint8Array, network: number, destination_tag: Uint8Array | undefined }.
|
|
401
420
|
*/
|
|
402
421
|
export function parseOotleAddress(address: string): ParsedOotleAddress;
|
|
403
422
|
|
|
@@ -407,8 +426,7 @@ export function parseOotleAddress(address: string): ParsedOotleAddress;
|
|
|
407
426
|
export function publicKeyFromSecretKey(secret_key: Uint8Array): Uint8Array;
|
|
408
427
|
|
|
409
428
|
/**
|
|
410
|
-
* Schnorr-sign
|
|
411
|
-
* Returns { public_nonce: Uint8Array, signature: Uint8Array }.
|
|
429
|
+
* Ristretto Schnorr-sign `message` (off-chain proofs only; transactions use sr25519).
|
|
412
430
|
*/
|
|
413
431
|
export function schnorrSign(secret_key: Uint8Array, message: Uint8Array): SchnorrSignatureResult;
|
|
414
432
|
|
|
@@ -421,13 +439,13 @@ export function schnorrSign(secret_key: Uint8Array, message: Uint8Array): Schnor
|
|
|
421
439
|
export function sealTransaction(tx_json: string, seal_signer_secret_key: Uint8Array): string;
|
|
422
440
|
|
|
423
441
|
/**
|
|
424
|
-
* Derive the recipient's stealth spending scalar `c + k`, where `c = H(network ||
|
|
425
|
-
* receiver runs this with their account secret key
|
|
426
|
-
* nonce to obtain the one-time secret that controls the stealth output.
|
|
442
|
+
* Derive the recipient's stealth spending scalar `c + k`, where `c = H(network || v·R)`. The
|
|
443
|
+
* receiver runs this with their account secret key `k`, view secret key `v` and the sender-provided
|
|
444
|
+
* public nonce `R` to obtain the one-time secret that controls the stealth output.
|
|
427
445
|
*
|
|
428
446
|
* `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
|
|
429
447
|
*/
|
|
430
|
-
export function stealthDhSecret(network: number,
|
|
448
|
+
export function stealthDhSecret(network: number, account_secret: Uint8Array, view_secret: Uint8Array, public_nonce: Uint8Array): Uint8Array;
|
|
431
449
|
|
|
432
450
|
/**
|
|
433
451
|
* Decrypt and verify the AEAD payload of an inbound stealth UTXO.
|
|
@@ -450,7 +468,7 @@ export function unblindOutput(output_commitment: Uint8Array, encrypted_data: Uin
|
|
|
450
468
|
export function validateBalanceProofSignature(public_nonce: Uint8Array, signature: Uint8Array, inputs_statement_json: string, outputs_statement_json: string, covenant_claims_json: string): boolean;
|
|
451
469
|
|
|
452
470
|
/**
|
|
453
|
-
* Check an L1 burn
|
|
471
|
+
* Check an L1 burn ownership proof against the stealth claim key derived from `stealth_secret`,
|
|
454
472
|
* exactly as a validator will. `false` means the claim would be rejected.
|
|
455
473
|
*
|
|
456
474
|
* `network` is the network byte (0x00 = MainNet, 0x10 = LocalNet, 0x26 = Esmeralda, ...).
|
|
@@ -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, 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
|
|
8
|
+
DecryptedOutputResult, KeypairResult, OotlePublicKey, OotleSecretKey, ParsedOotleAddress, SchnorrSignatureResult, StealthOutputsResult, addTransactionSigner, aggregateInputMasks, attachSealSignature, attachTransactionSignature, borEncodeTransaction, buildScriptPathWitness, buildStealthInputsStatement, buildStealthInputsStatementFromInputs, buildStealthTransferStatement, burnClaimStealthSecret, createConfidentialWithdrawProofLiteral, createStealthOutputWitness, decryptElgamalViewableBalance, encryptedDataDhKdfAead, generateElgamalViewableBalanceProof, generateExtendedBulletProof, generateKeypair, generateOotleAddress, generateOotleSecretKey, generateStealthBalanceProofSignature, generateStealthOutputsStatement, hashUnsealedTransaction, hashUnsignedTransaction, on_start, ootlePublicKeyFromSecretKey, parseOotleAddress, publicKeyFromSecretKey, schnorrSign, sealTransaction, stealthDhSecret, unblindOutput, validateBalanceProofSignature, validateBurnClaimOwnershipProof, validateStealthTransfer
|
|
9
9
|
} from "./ootle_wasm_bg.js";
|