@swapkit/toolboxes 5.4.2 → 6.0.1
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/CHANGELOG.md +22 -0
- package/dist/{chunk-4428244x.js → chunk-exyqap7m.js} +1 -1
- package/dist/chunk-ncc6qmj6.js +1 -0
- package/dist/{chunk-as9fracn.js → chunk-xdkdc1f0.js} +1 -1
- package/dist/{chunk-rn33j2bm.js → chunk-ygq25ce3.js} +2 -2
- package/dist/src/aleo/index.js +1 -1
- package/dist/src/aptos/index.js +1 -1
- package/dist/src/cardano/index.js +1 -1
- package/dist/src/cosmos/index.js +1 -1
- package/dist/src/evm/index.js +1 -1
- package/dist/src/hypercore/index.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/near/index.js +1 -1
- package/dist/src/radix/index.js +1 -1
- package/dist/src/ripple/index.js +1 -1
- package/dist/src/solana/index.js +1 -1
- package/dist/src/starknet/index.js +1 -1
- package/dist/src/stellar/index.js +1 -1
- package/dist/src/substrate/index.js +1 -1
- package/dist/src/sui/index.js +1 -1
- package/dist/src/ton/index.js +1 -1
- package/dist/src/tron/index.js +1 -1
- package/dist/src/utxo/index.js +1 -1
- package/dist/types/cosmos/types.d.ts +0 -1
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +1 -0
- package/dist/types/evm/toolbox/op.d.ts +8 -0
- package/dist/types/near/toolbox.d.ts +0 -2
- package/dist/types/near/types/toolbox.d.ts +0 -2
- package/dist/types/solana/index.d.ts +3 -0
- package/dist/types/solana/toolbox.d.ts +2 -2
- package/dist/types/utxo/__tests__/fixtures/utxo.d.ts +6 -5
- package/dist/types/utxo/helpers/addressType.d.ts +8 -0
- package/dist/types/utxo/helpers/network.d.ts +4 -0
- package/dist/types/utxo/helpers/scriptTypes.d.ts +40 -0
- package/dist/types/utxo/helpers/txSize.d.ts +7 -6
- package/dist/types/utxo/helpers/xpubDerivation.d.ts +4 -2
- package/dist/types/utxo/index.d.ts +1 -1
- package/dist/types/utxo/toolbox/bitcoinCash.d.ts +5 -8
- package/dist/types/utxo/toolbox/index.d.ts +3 -7
- package/dist/types/utxo/toolbox/params.d.ts +24 -19
- package/dist/types/utxo/toolbox/utxo.d.ts +51 -36
- package/dist/types/utxo/toolbox/validators.d.ts +1 -2
- package/dist/types/utxo/toolbox/zcash.d.ts +6 -8
- package/dist/types/utxo/types.d.ts +4 -1
- package/package.json +2 -2
- package/dist/chunk-dssawneq.js +0 -1
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import { AssetValue,
|
|
1
|
+
import { AssetValue, FeeOption, type UTXOChain } from "@swapkit/helpers";
|
|
2
2
|
import { type BTCNetwork, Transaction } from "@swapkit/utxo-signer";
|
|
3
|
-
import { accumulative } from "../helpers";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
3
|
+
import { accumulative, UTXOScriptType } from "../helpers";
|
|
4
|
+
import { getUtxoAddressType, type UtxoAddressType } from "../helpers/addressType";
|
|
5
|
+
import { getNetworkForChain } from "../helpers/network";
|
|
6
|
+
import { nonSegwitChains } from "../helpers/scriptTypes";
|
|
7
|
+
import type { DeriveAddressParams, InputDerivation, RBFTransactionParams, ResolveDerivationParams, TargetOutput, UTXOBuildTxParams, UTXOCalculateTxSizeParams, UTXOForMultiAddressTransfer, UTXOTransferParams, UTXOType } from "../types";
|
|
8
|
+
import type { UTXOToolboxDerivationParams, UtxoToolboxParams } from "./params";
|
|
9
|
+
export { getNetworkForChain, getUtxoAddressType, nonSegwitChains, type UtxoAddressType };
|
|
7
10
|
export declare const rbfSupportedChains: UTXOChain[];
|
|
8
|
-
export declare function getUtxoAddressType({ address, chain }: {
|
|
9
|
-
address: string;
|
|
10
|
-
chain: UTXOChain;
|
|
11
|
-
}): "pkh" | "sh" | "sprout" | "sapling" | "unified" | "wpkh" | "wsh" | "tr" | null;
|
|
12
|
-
export type UtxoAddressType = NonNullable<ReturnType<typeof getUtxoAddressType>>;
|
|
13
11
|
export declare function validateUtxoAddress({ address, chain }: {
|
|
14
12
|
address: string;
|
|
15
13
|
chain: UTXOChain;
|
|
16
14
|
}): boolean;
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function getAddressFromPublicKey({ publicKey, chain, network, }: {
|
|
15
|
+
export declare function getAddressFromPublicKey({ publicKey, chain, network, scriptType, }: {
|
|
19
16
|
publicKey: Uint8Array;
|
|
20
17
|
chain: UTXOChain;
|
|
21
18
|
network: BTCNetwork;
|
|
19
|
+
scriptType: UTXOScriptType;
|
|
22
20
|
}): string;
|
|
23
21
|
export declare function createKeysForPath({ phrase, derivationPath, chain, wif, seed, }: {
|
|
24
22
|
phrase?: string;
|
|
@@ -30,6 +28,26 @@ export declare function createKeysForPath({ phrase, derivationPath, chain, wif,
|
|
|
30
28
|
privateKey: import("@swapkit/utxo-signer/utils").Bytes;
|
|
31
29
|
publicKey: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
32
30
|
};
|
|
31
|
+
export type SpendingMetadata = {
|
|
32
|
+
redeemScript?: Uint8Array;
|
|
33
|
+
tapInternalKey?: Uint8Array;
|
|
34
|
+
};
|
|
35
|
+
export declare function getSpendingMetadataForScript({ chain, script, publicKey, network, }: {
|
|
36
|
+
chain: UTXOChain;
|
|
37
|
+
script: Uint8Array;
|
|
38
|
+
publicKey: Uint8Array;
|
|
39
|
+
network: BTCNetwork;
|
|
40
|
+
}): SpendingMetadata;
|
|
41
|
+
export type MissingSpendingMetadata = {
|
|
42
|
+
index: number;
|
|
43
|
+
} & SpendingMetadata;
|
|
44
|
+
export declare function getMissingSpendingMetadata({ chain, tx, publicKey, network, indexes, }: {
|
|
45
|
+
chain: UTXOChain;
|
|
46
|
+
tx: InstanceType<typeof Transaction>;
|
|
47
|
+
publicKey: Uint8Array;
|
|
48
|
+
network: BTCNetwork;
|
|
49
|
+
indexes?: number[];
|
|
50
|
+
}): MissingSpendingMetadata[];
|
|
33
51
|
export declare function addInputsAndOutputs({ inputs, outputs, chain, tx, sender, compiledMemo, enableRBF, }: {
|
|
34
52
|
inputs: UTXOType[];
|
|
35
53
|
outputs: TargetOutput[];
|
|
@@ -42,21 +60,6 @@ export declare function addInputsAndOutputs({ inputs, outputs, chain, tx, sender
|
|
|
42
60
|
inputs: UTXOType[];
|
|
43
61
|
tx: Transaction;
|
|
44
62
|
};
|
|
45
|
-
declare function createTransaction({ assetValue, recipient, memo, feeRate, sender, fetchTxHex, enableRBF, sweep, }: UTXOBuildTxParams): Promise<{
|
|
46
|
-
inputs: UTXOType[];
|
|
47
|
-
tx: Transaction;
|
|
48
|
-
utxos: {
|
|
49
|
-
address: string;
|
|
50
|
-
hash: string;
|
|
51
|
-
index: number;
|
|
52
|
-
txHex: string | undefined;
|
|
53
|
-
value: number;
|
|
54
|
-
witnessUtxo: {
|
|
55
|
-
script: Buffer<ArrayBuffer>;
|
|
56
|
-
value: number;
|
|
57
|
-
};
|
|
58
|
-
}[];
|
|
59
|
-
}>;
|
|
60
63
|
declare function getInputsOutputsFee({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, sweep, }: Omit<UTXOBuildTxParams, "feeRate"> & {
|
|
61
64
|
feeOptionKey?: FeeOption;
|
|
62
65
|
feeRate?: number;
|
|
@@ -80,7 +83,9 @@ declare function getInputsOutputsFee({ assetValue, feeOptionKey, feeRate, memo,
|
|
|
80
83
|
outputs?: undefined;
|
|
81
84
|
}>;
|
|
82
85
|
export declare function getUTXOAddressValidator(chain: UTXOChain): (address: string) => boolean;
|
|
83
|
-
export declare function addressFromKeysGetter(chain: UTXOChain
|
|
86
|
+
export declare function addressFromKeysGetter(chain: UTXOChain, { scriptType }: {
|
|
87
|
+
scriptType: UTXOScriptType;
|
|
88
|
+
}): (keys: {
|
|
84
89
|
publicKey: Uint8Array;
|
|
85
90
|
}) => string;
|
|
86
91
|
export type RBFStatusResult = {
|
|
@@ -105,11 +110,7 @@ export type BumpFeeResult = {
|
|
|
105
110
|
originalFee: number;
|
|
106
111
|
newFee: number;
|
|
107
112
|
};
|
|
108
|
-
export declare function createUTXOToolbox<T extends UTXOChain>(
|
|
109
|
-
phrase?: string;
|
|
110
|
-
derivationPath?: DerivationPathArray;
|
|
111
|
-
index?: number;
|
|
112
|
-
}) & {
|
|
113
|
+
export declare function createUTXOToolbox<T extends UTXOChain>(toolboxParams: (UtxoToolboxParams[T] | UTXOToolboxDerivationParams) & {
|
|
113
114
|
chain: T;
|
|
114
115
|
}): {
|
|
115
116
|
accumulative: typeof accumulative;
|
|
@@ -119,7 +120,7 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
|
|
|
119
120
|
originalFee: number;
|
|
120
121
|
txid: string;
|
|
121
122
|
}>;
|
|
122
|
-
calculateTxSize: (
|
|
123
|
+
calculateTxSize: (params: Omit<UTXOCalculateTxSizeParams, "chain">) => number;
|
|
123
124
|
createKeysForPath: (params: {
|
|
124
125
|
wif?: string;
|
|
125
126
|
phrase?: string;
|
|
@@ -129,7 +130,21 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
|
|
|
129
130
|
publicKey: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
130
131
|
};
|
|
131
132
|
createReplacementTransaction: ({ txid, newFeeRate, recipient, memo, }: RBFTransactionParams) => Promise<ReplacementTransactionResult>;
|
|
132
|
-
createTransaction:
|
|
133
|
+
createTransaction: (params: UTXOBuildTxParams) => Promise<{
|
|
134
|
+
inputs: UTXOType[];
|
|
135
|
+
tx: Transaction;
|
|
136
|
+
utxos: {
|
|
137
|
+
address: string;
|
|
138
|
+
hash: string;
|
|
139
|
+
index: number;
|
|
140
|
+
txHex: string | undefined;
|
|
141
|
+
value: number;
|
|
142
|
+
witnessUtxo: {
|
|
143
|
+
script: Buffer<ArrayBuffer>;
|
|
144
|
+
value: number;
|
|
145
|
+
};
|
|
146
|
+
}[];
|
|
147
|
+
}>;
|
|
133
148
|
deriveAddressAtIndex: ({ accountIndex, index, change }: DeriveAddressParams) => {
|
|
134
149
|
accountIndex: number;
|
|
135
150
|
address: string;
|
|
@@ -190,6 +205,7 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
|
|
|
190
205
|
change: boolean;
|
|
191
206
|
index: number;
|
|
192
207
|
} | undefined;
|
|
208
|
+
scriptType: UTXOScriptType;
|
|
193
209
|
signAndBroadcastTransaction: (tx: InstanceType<typeof Transaction>) => Promise<string>;
|
|
194
210
|
signTransaction: (tx: InstanceType<typeof Transaction>) => Transaction | Promise<Transaction>;
|
|
195
211
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
@@ -212,4 +228,3 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
|
|
|
212
228
|
}) => Promise<string>;
|
|
213
229
|
validateAddress: (address: string) => boolean;
|
|
214
230
|
};
|
|
215
|
-
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { getZcashAddressType, validateZcashAddress } from "@swapkit/utxo-signer";
|
|
2
|
-
export
|
|
3
|
-
export declare function getBchAddressType(address: string): "pkh" | "sh" | null;
|
|
2
|
+
export { getBchAddressType, stripPrefix } from "../helpers/addressType";
|
|
4
3
|
export declare function validateBchAddress(address: string): boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { type ChainSigner,
|
|
1
|
+
import { type ChainSigner, FeeOption } from "@swapkit/helpers";
|
|
2
2
|
import { PCZT, ZcashPSBT, type ZcashTransaction } from "@swapkit/utxo-signer";
|
|
3
3
|
import { accumulative } from "../helpers";
|
|
4
4
|
import type { TargetOutput, UTXOBuildTxParams, UTXOTransferParams, UTXOType } from "../types";
|
|
5
|
+
import type { UTXOToolboxDerivationParams } from "./params";
|
|
5
6
|
import { validateZcashAddress } from "./validators";
|
|
6
7
|
type ZcashSigner = ChainSigner<ZcashTransaction | PCZT | ZcashPSBT, ZcashTransaction>;
|
|
7
8
|
declare function createTransaction(buildTxParams: UTXOBuildTxParams): Promise<{
|
|
@@ -9,13 +10,9 @@ declare function createTransaction(buildTxParams: UTXOBuildTxParams): Promise<{
|
|
|
9
10
|
outputs: TargetOutput[];
|
|
10
11
|
tx: ZcashTransaction;
|
|
11
12
|
}>;
|
|
12
|
-
export declare function createZcashToolbox(toolboxParams
|
|
13
|
+
export declare function createZcashToolbox(toolboxParams?: {
|
|
13
14
|
signer?: ZcashSigner;
|
|
14
|
-
} | {
|
|
15
|
-
phrase?: string;
|
|
16
|
-
derivationPath?: DerivationPathArray;
|
|
17
|
-
index?: number;
|
|
18
|
-
}): {
|
|
15
|
+
} | UTXOToolboxDerivationParams): {
|
|
19
16
|
createKeysForPath: ({ phrase, derivationPath, }: {
|
|
20
17
|
phrase: string;
|
|
21
18
|
derivationPath?: string;
|
|
@@ -39,7 +36,7 @@ export declare function createZcashToolbox(toolboxParams: {
|
|
|
39
36
|
originalFee: number;
|
|
40
37
|
txid: string;
|
|
41
38
|
}>;
|
|
42
|
-
calculateTxSize: (
|
|
39
|
+
calculateTxSize: (params: Omit<import("..").UTXOCalculateTxSizeParams, "chain">) => number;
|
|
43
40
|
createReplacementTransaction: ({ txid, newFeeRate, recipient, memo, }: import("..").RBFTransactionParams) => Promise<import("./utxo").ReplacementTransactionResult>;
|
|
44
41
|
deriveAddressAtIndex: ({ accountIndex, index, change }: import("..").DeriveAddressParams) => {
|
|
45
42
|
accountIndex: number;
|
|
@@ -118,6 +115,7 @@ export declare function createZcashToolbox(toolboxParams: {
|
|
|
118
115
|
change: boolean;
|
|
119
116
|
index: number;
|
|
120
117
|
} | undefined;
|
|
118
|
+
scriptType: import("@swapkit/helpers").UTXOScriptType;
|
|
121
119
|
signTransactionWithMultipleKeys: ({ tx, inputDerivations, }: {
|
|
122
120
|
tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
|
|
123
121
|
inputDerivations: import("..").InputDerivation[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenericCreateTransactionParams, GenericTransferParams, Witness } from "@swapkit/helpers";
|
|
1
|
+
import type { GenericCreateTransactionParams, GenericTransferParams, UTXOChain, Witness } from "@swapkit/helpers";
|
|
2
2
|
import type { UTXOScriptType } from "./helpers";
|
|
3
3
|
export type TransactionType = {
|
|
4
4
|
toHex(): string;
|
|
@@ -17,6 +17,7 @@ export type UTXOType = {
|
|
|
17
17
|
value: number;
|
|
18
18
|
txHex?: string;
|
|
19
19
|
witnessUtxo?: Witness;
|
|
20
|
+
publicKey?: Uint8Array;
|
|
20
21
|
};
|
|
21
22
|
export type UTXOInputWithScriptType = UTXOType & {
|
|
22
23
|
type: UTXOScriptType;
|
|
@@ -28,6 +29,7 @@ export type UTXOSizeInput = {
|
|
|
28
29
|
type?: UTXOScriptType;
|
|
29
30
|
};
|
|
30
31
|
export type UTXOCalculateTxSizeParams = {
|
|
32
|
+
chain: UTXOChain;
|
|
31
33
|
inputs: (UTXOInputWithScriptType | UTXOType | UTXOSizeInput)[];
|
|
32
34
|
outputs?: TargetOutput[];
|
|
33
35
|
feeRate?: number;
|
|
@@ -35,6 +37,7 @@ export type UTXOCalculateTxSizeParams = {
|
|
|
35
37
|
export type UTXOBuildTxParams = GenericCreateTransactionParams & {
|
|
36
38
|
fetchTxHex?: boolean;
|
|
37
39
|
enableRBF?: boolean;
|
|
40
|
+
publicKey?: Uint8Array;
|
|
38
41
|
};
|
|
39
42
|
export type UTXOTransferParams = GenericTransferParams;
|
|
40
43
|
export type HDWalletAccountParams = {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"dependencies": { "@swapkit/helpers": "
|
|
2
|
+
"dependencies": { "@swapkit/helpers": "6.0.1", "@swapkit/utxo-signer": "3.1.0" },
|
|
3
3
|
"description": "SwapKit - Toolboxes",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@aptos-labs/ts-sdk": "7.0.1",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
"type-check:go": "tsgo"
|
|
132
132
|
},
|
|
133
133
|
"type": "module",
|
|
134
|
-
"version": "
|
|
134
|
+
"version": "6.0.1"
|
|
135
135
|
}
|
package/dist/chunk-dssawneq.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as N,A as m,B as n,C as o,D as p,E as q,F as r,G as s,H as t,I as u,J as v,K as w,L as x,M as y,N as z,O as A,P as B,Q as C,R as D,S as E,T as F,U as G,V as H,W as I,X as J,Y as K,Z as L,_ as M,aa as O,ba as P,ca as Q,da as R,ea as S,o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-rn33j2bm.js";import"./chunk-as9fracn.js";import"./chunk-4428244x.js";export{u as ADIToolbox,v as ARBToolbox,w as ARCToolbox,x as AURORAToolbox,y as AVAXToolbox,z as BASEToolbox,A as BERAToolbox,B as BSCToolbox,b as BaseEVMToolbox,C as BotanixToolbox,D as COREToolbox,E as CORNToolbox,F as CROToolbox,k as ContractAddress,t as ETHToolbox,G as GNOToolbox,H as HOODToolbox,I as HYPEREVMToolbox,J as LINEAToolbox,K as MATICToolbox,a as MAX_APPROVAL,L as MEGAETHToolbox,M as MONADToolbox,s as OPToolbox,N as PLASMAToolbox,O as SONICToolbox,P as UNIToolbox,Q as XLayerToolbox,e as createContract,r as createOPStackToolbox,j as getChecksumAddressFromAsset,f as getCreateContract,m as getCreateContractTxObject,i as getEIP1193SendTransaction,q as getEVMTxType,n as getEstimateGasPrices,R as getEvmToolbox,S as getEvmToolboxAsync,l as getTokenAddress,d as isBrowserProvider,p as isEIP1559Transaction,o as isEIP7702Transaction,g as isStateChangingCall,h as toChecksumAddress,c as validateEVMAddress};
|