@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.
- package/dist/src/cosmos/index.cjs +2 -2
- package/dist/src/cosmos/index.cjs.map +10 -6
- package/dist/src/cosmos/index.js +2 -2
- package/dist/src/cosmos/index.js.map +10 -6
- package/dist/src/evm/index.cjs +2 -2
- package/dist/src/evm/index.cjs.map +10 -8
- package/dist/src/evm/index.js +2 -2
- package/dist/src/evm/index.js.map +10 -8
- package/dist/src/index.cjs +4 -2
- package/dist/src/index.cjs.map +54 -4
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +54 -4
- package/dist/src/near/index.cjs +2 -2
- package/dist/src/near/index.cjs.map +7 -5
- package/dist/src/near/index.js +2 -2
- package/dist/src/near/index.js.map +7 -5
- package/dist/src/radix/index.cjs +2 -2
- package/dist/src/radix/index.cjs.map +2 -2
- package/dist/src/radix/index.js +2 -2
- package/dist/src/radix/index.js.map +2 -2
- package/dist/src/ripple/index.cjs +2 -2
- package/dist/src/ripple/index.cjs.map +2 -2
- package/dist/src/ripple/index.js +2 -2
- package/dist/src/ripple/index.js.map +2 -2
- package/dist/src/solana/index.cjs +2 -2
- package/dist/src/solana/index.cjs.map +5 -4
- package/dist/src/solana/index.js +2 -2
- package/dist/src/solana/index.js.map +5 -4
- package/dist/src/substrate/index.cjs +2 -2
- package/dist/src/substrate/index.cjs.map +6 -5
- package/dist/src/substrate/index.js +2 -2
- package/dist/src/substrate/index.js.map +6 -5
- package/dist/src/tron/index.cjs +2 -2
- package/dist/src/tron/index.cjs.map +6 -5
- package/dist/src/tron/index.js +2 -2
- package/dist/src/tron/index.js.map +6 -5
- package/dist/src/utxo/index.cjs +4 -4
- package/dist/src/utxo/index.cjs.map +10 -7
- package/dist/src/utxo/index.js +4 -4
- package/dist/src/utxo/index.js.map +10 -7
- package/{src/cosmos/index.ts → dist/types/cosmos/index.d.ts} +1 -0
- package/dist/types/cosmos/index.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts +5 -0
- package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts.map +1 -0
- package/{src/cosmos/thorchainUtils/index.ts → dist/types/cosmos/thorchainUtils/index.d.ts} +1 -0
- package/dist/types/cosmos/thorchainUtils/index.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/messages.d.ts +208 -0
- package/dist/types/cosmos/thorchainUtils/messages.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/registry.d.ts +4 -0
- package/dist/types/cosmos/thorchainUtils/registry.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts +2 -0
- package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts +66 -0
- package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts.map +1 -0
- package/dist/types/cosmos/thorchainUtils/types/index.d.ts +2 -0
- package/dist/types/cosmos/thorchainUtils/types/index.d.ts.map +1 -0
- package/dist/types/cosmos/toolbox/cosmos.d.ts +93 -0
- package/dist/types/cosmos/toolbox/cosmos.d.ts.map +1 -0
- package/dist/types/cosmos/toolbox/index.d.ts +14 -0
- package/dist/types/cosmos/toolbox/index.d.ts.map +1 -0
- package/dist/types/cosmos/toolbox/thorchain.d.ts +158 -0
- package/dist/types/cosmos/toolbox/thorchain.d.ts.map +1 -0
- package/{src/cosmos/types.ts → dist/types/cosmos/types.d.ts} +24 -29
- package/dist/types/cosmos/types.d.ts.map +1 -0
- package/dist/types/cosmos/util.d.ts +68 -0
- package/dist/types/cosmos/util.d.ts.map +1 -0
- package/dist/types/evm/api.d.ts +8 -0
- package/dist/types/evm/api.d.ts.map +1 -0
- package/dist/types/evm/contracts/eth/multicall.d.ts +36 -0
- package/dist/types/evm/contracts/eth/multicall.d.ts.map +1 -0
- package/dist/types/evm/contracts/op/gasOracle.d.ts +40 -0
- package/dist/types/evm/contracts/op/gasOracle.d.ts.map +1 -0
- package/dist/types/evm/helpers.d.ts +20 -0
- package/dist/types/evm/helpers.d.ts.map +1 -0
- package/{src/evm/index.ts → dist/types/evm/index.d.ts} +1 -0
- package/dist/types/evm/index.d.ts.map +1 -0
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +82 -0
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts.map +1 -0
- package/dist/types/evm/toolbox/evm.d.ts +367 -0
- package/dist/types/evm/toolbox/evm.d.ts.map +1 -0
- package/dist/types/evm/toolbox/index.d.ts +89 -0
- package/dist/types/evm/toolbox/index.d.ts.map +1 -0
- package/dist/types/evm/toolbox/op.d.ts +62 -0
- package/dist/types/evm/toolbox/op.d.ts.map +1 -0
- package/dist/types/evm/types.d.ts +98 -0
- package/dist/types/evm/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/near/helpers/core.d.ts +15 -0
- package/dist/types/near/helpers/core.d.ts.map +1 -0
- package/dist/types/near/helpers/gasEstimation.d.ts +41 -0
- package/dist/types/near/helpers/gasEstimation.d.ts.map +1 -0
- package/dist/types/near/helpers/nep141.d.ts +72 -0
- package/dist/types/near/helpers/nep141.d.ts.map +1 -0
- package/dist/types/near/index.d.ts +10 -0
- package/dist/types/near/index.d.ts.map +1 -0
- package/dist/types/near/toolbox.d.ts +4 -0
- package/dist/types/near/toolbox.d.ts.map +1 -0
- package/dist/types/near/types/contract.d.ts +38 -0
- package/dist/types/near/types/contract.d.ts.map +1 -0
- package/dist/types/near/types/nep141.d.ts +56 -0
- package/dist/types/near/types/nep141.d.ts.map +1 -0
- package/dist/types/near/types/toolbox.d.ts +57 -0
- package/dist/types/near/types/toolbox.d.ts.map +1 -0
- package/dist/types/near/types.d.ts +44 -0
- package/dist/types/near/types.d.ts.map +1 -0
- package/dist/types/radix/index.d.ts +14 -0
- package/dist/types/radix/index.d.ts.map +1 -0
- package/dist/types/ripple/index.d.ts +43 -0
- package/dist/types/ripple/index.d.ts.map +1 -0
- package/dist/types/solana/index.d.ts +37 -0
- package/dist/types/solana/index.d.ts.map +1 -0
- package/dist/types/solana/toolbox.d.ts +41 -0
- package/dist/types/solana/toolbox.d.ts.map +1 -0
- package/dist/types/substrate/balance.d.ts +17 -0
- package/dist/types/substrate/balance.d.ts.map +1 -0
- package/{src/substrate/index.ts → dist/types/substrate/index.d.ts} +1 -0
- package/dist/types/substrate/index.d.ts.map +1 -0
- package/dist/types/substrate/substrate.d.ts +148 -0
- package/dist/types/substrate/substrate.d.ts.map +1 -0
- package/dist/types/substrate/types.d.ts +100 -0
- package/dist/types/substrate/types.d.ts.map +1 -0
- package/dist/types/tron/helpers/trc20.abi.d.ts +156 -0
- package/dist/types/tron/helpers/trc20.abi.d.ts.map +1 -0
- package/dist/types/tron/helpers/trongrid.d.ts +8 -0
- package/dist/types/tron/helpers/trongrid.d.ts.map +1 -0
- package/dist/types/tron/index.d.ts +6 -0
- package/dist/types/tron/index.d.ts.map +1 -0
- package/dist/types/tron/toolbox.d.ts +26 -0
- package/dist/types/tron/toolbox.d.ts.map +1 -0
- package/dist/types/tron/types.d.ts +101 -0
- package/dist/types/tron/types.d.ts.map +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils.d.ts +4 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utxo/helpers/api.d.ts +133 -0
- package/dist/types/utxo/helpers/api.d.ts.map +1 -0
- package/dist/types/utxo/helpers/bchaddrjs.d.ts +10 -0
- package/dist/types/utxo/helpers/bchaddrjs.d.ts.map +1 -0
- package/dist/types/utxo/helpers/coinselect.d.ts +16 -0
- package/dist/types/utxo/helpers/coinselect.d.ts.map +1 -0
- package/{src/utxo/helpers/index.ts → dist/types/utxo/helpers/index.d.ts} +1 -0
- package/dist/types/utxo/helpers/index.d.ts.map +1 -0
- package/dist/types/utxo/helpers/txSize.d.ts +21 -0
- package/dist/types/utxo/helpers/txSize.d.ts.map +1 -0
- package/{src/utxo/index.ts → dist/types/utxo/index.d.ts} +1 -0
- package/dist/types/utxo/index.d.ts.map +1 -0
- package/dist/types/utxo/toolbox/bitcoinCash.d.ts +104 -0
- package/dist/types/utxo/toolbox/bitcoinCash.d.ts.map +1 -0
- package/dist/types/utxo/toolbox/index.d.ts +50 -0
- package/dist/types/utxo/toolbox/index.d.ts.map +1 -0
- package/dist/types/utxo/toolbox/utxo.d.ts +102 -0
- package/dist/types/utxo/toolbox/utxo.d.ts.map +1 -0
- package/dist/types/utxo/toolbox/zcash.d.ts +83 -0
- package/dist/types/utxo/toolbox/zcash.d.ts.map +1 -0
- package/dist/types/utxo/types.d.ts +46 -0
- package/dist/types/utxo/types.d.ts.map +1 -0
- package/package.json +15 -18
- package/dist/chunk-0h4xdrwz.js +0 -5
- package/dist/chunk-0h4xdrwz.js.map +0 -10
- package/dist/chunk-4yap1fvd.js +0 -4
- package/dist/chunk-4yap1fvd.js.map +0 -10
- package/dist/chunk-9bqegm61.js +0 -4
- package/dist/chunk-9bqegm61.js.map +0 -10
- package/dist/chunk-fazw0jvt.js +0 -4
- package/dist/chunk-fazw0jvt.js.map +0 -9
- package/dist/chunk-fjfxga2v.js +0 -4
- package/dist/chunk-fjfxga2v.js.map +0 -10
- package/dist/chunk-s47y8512.js +0 -5
- package/dist/chunk-s47y8512.js.map +0 -9
- package/dist/chunk-vtd17cje.js +0 -4
- package/dist/chunk-vtd17cje.js.map +0 -10
- package/dist/chunk-zcdeg6h9.js +0 -5
- package/dist/chunk-zcdeg6h9.js.map +0 -10
- package/src/cosmos/thorchainUtils/addressFormat.ts +0 -26
- package/src/cosmos/thorchainUtils/messages.ts +0 -262
- package/src/cosmos/thorchainUtils/registry.ts +0 -44
- package/src/cosmos/thorchainUtils/types/MsgCompiled.ts +0 -2800
- package/src/cosmos/thorchainUtils/types/client-types.ts +0 -73
- package/src/cosmos/thorchainUtils/types/index.ts +0 -1
- package/src/cosmos/toolbox/cosmos.ts +0 -375
- package/src/cosmos/toolbox/index.ts +0 -33
- package/src/cosmos/toolbox/thorchain.ts +0 -313
- package/src/cosmos/util.ts +0 -266
- package/src/evm/__tests__/address-validation.test.ts +0 -86
- package/src/evm/__tests__/ethereum.test.ts +0 -141
- package/src/evm/api.ts +0 -21
- package/src/evm/contracts/eth/multicall.ts +0 -165
- package/src/evm/contracts/op/gasOracle.ts +0 -151
- package/src/evm/helpers.ts +0 -194
- package/src/evm/toolbox/baseEVMToolbox.ts +0 -762
- package/src/evm/toolbox/evm.ts +0 -66
- package/src/evm/toolbox/index.ts +0 -52
- package/src/evm/toolbox/op.ts +0 -131
- package/src/evm/types.ts +0 -146
- package/src/index.ts +0 -263
- package/src/near/__tests__/core.test.ts +0 -80
- package/src/near/helpers/contractFactory.ts +0 -22
- package/src/near/helpers/core.ts +0 -91
- package/src/near/helpers/gasEstimation.ts +0 -110
- package/src/near/helpers/index.ts +0 -5
- package/src/near/helpers/nep141.ts +0 -110
- package/src/near/index.ts +0 -24
- package/src/near/toolbox.ts +0 -509
- package/src/near/types/contract.ts +0 -48
- package/src/near/types/nep141.ts +0 -66
- package/src/near/types.ts +0 -57
- package/src/radix/index.ts +0 -156
- package/src/ripple/index.ts +0 -192
- package/src/solana/index.ts +0 -55
- package/src/solana/toolbox.ts +0 -433
- package/src/substrate/balance.ts +0 -92
- package/src/substrate/substrate.ts +0 -320
- package/src/substrate/types.ts +0 -120
- package/src/tron/__tests__/toolbox.test.ts +0 -147
- package/src/tron/helpers/trc20.abi.ts +0 -107
- package/src/tron/helpers/trongrid.ts +0 -54
- package/src/tron/index.ts +0 -17
- package/src/tron/toolbox.ts +0 -650
- package/src/tron/types.ts +0 -120
- package/src/utils.ts +0 -27
- package/src/utxo/__tests__/zcash-integration.test.ts +0 -114
- package/src/utxo/helpers/api.ts +0 -560
- package/src/utxo/helpers/bchaddrjs.ts +0 -183
- package/src/utxo/helpers/coinselect.ts +0 -98
- package/src/utxo/helpers/txSize.ts +0 -104
- package/src/utxo/toolbox/bitcoinCash.ts +0 -320
- package/src/utxo/toolbox/index.ts +0 -90
- package/src/utxo/toolbox/utxo.ts +0 -525
- package/src/utxo/toolbox/zcash.ts +0 -208
- package/src/utxo/types.ts +0 -57
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AssetValue } from "@swapkit/helpers";
|
|
2
|
+
import type { TronWeb } from "tronweb";
|
|
3
|
+
import type { ApproveParams, ApprovedParams, IsApprovedParams, TronCreateTransactionParams, TronToolboxOptions, TronTransferParams } from "./types";
|
|
4
|
+
export declare function getTronAddressValidator(): Promise<(address: string) => boolean>;
|
|
5
|
+
export declare function getTronPrivateKeyFromMnemonic({ phrase, derivationPath: customPath, index, }: {
|
|
6
|
+
phrase: string;
|
|
7
|
+
derivationPath?: string;
|
|
8
|
+
index?: number;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
export declare const createTronToolbox: (options?: TronToolboxOptions) => Promise<{
|
|
11
|
+
tronWeb: TronWeb;
|
|
12
|
+
getAddress: () => Promise<string>;
|
|
13
|
+
validateAddress: (address: string) => boolean;
|
|
14
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
15
|
+
transfer: (params: TronTransferParams) => Promise<string>;
|
|
16
|
+
estimateTransactionFee: (params: TronTransferParams & {
|
|
17
|
+
sender?: string;
|
|
18
|
+
}) => Promise<AssetValue>;
|
|
19
|
+
createTransaction: (params: TronCreateTransactionParams) => Promise<any>;
|
|
20
|
+
signTransaction: (transaction: any) => Promise<any>;
|
|
21
|
+
broadcastTransaction: (signedTransaction: any) => Promise<string>;
|
|
22
|
+
approve: (params: ApproveParams) => Promise<string>;
|
|
23
|
+
isApproved: (params: IsApprovedParams) => Promise<boolean>;
|
|
24
|
+
getApprovedAmount: (params: ApprovedParams) => Promise<bigint>;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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B,EAAE,CAAC,iBAAiB,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,iBAAiB,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAChE,CA6hBA,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { DerivationPathArray, FeeOption, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
|
|
2
|
+
import type { Contract, Types } from "tronweb";
|
|
3
|
+
export type TronTransaction = Types.Transaction;
|
|
4
|
+
export type TronContract = Contract;
|
|
5
|
+
export type TronSignedTransaction = Types.SignedTransaction;
|
|
6
|
+
export interface TronSigner {
|
|
7
|
+
getAddress(): Promise<string>;
|
|
8
|
+
signTransaction(transaction: TronTransaction): Promise<TronSignedTransaction>;
|
|
9
|
+
}
|
|
10
|
+
export type TronToolboxOptions = {
|
|
11
|
+
signer?: TronSigner;
|
|
12
|
+
} | {
|
|
13
|
+
phrase?: string;
|
|
14
|
+
derivationPath?: DerivationPathArray;
|
|
15
|
+
index?: number;
|
|
16
|
+
} | {};
|
|
17
|
+
export interface TronTransferParams extends GenericTransferParams {
|
|
18
|
+
}
|
|
19
|
+
export interface TronCreateTransactionParams extends Omit<GenericCreateTransactionParams, "feeRate"> {
|
|
20
|
+
}
|
|
21
|
+
export type ApproveParams = {
|
|
22
|
+
assetAddress: string;
|
|
23
|
+
spenderAddress: string;
|
|
24
|
+
feeOptionKey?: FeeOption;
|
|
25
|
+
amount?: bigint | string | number;
|
|
26
|
+
from?: string;
|
|
27
|
+
gasLimitFallback?: bigint | string | number;
|
|
28
|
+
nonce?: number;
|
|
29
|
+
};
|
|
30
|
+
export type ApprovedParams = {
|
|
31
|
+
assetAddress: string;
|
|
32
|
+
spenderAddress: string;
|
|
33
|
+
from: string;
|
|
34
|
+
};
|
|
35
|
+
export type IsApprovedParams = ApprovedParams & {
|
|
36
|
+
amount?: bigint | string | number;
|
|
37
|
+
};
|
|
38
|
+
export type TronGridTRC20Balance = Array<{
|
|
39
|
+
[contractAddress: string]: string;
|
|
40
|
+
}>;
|
|
41
|
+
export interface TronGridAccountResponse {
|
|
42
|
+
data: Array<{
|
|
43
|
+
address: string;
|
|
44
|
+
balance: number;
|
|
45
|
+
create_time: number;
|
|
46
|
+
latest_opration_time: number;
|
|
47
|
+
free_net_usage: number;
|
|
48
|
+
net_window_size: number;
|
|
49
|
+
net_window_optimized: boolean;
|
|
50
|
+
trc20: TronGridTRC20Balance;
|
|
51
|
+
assetV2?: Array<{
|
|
52
|
+
key: string;
|
|
53
|
+
value: number;
|
|
54
|
+
}>;
|
|
55
|
+
frozenV2?: Array<{
|
|
56
|
+
type?: string;
|
|
57
|
+
}>;
|
|
58
|
+
free_asset_net_usageV2?: Array<{
|
|
59
|
+
key: string;
|
|
60
|
+
value: number;
|
|
61
|
+
}>;
|
|
62
|
+
latest_consume_free_time?: number;
|
|
63
|
+
owner_permission?: {
|
|
64
|
+
keys: Array<{
|
|
65
|
+
address: string;
|
|
66
|
+
weight: number;
|
|
67
|
+
}>;
|
|
68
|
+
threshold: number;
|
|
69
|
+
permission_name: string;
|
|
70
|
+
};
|
|
71
|
+
active_permission?: Array<{
|
|
72
|
+
operations: string;
|
|
73
|
+
keys: Array<{
|
|
74
|
+
address: string;
|
|
75
|
+
weight: number;
|
|
76
|
+
}>;
|
|
77
|
+
threshold: number;
|
|
78
|
+
id: number;
|
|
79
|
+
type: string;
|
|
80
|
+
permission_name: string;
|
|
81
|
+
}>;
|
|
82
|
+
account_resource?: {
|
|
83
|
+
energy_window_optimized: boolean;
|
|
84
|
+
energy_window_size: number;
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
87
|
+
success: boolean;
|
|
88
|
+
meta: {
|
|
89
|
+
at: number;
|
|
90
|
+
page_size: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface TronGridTokenInfo {
|
|
94
|
+
symbol: string;
|
|
95
|
+
address: string;
|
|
96
|
+
decimals: number;
|
|
97
|
+
name: string;
|
|
98
|
+
totalSupply: string;
|
|
99
|
+
owner: string;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tron/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,8BAA8B,EAC9B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAG/C,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AACpC,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,iBAAiB,CAAC;AAG5D,MAAM,WAAW,UAAU;IACzB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,eAAe,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC/E;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,GACvB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE,EAAE,CAAC;AAEP,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;CAEhE;AAED,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,8BAA8B,EAAE,SAAS,CAAC;CAExD;AAGD,MAAM,MAAM,aAAa,G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,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,gBAAgB,CAAC,EAAE;YACjB,IAAI,EAAE,KAAK,CAAC;gBACV,OAAO,EAAE,MAAM,CAAC;gBAChB,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC,CAAC;YACH,SAAS,EAAE,MAAM,CAAC;YAClB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;QACF,iBAAiB,CAAC,EAAE,KAAK,CAAC;YACxB,UAAU,EAAE,MAAM,CAAC;YACnB,IAAI,EAAE,KAAK,CAAC;gBACV,OAAO,EAAE,MAAM,CAAC;gBAChB,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC,CAAC;YACH,SAAS,EAAE,MAAM,CAAC;YAClB,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC,CAAC;QACH,gBAAgB,CAAC,EAAE;YACjB,uBAAuB,EAAE,OAAO,CAAC;YACjC,kBAAkB,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type BaseWallet, Chain } from "@swapkit/helpers";
|
|
2
|
+
import type { CosmosWallets, ThorchainWallets } from "./cosmos";
|
|
3
|
+
import type { EVMToolboxes } from "./evm";
|
|
4
|
+
import type { NearWallet } from "./near";
|
|
5
|
+
import type { RadixWallet } from "./radix";
|
|
6
|
+
import type { RippleWallet } from "./ripple";
|
|
7
|
+
import type { SolanaWallet } from "./solana";
|
|
8
|
+
import type { SubstrateToolboxes } from "./substrate";
|
|
9
|
+
import type { TronWallet } from "./tron";
|
|
10
|
+
import type { UTXOToolboxes } from "./utxo";
|
|
11
|
+
export type FullWallet = BaseWallet<EVMToolboxes & UTXOToolboxes & CosmosWallets & ThorchainWallets & SubstrateToolboxes & {
|
|
12
|
+
[Chain.Radix]: RadixWallet;
|
|
13
|
+
[Chain.Ripple]: RippleWallet;
|
|
14
|
+
[Chain.Solana]: SolanaWallet;
|
|
15
|
+
[Chain.Tron]: TronWallet;
|
|
16
|
+
[Chain.Near]: NearWallet;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,MAAM,UAAU,GAAG,UAAU,CACjC,YAAY,GACV,aAAa,GACb,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAAG;IACnB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC3B,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC7B,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC7B,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IACzB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;CAC1B,CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAMvE,wBAAgB,MAAM,WAUrB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,IACjB,SAAS,MAAM,EAAE,oBAAiB,2BAOpE"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Chain, type UTXOChain } from "@swapkit/helpers";
|
|
2
|
+
declare function utxoApi(chain: UTXOChain): {
|
|
3
|
+
broadcastTx: (txHash: string) => Promise<string>;
|
|
4
|
+
getRawTx: (txHash: string) => Promise<string>;
|
|
5
|
+
getSuggestedTxFee: () => Promise<number>;
|
|
6
|
+
getBalance: (address: string) => Promise<number>;
|
|
7
|
+
getAddressData: (address: string) => Promise<{
|
|
8
|
+
address: BlockchairAddressCoreData;
|
|
9
|
+
transactions: BlockchairTransaction[];
|
|
10
|
+
utxo: BlockchairUtxo[];
|
|
11
|
+
} | {
|
|
12
|
+
utxo: never[];
|
|
13
|
+
address: {
|
|
14
|
+
balance: number;
|
|
15
|
+
transaction_count: number;
|
|
16
|
+
};
|
|
17
|
+
} | undefined>;
|
|
18
|
+
getUtxos: (params: {
|
|
19
|
+
address: string;
|
|
20
|
+
fetchTxHex?: boolean;
|
|
21
|
+
targetValue?: number;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
address: string;
|
|
24
|
+
hash: string;
|
|
25
|
+
index: number;
|
|
26
|
+
txHex: string | undefined;
|
|
27
|
+
value: number;
|
|
28
|
+
witnessUtxo: {
|
|
29
|
+
value: number;
|
|
30
|
+
script: Buffer<ArrayBuffer>;
|
|
31
|
+
};
|
|
32
|
+
}[]>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* "Factory" to ensure typing for custom UTXO APIs
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCustomUtxoApi(methods: ReturnType<typeof utxoApi>): {
|
|
38
|
+
broadcastTx: (txHash: string) => Promise<string>;
|
|
39
|
+
getRawTx: (txHash: string) => Promise<string>;
|
|
40
|
+
getSuggestedTxFee: () => Promise<number>;
|
|
41
|
+
getBalance: (address: string) => Promise<number>;
|
|
42
|
+
getAddressData: (address: string) => Promise<{
|
|
43
|
+
address: BlockchairAddressCoreData;
|
|
44
|
+
transactions: BlockchairTransaction[];
|
|
45
|
+
utxo: BlockchairUtxo[];
|
|
46
|
+
} | {
|
|
47
|
+
utxo: never[];
|
|
48
|
+
address: {
|
|
49
|
+
balance: number;
|
|
50
|
+
transaction_count: number;
|
|
51
|
+
};
|
|
52
|
+
} | undefined>;
|
|
53
|
+
getUtxos: (params: {
|
|
54
|
+
address: string;
|
|
55
|
+
fetchTxHex?: boolean;
|
|
56
|
+
targetValue?: number;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
address: string;
|
|
59
|
+
hash: string;
|
|
60
|
+
index: number;
|
|
61
|
+
txHex: string | undefined;
|
|
62
|
+
value: number;
|
|
63
|
+
witnessUtxo: {
|
|
64
|
+
value: number;
|
|
65
|
+
script: Buffer<ArrayBuffer>;
|
|
66
|
+
};
|
|
67
|
+
}[]>;
|
|
68
|
+
};
|
|
69
|
+
export declare function getUtxoApi(chain: UTXOChain): {
|
|
70
|
+
broadcastTx: (txHash: string) => Promise<string>;
|
|
71
|
+
getRawTx: (txHash: string) => Promise<string>;
|
|
72
|
+
getSuggestedTxFee: () => Promise<number>;
|
|
73
|
+
getBalance: (address: string) => Promise<number>;
|
|
74
|
+
getAddressData: (address: string) => Promise<{
|
|
75
|
+
address: BlockchairAddressCoreData;
|
|
76
|
+
transactions: BlockchairTransaction[];
|
|
77
|
+
utxo: BlockchairUtxo[];
|
|
78
|
+
} | {
|
|
79
|
+
utxo: never[];
|
|
80
|
+
address: {
|
|
81
|
+
balance: number;
|
|
82
|
+
transaction_count: number;
|
|
83
|
+
};
|
|
84
|
+
} | undefined>;
|
|
85
|
+
getUtxos: (params: {
|
|
86
|
+
address: string;
|
|
87
|
+
fetchTxHex?: boolean;
|
|
88
|
+
targetValue?: number;
|
|
89
|
+
}) => Promise<{
|
|
90
|
+
address: string;
|
|
91
|
+
hash: string;
|
|
92
|
+
index: number;
|
|
93
|
+
txHex: string | undefined;
|
|
94
|
+
value: number;
|
|
95
|
+
witnessUtxo: {
|
|
96
|
+
value: number;
|
|
97
|
+
script: Buffer<ArrayBuffer>;
|
|
98
|
+
};
|
|
99
|
+
}[]>;
|
|
100
|
+
};
|
|
101
|
+
export declare function getUtxoNetwork(): (chain: Chain) => any;
|
|
102
|
+
interface BlockchairTransaction {
|
|
103
|
+
block_id: number;
|
|
104
|
+
hash: string;
|
|
105
|
+
time: string;
|
|
106
|
+
balance_change: number;
|
|
107
|
+
}
|
|
108
|
+
interface BlockchairUtxo {
|
|
109
|
+
block_id: number;
|
|
110
|
+
transaction_hash: string;
|
|
111
|
+
index: number;
|
|
112
|
+
value: number;
|
|
113
|
+
}
|
|
114
|
+
interface BlockchairAddressCoreData {
|
|
115
|
+
type: string;
|
|
116
|
+
script_hex: string;
|
|
117
|
+
balance: number;
|
|
118
|
+
balance_usd: number;
|
|
119
|
+
received: number;
|
|
120
|
+
received_usd: number;
|
|
121
|
+
spent: number;
|
|
122
|
+
spent_usd: number;
|
|
123
|
+
output_count: number;
|
|
124
|
+
unspent_output_count: number;
|
|
125
|
+
first_seen_receiving: string;
|
|
126
|
+
last_seen_receiving: string;
|
|
127
|
+
first_seen_spending: null | string;
|
|
128
|
+
last_seen_spending: null | string;
|
|
129
|
+
transaction_count: number;
|
|
130
|
+
scripthash_type: null | string;
|
|
131
|
+
}
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/utxo/helpers/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAIL,KAAK,SAAS,EAEf,MAAM,kBAAkB,CAAC;AA0T1B,iBAAS,OAAO,CAAC,KAAK,EAAE,SAAS;0BAMP,MAAM;uBACT,MAAM;;0BAEH,MAAM;8BACF,MAAM;iBA6KvB,yBAAyB;sBACpB,qBAAqB,EAAE;cAC/B,cAAc,EAAE;;;;;;;;uBA9KH;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;;;;;;;;;;;EAEJ;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC;0BAhB7C,MAAM;uBACT,MAAM;;0BAEH,MAAM;8BACF,MAAM;iBA6KvB,yBAAyB;sBACpB,qBAAqB,EAAE;cAC/B,cAAc,EAAE;;;;;;;;uBA9KH;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;;;;;;;;;;;EASJ;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS;0BApBjB,MAAM;uBACT,MAAM;;0BAEH,MAAM;8BACF,MAAM;iBA6KvB,yBAAyB;sBACpB,qBAAqB,EA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
6
|
+
declare function detectAddressNetwork(address: string): UtxoNetwork;
|
|
7
|
+
declare function toLegacyAddress(address: string): string;
|
|
8
|
+
declare function toCashAddress(address: string): string;
|
|
9
|
+
export { detectAddressNetwork, isValidAddress, UtxoNetwork, toCashAddress, toLegacyAddress };
|
|
10
|
+
//# sourceMappingURL=bchaddrjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bchaddrjs.d.ts","sourceRoot":"","sources":["../../../../src/utxo/helpers/bchaddrjs.ts"],"names":[],"mappings":"AAUA,aAAK,WAAW;IACd,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAoCD,iBAAS,cAAc,CAAC,KAAK,EAAE,GAAG,WAOjC;AAED,iBAAS,oBAAoB,CAAC,OAAO,EAAE,MAAM,eAE5C;AAED,iBAAS,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED,iBAAS,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG9C;AA6GD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type UTXOChain } from "@swapkit/helpers";
|
|
2
|
+
import type { TargetOutput, UTXOCalculateTxSizeParams, UTXOType } from "../types";
|
|
3
|
+
export declare const getDustThreshold: (chain: UTXOChain) => 100000 | 550 | 5500 | 546;
|
|
4
|
+
export declare const accumulative: ({ inputs, outputs, feeRate: initialFeeRate, chain, }: UTXOCalculateTxSizeParams & {
|
|
5
|
+
outputs: TargetOutput[];
|
|
6
|
+
chain: UTXOChain;
|
|
7
|
+
}) => {
|
|
8
|
+
inputs: (UTXOType | import("..").UTXOInputWithScriptType)[];
|
|
9
|
+
outputs: TargetOutput[];
|
|
10
|
+
fee: number;
|
|
11
|
+
} | {
|
|
12
|
+
fee: number;
|
|
13
|
+
inputs?: undefined;
|
|
14
|
+
outputs?: undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=coinselect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coinselect.d.ts","sourceRoot":"","sources":["../../../../src/utxo/helpers/coinselect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAUvE,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAElF,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,8BAehD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,sDAK1B,yBAAyB,GAAG;IAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE;;;;;;;;CA+D3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utxo/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TargetOutput, UTXOCalculateTxSizeParams, UTXOInputWithScriptType, UTXOType } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum transaction fee
|
|
4
|
+
* 1000 satoshi/kB (similar to current `minrelaytxfee`)
|
|
5
|
+
* @see https://github.com/bitcoin/bitcoin/blob/db88db47278d2e7208c50d16ab10cb355067d071/src/validation.h#L56
|
|
6
|
+
*/
|
|
7
|
+
export declare const MIN_TX_FEE = 1000;
|
|
8
|
+
export declare const TX_OVERHEAD: number;
|
|
9
|
+
export declare const OP_RETURN_OVERHEAD: number;
|
|
10
|
+
export declare function compileMemo(memo: string): Buffer<ArrayBufferLike>;
|
|
11
|
+
export declare enum UTXOScriptType {
|
|
12
|
+
P2PKH = "P2PKH",// legacy
|
|
13
|
+
P2WPKH = "P2WPKH"
|
|
14
|
+
}
|
|
15
|
+
export declare const InputSizes: Record<UTXOScriptType, number>;
|
|
16
|
+
export declare const OutputSizes: Record<UTXOScriptType, number>;
|
|
17
|
+
export declare const getScriptTypeForAddress: (address: string) => UTXOScriptType;
|
|
18
|
+
export declare const calculateTxSize: ({ inputs, outputs, feeRate }: UTXOCalculateTxSizeParams) => number;
|
|
19
|
+
export declare const getInputSize: (input: UTXOInputWithScriptType | UTXOType) => number;
|
|
20
|
+
export declare const getOutputSize: (output: TargetOutput, scriptType?: UTXOScriptType) => number;
|
|
21
|
+
//# sourceMappingURL=txSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txSize.d.ts","sourceRoot":"","sources":["../../../../src/utxo/helpers/txSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,WAAW,QAAgB,CAAC;AACzC,eAAO,MAAM,kBAAkB,QAAY,CAAC;AAI5C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,2BAGvC;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU,CAAE,SAAS;IAE1B,MAAM,WAAW;CAElB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAIrD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAItD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,mBAoBtD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,8BAA8B,yBAAyB,WAiBtF,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,uBAAuB,GAAG,QAAQ,WAQrE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,YAAY,EAAE,aAAa,cAAc,WAQ9E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utxo/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Chain, type DerivationPathArray, FeeOption } from "@swapkit/helpers";
|
|
2
|
+
import { Psbt } from "bitcoinjs-lib";
|
|
3
|
+
import type { BchECPair, TargetOutput, TransactionBuilderType, UTXOBuildTxParams, UTXOTransferParams, UTXOType } from "../types";
|
|
4
|
+
import type { UtxoToolboxParams } from "./index";
|
|
5
|
+
export declare function stripPrefix(address: string): string;
|
|
6
|
+
export declare function bchValidateAddress(address: string): boolean;
|
|
7
|
+
export declare function stripToCashAddress(address: string): string;
|
|
8
|
+
export declare function createBCHToolbox<T extends Chain.BitcoinCash>(toolboxParams: UtxoToolboxParams[T] | {
|
|
9
|
+
phrase?: string;
|
|
10
|
+
derivationPath?: DerivationPathArray;
|
|
11
|
+
index?: number;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
getAddress: () => Promise<string | undefined>;
|
|
14
|
+
broadcastTx: (txHash: string) => Promise<string>;
|
|
15
|
+
createTransaction: typeof createTransaction;
|
|
16
|
+
buildTx: typeof buildTx;
|
|
17
|
+
getAddressFromKeys: typeof getAddressFromKeys;
|
|
18
|
+
getBalance: (address: string, _scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
|
|
19
|
+
getFeeRates: () => Promise<{
|
|
20
|
+
average: number;
|
|
21
|
+
fast: number;
|
|
22
|
+
fastest: number;
|
|
23
|
+
}>;
|
|
24
|
+
stripPrefix: typeof stripPrefix;
|
|
25
|
+
stripToCashAddress: typeof stripToCashAddress;
|
|
26
|
+
validateAddress: typeof bchValidateAddress;
|
|
27
|
+
transfer: ({ recipient, assetValue, feeOptionKey, ...rest }: UTXOTransferParams) => Promise<string>;
|
|
28
|
+
accumulative: ({ inputs, outputs, feeRate: initialFeeRate, chain, }: import("..").UTXOCalculateTxSizeParams & {
|
|
29
|
+
outputs: TargetOutput[];
|
|
30
|
+
chain: import("@swapkit/helpers").UTXOChain;
|
|
31
|
+
}) => {
|
|
32
|
+
inputs: (UTXOType | import("..").UTXOInputWithScriptType)[];
|
|
33
|
+
outputs: TargetOutput[];
|
|
34
|
+
fee: number;
|
|
35
|
+
} | {
|
|
36
|
+
fee: number;
|
|
37
|
+
inputs?: undefined;
|
|
38
|
+
outputs?: undefined;
|
|
39
|
+
};
|
|
40
|
+
calculateTxSize: ({ inputs, outputs, feeRate }: import("..").UTXOCalculateTxSizeParams) => number;
|
|
41
|
+
createKeysForPath: (params: {
|
|
42
|
+
wif?: string;
|
|
43
|
+
phrase?: string;
|
|
44
|
+
derivationPath?: string;
|
|
45
|
+
}) => BchECPair;
|
|
46
|
+
getInputsOutputsFee: ({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, }: Omit<UTXOBuildTxParams, "feeRate"> & {
|
|
47
|
+
feeOptionKey?: FeeOption;
|
|
48
|
+
feeRate?: number;
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
inputs: (UTXOType | import("..").UTXOInputWithScriptType)[];
|
|
51
|
+
outputs: TargetOutput[];
|
|
52
|
+
fee: number;
|
|
53
|
+
} | {
|
|
54
|
+
fee: number;
|
|
55
|
+
inputs?: undefined;
|
|
56
|
+
outputs?: undefined;
|
|
57
|
+
}>;
|
|
58
|
+
getPrivateKeyFromMnemonic: (params: {
|
|
59
|
+
phrase: string;
|
|
60
|
+
derivationPath: string;
|
|
61
|
+
}) => string;
|
|
62
|
+
estimateTransactionFee: (params: {
|
|
63
|
+
assetValue: import("@swapkit/helpers").AssetValue;
|
|
64
|
+
recipient: string;
|
|
65
|
+
sender: string;
|
|
66
|
+
memo?: string;
|
|
67
|
+
feeOptionKey?: FeeOption;
|
|
68
|
+
feeRate?: number;
|
|
69
|
+
fetchTxHex?: boolean;
|
|
70
|
+
}) => Promise<import("@swapkit/helpers").AssetValue>;
|
|
71
|
+
estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipients, }: {
|
|
72
|
+
from: string;
|
|
73
|
+
memo?: string;
|
|
74
|
+
feeRate?: number;
|
|
75
|
+
feeOptionKey?: FeeOption;
|
|
76
|
+
recipients?: number | TargetOutput[];
|
|
77
|
+
}) => Promise<import("@swapkit/helpers").AssetValue>;
|
|
78
|
+
}>;
|
|
79
|
+
declare function createTransaction({ assetValue, recipient, memo, feeRate, sender, }: UTXOBuildTxParams): Promise<{
|
|
80
|
+
builder: TransactionBuilderType;
|
|
81
|
+
utxos: (UTXOType | import("..").UTXOInputWithScriptType)[];
|
|
82
|
+
}>;
|
|
83
|
+
declare function buildTx({ assetValue, recipient, memo, feeRate, sender, setSigHashType, }: UTXOBuildTxParams & {
|
|
84
|
+
setSigHashType?: boolean;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
psbt: Psbt;
|
|
87
|
+
utxos: {
|
|
88
|
+
address: string;
|
|
89
|
+
hash: string;
|
|
90
|
+
index: number;
|
|
91
|
+
txHex: string | undefined;
|
|
92
|
+
value: number;
|
|
93
|
+
witnessUtxo: {
|
|
94
|
+
value: number;
|
|
95
|
+
script: Buffer<ArrayBuffer>;
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
inputs: UTXOType[];
|
|
99
|
+
}>;
|
|
100
|
+
declare function getAddressFromKeys(keys: {
|
|
101
|
+
getAddress: (index?: number) => string;
|
|
102
|
+
}): string;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=bitcoinCash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoinCash.d.ts","sourceRoot":"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Ac,GACf,EAAE,iBAAiB,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;YAmET,QAAQ,EAAE;GACnD;AAED,iBAAS,kBAAkB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,UAG3E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Chain, type ChainSigner, type DerivationPathArray, type UTXOChain } from "@swapkit/helpers";
|
|
2
|
+
import type { Psbt } from "bitcoinjs-lib";
|
|
3
|
+
import type { TransactionBuilderType, TransactionType, UTXOType } from "../types";
|
|
4
|
+
import { createBCHToolbox } from "./bitcoinCash";
|
|
5
|
+
import { createUTXOToolbox } from "./utxo";
|
|
6
|
+
import { createZcashToolbox } from "./zcash";
|
|
7
|
+
type BCHToolbox = Awaited<ReturnType<typeof createBCHToolbox>>;
|
|
8
|
+
type CommonUTXOToolbox = Awaited<ReturnType<typeof createUTXOToolbox<Exclude<UTXOChain, Chain.BitcoinCash | Chain.Zcash>>>>;
|
|
9
|
+
type ZcashToolbox = Awaited<ReturnType<typeof createZcashToolbox>>;
|
|
10
|
+
export type UTXOToolboxes = {
|
|
11
|
+
[Chain.BitcoinCash]: BCHToolbox;
|
|
12
|
+
[Chain.Bitcoin]: CommonUTXOToolbox;
|
|
13
|
+
[Chain.Dogecoin]: CommonUTXOToolbox;
|
|
14
|
+
[Chain.Litecoin]: CommonUTXOToolbox;
|
|
15
|
+
[Chain.Dash]: CommonUTXOToolbox;
|
|
16
|
+
[Chain.Zcash]: ZcashToolbox;
|
|
17
|
+
};
|
|
18
|
+
export type UTXOWallets = {
|
|
19
|
+
[key in keyof UTXOToolboxes]: UTXOToolboxes[key];
|
|
20
|
+
};
|
|
21
|
+
export type UtxoToolboxParams = {
|
|
22
|
+
[Chain.BitcoinCash]: {
|
|
23
|
+
signer: ChainSigner<{
|
|
24
|
+
builder: TransactionBuilderType;
|
|
25
|
+
utxos: UTXOType[];
|
|
26
|
+
}, TransactionType>;
|
|
27
|
+
};
|
|
28
|
+
[Chain.Bitcoin]: {
|
|
29
|
+
signer: ChainSigner<Psbt, Psbt>;
|
|
30
|
+
};
|
|
31
|
+
[Chain.Dogecoin]: {
|
|
32
|
+
signer: ChainSigner<Psbt, Psbt>;
|
|
33
|
+
};
|
|
34
|
+
[Chain.Litecoin]: {
|
|
35
|
+
signer: ChainSigner<Psbt, Psbt>;
|
|
36
|
+
};
|
|
37
|
+
[Chain.Dash]: {
|
|
38
|
+
signer: ChainSigner<Psbt, Psbt>;
|
|
39
|
+
};
|
|
40
|
+
[Chain.Zcash]: {
|
|
41
|
+
signer?: ChainSigner<Psbt, Psbt>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare function getUtxoToolbox<T extends keyof UTXOToolboxes>(chain: T, params?: UtxoToolboxParams[T] | {
|
|
45
|
+
phrase?: string;
|
|
46
|
+
derivationPath?: DerivationPathArray;
|
|
47
|
+
index?: number;
|
|
48
|
+
}): Promise<UTXOToolboxes[T]>;
|
|
49
|
+
export { stripToCashAddress, stripPrefix, bchValidateAddress, } from "./bitcoinCash";
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utxo/toolbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAExB,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,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