@runflame/wallet-wasm 0.0.1-rc.0 → 0.0.1-rc.10
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 +99 -17
- package/flamewallet_wasm.js +123 -1
- package/flamewallet_wasm_bg.wasm +0 -0
- package/flamewallet_wasm_bg.wasm.d.ts +28 -13
- package/package.json +1 -1
- package/sbom.cdx.json +5972 -0
package/flamewallet_wasm.d.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
/** Which network addresses are encoded for: `f1…` or `tf1…`. */
|
|
4
4
|
export type Network = "mainnet" | "testnet";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* What a `Wallet` was built from, and so what it can do: `spend` (seed or
|
|
8
|
+
* mnemonic) finds, opens and spends; `view` (view key) finds and opens;
|
|
9
|
+
* `receive` (receiving key) only finds.
|
|
10
|
+
*/
|
|
11
|
+
export type WalletKind = "spend" | "view" | "receive";
|
|
12
|
+
|
|
6
13
|
/** `m/35263'/network'/0'/branch/index`; branch 0 is receiving, 1 is change. */
|
|
7
14
|
export interface KeyPath {
|
|
8
15
|
branch: number;
|
|
@@ -50,10 +57,13 @@ export interface TransferInput {
|
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
export interface TransferOutput {
|
|
53
|
-
|
|
60
|
+
/** The recipient's bech32f address, for the wallet's network. */
|
|
61
|
+
address: string;
|
|
54
62
|
qty: bigint;
|
|
55
63
|
/** Absent for flames. */
|
|
56
64
|
flavor?: Uint8Array;
|
|
65
|
+
/** Sealed into the note for the recipient alone; at most 4006 bytes. */
|
|
66
|
+
memo?: Uint8Array;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
export interface TransferRequest {
|
|
@@ -70,8 +80,8 @@ export interface CreatedOutput {
|
|
|
70
80
|
contractId: Uint8Array;
|
|
71
81
|
/** Its published bytes, as an indexer serves them once confirmed. */
|
|
72
82
|
contract: Uint8Array;
|
|
73
|
-
/** The
|
|
74
|
-
|
|
83
|
+
/** The encrypted note that follows it on chain; `Wallet.openNote` reads it. */
|
|
84
|
+
note: Uint8Array;
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
export interface Transfer {
|
|
@@ -79,25 +89,50 @@ export interface Transfer {
|
|
|
79
89
|
txid: Uint8Array;
|
|
80
90
|
/** `BlockTx::to_bytes`: what a node's `submit_tx` takes. */
|
|
81
91
|
blockTx: Uint8Array;
|
|
92
|
+
/** In published order, not request order: match each by its predicate. */
|
|
82
93
|
outputs: CreatedOutput[];
|
|
83
94
|
}
|
|
84
95
|
|
|
96
|
+
/** What `Wallet.openNote` gives: the opening to spend with, and the memo. */
|
|
97
|
+
export interface ReceivedNote {
|
|
98
|
+
opening: Opening;
|
|
99
|
+
memo: Uint8Array;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Why a note did not open; `docs/payments.md` "Receiving" says what to do. */
|
|
103
|
+
export type NoteFailure =
|
|
104
|
+
| "missing"
|
|
105
|
+
| "malformed"
|
|
106
|
+
| "unknownVersion"
|
|
107
|
+
| "undecryptable"
|
|
108
|
+
| "openingMismatch"
|
|
109
|
+
| "notConfidential";
|
|
110
|
+
|
|
85
111
|
/** What every call throws. Fields beyond `kind` depend on it. */
|
|
86
112
|
export interface FlameError extends Error {
|
|
87
113
|
name: "FlameError";
|
|
88
114
|
kind:
|
|
89
115
|
| "invalidMnemonic"
|
|
90
116
|
| "invalidSeed"
|
|
117
|
+
| "invalidKey"
|
|
118
|
+
| "notPermitted"
|
|
91
119
|
| "invalidAddress"
|
|
92
120
|
| "invalidKeyPath"
|
|
93
121
|
| "invalidBytes"
|
|
94
122
|
| "keyMismatch"
|
|
123
|
+
| "note"
|
|
95
124
|
| "transfer";
|
|
96
125
|
reason?: string;
|
|
97
126
|
/** For `invalidBytes`: contract, proof, predicate, flavor or blinding. */
|
|
98
127
|
what?: string;
|
|
99
128
|
/** For `keyMismatch`: the input's position. */
|
|
100
129
|
input?: number;
|
|
130
|
+
/** For `note`: how it failed. */
|
|
131
|
+
failure?: NoteFailure;
|
|
132
|
+
/** For `notPermitted`: the wallet that refused. */
|
|
133
|
+
wallet?: WalletKind;
|
|
134
|
+
/** For `notPermitted`: the least kind of wallet that could. */
|
|
135
|
+
needs?: WalletKind;
|
|
101
136
|
}
|
|
102
137
|
|
|
103
138
|
|
|
@@ -105,7 +140,10 @@ export interface FlameError extends Error {
|
|
|
105
140
|
/**
|
|
106
141
|
* One account, `m/35263'/network'/0'`. Its keys live in this module's
|
|
107
142
|
* memory until `free()` — or `using` — drops the handle, which zeroizes
|
|
108
|
-
* them
|
|
143
|
+
* them. Two calls hand key material to JavaScript, where nothing can wipe
|
|
144
|
+
* it, so keep what they return as secret as the wallet: `viewKey()` reads
|
|
145
|
+
* every amount and memo, and `receivingKey()` links every address.
|
|
146
|
+
* Neither can spend.
|
|
109
147
|
*/
|
|
110
148
|
export class Wallet {
|
|
111
149
|
private constructor();
|
|
@@ -124,11 +162,29 @@ export class Wallet {
|
|
|
124
162
|
* seeing the seed.
|
|
125
163
|
*/
|
|
126
164
|
static fromMnemonic(phrase: string, passphrase: string, network: Network, nextIndex: number): Wallet;
|
|
165
|
+
/**
|
|
166
|
+
* A receive wallet from its bech32f receiving key, as `receivingKey`
|
|
167
|
+
* gives it. It issues addresses and finds payments; `viewKey`,
|
|
168
|
+
* `openNote` and `buildTransfer` throw `notPermitted`. Only the key
|
|
169
|
+
* `receivingKey` exports will do, as with `fromViewKey`.
|
|
170
|
+
*/
|
|
171
|
+
static fromReceivingKey(receivingKey: string, network: Network, nextIndex: number): Wallet;
|
|
127
172
|
/**
|
|
128
173
|
* The account below a 64-byte seed, with `nextIndex` receiving
|
|
129
174
|
* addresses already issued; a new wallet passes 0.
|
|
130
175
|
*/
|
|
131
176
|
static fromSeed(seed: Uint8Array, network: Network, nextIndex: number): Wallet;
|
|
177
|
+
/**
|
|
178
|
+
* A view wallet from its bech32f view key, as `viewKey` gives it.
|
|
179
|
+
* Everything works except `buildTransfer`, which throws
|
|
180
|
+
* `notPermitted`. Only the key `viewKey` exports will do: a key from
|
|
181
|
+
* another node is accepted and silently owns nothing.
|
|
182
|
+
*/
|
|
183
|
+
static fromViewKey(viewKey: string, network: Network, nextIndex: number): Wallet;
|
|
184
|
+
/**
|
|
185
|
+
* What this wallet was built from: `spend`, `view` or `receive`.
|
|
186
|
+
*/
|
|
187
|
+
kind(): WalletKind;
|
|
132
188
|
network(): Network;
|
|
133
189
|
/**
|
|
134
190
|
* Issues the next receiving address and advances the counter.
|
|
@@ -138,6 +194,11 @@ export class Wallet {
|
|
|
138
194
|
* The next receiving index not yet issued: what an app stores.
|
|
139
195
|
*/
|
|
140
196
|
nextIndex(): number;
|
|
197
|
+
/**
|
|
198
|
+
* Opens the note a scan served with `contract` (`undefined` if none),
|
|
199
|
+
* with the key at `path`, as `owns` found it.
|
|
200
|
+
*/
|
|
201
|
+
openNote(contract: Uint8Array, note: Uint8Array | null | undefined, path: KeyPath): ReceivedNote;
|
|
141
202
|
/**
|
|
142
203
|
* Which path below `nextIndex + gap` owns `predicate`, if any.
|
|
143
204
|
*/
|
|
@@ -146,6 +207,12 @@ export class Wallet {
|
|
|
146
207
|
* The bech32f receiving key an indexer is given.
|
|
147
208
|
*/
|
|
148
209
|
receivingKey(): string;
|
|
210
|
+
/**
|
|
211
|
+
* The bech32f view key a view wallet is built from: it reads every
|
|
212
|
+
* amount and memo but cannot spend, so store it as a secret. A
|
|
213
|
+
* receive wallet throws `notPermitted`.
|
|
214
|
+
*/
|
|
215
|
+
viewKey(): string;
|
|
149
216
|
}
|
|
150
217
|
|
|
151
218
|
/**
|
|
@@ -192,12 +259,17 @@ export interface InitOutput {
|
|
|
192
259
|
readonly wallet_address: (a: number, b: number, c: number) => void;
|
|
193
260
|
readonly wallet_buildTransfer: (a: number, b: number, c: number) => void;
|
|
194
261
|
readonly wallet_fromMnemonic: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
262
|
+
readonly wallet_fromReceivingKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
195
263
|
readonly wallet_fromSeed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
264
|
+
readonly wallet_fromViewKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
265
|
+
readonly wallet_kind: (a: number) => number;
|
|
196
266
|
readonly wallet_network: (a: number, b: number) => void;
|
|
197
267
|
readonly wallet_nextAddress: (a: number, b: number) => void;
|
|
198
268
|
readonly wallet_nextIndex: (a: number) => number;
|
|
269
|
+
readonly wallet_openNote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
199
270
|
readonly wallet_owns: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
200
271
|
readonly wallet_receivingKey: (a: number, b: number) => void;
|
|
272
|
+
readonly wallet_viewKey: (a: number, b: number) => void;
|
|
201
273
|
readonly ffi_flamewallet_ffi_uniffi_contract_version: () => number;
|
|
202
274
|
readonly ffi_flamewallet_ffi_rustbuffer_alloc: (a: number, b: bigint, c: number) => void;
|
|
203
275
|
readonly ffi_flamewallet_ffi_rustbuffer_from_bytes: (a: number, b: number, c: number) => void;
|
|
@@ -245,6 +317,12 @@ export interface InitOutput {
|
|
|
245
317
|
readonly uniffi_flamewallet_ffi_checksum_constructor_wallet_new: () => number;
|
|
246
318
|
readonly uniffi_flamewallet_ffi_fn_constructor_wallet_from_mnemonic: (a: number, b: number, c: number, d: number, e: number) => bigint;
|
|
247
319
|
readonly uniffi_flamewallet_ffi_checksum_constructor_wallet_from_mnemonic: () => number;
|
|
320
|
+
readonly uniffi_flamewallet_ffi_fn_constructor_wallet_from_view_key: (a: number, b: number, c: number, d: number) => bigint;
|
|
321
|
+
readonly uniffi_flamewallet_ffi_checksum_constructor_wallet_from_view_key: () => number;
|
|
322
|
+
readonly uniffi_flamewallet_ffi_fn_constructor_wallet_from_receiving_key: (a: number, b: number, c: number, d: number) => bigint;
|
|
323
|
+
readonly uniffi_flamewallet_ffi_checksum_constructor_wallet_from_receiving_key: () => number;
|
|
324
|
+
readonly uniffi_flamewallet_ffi_fn_method_wallet_kind: (a: number, b: bigint, c: number) => void;
|
|
325
|
+
readonly uniffi_flamewallet_ffi_checksum_method_wallet_kind: () => number;
|
|
248
326
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_network: (a: number, b: bigint, c: number) => void;
|
|
249
327
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_network: () => number;
|
|
250
328
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_address: (a: number, b: bigint, c: number, d: number) => void;
|
|
@@ -257,32 +335,36 @@ export interface InitOutput {
|
|
|
257
335
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_owns: () => number;
|
|
258
336
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_receiving_key: (a: number, b: bigint, c: number) => void;
|
|
259
337
|
readonly uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key: () => number;
|
|
338
|
+
readonly uniffi_flamewallet_ffi_fn_method_wallet_view_key: (a: number, b: bigint, c: number) => void;
|
|
339
|
+
readonly uniffi_flamewallet_ffi_checksum_method_wallet_view_key: () => number;
|
|
340
|
+
readonly uniffi_flamewallet_ffi_fn_method_wallet_open_note: (a: number, b: bigint, c: number, d: number, e: number, f: number) => void;
|
|
341
|
+
readonly uniffi_flamewallet_ffi_checksum_method_wallet_open_note: () => number;
|
|
260
342
|
readonly uniffi_flamewallet_ffi_fn_method_wallet_build_transfer: (a: number, b: bigint, c: number, d: number) => void;
|
|
261
343
|
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
344
|
readonly ffi_flamewallet_ffi_rust_future_free_rust_buffer: (a: bigint) => void;
|
|
270
345
|
readonly ffi_flamewallet_ffi_rust_future_cancel_rust_buffer: (a: bigint) => void;
|
|
271
|
-
readonly
|
|
272
|
-
readonly
|
|
346
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
347
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
273
348
|
readonly ffi_flamewallet_ffi_rust_future_free_u64: (a: bigint) => void;
|
|
274
349
|
readonly ffi_flamewallet_ffi_rust_future_complete_u64: (a: bigint, b: number) => bigint;
|
|
275
350
|
readonly ffi_flamewallet_ffi_rust_future_cancel_u64: (a: bigint) => void;
|
|
351
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u8: (a: bigint) => void;
|
|
352
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u8: (a: bigint) => void;
|
|
276
353
|
readonly ffi_flamewallet_ffi_rust_future_free_void: (a: bigint) => void;
|
|
277
354
|
readonly ffi_flamewallet_ffi_rust_future_cancel_void: (a: bigint) => void;
|
|
355
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i16: (a: bigint) => void;
|
|
356
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i16: (a: bigint) => void;
|
|
357
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
358
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
278
359
|
readonly ffi_flamewallet_ffi_rust_future_free_f64: (a: bigint) => void;
|
|
279
360
|
readonly ffi_flamewallet_ffi_rust_future_cancel_f64: (a: bigint) => void;
|
|
280
361
|
readonly ffi_flamewallet_ffi_rust_future_free_i8: (a: bigint) => void;
|
|
281
362
|
readonly ffi_flamewallet_ffi_rust_future_cancel_i8: (a: bigint) => void;
|
|
282
|
-
readonly
|
|
283
|
-
readonly
|
|
284
|
-
readonly
|
|
285
|
-
readonly
|
|
363
|
+
readonly ffi_flamewallet_ffi_rust_future_free_i32: (a: bigint) => void;
|
|
364
|
+
readonly ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
365
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_i32: (a: bigint) => void;
|
|
366
|
+
readonly ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
367
|
+
readonly ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
286
368
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
287
369
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
288
370
|
readonly __wbindgen_export3: (a: number) => void;
|
package/flamewallet_wasm.js
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* One account, `m/35263'/network'/0'`. Its keys live in this module's
|
|
5
5
|
* memory until `free()` — or `using` — drops the handle, which zeroizes
|
|
6
|
-
* them
|
|
6
|
+
* them. Two calls hand key material to JavaScript, where nothing can wipe
|
|
7
|
+
* it, so keep what they return as secret as the wallet: `viewKey()` reads
|
|
8
|
+
* every amount and memo, and `receivingKey()` links every address.
|
|
9
|
+
* Neither can spend.
|
|
7
10
|
*/
|
|
8
11
|
export class Wallet {
|
|
9
12
|
static __wrap(ptr) {
|
|
@@ -90,6 +93,33 @@ export class Wallet {
|
|
|
90
93
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
91
94
|
}
|
|
92
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* A receive wallet from its bech32f receiving key, as `receivingKey`
|
|
98
|
+
* gives it. It issues addresses and finds payments; `viewKey`,
|
|
99
|
+
* `openNote` and `buildTransfer` throw `notPermitted`. Only the key
|
|
100
|
+
* `receivingKey` exports will do, as with `fromViewKey`.
|
|
101
|
+
* @param {string} receivingKey
|
|
102
|
+
* @param {Network} network
|
|
103
|
+
* @param {number} nextIndex
|
|
104
|
+
* @returns {Wallet}
|
|
105
|
+
*/
|
|
106
|
+
static fromReceivingKey(receivingKey, network, nextIndex) {
|
|
107
|
+
try {
|
|
108
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
109
|
+
const ptr0 = passStringToWasm0(receivingKey, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
111
|
+
wasm.wallet_fromReceivingKey(retptr, ptr0, len0, addHeapObject(network), nextIndex);
|
|
112
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
113
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
114
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
115
|
+
if (r2) {
|
|
116
|
+
throw takeObject(r1);
|
|
117
|
+
}
|
|
118
|
+
return Wallet.__wrap(r0);
|
|
119
|
+
} finally {
|
|
120
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
93
123
|
/**
|
|
94
124
|
* The account below a 64-byte seed, with `nextIndex` receiving
|
|
95
125
|
* addresses already issued; a new wallet passes 0.
|
|
@@ -115,6 +145,41 @@ export class Wallet {
|
|
|
115
145
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
116
146
|
}
|
|
117
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* A view wallet from its bech32f view key, as `viewKey` gives it.
|
|
150
|
+
* Everything works except `buildTransfer`, which throws
|
|
151
|
+
* `notPermitted`. Only the key `viewKey` exports will do: a key from
|
|
152
|
+
* another node is accepted and silently owns nothing.
|
|
153
|
+
* @param {string} viewKey
|
|
154
|
+
* @param {Network} network
|
|
155
|
+
* @param {number} nextIndex
|
|
156
|
+
* @returns {Wallet}
|
|
157
|
+
*/
|
|
158
|
+
static fromViewKey(viewKey, network, nextIndex) {
|
|
159
|
+
try {
|
|
160
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
161
|
+
const ptr0 = passStringToWasm0(viewKey, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
162
|
+
const len0 = WASM_VECTOR_LEN;
|
|
163
|
+
wasm.wallet_fromViewKey(retptr, ptr0, len0, addHeapObject(network), nextIndex);
|
|
164
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
165
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
166
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
167
|
+
if (r2) {
|
|
168
|
+
throw takeObject(r1);
|
|
169
|
+
}
|
|
170
|
+
return Wallet.__wrap(r0);
|
|
171
|
+
} finally {
|
|
172
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* What this wallet was built from: `spend`, `view` or `receive`.
|
|
177
|
+
* @returns {WalletKind}
|
|
178
|
+
*/
|
|
179
|
+
kind() {
|
|
180
|
+
const ret = wasm.wallet_kind(this.__wbg_ptr);
|
|
181
|
+
return takeObject(ret);
|
|
182
|
+
}
|
|
118
183
|
/**
|
|
119
184
|
* @returns {Network}
|
|
120
185
|
*/
|
|
@@ -160,6 +225,33 @@ export class Wallet {
|
|
|
160
225
|
const ret = wasm.wallet_nextIndex(this.__wbg_ptr);
|
|
161
226
|
return ret >>> 0;
|
|
162
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Opens the note a scan served with `contract` (`undefined` if none),
|
|
230
|
+
* with the key at `path`, as `owns` found it.
|
|
231
|
+
* @param {Uint8Array} contract
|
|
232
|
+
* @param {Uint8Array | null | undefined} note
|
|
233
|
+
* @param {KeyPath} path
|
|
234
|
+
* @returns {ReceivedNote}
|
|
235
|
+
*/
|
|
236
|
+
openNote(contract, note, path) {
|
|
237
|
+
try {
|
|
238
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
239
|
+
const ptr0 = passArray8ToWasm0(contract, wasm.__wbindgen_export);
|
|
240
|
+
const len0 = WASM_VECTOR_LEN;
|
|
241
|
+
var ptr1 = isLikeNone(note) ? 0 : passArray8ToWasm0(note, wasm.__wbindgen_export);
|
|
242
|
+
var len1 = WASM_VECTOR_LEN;
|
|
243
|
+
wasm.wallet_openNote(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(path));
|
|
244
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
245
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
246
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
247
|
+
if (r2) {
|
|
248
|
+
throw takeObject(r1);
|
|
249
|
+
}
|
|
250
|
+
return takeObject(r0);
|
|
251
|
+
} finally {
|
|
252
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
163
255
|
/**
|
|
164
256
|
* Which path below `nextIndex + gap` owns `predicate`, if any.
|
|
165
257
|
* @param {Uint8Array} predicate
|
|
@@ -203,6 +295,36 @@ export class Wallet {
|
|
|
203
295
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
204
296
|
}
|
|
205
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* The bech32f view key a view wallet is built from: it reads every
|
|
300
|
+
* amount and memo but cannot spend, so store it as a secret. A
|
|
301
|
+
* receive wallet throws `notPermitted`.
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
viewKey() {
|
|
305
|
+
let deferred2_0;
|
|
306
|
+
let deferred2_1;
|
|
307
|
+
try {
|
|
308
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
309
|
+
wasm.wallet_viewKey(retptr, this.__wbg_ptr);
|
|
310
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
311
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
312
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
313
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
314
|
+
var ptr1 = r0;
|
|
315
|
+
var len1 = r1;
|
|
316
|
+
if (r3) {
|
|
317
|
+
ptr1 = 0; len1 = 0;
|
|
318
|
+
throw takeObject(r2);
|
|
319
|
+
}
|
|
320
|
+
deferred2_0 = ptr1;
|
|
321
|
+
deferred2_1 = len1;
|
|
322
|
+
return getStringFromWasm0(ptr1, len1);
|
|
323
|
+
} finally {
|
|
324
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
325
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
206
328
|
}
|
|
207
329
|
if (Symbol.dispose) Wallet.prototype[Symbol.dispose] = Wallet.prototype.free;
|
|
208
330
|
|
package/flamewallet_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -11,12 +11,17 @@ export const validateMnemonic: (a: number, b: number) => number;
|
|
|
11
11
|
export const wallet_address: (a: number, b: number, c: number) => void;
|
|
12
12
|
export const wallet_buildTransfer: (a: number, b: number, c: number) => void;
|
|
13
13
|
export const wallet_fromMnemonic: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
14
|
+
export const wallet_fromReceivingKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
14
15
|
export const wallet_fromSeed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
16
|
+
export const wallet_fromViewKey: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
|
+
export const wallet_kind: (a: number) => number;
|
|
15
18
|
export const wallet_network: (a: number, b: number) => void;
|
|
16
19
|
export const wallet_nextAddress: (a: number, b: number) => void;
|
|
17
20
|
export const wallet_nextIndex: (a: number) => number;
|
|
21
|
+
export const wallet_openNote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
18
22
|
export const wallet_owns: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
23
|
export const wallet_receivingKey: (a: number, b: number) => void;
|
|
24
|
+
export const wallet_viewKey: (a: number, b: number) => void;
|
|
20
25
|
export const ffi_flamewallet_ffi_uniffi_contract_version: () => number;
|
|
21
26
|
export const ffi_flamewallet_ffi_rustbuffer_alloc: (a: number, b: bigint, c: number) => void;
|
|
22
27
|
export const ffi_flamewallet_ffi_rustbuffer_from_bytes: (a: number, b: number, c: number) => void;
|
|
@@ -64,6 +69,12 @@ export const uniffi_flamewallet_ffi_fn_constructor_wallet_new: (a: number, b: nu
|
|
|
64
69
|
export const uniffi_flamewallet_ffi_checksum_constructor_wallet_new: () => number;
|
|
65
70
|
export const uniffi_flamewallet_ffi_fn_constructor_wallet_from_mnemonic: (a: number, b: number, c: number, d: number, e: number) => bigint;
|
|
66
71
|
export const uniffi_flamewallet_ffi_checksum_constructor_wallet_from_mnemonic: () => number;
|
|
72
|
+
export const uniffi_flamewallet_ffi_fn_constructor_wallet_from_view_key: (a: number, b: number, c: number, d: number) => bigint;
|
|
73
|
+
export const uniffi_flamewallet_ffi_checksum_constructor_wallet_from_view_key: () => number;
|
|
74
|
+
export const uniffi_flamewallet_ffi_fn_constructor_wallet_from_receiving_key: (a: number, b: number, c: number, d: number) => bigint;
|
|
75
|
+
export const uniffi_flamewallet_ffi_checksum_constructor_wallet_from_receiving_key: () => number;
|
|
76
|
+
export const uniffi_flamewallet_ffi_fn_method_wallet_kind: (a: number, b: bigint, c: number) => void;
|
|
77
|
+
export const uniffi_flamewallet_ffi_checksum_method_wallet_kind: () => number;
|
|
67
78
|
export const uniffi_flamewallet_ffi_fn_method_wallet_network: (a: number, b: bigint, c: number) => void;
|
|
68
79
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_network: () => number;
|
|
69
80
|
export const uniffi_flamewallet_ffi_fn_method_wallet_address: (a: number, b: bigint, c: number, d: number) => void;
|
|
@@ -76,32 +87,36 @@ export const uniffi_flamewallet_ffi_fn_method_wallet_owns: (a: number, b: bigint
|
|
|
76
87
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_owns: () => number;
|
|
77
88
|
export const uniffi_flamewallet_ffi_fn_method_wallet_receiving_key: (a: number, b: bigint, c: number) => void;
|
|
78
89
|
export const uniffi_flamewallet_ffi_checksum_method_wallet_receiving_key: () => number;
|
|
90
|
+
export const uniffi_flamewallet_ffi_fn_method_wallet_view_key: (a: number, b: bigint, c: number) => void;
|
|
91
|
+
export const uniffi_flamewallet_ffi_checksum_method_wallet_view_key: () => number;
|
|
92
|
+
export const uniffi_flamewallet_ffi_fn_method_wallet_open_note: (a: number, b: bigint, c: number, d: number, e: number, f: number) => void;
|
|
93
|
+
export const uniffi_flamewallet_ffi_checksum_method_wallet_open_note: () => number;
|
|
79
94
|
export const uniffi_flamewallet_ffi_fn_method_wallet_build_transfer: (a: number, b: bigint, c: number, d: number) => void;
|
|
80
95
|
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
96
|
export const ffi_flamewallet_ffi_rust_future_free_rust_buffer: (a: bigint) => void;
|
|
89
97
|
export const ffi_flamewallet_ffi_rust_future_cancel_rust_buffer: (a: bigint) => void;
|
|
90
|
-
export const
|
|
91
|
-
export const
|
|
98
|
+
export const ffi_flamewallet_ffi_rust_future_free_i64: (a: bigint) => void;
|
|
99
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i64: (a: bigint) => void;
|
|
92
100
|
export const ffi_flamewallet_ffi_rust_future_free_u64: (a: bigint) => void;
|
|
93
101
|
export const ffi_flamewallet_ffi_rust_future_complete_u64: (a: bigint, b: number) => bigint;
|
|
94
102
|
export const ffi_flamewallet_ffi_rust_future_cancel_u64: (a: bigint) => void;
|
|
103
|
+
export const ffi_flamewallet_ffi_rust_future_free_u8: (a: bigint) => void;
|
|
104
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u8: (a: bigint) => void;
|
|
95
105
|
export const ffi_flamewallet_ffi_rust_future_free_void: (a: bigint) => void;
|
|
96
106
|
export const ffi_flamewallet_ffi_rust_future_cancel_void: (a: bigint) => void;
|
|
107
|
+
export const ffi_flamewallet_ffi_rust_future_free_i16: (a: bigint) => void;
|
|
108
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i16: (a: bigint) => void;
|
|
109
|
+
export const ffi_flamewallet_ffi_rust_future_free_u32: (a: bigint) => void;
|
|
110
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u32: (a: bigint) => void;
|
|
97
111
|
export const ffi_flamewallet_ffi_rust_future_free_f64: (a: bigint) => void;
|
|
98
112
|
export const ffi_flamewallet_ffi_rust_future_cancel_f64: (a: bigint) => void;
|
|
99
113
|
export const ffi_flamewallet_ffi_rust_future_free_i8: (a: bigint) => void;
|
|
100
114
|
export const ffi_flamewallet_ffi_rust_future_cancel_i8: (a: bigint) => void;
|
|
101
|
-
export const
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
115
|
+
export const ffi_flamewallet_ffi_rust_future_free_i32: (a: bigint) => void;
|
|
116
|
+
export const ffi_flamewallet_ffi_rust_future_complete_u32: (a: bigint, b: number) => number;
|
|
117
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_i32: (a: bigint) => void;
|
|
118
|
+
export const ffi_flamewallet_ffi_rust_future_free_u16: (a: bigint) => void;
|
|
119
|
+
export const ffi_flamewallet_ffi_rust_future_cancel_u16: (a: bigint) => void;
|
|
105
120
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
106
121
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
107
122
|
export const __wbindgen_export3: (a: number) => void;
|