@swapkit/toolboxes 4.0.0-beta.50 → 4.0.0-beta.52

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.
Files changed (232) hide show
  1. package/dist/src/cosmos/index.cjs +2 -2
  2. package/dist/src/cosmos/index.cjs.map +10 -6
  3. package/dist/src/cosmos/index.js +2 -2
  4. package/dist/src/cosmos/index.js.map +10 -6
  5. package/dist/src/evm/index.cjs +2 -2
  6. package/dist/src/evm/index.cjs.map +10 -8
  7. package/dist/src/evm/index.js +2 -2
  8. package/dist/src/evm/index.js.map +10 -8
  9. package/dist/src/index.cjs +4 -2
  10. package/dist/src/index.cjs.map +54 -4
  11. package/dist/src/index.js +4 -2
  12. package/dist/src/index.js.map +54 -4
  13. package/dist/src/near/index.cjs +2 -2
  14. package/dist/src/near/index.cjs.map +7 -5
  15. package/dist/src/near/index.js +2 -2
  16. package/dist/src/near/index.js.map +7 -5
  17. package/dist/src/radix/index.cjs +2 -2
  18. package/dist/src/radix/index.cjs.map +2 -2
  19. package/dist/src/radix/index.js +2 -2
  20. package/dist/src/radix/index.js.map +2 -2
  21. package/dist/src/ripple/index.cjs +2 -2
  22. package/dist/src/ripple/index.cjs.map +2 -2
  23. package/dist/src/ripple/index.js +2 -2
  24. package/dist/src/ripple/index.js.map +2 -2
  25. package/dist/src/solana/index.cjs +2 -2
  26. package/dist/src/solana/index.cjs.map +5 -4
  27. package/dist/src/solana/index.js +2 -2
  28. package/dist/src/solana/index.js.map +5 -4
  29. package/dist/src/substrate/index.cjs +2 -2
  30. package/dist/src/substrate/index.cjs.map +6 -5
  31. package/dist/src/substrate/index.js +2 -2
  32. package/dist/src/substrate/index.js.map +6 -5
  33. package/dist/src/tron/index.cjs +2 -2
  34. package/dist/src/tron/index.cjs.map +6 -5
  35. package/dist/src/tron/index.js +2 -2
  36. package/dist/src/tron/index.js.map +6 -5
  37. package/dist/src/utxo/index.cjs +4 -4
  38. package/dist/src/utxo/index.cjs.map +10 -7
  39. package/dist/src/utxo/index.js +4 -4
  40. package/dist/src/utxo/index.js.map +10 -7
  41. package/{src/cosmos/index.ts → dist/types/cosmos/index.d.ts} +1 -0
  42. package/dist/types/cosmos/index.d.ts.map +1 -0
  43. package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts +5 -0
  44. package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts.map +1 -0
  45. package/{src/cosmos/thorchainUtils/index.ts → dist/types/cosmos/thorchainUtils/index.d.ts} +1 -0
  46. package/dist/types/cosmos/thorchainUtils/index.d.ts.map +1 -0
  47. package/dist/types/cosmos/thorchainUtils/messages.d.ts +208 -0
  48. package/dist/types/cosmos/thorchainUtils/messages.d.ts.map +1 -0
  49. package/dist/types/cosmos/thorchainUtils/registry.d.ts +4 -0
  50. package/dist/types/cosmos/thorchainUtils/registry.d.ts.map +1 -0
  51. package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts +2 -0
  52. package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts.map +1 -0
  53. package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts +66 -0
  54. package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts.map +1 -0
  55. package/dist/types/cosmos/thorchainUtils/types/index.d.ts +2 -0
  56. package/dist/types/cosmos/thorchainUtils/types/index.d.ts.map +1 -0
  57. package/dist/types/cosmos/toolbox/cosmos.d.ts +93 -0
  58. package/dist/types/cosmos/toolbox/cosmos.d.ts.map +1 -0
  59. package/dist/types/cosmos/toolbox/index.d.ts +14 -0
  60. package/dist/types/cosmos/toolbox/index.d.ts.map +1 -0
  61. package/dist/types/cosmos/toolbox/thorchain.d.ts +158 -0
  62. package/dist/types/cosmos/toolbox/thorchain.d.ts.map +1 -0
  63. package/{src/cosmos/types.ts → dist/types/cosmos/types.d.ts} +24 -29
  64. package/dist/types/cosmos/types.d.ts.map +1 -0
  65. package/dist/types/cosmos/util.d.ts +68 -0
  66. package/dist/types/cosmos/util.d.ts.map +1 -0
  67. package/dist/types/evm/api.d.ts +8 -0
  68. package/dist/types/evm/api.d.ts.map +1 -0
  69. package/dist/types/evm/contracts/eth/multicall.d.ts +36 -0
  70. package/dist/types/evm/contracts/eth/multicall.d.ts.map +1 -0
  71. package/dist/types/evm/contracts/op/gasOracle.d.ts +40 -0
  72. package/dist/types/evm/contracts/op/gasOracle.d.ts.map +1 -0
  73. package/dist/types/evm/helpers.d.ts +20 -0
  74. package/dist/types/evm/helpers.d.ts.map +1 -0
  75. package/{src/evm/index.ts → dist/types/evm/index.d.ts} +1 -0
  76. package/dist/types/evm/index.d.ts.map +1 -0
  77. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +82 -0
  78. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts.map +1 -0
  79. package/dist/types/evm/toolbox/evm.d.ts +367 -0
  80. package/dist/types/evm/toolbox/evm.d.ts.map +1 -0
  81. package/dist/types/evm/toolbox/index.d.ts +89 -0
  82. package/dist/types/evm/toolbox/index.d.ts.map +1 -0
  83. package/dist/types/evm/toolbox/op.d.ts +62 -0
  84. package/dist/types/evm/toolbox/op.d.ts.map +1 -0
  85. package/dist/types/evm/types.d.ts +98 -0
  86. package/dist/types/evm/types.d.ts.map +1 -0
  87. package/dist/types/index.d.ts +63 -0
  88. package/dist/types/index.d.ts.map +1 -0
  89. package/dist/types/near/helpers/core.d.ts +15 -0
  90. package/dist/types/near/helpers/core.d.ts.map +1 -0
  91. package/dist/types/near/helpers/gasEstimation.d.ts +41 -0
  92. package/dist/types/near/helpers/gasEstimation.d.ts.map +1 -0
  93. package/dist/types/near/helpers/nep141.d.ts +72 -0
  94. package/dist/types/near/helpers/nep141.d.ts.map +1 -0
  95. package/dist/types/near/index.d.ts +10 -0
  96. package/dist/types/near/index.d.ts.map +1 -0
  97. package/dist/types/near/toolbox.d.ts +4 -0
  98. package/dist/types/near/toolbox.d.ts.map +1 -0
  99. package/dist/types/near/types/contract.d.ts +38 -0
  100. package/dist/types/near/types/contract.d.ts.map +1 -0
  101. package/dist/types/near/types/nep141.d.ts +56 -0
  102. package/dist/types/near/types/nep141.d.ts.map +1 -0
  103. package/dist/types/near/types/toolbox.d.ts +57 -0
  104. package/dist/types/near/types/toolbox.d.ts.map +1 -0
  105. package/dist/types/near/types.d.ts +44 -0
  106. package/dist/types/near/types.d.ts.map +1 -0
  107. package/dist/types/radix/index.d.ts +14 -0
  108. package/dist/types/radix/index.d.ts.map +1 -0
  109. package/dist/types/ripple/index.d.ts +43 -0
  110. package/dist/types/ripple/index.d.ts.map +1 -0
  111. package/dist/types/solana/index.d.ts +37 -0
  112. package/dist/types/solana/index.d.ts.map +1 -0
  113. package/dist/types/solana/toolbox.d.ts +41 -0
  114. package/dist/types/solana/toolbox.d.ts.map +1 -0
  115. package/dist/types/substrate/balance.d.ts +17 -0
  116. package/dist/types/substrate/balance.d.ts.map +1 -0
  117. package/{src/substrate/index.ts → dist/types/substrate/index.d.ts} +1 -0
  118. package/dist/types/substrate/index.d.ts.map +1 -0
  119. package/dist/types/substrate/substrate.d.ts +148 -0
  120. package/dist/types/substrate/substrate.d.ts.map +1 -0
  121. package/dist/types/substrate/types.d.ts +100 -0
  122. package/dist/types/substrate/types.d.ts.map +1 -0
  123. package/dist/types/tron/helpers/trc20.abi.d.ts +156 -0
  124. package/dist/types/tron/helpers/trc20.abi.d.ts.map +1 -0
  125. package/dist/types/tron/helpers/trongrid.d.ts +8 -0
  126. package/dist/types/tron/helpers/trongrid.d.ts.map +1 -0
  127. package/dist/types/tron/index.d.ts +6 -0
  128. package/dist/types/tron/index.d.ts.map +1 -0
  129. package/dist/types/tron/toolbox.d.ts +26 -0
  130. package/dist/types/tron/toolbox.d.ts.map +1 -0
  131. package/dist/types/tron/types.d.ts +101 -0
  132. package/dist/types/tron/types.d.ts.map +1 -0
  133. package/dist/types/types.d.ts +18 -0
  134. package/dist/types/types.d.ts.map +1 -0
  135. package/dist/types/utils.d.ts +4 -0
  136. package/dist/types/utils.d.ts.map +1 -0
  137. package/dist/types/utxo/helpers/api.d.ts +133 -0
  138. package/dist/types/utxo/helpers/api.d.ts.map +1 -0
  139. package/dist/types/utxo/helpers/bchaddrjs.d.ts +10 -0
  140. package/dist/types/utxo/helpers/bchaddrjs.d.ts.map +1 -0
  141. package/dist/types/utxo/helpers/coinselect.d.ts +16 -0
  142. package/dist/types/utxo/helpers/coinselect.d.ts.map +1 -0
  143. package/{src/utxo/helpers/index.ts → dist/types/utxo/helpers/index.d.ts} +1 -0
  144. package/dist/types/utxo/helpers/index.d.ts.map +1 -0
  145. package/dist/types/utxo/helpers/txSize.d.ts +21 -0
  146. package/dist/types/utxo/helpers/txSize.d.ts.map +1 -0
  147. package/{src/utxo/index.ts → dist/types/utxo/index.d.ts} +1 -0
  148. package/dist/types/utxo/index.d.ts.map +1 -0
  149. package/dist/types/utxo/toolbox/bitcoinCash.d.ts +104 -0
  150. package/dist/types/utxo/toolbox/bitcoinCash.d.ts.map +1 -0
  151. package/dist/types/utxo/toolbox/index.d.ts +50 -0
  152. package/dist/types/utxo/toolbox/index.d.ts.map +1 -0
  153. package/dist/types/utxo/toolbox/utxo.d.ts +102 -0
  154. package/dist/types/utxo/toolbox/utxo.d.ts.map +1 -0
  155. package/dist/types/utxo/toolbox/zcash.d.ts +83 -0
  156. package/dist/types/utxo/toolbox/zcash.d.ts.map +1 -0
  157. package/dist/types/utxo/types.d.ts +46 -0
  158. package/dist/types/utxo/types.d.ts.map +1 -0
  159. package/package.json +15 -18
  160. package/dist/chunk-0h4xdrwz.js +0 -5
  161. package/dist/chunk-0h4xdrwz.js.map +0 -10
  162. package/dist/chunk-4yap1fvd.js +0 -4
  163. package/dist/chunk-4yap1fvd.js.map +0 -10
  164. package/dist/chunk-9bqegm61.js +0 -4
  165. package/dist/chunk-9bqegm61.js.map +0 -10
  166. package/dist/chunk-fazw0jvt.js +0 -4
  167. package/dist/chunk-fazw0jvt.js.map +0 -9
  168. package/dist/chunk-fjfxga2v.js +0 -4
  169. package/dist/chunk-fjfxga2v.js.map +0 -10
  170. package/dist/chunk-s47y8512.js +0 -5
  171. package/dist/chunk-s47y8512.js.map +0 -9
  172. package/dist/chunk-vtd17cje.js +0 -4
  173. package/dist/chunk-vtd17cje.js.map +0 -10
  174. package/dist/chunk-zcdeg6h9.js +0 -5
  175. package/dist/chunk-zcdeg6h9.js.map +0 -10
  176. package/src/cosmos/thorchainUtils/addressFormat.ts +0 -26
  177. package/src/cosmos/thorchainUtils/messages.ts +0 -262
  178. package/src/cosmos/thorchainUtils/registry.ts +0 -44
  179. package/src/cosmos/thorchainUtils/types/MsgCompiled.ts +0 -2800
  180. package/src/cosmos/thorchainUtils/types/client-types.ts +0 -73
  181. package/src/cosmos/thorchainUtils/types/index.ts +0 -1
  182. package/src/cosmos/toolbox/cosmos.ts +0 -375
  183. package/src/cosmos/toolbox/index.ts +0 -33
  184. package/src/cosmos/toolbox/thorchain.ts +0 -313
  185. package/src/cosmos/util.ts +0 -266
  186. package/src/evm/__tests__/address-validation.test.ts +0 -86
  187. package/src/evm/__tests__/ethereum.test.ts +0 -141
  188. package/src/evm/api.ts +0 -21
  189. package/src/evm/contracts/eth/multicall.ts +0 -165
  190. package/src/evm/contracts/op/gasOracle.ts +0 -151
  191. package/src/evm/helpers.ts +0 -194
  192. package/src/evm/toolbox/baseEVMToolbox.ts +0 -762
  193. package/src/evm/toolbox/evm.ts +0 -66
  194. package/src/evm/toolbox/index.ts +0 -52
  195. package/src/evm/toolbox/op.ts +0 -131
  196. package/src/evm/types.ts +0 -146
  197. package/src/index.ts +0 -263
  198. package/src/near/__tests__/core.test.ts +0 -80
  199. package/src/near/helpers/contractFactory.ts +0 -22
  200. package/src/near/helpers/core.ts +0 -91
  201. package/src/near/helpers/gasEstimation.ts +0 -110
  202. package/src/near/helpers/index.ts +0 -5
  203. package/src/near/helpers/nep141.ts +0 -110
  204. package/src/near/index.ts +0 -24
  205. package/src/near/toolbox.ts +0 -509
  206. package/src/near/types/contract.ts +0 -48
  207. package/src/near/types/nep141.ts +0 -66
  208. package/src/near/types.ts +0 -57
  209. package/src/radix/index.ts +0 -156
  210. package/src/ripple/index.ts +0 -192
  211. package/src/solana/index.ts +0 -55
  212. package/src/solana/toolbox.ts +0 -433
  213. package/src/substrate/balance.ts +0 -92
  214. package/src/substrate/substrate.ts +0 -320
  215. package/src/substrate/types.ts +0 -120
  216. package/src/tron/__tests__/toolbox.test.ts +0 -147
  217. package/src/tron/helpers/trc20.abi.ts +0 -107
  218. package/src/tron/helpers/trongrid.ts +0 -54
  219. package/src/tron/index.ts +0 -17
  220. package/src/tron/toolbox.ts +0 -650
  221. package/src/tron/types.ts +0 -120
  222. package/src/utils.ts +0 -27
  223. package/src/utxo/__tests__/zcash-integration.test.ts +0 -114
  224. package/src/utxo/helpers/api.ts +0 -560
  225. package/src/utxo/helpers/bchaddrjs.ts +0 -183
  226. package/src/utxo/helpers/coinselect.ts +0 -98
  227. package/src/utxo/helpers/txSize.ts +0 -104
  228. package/src/utxo/toolbox/bitcoinCash.ts +0 -320
  229. package/src/utxo/toolbox/index.ts +0 -90
  230. package/src/utxo/toolbox/utxo.ts +0 -525
  231. package/src/utxo/toolbox/zcash.ts +0 -208
  232. package/src/utxo/types.ts +0 -57
