onekey-monero-runtime 0.1.0-alpha.3 → 0.1.0-alpha.4
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.
|
@@ -22,7 +22,7 @@ export function balance(account_id: bigint, chain_tip?: bigint | null): string;
|
|
|
22
22
|
* are marked, the transaction goes in flight, and `broadcast: accepted | unknown` is
|
|
23
23
|
* returned. Only an explicit node rejection errors and releases the inputs.
|
|
24
24
|
*/
|
|
25
|
-
export function broadcastTransaction(account_id: bigint, raw_hex: string, chain_tip: bigint, outgoing_atomic?: string | null, change_atomic?: string | null): Promise<string>;
|
|
25
|
+
export function broadcastTransaction(account_id: bigint, raw_hex: string, chain_tip: bigint, outgoing_atomic?: string | null, change_atomic?: string | null, signable_hex?: string | null, review_json?: string | null): Promise<string>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Fetch the chain tip. Does not require an open wallet DB: account creation needs
|
|
@@ -193,6 +193,8 @@ export function updateChainTip(account_id: bigint, tip: bigint): string;
|
|
|
193
193
|
*/
|
|
194
194
|
export function validateAddress(network: string, address: string): boolean;
|
|
195
195
|
|
|
196
|
+
export function verifySignedTransaction(signable_hex: string, review_json: string, raw_hex: string): string;
|
|
197
|
+
|
|
196
198
|
/**
|
|
197
199
|
* Validate actual payment effects before the host presents its confirmation.
|
|
198
200
|
*/
|
|
@@ -204,7 +206,7 @@ export interface InitOutput {
|
|
|
204
206
|
readonly memory: WebAssembly.Memory;
|
|
205
207
|
readonly addAccount: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number, number, number];
|
|
206
208
|
readonly balance: (a: bigint, b: number, c: bigint) => [number, number, number, number];
|
|
207
|
-
readonly broadcastTransaction: (a: bigint, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number) => any;
|
|
209
|
+
readonly broadcastTransaction: (a: bigint, b: number, c: number, d: bigint, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => any;
|
|
208
210
|
readonly chainTip: () => any;
|
|
209
211
|
readonly closeWallet: () => [number, number];
|
|
210
212
|
readonly deleteWallet: (a: number, b: number) => any;
|
|
@@ -231,6 +233,7 @@ export interface InitOutput {
|
|
|
231
233
|
readonly transactionDetails: (a: bigint, b: number, c: number) => [number, number, number, number];
|
|
232
234
|
readonly updateChainTip: (a: bigint, b: bigint) => [number, number, number, number];
|
|
233
235
|
readonly validateAddress: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
236
|
+
readonly verifySignedTransaction: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
234
237
|
readonly verifyTransaction: (a: number, b: number, c: number, d: number) => [number, number];
|
|
235
238
|
readonly rust_sqlite_wasm_abort: () => void;
|
|
236
239
|
readonly rust_sqlite_wasm_assert_fail: (a: number, b: number, c: number, d: number) => void;
|
package/onekey_monero_runtime.js
CHANGED
|
@@ -73,16 +73,22 @@ export function balance(account_id, chain_tip) {
|
|
|
73
73
|
* @param {bigint} chain_tip
|
|
74
74
|
* @param {string | null} [outgoing_atomic]
|
|
75
75
|
* @param {string | null} [change_atomic]
|
|
76
|
+
* @param {string | null} [signable_hex]
|
|
77
|
+
* @param {string | null} [review_json]
|
|
76
78
|
* @returns {Promise<string>}
|
|
77
79
|
*/
|
|
78
|
-
export function broadcastTransaction(account_id, raw_hex, chain_tip, outgoing_atomic, change_atomic) {
|
|
80
|
+
export function broadcastTransaction(account_id, raw_hex, chain_tip, outgoing_atomic, change_atomic, signable_hex, review_json) {
|
|
79
81
|
const ptr0 = passStringToWasm0(raw_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
80
82
|
const len0 = WASM_VECTOR_LEN;
|
|
81
83
|
var ptr1 = isLikeNone(outgoing_atomic) ? 0 : passStringToWasm0(outgoing_atomic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
84
|
var len1 = WASM_VECTOR_LEN;
|
|
83
85
|
var ptr2 = isLikeNone(change_atomic) ? 0 : passStringToWasm0(change_atomic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
86
|
var len2 = WASM_VECTOR_LEN;
|
|
85
|
-
|
|
87
|
+
var ptr3 = isLikeNone(signable_hex) ? 0 : passStringToWasm0(signable_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
+
var len3 = WASM_VECTOR_LEN;
|
|
89
|
+
var ptr4 = isLikeNone(review_json) ? 0 : passStringToWasm0(review_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
90
|
+
var len4 = WASM_VECTOR_LEN;
|
|
91
|
+
const ret = wasm.broadcastTransaction(account_id, ptr0, len0, chain_tip, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
86
92
|
return ret;
|
|
87
93
|
}
|
|
88
94
|
|
|
@@ -670,6 +676,37 @@ export function validateAddress(network, address) {
|
|
|
670
676
|
return ret[0] !== 0;
|
|
671
677
|
}
|
|
672
678
|
|
|
679
|
+
/**
|
|
680
|
+
* @param {string} signable_hex
|
|
681
|
+
* @param {string} review_json
|
|
682
|
+
* @param {string} raw_hex
|
|
683
|
+
* @returns {string}
|
|
684
|
+
*/
|
|
685
|
+
export function verifySignedTransaction(signable_hex, review_json, raw_hex) {
|
|
686
|
+
let deferred5_0;
|
|
687
|
+
let deferred5_1;
|
|
688
|
+
try {
|
|
689
|
+
const ptr0 = passStringToWasm0(signable_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
690
|
+
const len0 = WASM_VECTOR_LEN;
|
|
691
|
+
const ptr1 = passStringToWasm0(review_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
692
|
+
const len1 = WASM_VECTOR_LEN;
|
|
693
|
+
const ptr2 = passStringToWasm0(raw_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
694
|
+
const len2 = WASM_VECTOR_LEN;
|
|
695
|
+
const ret = wasm.verifySignedTransaction(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
696
|
+
var ptr4 = ret[0];
|
|
697
|
+
var len4 = ret[1];
|
|
698
|
+
if (ret[3]) {
|
|
699
|
+
ptr4 = 0; len4 = 0;
|
|
700
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
701
|
+
}
|
|
702
|
+
deferred5_0 = ptr4;
|
|
703
|
+
deferred5_1 = len4;
|
|
704
|
+
return getStringFromWasm0(ptr4, len4);
|
|
705
|
+
} finally {
|
|
706
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
673
710
|
/**
|
|
674
711
|
* Validate actual payment effects before the host presents its confirmation.
|
|
675
712
|
* @param {string} signable_hex
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "onekey-monero-runtime",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "OneKey Monero Runtime: wallet state over monero-oxide, persisted in SQLite",
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.4",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"onekey_monero_runtime.js",
|