@runflame/wallet-wasm 0.0.1-rc.0 → 0.0.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/flamewallet_wasm.d.ts +46 -16
- package/flamewallet_wasm.js +27 -0
- package/flamewallet_wasm_bg.wasm +0 -0
- package/flamewallet_wasm_bg.wasm.d.ts +16 -13
- package/package.json +1 -1
- package/sbom.cdx.json +5972 -0
package/flamewallet_wasm.d.ts
CHANGED
|
@@ -50,10 +50,13 @@ export interface TransferInput {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface TransferOutput {
|
|
53
|
-
|
|
53
|
+
/** The recipient's bech32f address, for the wallet's network. */
|
|
54
|
+
address: string;
|
|
54
55
|
qty: bigint;
|
|
55
56
|
/** Absent for flames. */
|
|
56
57
|
flavor?: Uint8Array;
|
|
58
|
+
/** Sealed into the note for the recipient alone; at most 8102 bytes. */
|
|
59
|
+
memo?: Uint8Array;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export interface TransferRequest {
|
|
@@ -70,8 +73,8 @@ export interface CreatedOutput {
|
|
|
70
73
|
contractId: Uint8Array;
|
|
71
74
|
/** Its published bytes, as an indexer serves them once confirmed. */
|
|
72
75
|
contract: Uint8Array;
|
|
73
|
-
/** The
|
|
74
|
-
|
|
76
|
+
/** The encrypted note that follows it on chain; `Wallet.openNote` reads it. */
|
|
77
|
+
note: Uint8Array;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
export interface Transfer {
|
|
@@ -79,9 +82,25 @@ export interface Transfer {
|
|
|
79
82
|
txid: Uint8Array;
|
|
80
83
|
/** `BlockTx::to_bytes`: what a node's `submit_tx` takes. */
|
|
81
84
|
blockTx: Uint8Array;
|
|
85
|
+
/** In published order, not request order: match each by its predicate. */
|
|
82
86
|
outputs: CreatedOutput[];
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
/** What `Wallet.openNote` gives: the opening to spend with, and the memo. */
|
|
90
|
+
export interface ReceivedNote {
|
|
91
|
+
opening: Opening;
|
|
92
|
+
memo: Uint8Array;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Why a note did not open; `docs/payments.md` "Receiving" says what to do. */
|
|
96
|
+
export type NoteFailure =
|
|
97
|
+
| "missing"
|
|
98
|
+
| "malformed"
|
|
99
|
+
| "unknownVersion"
|
|
100
|
+
| "undecryptable"
|
|
101
|
+
| "openingMismatch"
|
|
102
|
+
| "notConfidential";
|
|
103
|
+
|
|
85
104
|
/** What every call throws. Fields beyond `kind` depend on it. */
|
|
86
105
|
export interface FlameError extends Error {
|
|
87
106
|
name: "FlameError";
|
|
@@ -92,12 +111,15 @@ export interface FlameError extends Error {
|
|
|
92
111
|
| "invalidKeyPath"
|
|
93
112
|
| "invalidBytes"
|
|
94
113
|
| "keyMismatch"
|
|
114
|
+
| "note"
|
|
95
115
|
| "transfer";
|
|
96
116
|
reason?: string;
|
|
97
117
|
/** For `invalidBytes`: contract, proof, predicate, flavor or blinding. */
|
|
98
118
|
what?: string;
|
|
99
119
|
/** For `keyMismatch`: the input's position. */
|
|
100
120
|
input?: number;
|
|
121
|
+
/** For `note`: how it failed. */
|
|
122
|
+
failure?: NoteFailure;
|
|
101
123
|
}
|
|
102
124
|
|
|
103
125
|
|
|
@@ -138,6 +160,11 @@ export class Wallet {
|
|
|
138
160
|
* The next receiving index not yet issued: what an app stores.
|
|
139
161
|
*/
|
|
140
162
|
nextIndex(): number;
|
|
163
|
+
/**
|
|
164
|
+
* Opens the note a scan served with `contract` (`undefined` if none),
|
|
165
|
+
* with the key at `path`, as `owns` found it.
|
|
166
|
+
*/
|
|
167
|
+
openNote(contract: Uint8Array, note: Uint8Array | null | undefined, path: KeyPath): ReceivedNote;
|
|
141
168
|
/**
|
|
142
169
|
* Which path below `nextIndex + gap` owns `predicate`, if any.
|
|
143
170
|
*/
|
|
@@ -196,6 +223,7 @@ export interface InitOutput {
|
|
|
196
223
|
readonly wallet_network: (a: number, b: number) => void;
|
|
197
224
|
readonly wallet_nextAddress: (a: number, b: number) => void;
|
|
198
225
|
readonly wallet_nextIndex: (a: number) => number;
|
|
226
|
+
readonly wallet_openNote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
199
227
|
readonly wallet_owns: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
200
228
|
readonly wallet_receivingKey: (a: number, b: number) => void;
|
|
201
229
|
readonly ffi_flamewallet_ffi_uniffi_contract_version: () => number;
|
|
@@ -257,32 +285,34 @@ export interface InitOutput {
|
|
|
257
285
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_owns: () => number;
|
|
258
286
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_receiving_key: (a: number, b: bigint, c: number) => void;
|
|
259
287
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key: () => number;
|
|
288
|
+
readonly uniffi_flamewallet_ffi_fn_method_wallet_open_note: (a: number, b: bigint, c: number, d: number, e: number, f: number) => void;
|
|
289
|
+
readonly uniffi_flamewallet_ffi_checksum_method_wallet_open_note: () => number;
|
|
260
290
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_build_transfer: (a: number, b: bigint, c: number, d: number) => void;
|
|
261
291
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_build_transfer: () => number;
|
|
262
|
-
readonly ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
263
|
-
readonly ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
264
|
-
readonly ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
265
|
-
readonly ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
266
|
-
readonly ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
267
|
-
readonly ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
268
|
-
readonly ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
269
292
|
readonly ffi_flamewallet_ffi_rust_future_free_rust_buffer: (a: bigint) => void;
|
|
270
293
|
readonly ffi_flamewallet_ffi_rust_future_cancel_rust_buffer: (a: bigint) => void;
|
|
271
|
-
readonly
|
|
272
|
-
readonly
|
|
294
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
295
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
273
296
|
readonly ffi_flamewallet_ffi_rust_future_free_u64: (a: bigint) => void;
|
|
274
297
|
readonly ffi_flamewallet_ffi_rust_future_complete_u64: (a: bigint, b: number) => bigint;
|
|
275
298
|
readonly ffi_flamewallet_ffi_rust_future_cancel_u64: (a: bigint) => void;
|
|
299
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u8: (a: bigint) => void;
|
|
300
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u8: (a: bigint) => void;
|
|
276
301
|
readonly ffi_flamewallet_ffi_rust_future_free_void: (a: bigint) => void;
|
|
277
302
|
readonly ffi_flamewallet_ffi_rust_future_cancel_void: (a: bigint) => void;
|
|
303
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i16: (a: bigint) => void;
|
|
304
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i16: (a: bigint) => void;
|
|
305
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
306
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
278
307
|
readonly ffi_flamewallet_ffi_rust_future_free_f64: (a: bigint) => void;
|
|
279
308
|
readonly ffi_flamewallet_ffi_rust_future_cancel_f64: (a: bigint) => void;
|
|
280
309
|
readonly ffi_flamewallet_ffi_rust_future_free_i8: (a: bigint) => void;
|
|
281
310
|
readonly ffi_flamewallet_ffi_rust_future_cancel_i8: (a: bigint) => void;
|
|
282
|
-
readonly
|
|
283
|
-
readonly
|
|
284
|
-
readonly
|
|
285
|
-
readonly
|
|
311
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i32: (a: bigint) => void;
|
|
312
|
+
readonly ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
313
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i32: (a: bigint) => void;
|
|
314
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
315
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
286
316
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
287
317
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
288
318
|
readonly __wbindgen_export3: (a: number) => void;
|
package/flamewallet_wasm.js
CHANGED
|
@@ -160,6 +160,33 @@ export class Wallet {
|
|
|
160
160
|
const ret = wasm.wallet_nextIndex(this.__wbg_ptr);
|
|
161
161
|
return ret >>> 0;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Opens the note a scan served with `contract` (`undefined` if none),
|
|
165
|
+
* with the key at `path`, as `owns` found it.
|
|
166
|
+
* @param {Uint8Array} contract
|
|
167
|
+
* @param {Uint8Array | null | undefined} note
|
|
168
|
+
* @param {KeyPath} path
|
|
169
|
+
* @returns {ReceivedNote}
|
|
170
|
+
*/
|
|
171
|
+
openNote(contract, note, path) {
|
|
172
|
+
try {
|
|
173
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
174
|
+
const ptr0 = passArray8ToWasm0(contract, wasm.__wbindgen_export);
|
|
175
|
+
const len0 = WASM_VECTOR_LEN;
|
|
176
|
+
var ptr1 = isLikeNone(note) ? 0 : passArray8ToWasm0(note, wasm.__wbindgen_export);
|
|
177
|
+
var len1 = WASM_VECTOR_LEN;
|
|
178
|
+
wasm.wallet_openNote(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(path));
|
|
179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
182
|
+
if (r2) {
|
|
183
|
+
throw takeObject(r1);
|
|
184
|
+
}
|
|
185
|
+
return takeObject(r0);
|
|
186
|
+
} finally {
|
|
187
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
163
190
|
/**
|
|
164
191
|
* Which path below `nextIndex + gap` owns `predicate`, if any.
|
|
165
192
|
* @param {Uint8Array} predicate
|
package/flamewallet_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -15,6 +15,7 @@ export const wallet_fromSeed: (a: number, b: number, c: number, d: number, e: nu
|
|
|
15
15
|
export const wallet_network: (a: number, b: number) => void;
|
|
16
16
|
export const wallet_nextAddress: (a: number, b: number) => void;
|
|
17
17
|
export const wallet_nextIndex: (a: number) => number;
|
|
18
|
+
export const wallet_openNote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
18
19
|
export const wallet_owns: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
20
|
export const wallet_receivingKey: (a: number, b: number) => void;
|
|
20
21
|
export const ffi_flamewallet_ffi_uniffi_contract_version: () => number;
|
|
@@ -76,32 +77,34 @@ export const uniffi_flamewallet_ffi_fn_method_wallet_owns: (a: number, b: bigint
|
|
|
76
77
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_owns: () => number;
|
|
77
78
|
export const uniffi_flamewallet_ffi_fn_method_wallet_receiving_key: (a: number, b: bigint, c: number) => void;
|
|
78
79
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key: () => number;
|
|
80
|
+
export const uniffi_flamewallet_ffi_fn_method_wallet_open_note: (a: number, b: bigint, c: number, d: number, e: number, f: number) => void;
|
|
81
|
+
export const uniffi_flamewallet_ffi_checksum_method_wallet_open_note: () => number;
|
|
79
82
|
export const uniffi_flamewallet_ffi_fn_method_wallet_build_transfer: (a: number, b: bigint, c: number, d: number) => void;
|
|
80
83
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_build_transfer: () => number;
|
|
81
|
-
export const ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
82
|
-
export const ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
83
|
-
export const ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
84
|
-
export const ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
85
|
-
export const ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
86
|
-
export const ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
87
|
-
export const ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
88
84
|
export const ffi_flamewallet_ffi_rust_future_free_rust_buffer: (a: bigint) => void;
|
|
89
85
|
export const ffi_flamewallet_ffi_rust_future_cancel_rust_buffer: (a: bigint) => void;
|
|
90
|
-
export const
|
|
91
|
-
export const
|
|
86
|
+
export const ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
87
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
92
88
|
export const ffi_flamewallet_ffi_rust_future_free_u64: (a: bigint) => void;
|
|
93
89
|
export const ffi_flamewallet_ffi_rust_future_complete_u64: (a: bigint, b: number) => bigint;
|
|
94
90
|
export const ffi_flamewallet_ffi_rust_future_cancel_u64: (a: bigint) => void;
|
|
91
|
+
export const ffi_flamewallet_ffi_rust_future_free_u8: (a: bigint) => void;
|
|
92
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u8: (a: bigint) => void;
|
|
95
93
|
export const ffi_flamewallet_ffi_rust_future_free_void: (a: bigint) => void;
|
|
96
94
|
export const ffi_flamewallet_ffi_rust_future_cancel_void: (a: bigint) => void;
|
|
95
|
+
export const ffi_flamewallet_ffi_rust_future_free_i16: (a: bigint) => void;
|
|
96
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i16: (a: bigint) => void;
|
|
97
|
+
export const ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
98
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
97
99
|
export const ffi_flamewallet_ffi_rust_future_free_f64: (a: bigint) => void;
|
|
98
100
|
export const ffi_flamewallet_ffi_rust_future_cancel_f64: (a: bigint) => void;
|
|
99
101
|
export const ffi_flamewallet_ffi_rust_future_free_i8: (a: bigint) => void;
|
|
100
102
|
export const ffi_flamewallet_ffi_rust_future_cancel_i8: (a: bigint) => void;
|
|
101
|
-
export const
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
103
|
+
export const ffi_flamewallet_ffi_rust_future_free_i32: (a: bigint) => void;
|
|
104
|
+
export const ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
105
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i32: (a: bigint) => void;
|
|
106
|
+
export const ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
107
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
105
108
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
106
109
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
107
110
|
export const __wbindgen_export3: (a: number) => void;
|