@@ -1,208 +0,0 @@
1
- import secp256k1 from "@bitcoinerlab/secp256k1";
2
- import { HDKey } from "@scure/bip32";
3
- import { mnemonicToSeedSync } from "@scure/bip39";
4
- import {
5
- Chain,
6
- type ChainSigner,
7
- type DerivationPathArray,
8
- FeeOption,
9
- NetworkDerivationPath,
10
- SKConfig,
11
- SwapKitError,
12
- derivationPathToString,
13
- updateDerivationPath,
14
- } from "@swapkit/helpers";
15
- import type { Psbt } from "bitcoinjs-lib";
16
- import { hash160 } from "bitcoinjs-lib/src/crypto";
17
- import bs58check from "bs58check";
18
- import { ECPairFactory } from "ecpair";
19
- import { P, match } from "ts-pattern";
20
- import { getUtxoNetwork } from "../helpers";
21
- import type { UTXOBuildTxParams, UTXOTransferParams } from "../types";
22
- import { createUTXOToolbox } from "./utxo";
23
-
24
- const chain = Chain.Zcash;
25
- const network = getUtxoNetwork()(chain);
26
-
27
- /**
28
- * Custom Zcash address generation that handles 2-byte prefixes
29
- *
30
- * Zcash transparent addresses use 2-byte version prefixes, unlike Bitcoin's single byte.
31
- * This is incompatible with bitcoinjs-lib's payment methods which expect UInt8 values.
32
- *
33
- * @param publicKey - The public key buffer to generate address from
34
- * @param isTestnet - Whether to generate testnet or mainnet address
35
- * @returns A valid Zcash transparent address (t1... for mainnet, tm... for testnet)
36
- */
37
- function generateZcashAddress(publicKey: Buffer, isTestnet = false): string {
38
- // Hash the public key using RIPEMD160(SHA256(pubkey))
39
- const publicKeyHash = hash160(publicKey);
40
-
41
- // Zcash uses 2-byte prefixes for transparent addresses
42
- // These prefixes ensure addresses start with expected characters when base58 encoded
43
- const prefix = isTestnet
44
- ? Buffer.from([0x1c, 0xba]) // testnet prefix (results in tm... addresses)
45
- : Buffer.from([0x1c, 0xb8]); // mainnet prefix (results in t1... addresses)
46
-
47
- // Combine prefix + hash (22 bytes total: 2 byte prefix + 20 byte hash)
48
- const payload = Buffer.concat([prefix, publicKeyHash]);
49
-
50
- // Encode with base58check for final address
51
- return bs58check.encode(payload);
52
- }
53
-
54
- export function validateZcashAddress(address: string) {
55
- try {
56
- // Shielded addresses are not supported
57
- if (address.startsWith("z")) {
58
- console.warn(
59
- "Shielded Zcash addresses (z-addresses) are not supported. Use transparent addresses (t1/t3) only.",
60
- );
61
- return false;
62
- }
63
-
64
- const isMainnet = address.startsWith("t1");
65
- const isTestnet = address.startsWith("t3");
66
-
67
- if (!(isMainnet || isTestnet)) {
68
- return false;
69
- }
70
-
71
- // Verify network matches address type
72
- const { isStagenet } = SKConfig.get("envs");
73
- if ((isMainnet && isStagenet) || (isTestnet && !isStagenet)) {
74
- return false;
75
- }
76
-
77
- return validateBase58Check(address, network);
78
- } catch {
79
- return false;
80
- }
81
- }
82
-
83
- function validateBase58Check(
84
- address: string,
85
- network: ReturnType<ReturnType<typeof getUtxoNetwork>>,
86
- ) {
87
- try {
88
- const decoded = bs58check.decode(address);
89
-
90
- if (decoded.length < 21) {
91
- return false;
92
- }
93
-
94
- const version = decoded[0];
95
- return version === network.pubKeyHash || version === network.scriptHash;
96
- } catch {
97
- return false;
98
- }
99
- }
100
-
101
- const ECPair = ECPairFactory(secp256k1);
102
-
103
- type ZcashSigner = ChainSigner<Psbt, Psbt>;
104
-
105
- async function createZcashSignerFromPhrase({
106
- phrase,
107
- derivationPathString,
108
- }: {
109
- phrase: string;
110
- derivationPathString: string;
111
- }) {
112
- const seed = mnemonicToSeedSync(phrase);
113
- const root = HDKey.fromMasterSeed(seed);
114
-
115
- const node = root.derive(derivationPathString);
116
-
117
- if (!node.privateKey) {
118
- throw new Error("Unable to derive private key");
119
- }
120
-
121
- const keyPair = ECPair.fromPrivateKey(Buffer.from(node.privateKey), { network });
122
-
123
- const { isStagenet } = SKConfig.get("envs");
124
- const address = generateZcashAddress(keyPair.publicKey, isStagenet);
125
-
126
- return {
127
- getAddress() {
128
- return Promise.resolve(address);
129
- },
130
-
131
- signTransaction(psbt: Psbt) {
132
- for (let i = 0; i < psbt.inputCount; i++) {
133
- psbt.signInput(i, keyPair);
134
- }
135
- return Promise.resolve(psbt);
136
- },
137
- };
138
- }
139
-
140
- export async function createZcashToolbox(
141
- toolboxParams:
142
- | {
143
- signer?: ZcashSigner;
144
- }
145
- | {
146
- phrase?: string;
147
- derivationPath?: DerivationPathArray;
148
- index?: number;
149
- },
150
- ) {
151
- const signer = await match(toolboxParams)
152
- .with({ signer: P.not(P.nullish) }, ({ signer }) => Promise.resolve(signer))
153
- .with({ phrase: P.string }, ({ phrase, derivationPath, index = 0 }) => {
154
- // Handle derivation path processing at toolbox level
155
- const baseDerivationPath = derivationPath ||
156
- NetworkDerivationPath[Chain.Zcash] || [44, 133, 0, 0, 0];
157
- const updatedDerivationPath = updateDerivationPath(baseDerivationPath, { index });
158
- const derivationPathString = derivationPathToString(updatedDerivationPath);
159
-
160
- return createZcashSignerFromPhrase({ phrase, derivationPathString });
161
- })
162
- .otherwise(() => Promise.resolve(undefined));
163
-
164
- const { getFeeRates, broadcastTx, ...toolbox } = await createUTXOToolbox({
165
- chain: Chain.Zcash,
166
- signer,
167
- });
168
-
169
- function getAddressFromKeys(keys: { getAddress: () => string }) {
170
- return keys.getAddress();
171
- }
172
-
173
- async function transfer({
174
- recipient,
175
- assetValue,
176
- feeOptionKey = FeeOption.Fast,
177
- ...rest
178
- }: UTXOTransferParams) {
179
- const from = await signer?.getAddress();
180
- if (!(signer && from)) throw new SwapKitError("toolbox_utxo_no_signer");
181
-
182
- const feeRate = rest.feeRate || (await getFeeRates())[feeOptionKey];
183
-
184
- const buildTxParams: UTXOBuildTxParams = {
185
- ...rest,
186
- assetValue,
187
- feeRate,
188
- recipient,
189
- sender: from,
190
- };
191
-
192
- const { psbt } = await toolbox.createTransaction(buildTxParams);
193
- const signedPsbt = await signer.signTransaction(psbt);
194
- signedPsbt.finalizeAllInputs();
195
- const txHex = signedPsbt.extractTransaction().toHex();
196
-
197
- return broadcastTx(txHex);
198
- }
199
-
200
- return {
201
- ...toolbox,
202
- broadcastTx,
203
- getFeeRates,
204
- transfer,
205
- getAddressFromKeys,
206
- validateAddress: validateZcashAddress,
207
- };
208
- }
package/src/utxo/types.ts DELETED
@@ -1,57 +0,0 @@
1
- import type {
2
- GenericCreateTransactionParams,
3
- GenericTransferParams,
4
- Witness,
5
- } from "@swapkit/helpers";
6
-
7
- import type { UTXOScriptType } from "./helpers";
8
-
9
- export type TransactionType = {
10
- toHex(): string;
11
- };
12
-
13
- export type TargetOutput =
14
- | { address: string; script?: Buffer; value: number }
15
- | { script: Buffer; value: number };
16
-
17
- export type UTXOType = {
18
- hash: string;
19
- index: number;
20
- value: number;
21
- txHex?: string;
22
- witnessUtxo?: Witness;
23
- };
24
-
25
- export type UTXOInputWithScriptType = UTXOType & { type: UTXOScriptType; address: string };
26
-
27
- export type UTXOCalculateTxSizeParams = {
28
- inputs: (UTXOInputWithScriptType | UTXOType)[];
29
- outputs?: TargetOutput[];
30
- feeRate: number;
31
- };
32
-
33
- export type UTXOBuildTxParams = GenericCreateTransactionParams & { fetchTxHex?: boolean };
34
-
35
- export type UTXOTransferParams = GenericTransferParams;
36
-
37
- export type BchECPair = {
38
- getAddress: (index?: number) => string;
39
- publicKey: Buffer;
40
- toWIF: () => string;
41
- };
42
-
43
- export type TransactionBuilderType = {
44
- inputs: any[];
45
- sign(
46
- vin: number,
47
- keyPair: BchECPair,
48
- redeemScript?: Buffer,
49
- hashType?: number,
50
- witnessValue?: number,
51
- witnessScript?: Buffer,
52
- signatureAlgorithm?: string,
53
- ): void;
54
- build(): TransactionType;
55
- addOutput(addressOrScriptBuffer: string | Buffer, value: number): void;
56
- addInput(txHash: string | Buffer, vout: number, sequence?: number, prevOutScript?: Buffer): void;
57
- };