@bitgo/wasm-utxo 1.26.0 → 1.27.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/cjs/js/coinName.d.ts +6 -1
- package/dist/cjs/js/coinName.js +65 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +40 -1
- package/dist/cjs/js/wasm/wasm_utxo.js +92 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +14 -10
- package/dist/esm/js/coinName.d.ts +6 -1
- package/dist/esm/js/coinName.js +60 -1
- package/dist/esm/js/wasm/wasm_utxo.d.ts +40 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +92 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +14 -10
- package/package.json +1 -1
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
2
|
+
export type CoinName = (typeof coinNames)[number];
|
|
3
|
+
export declare function getMainnet(name: CoinName): CoinName;
|
|
4
|
+
export declare function isMainnet(name: CoinName): boolean;
|
|
5
|
+
export declare function isTestnet(name: CoinName): boolean;
|
|
6
|
+
export declare function isCoinName(v: string): v is CoinName;
|
package/dist/cjs/js/coinName.js
CHANGED
|
@@ -1,2 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinNames = void 0;
|
|
4
|
+
exports.getMainnet = getMainnet;
|
|
5
|
+
exports.isMainnet = isMainnet;
|
|
6
|
+
exports.isTestnet = isTestnet;
|
|
7
|
+
exports.isCoinName = isCoinName;
|
|
8
|
+
// BitGo coin names (from Network::from_coin_name in src/networks.rs)
|
|
9
|
+
exports.coinNames = [
|
|
10
|
+
"btc",
|
|
11
|
+
"tbtc",
|
|
12
|
+
"tbtc4",
|
|
13
|
+
"tbtcsig",
|
|
14
|
+
"tbtcbgsig",
|
|
15
|
+
"bch",
|
|
16
|
+
"tbch",
|
|
17
|
+
"bcha",
|
|
18
|
+
"tbcha",
|
|
19
|
+
"btg",
|
|
20
|
+
"tbtg",
|
|
21
|
+
"bsv",
|
|
22
|
+
"tbsv",
|
|
23
|
+
"dash",
|
|
24
|
+
"tdash",
|
|
25
|
+
"doge",
|
|
26
|
+
"tdoge",
|
|
27
|
+
"ltc",
|
|
28
|
+
"tltc",
|
|
29
|
+
"zec",
|
|
30
|
+
"tzec",
|
|
31
|
+
];
|
|
32
|
+
function getMainnet(name) {
|
|
33
|
+
switch (name) {
|
|
34
|
+
case "tbtc":
|
|
35
|
+
case "tbtc4":
|
|
36
|
+
case "tbtcsig":
|
|
37
|
+
case "tbtcbgsig":
|
|
38
|
+
return "btc";
|
|
39
|
+
case "tbch":
|
|
40
|
+
return "bch";
|
|
41
|
+
case "tbcha":
|
|
42
|
+
return "bcha";
|
|
43
|
+
case "tbtg":
|
|
44
|
+
return "btg";
|
|
45
|
+
case "tbsv":
|
|
46
|
+
return "bsv";
|
|
47
|
+
case "tdash":
|
|
48
|
+
return "dash";
|
|
49
|
+
case "tdoge":
|
|
50
|
+
return "doge";
|
|
51
|
+
case "tltc":
|
|
52
|
+
return "ltc";
|
|
53
|
+
case "tzec":
|
|
54
|
+
return "zec";
|
|
55
|
+
default:
|
|
56
|
+
return name;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function isMainnet(name) {
|
|
60
|
+
return getMainnet(name) === name;
|
|
61
|
+
}
|
|
62
|
+
function isTestnet(name) {
|
|
63
|
+
return getMainnet(name) !== name;
|
|
64
|
+
}
|
|
65
|
+
function isCoinName(v) {
|
|
66
|
+
return exports.coinNames.includes(v);
|
|
67
|
+
}
|
|
@@ -963,15 +963,54 @@ export class WrapMiniscript {
|
|
|
963
963
|
}
|
|
964
964
|
|
|
965
965
|
export class WrapPsbt {
|
|
966
|
-
private constructor();
|
|
967
966
|
free(): void;
|
|
968
967
|
[Symbol.dispose](): void;
|
|
968
|
+
/**
|
|
969
|
+
* Add an output to the PSBT
|
|
970
|
+
*
|
|
971
|
+
* # Arguments
|
|
972
|
+
* * `script` - The output script (scriptPubKey)
|
|
973
|
+
* * `value` - Value in satoshis
|
|
974
|
+
*
|
|
975
|
+
* # Returns
|
|
976
|
+
* The index of the newly added output
|
|
977
|
+
*/
|
|
978
|
+
addOutput(script: Uint8Array, value: bigint): number;
|
|
969
979
|
static deserialize(psbt: Uint8Array): WrapPsbt;
|
|
970
980
|
finalize(): void;
|
|
971
981
|
signWithPrv(prv: Uint8Array): any;
|
|
972
982
|
signWithXprv(xprv: string): any;
|
|
983
|
+
/**
|
|
984
|
+
* Get the unsigned transaction bytes
|
|
985
|
+
*
|
|
986
|
+
* # Returns
|
|
987
|
+
* The serialized unsigned transaction
|
|
988
|
+
*/
|
|
989
|
+
getUnsignedTx(): Uint8Array;
|
|
973
990
|
updateInputWithDescriptor(input_index: number, descriptor: WrapDescriptor): void;
|
|
974
991
|
updateOutputWithDescriptor(output_index: number, descriptor: WrapDescriptor): void;
|
|
992
|
+
/**
|
|
993
|
+
* Create an empty PSBT
|
|
994
|
+
*
|
|
995
|
+
* # Arguments
|
|
996
|
+
* * `version` - Transaction version (default: 2)
|
|
997
|
+
* * `lock_time` - Transaction lock time (default: 0)
|
|
998
|
+
*/
|
|
999
|
+
constructor(version?: number | null, lock_time?: number | null);
|
|
975
1000
|
clone(): WrapPsbt;
|
|
1001
|
+
/**
|
|
1002
|
+
* Add an input to the PSBT
|
|
1003
|
+
*
|
|
1004
|
+
* # Arguments
|
|
1005
|
+
* * `txid` - Transaction ID (hex string, 32 bytes reversed)
|
|
1006
|
+
* * `vout` - Output index being spent
|
|
1007
|
+
* * `value` - Value in satoshis of the output being spent
|
|
1008
|
+
* * `script` - The scriptPubKey of the output being spent
|
|
1009
|
+
* * `sequence` - Sequence number (default: 0xFFFFFFFE for RBF)
|
|
1010
|
+
*
|
|
1011
|
+
* # Returns
|
|
1012
|
+
* The index of the newly added input
|
|
1013
|
+
*/
|
|
1014
|
+
addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
|
|
976
1015
|
serialize(): Uint8Array;
|
|
977
1016
|
}
|
|
@@ -3619,6 +3619,25 @@ class WrapPsbt {
|
|
|
3619
3619
|
const ptr = this.__destroy_into_raw();
|
|
3620
3620
|
wasm.__wbg_wrappsbt_free(ptr, 0);
|
|
3621
3621
|
}
|
|
3622
|
+
/**
|
|
3623
|
+
* Add an output to the PSBT
|
|
3624
|
+
*
|
|
3625
|
+
* # Arguments
|
|
3626
|
+
* * `script` - The output script (scriptPubKey)
|
|
3627
|
+
* * `value` - Value in satoshis
|
|
3628
|
+
*
|
|
3629
|
+
* # Returns
|
|
3630
|
+
* The index of the newly added output
|
|
3631
|
+
* @param {Uint8Array} script
|
|
3632
|
+
* @param {bigint} value
|
|
3633
|
+
* @returns {number}
|
|
3634
|
+
*/
|
|
3635
|
+
addOutput(script, value) {
|
|
3636
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3637
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3638
|
+
const ret = wasm.wrappsbt_addOutput(this.__wbg_ptr, ptr0, len0, value);
|
|
3639
|
+
return ret >>> 0;
|
|
3640
|
+
}
|
|
3622
3641
|
/**
|
|
3623
3642
|
* @param {Uint8Array} psbt
|
|
3624
3643
|
* @returns {WrapPsbt}
|
|
@@ -3695,6 +3714,26 @@ class WrapPsbt {
|
|
|
3695
3714
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3696
3715
|
}
|
|
3697
3716
|
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Get the unsigned transaction bytes
|
|
3719
|
+
*
|
|
3720
|
+
* # Returns
|
|
3721
|
+
* The serialized unsigned transaction
|
|
3722
|
+
* @returns {Uint8Array}
|
|
3723
|
+
*/
|
|
3724
|
+
getUnsignedTx() {
|
|
3725
|
+
try {
|
|
3726
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3727
|
+
wasm.wrappsbt_getUnsignedTx(retptr, this.__wbg_ptr);
|
|
3728
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3729
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3730
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
3731
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3732
|
+
return v1;
|
|
3733
|
+
} finally {
|
|
3734
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3698
3737
|
/**
|
|
3699
3738
|
* @param {number} input_index
|
|
3700
3739
|
* @param {WrapDescriptor} descriptor
|
|
@@ -3731,6 +3770,21 @@ class WrapPsbt {
|
|
|
3731
3770
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3732
3771
|
}
|
|
3733
3772
|
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Create an empty PSBT
|
|
3775
|
+
*
|
|
3776
|
+
* # Arguments
|
|
3777
|
+
* * `version` - Transaction version (default: 2)
|
|
3778
|
+
* * `lock_time` - Transaction lock time (default: 0)
|
|
3779
|
+
* @param {number | null} [version]
|
|
3780
|
+
* @param {number | null} [lock_time]
|
|
3781
|
+
*/
|
|
3782
|
+
constructor(version, lock_time) {
|
|
3783
|
+
const ret = wasm.wrappsbt_new(isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0);
|
|
3784
|
+
this.__wbg_ptr = ret >>> 0;
|
|
3785
|
+
WrapPsbtFinalization.register(this, this.__wbg_ptr, this);
|
|
3786
|
+
return this;
|
|
3787
|
+
}
|
|
3734
3788
|
/**
|
|
3735
3789
|
* @returns {WrapPsbt}
|
|
3736
3790
|
*/
|
|
@@ -3738,6 +3792,44 @@ class WrapPsbt {
|
|
|
3738
3792
|
const ret = wasm.wrappsbt_clone(this.__wbg_ptr);
|
|
3739
3793
|
return WrapPsbt.__wrap(ret);
|
|
3740
3794
|
}
|
|
3795
|
+
/**
|
|
3796
|
+
* Add an input to the PSBT
|
|
3797
|
+
*
|
|
3798
|
+
* # Arguments
|
|
3799
|
+
* * `txid` - Transaction ID (hex string, 32 bytes reversed)
|
|
3800
|
+
* * `vout` - Output index being spent
|
|
3801
|
+
* * `value` - Value in satoshis of the output being spent
|
|
3802
|
+
* * `script` - The scriptPubKey of the output being spent
|
|
3803
|
+
* * `sequence` - Sequence number (default: 0xFFFFFFFE for RBF)
|
|
3804
|
+
*
|
|
3805
|
+
* # Returns
|
|
3806
|
+
* The index of the newly added input
|
|
3807
|
+
* @param {string} txid
|
|
3808
|
+
* @param {number} vout
|
|
3809
|
+
* @param {bigint} value
|
|
3810
|
+
* @param {Uint8Array} script
|
|
3811
|
+
* @param {number | null} [sequence]
|
|
3812
|
+
* @returns {number}
|
|
3813
|
+
*/
|
|
3814
|
+
addInput(txid, vout, value, script, sequence) {
|
|
3815
|
+
try {
|
|
3816
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3817
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3818
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3819
|
+
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3820
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3821
|
+
wasm.wrappsbt_addInput(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3822
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3823
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3824
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3825
|
+
if (r2) {
|
|
3826
|
+
throw takeObject(r1);
|
|
3827
|
+
}
|
|
3828
|
+
return r0 >>> 0;
|
|
3829
|
+
} finally {
|
|
3830
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3741
3833
|
/**
|
|
3742
3834
|
* @returns {Uint8Array}
|
|
3743
3835
|
*/
|
|
Binary file
|
|
@@ -9,7 +9,7 @@ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
|
9
9
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
10
10
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
11
11
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
12
|
-
export const
|
|
12
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
13
13
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
14
14
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
15
15
|
export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
@@ -99,15 +99,13 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
99
99
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
100
100
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
101
101
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
105
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
106
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
102
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
103
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
104
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
107
105
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
108
106
|
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
109
107
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
110
|
-
export const
|
|
108
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
111
109
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
112
110
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
113
111
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
@@ -117,9 +115,11 @@ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b
|
|
|
117
115
|
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
118
116
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
119
117
|
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
120
|
-
export const
|
|
121
|
-
export const
|
|
122
|
-
export const
|
|
118
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
119
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
120
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
121
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
122
|
+
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
123
123
|
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
124
124
|
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
125
125
|
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
@@ -142,9 +142,13 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
|
|
|
142
142
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
143
143
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
144
144
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
145
|
+
export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
|
|
146
|
+
export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
|
|
145
147
|
export const wrappsbt_clone: (a: number) => number;
|
|
146
148
|
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
147
149
|
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
150
|
+
export const wrappsbt_getUnsignedTx: (a: number, b: number) => void;
|
|
151
|
+
export const wrappsbt_new: (a: number, b: number) => number;
|
|
148
152
|
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
149
153
|
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
150
154
|
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
|
|
2
|
+
export type CoinName = (typeof coinNames)[number];
|
|
3
|
+
export declare function getMainnet(name: CoinName): CoinName;
|
|
4
|
+
export declare function isMainnet(name: CoinName): boolean;
|
|
5
|
+
export declare function isTestnet(name: CoinName): boolean;
|
|
6
|
+
export declare function isCoinName(v: string): v is CoinName;
|
package/dist/esm/js/coinName.js
CHANGED
|
@@ -1 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
// BitGo coin names (from Network::from_coin_name in src/networks.rs)
|
|
2
|
+
export const coinNames = [
|
|
3
|
+
"btc",
|
|
4
|
+
"tbtc",
|
|
5
|
+
"tbtc4",
|
|
6
|
+
"tbtcsig",
|
|
7
|
+
"tbtcbgsig",
|
|
8
|
+
"bch",
|
|
9
|
+
"tbch",
|
|
10
|
+
"bcha",
|
|
11
|
+
"tbcha",
|
|
12
|
+
"btg",
|
|
13
|
+
"tbtg",
|
|
14
|
+
"bsv",
|
|
15
|
+
"tbsv",
|
|
16
|
+
"dash",
|
|
17
|
+
"tdash",
|
|
18
|
+
"doge",
|
|
19
|
+
"tdoge",
|
|
20
|
+
"ltc",
|
|
21
|
+
"tltc",
|
|
22
|
+
"zec",
|
|
23
|
+
"tzec",
|
|
24
|
+
];
|
|
25
|
+
export function getMainnet(name) {
|
|
26
|
+
switch (name) {
|
|
27
|
+
case "tbtc":
|
|
28
|
+
case "tbtc4":
|
|
29
|
+
case "tbtcsig":
|
|
30
|
+
case "tbtcbgsig":
|
|
31
|
+
return "btc";
|
|
32
|
+
case "tbch":
|
|
33
|
+
return "bch";
|
|
34
|
+
case "tbcha":
|
|
35
|
+
return "bcha";
|
|
36
|
+
case "tbtg":
|
|
37
|
+
return "btg";
|
|
38
|
+
case "tbsv":
|
|
39
|
+
return "bsv";
|
|
40
|
+
case "tdash":
|
|
41
|
+
return "dash";
|
|
42
|
+
case "tdoge":
|
|
43
|
+
return "doge";
|
|
44
|
+
case "tltc":
|
|
45
|
+
return "ltc";
|
|
46
|
+
case "tzec":
|
|
47
|
+
return "zec";
|
|
48
|
+
default:
|
|
49
|
+
return name;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function isMainnet(name) {
|
|
53
|
+
return getMainnet(name) === name;
|
|
54
|
+
}
|
|
55
|
+
export function isTestnet(name) {
|
|
56
|
+
return getMainnet(name) !== name;
|
|
57
|
+
}
|
|
58
|
+
export function isCoinName(v) {
|
|
59
|
+
return coinNames.includes(v);
|
|
60
|
+
}
|
|
@@ -963,15 +963,54 @@ export class WrapMiniscript {
|
|
|
963
963
|
}
|
|
964
964
|
|
|
965
965
|
export class WrapPsbt {
|
|
966
|
-
private constructor();
|
|
967
966
|
free(): void;
|
|
968
967
|
[Symbol.dispose](): void;
|
|
968
|
+
/**
|
|
969
|
+
* Add an output to the PSBT
|
|
970
|
+
*
|
|
971
|
+
* # Arguments
|
|
972
|
+
* * `script` - The output script (scriptPubKey)
|
|
973
|
+
* * `value` - Value in satoshis
|
|
974
|
+
*
|
|
975
|
+
* # Returns
|
|
976
|
+
* The index of the newly added output
|
|
977
|
+
*/
|
|
978
|
+
addOutput(script: Uint8Array, value: bigint): number;
|
|
969
979
|
static deserialize(psbt: Uint8Array): WrapPsbt;
|
|
970
980
|
finalize(): void;
|
|
971
981
|
signWithPrv(prv: Uint8Array): any;
|
|
972
982
|
signWithXprv(xprv: string): any;
|
|
983
|
+
/**
|
|
984
|
+
* Get the unsigned transaction bytes
|
|
985
|
+
*
|
|
986
|
+
* # Returns
|
|
987
|
+
* The serialized unsigned transaction
|
|
988
|
+
*/
|
|
989
|
+
getUnsignedTx(): Uint8Array;
|
|
973
990
|
updateInputWithDescriptor(input_index: number, descriptor: WrapDescriptor): void;
|
|
974
991
|
updateOutputWithDescriptor(output_index: number, descriptor: WrapDescriptor): void;
|
|
992
|
+
/**
|
|
993
|
+
* Create an empty PSBT
|
|
994
|
+
*
|
|
995
|
+
* # Arguments
|
|
996
|
+
* * `version` - Transaction version (default: 2)
|
|
997
|
+
* * `lock_time` - Transaction lock time (default: 0)
|
|
998
|
+
*/
|
|
999
|
+
constructor(version?: number | null, lock_time?: number | null);
|
|
975
1000
|
clone(): WrapPsbt;
|
|
1001
|
+
/**
|
|
1002
|
+
* Add an input to the PSBT
|
|
1003
|
+
*
|
|
1004
|
+
* # Arguments
|
|
1005
|
+
* * `txid` - Transaction ID (hex string, 32 bytes reversed)
|
|
1006
|
+
* * `vout` - Output index being spent
|
|
1007
|
+
* * `value` - Value in satoshis of the output being spent
|
|
1008
|
+
* * `script` - The scriptPubKey of the output being spent
|
|
1009
|
+
* * `sequence` - Sequence number (default: 0xFFFFFFFE for RBF)
|
|
1010
|
+
*
|
|
1011
|
+
* # Returns
|
|
1012
|
+
* The index of the newly added input
|
|
1013
|
+
*/
|
|
1014
|
+
addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
|
|
976
1015
|
serialize(): Uint8Array;
|
|
977
1016
|
}
|
|
@@ -3612,6 +3612,25 @@ export class WrapPsbt {
|
|
|
3612
3612
|
const ptr = this.__destroy_into_raw();
|
|
3613
3613
|
wasm.__wbg_wrappsbt_free(ptr, 0);
|
|
3614
3614
|
}
|
|
3615
|
+
/**
|
|
3616
|
+
* Add an output to the PSBT
|
|
3617
|
+
*
|
|
3618
|
+
* # Arguments
|
|
3619
|
+
* * `script` - The output script (scriptPubKey)
|
|
3620
|
+
* * `value` - Value in satoshis
|
|
3621
|
+
*
|
|
3622
|
+
* # Returns
|
|
3623
|
+
* The index of the newly added output
|
|
3624
|
+
* @param {Uint8Array} script
|
|
3625
|
+
* @param {bigint} value
|
|
3626
|
+
* @returns {number}
|
|
3627
|
+
*/
|
|
3628
|
+
addOutput(script, value) {
|
|
3629
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3630
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3631
|
+
const ret = wasm.wrappsbt_addOutput(this.__wbg_ptr, ptr0, len0, value);
|
|
3632
|
+
return ret >>> 0;
|
|
3633
|
+
}
|
|
3615
3634
|
/**
|
|
3616
3635
|
* @param {Uint8Array} psbt
|
|
3617
3636
|
* @returns {WrapPsbt}
|
|
@@ -3688,6 +3707,26 @@ export class WrapPsbt {
|
|
|
3688
3707
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3689
3708
|
}
|
|
3690
3709
|
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Get the unsigned transaction bytes
|
|
3712
|
+
*
|
|
3713
|
+
* # Returns
|
|
3714
|
+
* The serialized unsigned transaction
|
|
3715
|
+
* @returns {Uint8Array}
|
|
3716
|
+
*/
|
|
3717
|
+
getUnsignedTx() {
|
|
3718
|
+
try {
|
|
3719
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3720
|
+
wasm.wrappsbt_getUnsignedTx(retptr, this.__wbg_ptr);
|
|
3721
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3722
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3723
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
3724
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3725
|
+
return v1;
|
|
3726
|
+
} finally {
|
|
3727
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3691
3730
|
/**
|
|
3692
3731
|
* @param {number} input_index
|
|
3693
3732
|
* @param {WrapDescriptor} descriptor
|
|
@@ -3724,6 +3763,21 @@ export class WrapPsbt {
|
|
|
3724
3763
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3725
3764
|
}
|
|
3726
3765
|
}
|
|
3766
|
+
/**
|
|
3767
|
+
* Create an empty PSBT
|
|
3768
|
+
*
|
|
3769
|
+
* # Arguments
|
|
3770
|
+
* * `version` - Transaction version (default: 2)
|
|
3771
|
+
* * `lock_time` - Transaction lock time (default: 0)
|
|
3772
|
+
* @param {number | null} [version]
|
|
3773
|
+
* @param {number | null} [lock_time]
|
|
3774
|
+
*/
|
|
3775
|
+
constructor(version, lock_time) {
|
|
3776
|
+
const ret = wasm.wrappsbt_new(isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0);
|
|
3777
|
+
this.__wbg_ptr = ret >>> 0;
|
|
3778
|
+
WrapPsbtFinalization.register(this, this.__wbg_ptr, this);
|
|
3779
|
+
return this;
|
|
3780
|
+
}
|
|
3727
3781
|
/**
|
|
3728
3782
|
* @returns {WrapPsbt}
|
|
3729
3783
|
*/
|
|
@@ -3731,6 +3785,44 @@ export class WrapPsbt {
|
|
|
3731
3785
|
const ret = wasm.wrappsbt_clone(this.__wbg_ptr);
|
|
3732
3786
|
return WrapPsbt.__wrap(ret);
|
|
3733
3787
|
}
|
|
3788
|
+
/**
|
|
3789
|
+
* Add an input to the PSBT
|
|
3790
|
+
*
|
|
3791
|
+
* # Arguments
|
|
3792
|
+
* * `txid` - Transaction ID (hex string, 32 bytes reversed)
|
|
3793
|
+
* * `vout` - Output index being spent
|
|
3794
|
+
* * `value` - Value in satoshis of the output being spent
|
|
3795
|
+
* * `script` - The scriptPubKey of the output being spent
|
|
3796
|
+
* * `sequence` - Sequence number (default: 0xFFFFFFFE for RBF)
|
|
3797
|
+
*
|
|
3798
|
+
* # Returns
|
|
3799
|
+
* The index of the newly added input
|
|
3800
|
+
* @param {string} txid
|
|
3801
|
+
* @param {number} vout
|
|
3802
|
+
* @param {bigint} value
|
|
3803
|
+
* @param {Uint8Array} script
|
|
3804
|
+
* @param {number | null} [sequence]
|
|
3805
|
+
* @returns {number}
|
|
3806
|
+
*/
|
|
3807
|
+
addInput(txid, vout, value, script, sequence) {
|
|
3808
|
+
try {
|
|
3809
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3810
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3811
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3812
|
+
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3813
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3814
|
+
wasm.wrappsbt_addInput(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3815
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3816
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3817
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3818
|
+
if (r2) {
|
|
3819
|
+
throw takeObject(r1);
|
|
3820
|
+
}
|
|
3821
|
+
return r0 >>> 0;
|
|
3822
|
+
} finally {
|
|
3823
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3734
3826
|
/**
|
|
3735
3827
|
* @returns {Uint8Array}
|
|
3736
3828
|
*/
|
|
Binary file
|
|
@@ -9,7 +9,7 @@ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
|
9
9
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
10
10
|
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
11
11
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
12
|
-
export const
|
|
12
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
13
13
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
14
14
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
15
15
|
export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
@@ -99,15 +99,13 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
99
99
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
100
100
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
101
101
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
104
|
-
export const
|
|
105
|
-
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
106
|
-
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
102
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
103
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
104
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
107
105
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
108
106
|
export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
|
|
109
107
|
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
110
|
-
export const
|
|
108
|
+
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
111
109
|
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
112
110
|
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
113
111
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
@@ -117,9 +115,11 @@ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b
|
|
|
117
115
|
export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
|
|
118
116
|
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
119
117
|
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
120
|
-
export const
|
|
121
|
-
export const
|
|
122
|
-
export const
|
|
118
|
+
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
119
|
+
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
120
|
+
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
121
|
+
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
122
|
+
export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
123
123
|
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
124
124
|
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
125
125
|
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
@@ -142,9 +142,13 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
|
|
|
142
142
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
143
143
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
144
144
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
145
|
+
export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
|
|
146
|
+
export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
|
|
145
147
|
export const wrappsbt_clone: (a: number) => number;
|
|
146
148
|
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
147
149
|
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
150
|
+
export const wrappsbt_getUnsignedTx: (a: number, b: number) => void;
|
|
151
|
+
export const wrappsbt_new: (a: number, b: number) => number;
|
|
148
152
|
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
149
153
|
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
150
154
|
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|