@bitgo/wasm-utxo 1.18.0 → 1.20.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/fixedScriptWallet/BitGoPsbt.d.ts +45 -4
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +52 -43
- package/dist/cjs/js/fixedScriptWallet/Dimensions.d.ts +65 -0
- package/dist/cjs/js/fixedScriptWallet/Dimensions.js +83 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +1 -0
- package/dist/cjs/js/fixedScriptWallet/index.js +3 -1
- package/dist/cjs/js/index.d.ts +1 -0
- package/dist/cjs/js/index.js +3 -1
- package/dist/cjs/js/transaction.d.ts +8 -0
- package/dist/cjs/js/transaction.js +10 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +82 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +223 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +38 -26
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +45 -4
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +52 -43
- package/dist/esm/js/fixedScriptWallet/Dimensions.d.ts +65 -0
- package/dist/esm/js/fixedScriptWallet/Dimensions.js +79 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +1 -0
- package/dist/esm/js/fixedScriptWallet/index.js +1 -0
- package/dist/esm/js/index.d.ts +1 -0
- package/dist/esm/js/index.js +1 -0
- package/dist/esm/js/transaction.d.ts +8 -0
- package/dist/esm/js/transaction.js +10 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +82 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.js +222 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +38 -26
- package/package.json +1 -1
|
@@ -181,6 +181,10 @@ const WasmDashTransactionFinalization = (typeof FinalizationRegistry === 'undefi
|
|
|
181
181
|
? { register: () => {}, unregister: () => {} }
|
|
182
182
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdashtransaction_free(ptr >>> 0, 1));
|
|
183
183
|
|
|
184
|
+
const WasmDimensionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
185
|
+
? { register: () => {}, unregister: () => {} }
|
|
186
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdimensions_free(ptr >>> 0, 1));
|
|
187
|
+
|
|
184
188
|
const WasmECPairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
185
189
|
? { register: () => {}, unregister: () => {} }
|
|
186
190
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmecpair_free(ptr >>> 0, 1));
|
|
@@ -796,6 +800,36 @@ class BitGoPsbt {
|
|
|
796
800
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
797
801
|
}
|
|
798
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* Add an output to the PSBT by address
|
|
805
|
+
*
|
|
806
|
+
* # Arguments
|
|
807
|
+
* * `address` - The destination address
|
|
808
|
+
* * `value` - The value in satoshis
|
|
809
|
+
*
|
|
810
|
+
* # Returns
|
|
811
|
+
* The index of the newly added output
|
|
812
|
+
* @param {string} address
|
|
813
|
+
* @param {bigint} value
|
|
814
|
+
* @returns {number}
|
|
815
|
+
*/
|
|
816
|
+
add_output_with_address(address, value) {
|
|
817
|
+
try {
|
|
818
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
819
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
820
|
+
const len0 = WASM_VECTOR_LEN;
|
|
821
|
+
wasm.bitgopsbt_add_output_with_address(retptr, this.__wbg_ptr, ptr0, len0, value);
|
|
822
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
823
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
824
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
825
|
+
if (r2) {
|
|
826
|
+
throw takeObject(r1);
|
|
827
|
+
}
|
|
828
|
+
return r0 >>> 0;
|
|
829
|
+
} finally {
|
|
830
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
799
833
|
/**
|
|
800
834
|
* Verify if a valid signature exists for a given ECPair key at the specified input index
|
|
801
835
|
*
|
|
@@ -1735,6 +1769,181 @@ class WasmDashTransaction {
|
|
|
1735
1769
|
if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
|
|
1736
1770
|
exports.WasmDashTransaction = WasmDashTransaction;
|
|
1737
1771
|
|
|
1772
|
+
/**
|
|
1773
|
+
* Dimensions for estimating transaction virtual size.
|
|
1774
|
+
*
|
|
1775
|
+
* Tracks weight internally with min/max bounds to handle ECDSA signature variance.
|
|
1776
|
+
* Schnorr signatures have no variance (always 64 bytes).
|
|
1777
|
+
*/
|
|
1778
|
+
class WasmDimensions {
|
|
1779
|
+
static __wrap(ptr) {
|
|
1780
|
+
ptr = ptr >>> 0;
|
|
1781
|
+
const obj = Object.create(WasmDimensions.prototype);
|
|
1782
|
+
obj.__wbg_ptr = ptr;
|
|
1783
|
+
WasmDimensionsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1784
|
+
return obj;
|
|
1785
|
+
}
|
|
1786
|
+
__destroy_into_raw() {
|
|
1787
|
+
const ptr = this.__wbg_ptr;
|
|
1788
|
+
this.__wbg_ptr = 0;
|
|
1789
|
+
WasmDimensionsFinalization.unregister(this);
|
|
1790
|
+
return ptr;
|
|
1791
|
+
}
|
|
1792
|
+
free() {
|
|
1793
|
+
const ptr = this.__destroy_into_raw();
|
|
1794
|
+
wasm.__wbg_wasmdimensions_free(ptr, 0);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Create dimensions for a single input from chain code
|
|
1798
|
+
*
|
|
1799
|
+
* # Arguments
|
|
1800
|
+
* * `chain` - Chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
1801
|
+
* * `signer` - Optional signer key ("user", "backup", "bitgo")
|
|
1802
|
+
* * `cosigner` - Optional cosigner key ("user", "backup", "bitgo")
|
|
1803
|
+
* @param {number} chain
|
|
1804
|
+
* @param {string | null} [signer]
|
|
1805
|
+
* @param {string | null} [cosigner]
|
|
1806
|
+
* @returns {WasmDimensions}
|
|
1807
|
+
*/
|
|
1808
|
+
static from_input(chain, signer, cosigner) {
|
|
1809
|
+
try {
|
|
1810
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1811
|
+
var ptr0 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1812
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1813
|
+
var ptr1 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1814
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1815
|
+
wasm.wasmdimensions_from_input(retptr, chain, ptr0, len0, ptr1, len1);
|
|
1816
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1817
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1818
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1819
|
+
if (r2) {
|
|
1820
|
+
throw takeObject(r1);
|
|
1821
|
+
}
|
|
1822
|
+
return WasmDimensions.__wrap(r0);
|
|
1823
|
+
} finally {
|
|
1824
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Get total weight (min or max)
|
|
1829
|
+
*
|
|
1830
|
+
* # Arguments
|
|
1831
|
+
* * `size` - "min" or "max", defaults to "max"
|
|
1832
|
+
* @param {string | null} [size]
|
|
1833
|
+
* @returns {number}
|
|
1834
|
+
*/
|
|
1835
|
+
get_weight(size) {
|
|
1836
|
+
var ptr0 = isLikeNone(size) ? 0 : passStringToWasm0(size, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1837
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1838
|
+
const ret = wasm.wasmdimensions_get_weight(this.__wbg_ptr, ptr0, len0);
|
|
1839
|
+
return ret >>> 0;
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Whether any inputs are segwit (affects overhead calculation)
|
|
1843
|
+
* @returns {boolean}
|
|
1844
|
+
*/
|
|
1845
|
+
has_segwit() {
|
|
1846
|
+
const ret = wasm.wasmdimensions_has_segwit(this.__wbg_ptr);
|
|
1847
|
+
return ret !== 0;
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Create dimensions for a single output from script bytes
|
|
1851
|
+
* @param {Uint8Array} script
|
|
1852
|
+
* @returns {WasmDimensions}
|
|
1853
|
+
*/
|
|
1854
|
+
static from_output_script(script) {
|
|
1855
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
1856
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1857
|
+
const ret = wasm.wasmdimensions_from_output_script(ptr0, len0);
|
|
1858
|
+
return WasmDimensions.__wrap(ret);
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Create dimensions for a single input from script type string
|
|
1862
|
+
*
|
|
1863
|
+
* # Arguments
|
|
1864
|
+
* * `script_type` - One of: "p2sh", "p2shP2wsh", "p2wsh", "p2trLegacy",
|
|
1865
|
+
* "p2trMusig2KeyPath", "p2trMusig2ScriptPath", "p2shP2pk"
|
|
1866
|
+
* @param {string} script_type
|
|
1867
|
+
* @returns {WasmDimensions}
|
|
1868
|
+
*/
|
|
1869
|
+
static from_input_script_type(script_type) {
|
|
1870
|
+
try {
|
|
1871
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1872
|
+
const ptr0 = passStringToWasm0(script_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1873
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1874
|
+
wasm.wasmdimensions_from_input_script_type(retptr, ptr0, len0);
|
|
1875
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1876
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1877
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1878
|
+
if (r2) {
|
|
1879
|
+
throw takeObject(r1);
|
|
1880
|
+
}
|
|
1881
|
+
return WasmDimensions.__wrap(r0);
|
|
1882
|
+
} finally {
|
|
1883
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Combine with another Dimensions instance
|
|
1888
|
+
* @param {WasmDimensions} other
|
|
1889
|
+
* @returns {WasmDimensions}
|
|
1890
|
+
*/
|
|
1891
|
+
plus(other) {
|
|
1892
|
+
_assertClass(other, WasmDimensions);
|
|
1893
|
+
const ret = wasm.wasmdimensions_plus(this.__wbg_ptr, other.__wbg_ptr);
|
|
1894
|
+
return WasmDimensions.__wrap(ret);
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Create empty dimensions (zero weight)
|
|
1898
|
+
* @returns {WasmDimensions}
|
|
1899
|
+
*/
|
|
1900
|
+
static empty() {
|
|
1901
|
+
const ret = wasm.wasmdimensions_empty();
|
|
1902
|
+
return WasmDimensions.__wrap(ret);
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Create dimensions from a BitGoPsbt
|
|
1906
|
+
*
|
|
1907
|
+
* Parses PSBT inputs and outputs to compute weight bounds without
|
|
1908
|
+
* requiring wallet keys. Input types are detected from BIP32 derivation
|
|
1909
|
+
* paths stored in the PSBT.
|
|
1910
|
+
* @param {BitGoPsbt} psbt
|
|
1911
|
+
* @returns {WasmDimensions}
|
|
1912
|
+
*/
|
|
1913
|
+
static from_psbt(psbt) {
|
|
1914
|
+
try {
|
|
1915
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1916
|
+
_assertClass(psbt, BitGoPsbt);
|
|
1917
|
+
wasm.wasmdimensions_from_psbt(retptr, psbt.__wbg_ptr);
|
|
1918
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1919
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1920
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1921
|
+
if (r2) {
|
|
1922
|
+
throw takeObject(r1);
|
|
1923
|
+
}
|
|
1924
|
+
return WasmDimensions.__wrap(r0);
|
|
1925
|
+
} finally {
|
|
1926
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Get virtual size (min or max)
|
|
1931
|
+
*
|
|
1932
|
+
* # Arguments
|
|
1933
|
+
* * `size` - "min" or "max", defaults to "max"
|
|
1934
|
+
* @param {string | null} [size]
|
|
1935
|
+
* @returns {number}
|
|
1936
|
+
*/
|
|
1937
|
+
get_vsize(size) {
|
|
1938
|
+
var ptr0 = isLikeNone(size) ? 0 : passStringToWasm0(size, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1939
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1940
|
+
const ret = wasm.wasmdimensions_get_vsize(this.__wbg_ptr, ptr0, len0);
|
|
1941
|
+
return ret >>> 0;
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
if (Symbol.dispose) WasmDimensions.prototype[Symbol.dispose] = WasmDimensions.prototype.free;
|
|
1945
|
+
exports.WasmDimensions = WasmDimensions;
|
|
1946
|
+
|
|
1738
1947
|
/**
|
|
1739
1948
|
* WASM wrapper for elliptic curve key pairs (always uses compressed keys)
|
|
1740
1949
|
*/
|
|
@@ -2258,6 +2467,20 @@ class WasmTransaction {
|
|
|
2258
2467
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2259
2468
|
}
|
|
2260
2469
|
}
|
|
2470
|
+
/**
|
|
2471
|
+
* Get the virtual size of the transaction
|
|
2472
|
+
*
|
|
2473
|
+
* Virtual size is calculated as ceil(weight / 4), where weight accounts
|
|
2474
|
+
* for the segwit discount on witness data.
|
|
2475
|
+
*
|
|
2476
|
+
* # Returns
|
|
2477
|
+
* The virtual size in virtual bytes (vbytes)
|
|
2478
|
+
* @returns {number}
|
|
2479
|
+
*/
|
|
2480
|
+
get_vsize() {
|
|
2481
|
+
const ret = wasm.wasmtransaction_get_vsize(this.__wbg_ptr);
|
|
2482
|
+
return ret >>> 0;
|
|
2483
|
+
}
|
|
2261
2484
|
}
|
|
2262
2485
|
if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
|
|
2263
2486
|
exports.WasmTransaction = WasmTransaction;
|
|
Binary file
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
8
|
+
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
4
9
|
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
10
|
+
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
11
|
+
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
12
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
13
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
14
|
+
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
15
|
+
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
16
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
18
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
19
|
+
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const wasmtransaction_get_vsize: (a: number) => number;
|
|
21
|
+
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
22
|
+
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
5
24
|
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
6
25
|
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
7
26
|
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
@@ -13,33 +32,32 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
|
13
32
|
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
14
33
|
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
15
34
|
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
16
|
-
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
17
|
-
export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
|
|
18
|
-
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
19
|
-
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
20
|
-
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
21
|
-
export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
22
|
-
export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
|
|
23
35
|
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
24
36
|
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
25
37
|
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
26
38
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
27
39
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
28
40
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
41
|
+
export const wrappsbt_clone: (a: number) => number;
|
|
42
|
+
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
43
|
+
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
44
|
+
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
45
|
+
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
46
|
+
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
47
|
+
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
48
|
+
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
29
49
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
30
50
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
31
51
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
32
52
|
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
53
|
+
export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
|
|
33
54
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
34
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
35
55
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
36
|
-
export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
|
|
37
|
-
export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
|
|
38
|
-
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
39
56
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
40
57
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
41
58
|
export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
|
|
42
59
|
export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
60
|
+
export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
43
61
|
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
44
62
|
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
|
|
45
63
|
export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
|
|
@@ -88,6 +106,15 @@ export const wasmbip32_private_key: (a: number) => number;
|
|
|
88
106
|
export const wasmbip32_public_key: (a: number) => number;
|
|
89
107
|
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
90
108
|
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
109
|
+
export const wasmdimensions_empty: () => number;
|
|
110
|
+
export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
111
|
+
export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number) => void;
|
|
112
|
+
export const wasmdimensions_from_output_script: (a: number, b: number) => number;
|
|
113
|
+
export const wasmdimensions_from_psbt: (a: number, b: number) => void;
|
|
114
|
+
export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
|
|
115
|
+
export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
|
|
116
|
+
export const wasmdimensions_has_segwit: (a: number) => number;
|
|
117
|
+
export const wasmdimensions_plus: (a: number, b: number) => number;
|
|
91
118
|
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
92
119
|
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
93
120
|
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
@@ -98,26 +125,11 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
98
125
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
99
126
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
100
127
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
101
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
102
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
103
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
104
128
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
105
129
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
106
130
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
107
131
|
export const wasmrootwalletkeys_user_key: (a: number) => number;
|
|
108
132
|
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;
|
|
109
|
-
export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
110
|
-
export const wasmtransaction_to_bytes: (a: number, b: number) => void;
|
|
111
|
-
export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
|
|
112
|
-
export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
|
|
113
|
-
export const wrappsbt_clone: (a: number) => number;
|
|
114
|
-
export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
|
|
115
|
-
export const wrappsbt_finalize: (a: number, b: number) => void;
|
|
116
|
-
export const wrappsbt_serialize: (a: number, b: number) => void;
|
|
117
|
-
export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
|
|
118
|
-
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
119
|
-
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
120
|
-
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
121
133
|
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
122
134
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
123
135
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
@@ -57,10 +57,13 @@ export type AddInputOptions = {
|
|
|
57
57
|
prevTx?: Uint8Array;
|
|
58
58
|
};
|
|
59
59
|
export type AddOutputOptions = {
|
|
60
|
-
/** Output script (scriptPubKey) */
|
|
61
60
|
script: Uint8Array;
|
|
62
61
|
/** Value in satoshis */
|
|
63
62
|
value: bigint;
|
|
63
|
+
} | {
|
|
64
|
+
address: string;
|
|
65
|
+
/** Value in satoshis */
|
|
66
|
+
value: bigint;
|
|
64
67
|
};
|
|
65
68
|
/** Key identifier for signing ("user", "backup", or "bitgo") */
|
|
66
69
|
export type SignerKey = "user" | "backup" | "bitgo";
|
|
@@ -86,8 +89,13 @@ export type AddWalletOutputOptions = {
|
|
|
86
89
|
value: bigint;
|
|
87
90
|
};
|
|
88
91
|
export declare class BitGoPsbt {
|
|
89
|
-
protected
|
|
90
|
-
protected constructor(
|
|
92
|
+
protected _wasm: WasmBitGoPsbt;
|
|
93
|
+
protected constructor(_wasm: WasmBitGoPsbt);
|
|
94
|
+
/**
|
|
95
|
+
* Get the underlying WASM instance
|
|
96
|
+
* @internal - for use by other wasm-utxo modules
|
|
97
|
+
*/
|
|
98
|
+
get wasm(): WasmBitGoPsbt;
|
|
91
99
|
/**
|
|
92
100
|
* Create an empty PSBT for the given network with wallet keys
|
|
93
101
|
*
|
|
@@ -141,15 +149,48 @@ export declare class BitGoPsbt {
|
|
|
141
149
|
/**
|
|
142
150
|
* Add an output to the PSBT
|
|
143
151
|
*
|
|
144
|
-
* @param
|
|
152
|
+
* @param script - The output script (scriptPubKey)
|
|
153
|
+
* @param value - Value in satoshis
|
|
154
|
+
* @returns The index of the newly added output
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const outputIndex = psbt.addOutput(outputScript, 50000n);
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
addOutput(script: Uint8Array, value: bigint): number;
|
|
162
|
+
/**
|
|
163
|
+
* Add an output to the PSBT by address
|
|
164
|
+
*
|
|
165
|
+
* @param address - The destination address
|
|
166
|
+
* @param value - Value in satoshis
|
|
167
|
+
* @returns The index of the newly added output
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const outputIndex = psbt.addOutput("bc1q...", 50000n);
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
addOutput(address: string, value: bigint): number;
|
|
175
|
+
/**
|
|
176
|
+
* Add an output to the PSBT
|
|
177
|
+
*
|
|
178
|
+
* @param options - Output options (script or address, and value)
|
|
145
179
|
* @returns The index of the newly added output
|
|
146
180
|
*
|
|
147
181
|
* @example
|
|
148
182
|
* ```typescript
|
|
183
|
+
* // Using script
|
|
149
184
|
* const outputIndex = psbt.addOutput({
|
|
150
185
|
* script: outputScript,
|
|
151
186
|
* value: 50000n,
|
|
152
187
|
* });
|
|
188
|
+
*
|
|
189
|
+
* // Using address
|
|
190
|
+
* const outputIndex = psbt.addOutput({
|
|
191
|
+
* address: "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
|
|
192
|
+
* value: 50000n,
|
|
193
|
+
* });
|
|
153
194
|
* ```
|
|
154
195
|
*/
|
|
155
196
|
addOutput(options: AddOutputOptions): number;
|