@swapkit/toolboxes 1.0.0-beta.1 → 1.0.0-beta.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/dist/cosmos/index.cjs +2 -2
- package/dist/cosmos/index.cjs.map +6 -6
- package/dist/cosmos/index.js +2 -2
- package/dist/cosmos/index.js.map +6 -6
- package/dist/evm/index.cjs +2 -2
- package/dist/evm/index.cjs.map +3 -3
- package/dist/evm/index.js +2 -2
- package/dist/evm/index.js.map +3 -3
- package/dist/ripple/index.cjs +2 -2
- package/dist/ripple/index.cjs.map +3 -3
- package/dist/ripple/index.js +2 -2
- package/dist/ripple/index.js.map +3 -3
- package/dist/solana/index.cjs +2 -2
- package/dist/solana/index.cjs.map +3 -3
- package/dist/solana/index.js +2 -2
- package/dist/solana/index.js.map +3 -3
- package/dist/utxo/index.cjs +2 -2
- package/dist/utxo/index.cjs.map +6 -6
- package/dist/utxo/index.js +2 -2
- package/dist/utxo/index.js.map +6 -6
- package/package.json +5 -7
- package/src/cosmos/thorchainUtils/registry.ts +3 -3
- package/src/cosmos/toolbox/cosmos.ts +5 -5
- package/src/cosmos/toolbox/thorchain.ts +8 -7
- package/src/cosmos/util.ts +3 -3
- package/src/evm/toolbox/baseEVMToolbox.ts +3 -1
- package/src/ripple/index.ts +1 -5
- package/src/solana/toolbox.ts +8 -8
- package/src/utxo/helpers/api.ts +1 -1
- package/src/utxo/helpers/txSize.ts +1 -1
- package/src/utxo/toolbox/bitcoinCash.ts +2 -2
- package/src/utxo/toolbox/utxo.ts +7 -7
- package/src/utxo/types.ts +2 -0
|
@@ -160,7 +160,7 @@ async function createTransaction({
|
|
|
160
160
|
// .inputs and .outputs will be undefined if no solution was found
|
|
161
161
|
if (!(inputs && outputs)) throw new Error("Balance insufficient for transaction");
|
|
162
162
|
const getNetwork = await getUtxoNetwork();
|
|
163
|
-
const builder = new TransactionBuilder(getNetwork(chain));
|
|
163
|
+
const builder = new TransactionBuilder(getNetwork(chain)) as TransactionBuilderType;
|
|
164
164
|
|
|
165
165
|
await Promise.all(
|
|
166
166
|
inputs.map(async (utxo: UTXOType) => {
|
|
@@ -226,7 +226,7 @@ function transfer({
|
|
|
226
226
|
|
|
227
227
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO: refactor
|
|
228
228
|
async function buildTx({ assetValue, recipient, memo, feeRate, sender }: UTXOBuildTxParams) {
|
|
229
|
-
const { Psbt } = await import("bitcoinjs-lib");
|
|
229
|
+
const { Psbt } = (await import("bitcoinjs-lib")).default;
|
|
230
230
|
const recipientCashAddress = toCashAddress(recipient);
|
|
231
231
|
if (!bchValidateAddress(recipientCashAddress)) throw new Error("Invalid address");
|
|
232
232
|
|
package/src/utxo/toolbox/utxo.ts
CHANGED
|
@@ -62,8 +62,8 @@ async function addInputsAndOutputs({
|
|
|
62
62
|
psbt.addInput({ hash: utxo.hash, index: utxo.index, ...witnessInfo, ...nonWitnessInfo });
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const { initEccLib } = await import("bitcoinjs-lib");
|
|
66
|
-
const secp256k1 = await import("@bitcoinerlab/secp256k1");
|
|
65
|
+
const { initEccLib } = (await import("bitcoinjs-lib")).default;
|
|
66
|
+
const secp256k1 = (await import("@bitcoinerlab/secp256k1")).default;
|
|
67
67
|
|
|
68
68
|
for (const output of outputs) {
|
|
69
69
|
const address = "address" in output && output.address ? output.address : sender;
|
|
@@ -104,7 +104,7 @@ async function createTransaction({
|
|
|
104
104
|
}> {
|
|
105
105
|
const chain = assetValue.chain as UTXOChain;
|
|
106
106
|
|
|
107
|
-
const { Psbt } = await import("bitcoinjs-lib");
|
|
107
|
+
const { Psbt } = (await import("bitcoinjs-lib")).default;
|
|
108
108
|
const compiledMemo = memo ? await compileMemo(memo) : null;
|
|
109
109
|
|
|
110
110
|
const inputsAndOutputs = await getInputsAndTargetOutputs({
|
|
@@ -141,8 +141,8 @@ async function createTransaction({
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export async function getUTXOAddressValidator() {
|
|
144
|
-
const secp256k1 = await import("@bitcoinerlab/secp256k1");
|
|
145
|
-
const { initEccLib, address: btcLibAddress } = await import("bitcoinjs-lib");
|
|
144
|
+
const secp256k1 = (await import("@bitcoinerlab/secp256k1")).default;
|
|
145
|
+
const { initEccLib, address: btcLibAddress } = (await import("bitcoinjs-lib")).default;
|
|
146
146
|
const getNetwork = await getUtxoNetwork();
|
|
147
147
|
|
|
148
148
|
return function validateAddress({ address, chain }: { address: string; chain: UTXOChain }) {
|
|
@@ -360,7 +360,7 @@ export async function getCreateKeysForPath<T extends keyof CreateKeysForPathRetu
|
|
|
360
360
|
}) => CreateKeysForPathReturnType[T]
|
|
361
361
|
> {
|
|
362
362
|
const { ECPairFactory } = await import("ecpair");
|
|
363
|
-
const secp256k1 = await import("@bitcoinerlab/secp256k1");
|
|
363
|
+
const secp256k1 = (await import("@bitcoinerlab/secp256k1")).default;
|
|
364
364
|
const { HDKey } = await import("@scure/bip32");
|
|
365
365
|
const { mnemonicToSeedSync } = await import("@scure/bip39");
|
|
366
366
|
const getNetwork = await getUtxoNetwork();
|
|
@@ -427,7 +427,7 @@ export async function getCreateKeysForPath<T extends keyof CreateKeysForPathRetu
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
export async function addressFromKeysGetter(chain: UTXOChain) {
|
|
430
|
-
const { payments } = await import("bitcoinjs-lib");
|
|
430
|
+
const { payments } = (await import("bitcoinjs-lib")).default;
|
|
431
431
|
const getNetwork = await getUtxoNetwork();
|
|
432
432
|
|
|
433
433
|
return function getAddressFromKeys(keys: ECPairInterface | BchECPair) {
|
package/src/utxo/types.ts
CHANGED
|
@@ -52,4 +52,6 @@ export type TransactionBuilderType = {
|
|
|
52
52
|
signatureAlgorithm?: string,
|
|
53
53
|
): void;
|
|
54
54
|
build(): TransactionType;
|
|
55
|
+
addOutput(addressOrScriptBuffer: string | Buffer, value: number): void;
|
|
56
|
+
addInput(txHash: string | Buffer, vout: number, sequence?: number, prevOutScript?: Buffer): void;
|
|
55
57
|
};
|