@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,66 @@
|
|
|
1
|
+
import type { EncodeObject } from "@cosmjs/proto-signing";
|
|
2
|
+
import type { Asset, ChainId, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
|
|
3
|
+
declare enum TxType {
|
|
4
|
+
Transfer = "transfer",
|
|
5
|
+
Unknown = "unknown"
|
|
6
|
+
}
|
|
7
|
+
type Tx = {
|
|
8
|
+
asset: Asset;
|
|
9
|
+
from: {
|
|
10
|
+
from: string;
|
|
11
|
+
}[];
|
|
12
|
+
to: {
|
|
13
|
+
to: string;
|
|
14
|
+
}[];
|
|
15
|
+
date: Date;
|
|
16
|
+
type: TxType;
|
|
17
|
+
hash: string;
|
|
18
|
+
};
|
|
19
|
+
export type NodeUrl = {
|
|
20
|
+
node: string;
|
|
21
|
+
rpc: string;
|
|
22
|
+
};
|
|
23
|
+
export type TxData = Pick<Tx, "from" | "to" | "type">;
|
|
24
|
+
/**
|
|
25
|
+
* Response from `thorchain/constants` endpoint
|
|
26
|
+
*/
|
|
27
|
+
export type ThorchainConstantsResponse = {
|
|
28
|
+
int_64_values: {
|
|
29
|
+
NativeTransactionFee: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Response of `/cosmos/base/tendermint/v1beta1/node_info`
|
|
34
|
+
* Note: We are interested in `network` (aka chain id) only
|
|
35
|
+
*/
|
|
36
|
+
export type NodeInfoResponse = {
|
|
37
|
+
default_node_info: {
|
|
38
|
+
network: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type TransferTransaction = {
|
|
42
|
+
memo: string;
|
|
43
|
+
accountNumber: number;
|
|
44
|
+
sequence: number;
|
|
45
|
+
chainId: ChainId;
|
|
46
|
+
msgs: EncodeObject[];
|
|
47
|
+
fee: {
|
|
48
|
+
amount: {
|
|
49
|
+
denom: string;
|
|
50
|
+
amount: string;
|
|
51
|
+
}[];
|
|
52
|
+
gas: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type CosmosCreateTransactionParams = GenericCreateTransactionParams & {
|
|
56
|
+
accountNumber?: number;
|
|
57
|
+
sequence?: number;
|
|
58
|
+
};
|
|
59
|
+
export type ThorchainCreateTransactionParams = Omit<CosmosCreateTransactionParams, "feeRate" | "recipient"> & {
|
|
60
|
+
recipient?: string;
|
|
61
|
+
asSignable?: boolean;
|
|
62
|
+
asAminoMessage?: boolean;
|
|
63
|
+
};
|
|
64
|
+
export type ThorchainDepositParams = Omit<GenericTransferParams, "recipient">;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=client-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-types.d.ts","sourceRoot":"","sources":["../../../../../src/cosmos/thorchainUtils/types/client-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACP,8BAA8B,EAC9B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,aAAK,MAAM;IACT,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,KAAK,EAAE,GAAG;IACR,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzB,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,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ources":["../../../../../src/cosmos/thorchainUtils/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Account } from "@cosmjs/stargate";
|
|
2
|
+
import { AssetValue, Chain, type ChainId, type CosmosChain, type DerivationPathArray, type GenericTransferParams, SwapKitNumber } from "@swapkit/helpers";
|
|
3
|
+
import type { CosmosToolboxParams } from "../types";
|
|
4
|
+
export declare function fetchFeeRateFromSwapKit(chainId: ChainId, safeDefault: number): Promise<number>;
|
|
5
|
+
export declare function getSignerFromPhrase({ phrase, prefix, ...derivationParams }: {
|
|
6
|
+
phrase: string;
|
|
7
|
+
prefix?: string;
|
|
8
|
+
} & ({
|
|
9
|
+
chain: Chain;
|
|
10
|
+
index?: number;
|
|
11
|
+
} | {
|
|
12
|
+
derivationPath: string;
|
|
13
|
+
})): Promise<import("@cosmjs/proto-signing").DirectSecp256k1HdWallet>;
|
|
14
|
+
export declare function getSignerFromPrivateKey({ privateKey, prefix, }: {
|
|
15
|
+
privateKey: Uint8Array;
|
|
16
|
+
prefix: string;
|
|
17
|
+
}): Promise<import("@cosmjs/proto-signing").DirectSecp256k1Wallet>;
|
|
18
|
+
export declare function verifySignature(getAccount: (address: string) => Promise<Account | null>): ({ signature, message, address, }: {
|
|
19
|
+
signature: string;
|
|
20
|
+
message: string;
|
|
21
|
+
address: string;
|
|
22
|
+
}) => Promise<boolean>;
|
|
23
|
+
export declare function createCosmosToolbox({ chain, ...toolboxParams }: CosmosToolboxParams): Promise<{
|
|
24
|
+
transfer: ({ recipient, assetValue, memo, feeRate, feeOptionKey, }: GenericTransferParams) => Promise<string>;
|
|
25
|
+
getAddress: () => Promise<string | undefined>;
|
|
26
|
+
getAccount: (address: string) => Promise<Account | null>;
|
|
27
|
+
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<AssetValue[]>;
|
|
28
|
+
getSignerFromPhrase: ({ phrase, derivationPath, }: {
|
|
29
|
+
phrase: string;
|
|
30
|
+
derivationPath: DerivationPathArray;
|
|
31
|
+
}) => Promise<import("@cosmjs/proto-signing").DirectSecp256k1HdWallet>;
|
|
32
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@cosmjs/proto-signing").DirectSecp256k1Wallet>;
|
|
33
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
34
|
+
validateAddress: (address: string) => boolean;
|
|
35
|
+
getPubKey: () => Promise<string>;
|
|
36
|
+
getFees: () => Promise<{
|
|
37
|
+
average: SwapKitNumber;
|
|
38
|
+
fast: SwapKitNumber;
|
|
39
|
+
fastest: SwapKitNumber;
|
|
40
|
+
}>;
|
|
41
|
+
fetchFeeRateFromSwapKit: typeof fetchFeeRateFromSwapKit;
|
|
42
|
+
getBalanceAsDenoms: (address: string) => Promise<{
|
|
43
|
+
denom: string;
|
|
44
|
+
amount: string;
|
|
45
|
+
}[]>;
|
|
46
|
+
createTransaction: ({ sender, recipient, assetValue, memo, feeRate, sequence, accountNumber, }: import("..").CosmosCreateTransactionParams) => Promise<{
|
|
47
|
+
accountNumber: number;
|
|
48
|
+
chainId: ChainId;
|
|
49
|
+
fee: {
|
|
50
|
+
amount: {
|
|
51
|
+
denom: string;
|
|
52
|
+
amount: string;
|
|
53
|
+
}[];
|
|
54
|
+
gas: string;
|
|
55
|
+
};
|
|
56
|
+
memo: string;
|
|
57
|
+
sequence: number;
|
|
58
|
+
msgs: {
|
|
59
|
+
typeUrl: string;
|
|
60
|
+
value: {
|
|
61
|
+
fromAddress: string;
|
|
62
|
+
toAddress: string;
|
|
63
|
+
amount: {
|
|
64
|
+
amount: string;
|
|
65
|
+
denom: string;
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
}[];
|
|
69
|
+
}>;
|
|
70
|
+
verifySignature: ({ signature, message, address, }: {
|
|
71
|
+
signature: string;
|
|
72
|
+
message: string;
|
|
73
|
+
address: string;
|
|
74
|
+
}) => Promise<boolean>;
|
|
75
|
+
}>;
|
|
76
|
+
export declare function getFeeRateFromSwapKit(chainId: ChainId, safeDefault: number): Promise<number>;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated use getFeeRateFromSwapKit instead
|
|
79
|
+
*/
|
|
80
|
+
export declare const getFeeRateFromThorswap: typeof getFeeRateFromSwapKit;
|
|
81
|
+
export declare function cosmosValidateAddress({ address, chain, prefix: chainPrefix, }: {
|
|
82
|
+
address: string;
|
|
83
|
+
} & ({
|
|
84
|
+
prefix: string;
|
|
85
|
+
chain?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
chain: CosmosChain;
|
|
88
|
+
prefix?: undefined;
|
|
89
|
+
})): boolean;
|
|
90
|
+
export declare function estimateTransactionFee({ assetValue: { chain }, }: {
|
|
91
|
+
assetValue: AssetValue;
|
|
92
|
+
}): AssetValue;
|
|
93
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../../../src/cosmos/toolbox/cosmos.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EACL,UAAU,EAEV,KAAK,EACL,KAAK,OAAO,EAEZ,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EAExB,KAAK,qBAAqB,EAI1B,aAAa,EAId,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAUpD,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBASlF;AAED,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,MAAM,EACN,GAAG,gBAAgB,EACpB,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,CACrC;IAAE,KAAK,EAAE,KAAK,CAAC;I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AK,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,CAC7C,WAQA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EAAE,EAAE,KAAK,EAAE,GACtB,EAAE;IACD,UAAU,EAAE,UAAU,CAAC;CACxB,cAEA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CosmosChain } from "@swapkit/helpers";
|
|
2
|
+
import type { CosmosToolboxParams } from "../types";
|
|
3
|
+
import { createCosmosToolbox } from "./cosmos";
|
|
4
|
+
import { createThorchainToolbox } from "./thorchain";
|
|
5
|
+
export type CosmosToolboxes = {
|
|
6
|
+
GAIA: ReturnType<typeof createCosmosToolbox>;
|
|
7
|
+
KUJI: ReturnType<typeof createCosmosToolbox>;
|
|
8
|
+
MAYA: ReturnType<typeof createThorchainToolbox>;
|
|
9
|
+
THOR: ReturnType<typeof createThorchainToolbox>;
|
|
10
|
+
};
|
|
11
|
+
export declare const getCosmosToolbox: <T extends CosmosChain>(chain: T, params?: Omit<CosmosToolboxParams, "chain">) => CosmosToolboxes[T];
|
|
12
|
+
export * from "./cosmos";
|
|
13
|
+
export * from "./thorchain";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cosmos/toolbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IAC7C,IAAI,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IAC7C,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IAChD,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW,EACpD,OAAO,CAAC,EACR,SAAS,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,KAC1C,eAAe,CAAC,CAAC,CAanB,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Pubkey, Secp256k1HdWallet } from "@cosmjs/amino";
|
|
2
|
+
import { Chain, type GenericTransferParams, SwapKitNumber } from "@swapkit/helpers";
|
|
3
|
+
import { buildEncodedTxBody, createDefaultRegistry, parseAminoMessageForDirectSigning } from "../thorchainUtils";
|
|
4
|
+
import type { MultisigTx } from "../types";
|
|
5
|
+
import type { CosmosToolboxParams, MultiSigSigner } from "../types";
|
|
6
|
+
declare function createMultisig(pubKeys: string[], threshold: number, noSortPubKeys?: boolean): Promise<import("@cosmjs/amino").MultisigThresholdPubkey>;
|
|
7
|
+
declare function importSignature(signature: string): Uint8Array<ArrayBufferLike>;
|
|
8
|
+
declare function signWithPrivateKey({ privateKey, message, }: {
|
|
9
|
+
privateKey: Uint8Array;
|
|
10
|
+
message: string;
|
|
11
|
+
}): Promise<string>;
|
|
12
|
+
export declare function createThorchainToolbox({ chain, ...toolboxParams }: CosmosToolboxParams<Chain.THORChain | Chain.Maya>): Promise<{
|
|
13
|
+
broadcastMultisigTx: (tx: string, signers: MultiSigSigner[], membersPubKeys: string[], threshold: number, bodyBytes: Uint8Array) => Promise<string>;
|
|
14
|
+
buildAminoMsg: ({ sender, recipient, assetValue, memo, }: {
|
|
15
|
+
sender: string;
|
|
16
|
+
recipient?: string;
|
|
17
|
+
assetValue: import("@swapkit/helpers").AssetValue;
|
|
18
|
+
memo?: string;
|
|
19
|
+
}) => {
|
|
20
|
+
type: "thorchain/MsgSend" | "mayachain/MsgSend";
|
|
21
|
+
value: {
|
|
22
|
+
from_address: string;
|
|
23
|
+
to_address: string | undefined;
|
|
24
|
+
amount: {
|
|
25
|
+
amount: string;
|
|
26
|
+
denom: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: "thorchain/MsgDeposit" | "mayachain/MsgDeposit";
|
|
31
|
+
value: {
|
|
32
|
+
coins: {
|
|
33
|
+
amount: string;
|
|
34
|
+
asset: string;
|
|
35
|
+
}[];
|
|
36
|
+
signer: string;
|
|
37
|
+
memo: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
buildEncodedTxBody: typeof buildEncodedTxBody;
|
|
41
|
+
convertToSignable: (msg: {
|
|
42
|
+
type: "thorchain/MsgSend" | "mayachain/MsgSend";
|
|
43
|
+
value: {
|
|
44
|
+
from_address: string;
|
|
45
|
+
to_address: string | undefined;
|
|
46
|
+
amount: {
|
|
47
|
+
amount: string;
|
|
48
|
+
denom: string;
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
type: "thorchain/MsgDeposit" | "mayachain/MsgDeposit";
|
|
53
|
+
value: {
|
|
54
|
+
coins: {
|
|
55
|
+
amount: string;
|
|
56
|
+
asset: string;
|
|
57
|
+
}[];
|
|
58
|
+
signer: string;
|
|
59
|
+
memo: string;
|
|
60
|
+
};
|
|
61
|
+
}, chain: Chain.THORChain | Chain.Maya) => Promise<import("@cosmjs/proto-signing").EncodeObject>;
|
|
62
|
+
createDefaultAminoTypes: () => Promise<import("@cosmjs/stargate").AminoTypes>;
|
|
63
|
+
createDefaultRegistry: typeof createDefaultRegistry;
|
|
64
|
+
createMultisig: typeof createMultisig;
|
|
65
|
+
createTransaction: (params: import("..").ThorchainCreateTransactionParams) => Promise<{
|
|
66
|
+
chainId: import("@swapkit/helpers").ChainId;
|
|
67
|
+
accountNumber: number;
|
|
68
|
+
sequence: number;
|
|
69
|
+
msgs: (import("@cosmjs/proto-signing").EncodeObject | {
|
|
70
|
+
type: "thorchain/MsgSend" | "mayachain/MsgSend";
|
|
71
|
+
value: {
|
|
72
|
+
from_address: string;
|
|
73
|
+
to_address: string | undefined;
|
|
74
|
+
amount: {
|
|
75
|
+
amount: string;
|
|
76
|
+
denom: string;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
})[];
|
|
80
|
+
fee: {
|
|
81
|
+
amount: {
|
|
82
|
+
denom: string;
|
|
83
|
+
amount: string;
|
|
84
|
+
}[];
|
|
85
|
+
gas: string;
|
|
86
|
+
};
|
|
87
|
+
memo: string;
|
|
88
|
+
}> | Promise<{
|
|
89
|
+
chainId: import("@swapkit/helpers").ChainId;
|
|
90
|
+
accountNumber: number;
|
|
91
|
+
sequence: number;
|
|
92
|
+
msgs: (import("@cosmjs/proto-signing").EncodeObject | {
|
|
93
|
+
type: "thorchain/MsgDeposit" | "mayachain/MsgDeposit";
|
|
94
|
+
value: {
|
|
95
|
+
coins: {
|
|
96
|
+
amount: string;
|
|
97
|
+
asset: string;
|
|
98
|
+
}[];
|
|
99
|
+
signer: string;
|
|
100
|
+
memo: string;
|
|
101
|
+
};
|
|
102
|
+
})[];
|
|
103
|
+
fee: {
|
|
104
|
+
amount: {
|
|
105
|
+
denom: string;
|
|
106
|
+
amount: string;
|
|
107
|
+
}[];
|
|
108
|
+
gas: string;
|
|
109
|
+
};
|
|
110
|
+
memo: string;
|
|
111
|
+
}>;
|
|
112
|
+
deposit: ({ assetValue, memo, recipient, }: Omit<GenericTransferParams, "recipient"> & {
|
|
113
|
+
recipient?: string;
|
|
114
|
+
}) => Promise<string>;
|
|
115
|
+
getFees: () => Promise<{
|
|
116
|
+
average: SwapKitNumber;
|
|
117
|
+
fast: SwapKitNumber;
|
|
118
|
+
fastest: SwapKitNumber;
|
|
119
|
+
}>;
|
|
120
|
+
importSignature: typeof importSignature;
|
|
121
|
+
parseAminoMessageForDirectSigning: typeof parseAminoMessageForDirectSigning;
|
|
122
|
+
secp256k1HdWalletFromMnemonic: (mnemonic: string, index?: number) => Promise<Secp256k1HdWallet>;
|
|
123
|
+
signMultisigTx: ({ wallet, tx, }: {
|
|
124
|
+
wallet: Secp256k1HdWallet;
|
|
125
|
+
tx: string | MultisigTx;
|
|
126
|
+
}) => Promise<{
|
|
127
|
+
signature: string;
|
|
128
|
+
bodyBytes: Uint8Array<ArrayBufferLike>;
|
|
129
|
+
}>;
|
|
130
|
+
signWithPrivateKey: typeof signWithPrivateKey;
|
|
131
|
+
transfer: ({ assetValue, memo, recipient, }: Omit<GenericTransferParams, "recipient"> & {
|
|
132
|
+
recipient?: string;
|
|
133
|
+
}) => Promise<string>;
|
|
134
|
+
pubkeyToAddress: (pubkey: Pubkey) => Promise<string>;
|
|
135
|
+
getAddress: () => Promise<string | undefined>;
|
|
136
|
+
getAccount: (address: string) => Promise<import("@cosmjs/stargate").Account | null>;
|
|
137
|
+
getBalance: (address: string, _potentialScamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
|
|
138
|
+
getSignerFromPhrase: ({ phrase, derivationPath, }: {
|
|
139
|
+
phrase: string;
|
|
140
|
+
derivationPath: import("@swapkit/helpers").DerivationPathArray;
|
|
141
|
+
}) => Promise<import("@cosmjs/proto-signing").DirectSecp256k1HdWallet>;
|
|
142
|
+
getSignerFromPrivateKey: (privateKey: Uint8Array) => Promise<import("@cosmjs/proto-signing").DirectSecp256k1Wallet>;
|
|
143
|
+
createPrivateKeyFromPhrase: (phrase: string) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
144
|
+
validateAddress: (address: string) => boolean;
|
|
145
|
+
getPubKey: () => Promise<string>;
|
|
146
|
+
fetchFeeRateFromSwapKit: typeof import("./cosmos").fetchFeeRateFromSwapKit;
|
|
147
|
+
getBalanceAsDenoms: (address: string) => Promise<{
|
|
148
|
+
denom: string;
|
|
149
|
+
amount: string;
|
|
150
|
+
}[]>;
|
|
151
|
+
verifySignature: ({ signature, message, address, }: {
|
|
152
|
+
signature: string;
|
|
153
|
+
message: string;
|
|
154
|
+
address: string;
|
|
155
|
+
}) => Promise<boolean>;
|
|
156
|
+
}>;
|
|
157
|
+
export {};
|
|
158
|
+
//# sourceMappingURL=thorchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thorchain.d.ts","sourceRoot":"","sources":["../../../../src/cosmos/toolbox/thorchain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAEL,KAAK,EAGL,KAAK,qBAAqB,EAK1B,aAAa,EAGd,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAEL,kBAAkB,EAGlB,qBAAqB,EAErB,iCAAiC,EAClC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAsHpE,iBAAe,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,UAAO,4DAQvF;AAED,iBAAS,eAAe,CAAC,SAAS,EAAE,MAAM,+BAEzC;AAED,iBAAe,kBAAkB,CAAC,EAChC,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,mBAKA;AAED,wBAAsB,sBAAsB,CAAC,EAC3C,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,mBAAmB,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;8BA/D5C,MAAM,WACD,cAAc,EAAE,kBACT,MAAM,EAAE,aACb,MAAM,aACN,UAAU;;;iBA9Cf,CAAC;;YAEP,CAAH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAgKI,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;8CA7LN,MAAM;sCAsBjE;QACD,MAAM,EAAE,iBAAiB,CAAC;QAC1B,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC;KACzB;;;;;iDAoKE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;8BAyElC,MAAM;;;;;;;;;;;;;;;;;;;;;;GAKzC"}
|
|
@@ -5,46 +5,41 @@ import type { buildAminoMsg } from "./thorchainUtils";
|
|
|
5
5
|
import type { createCosmosToolbox } from "./toolbox/cosmos";
|
|
6
6
|
import type { createThorchainToolbox } from "./toolbox/thorchain";
|
|
7
7
|
import type { getDefaultChainFee } from "./util";
|
|
8
|
-
|
|
9
8
|
export type CosmosSDKClientParams = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
server: string;
|
|
10
|
+
chainId: ChainId;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
stagenet?: boolean;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
export type MultiSigSigner = {
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
pubKey: string;
|
|
16
|
+
signature: string;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
export type MultisigTx = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
msgs: ReturnType<typeof buildAminoMsg>[];
|
|
20
|
+
accountNumber: number;
|
|
21
|
+
sequence: number;
|
|
22
|
+
chainId: ChainId;
|
|
23
|
+
fee: ReturnType<typeof getDefaultChainFee>;
|
|
24
|
+
memo: string;
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
export type CosmosSigner = DirectSecp256k1HdWallet | OfflineDirectSigner | OfflineAminoSigner;
|
|
31
|
-
|
|
32
27
|
export type CosmosToolboxParams<T = CosmosChain> = {
|
|
33
|
-
|
|
34
|
-
} & (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
chain: T;
|
|
29
|
+
} & ({
|
|
30
|
+
signer?: CosmosSigner;
|
|
31
|
+
} | {
|
|
32
|
+
phrase?: string;
|
|
33
|
+
derivationPath?: DerivationPathArray;
|
|
34
|
+
index?: number;
|
|
35
|
+
});
|
|
39
36
|
export type BaseCosmosToolboxType = ReturnType<typeof createCosmosToolbox>;
|
|
40
37
|
export type BaseCosmosWallet = Awaited<ReturnType<typeof createCosmosToolbox>>;
|
|
41
38
|
export type CosmosWallets = {
|
|
42
|
-
|
|
39
|
+
[chain in Chain.Cosmos | Chain.Kujira]: BaseCosmosWallet;
|
|
43
40
|
};
|
|
44
|
-
|
|
45
|
-
export type ThorchainWallet = Awaited<
|
|
46
|
-
Omit<ReturnType<typeof createThorchainToolbox>, "signMessage">
|
|
47
|
-
>;
|
|
41
|
+
export type ThorchainWallet = Awaited<Omit<ReturnType<typeof createThorchainToolbox>, "signMessage">>;
|
|
48
42
|
export type ThorchainWallets = {
|
|
49
|
-
|
|
43
|
+
[chain in Chain.THORChain | Chain.Maya]: ThorchainWallet;
|
|
50
44
|
};
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cosmos/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kB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AAC3E,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;AAC/E,MAAM,MAAM,aAAa,GAAG;KACzB,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,gBAAgB;CACzD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,CACnC,IAAI,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,aAAa,CAAC,CAC/D,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;KAC5B,KAAK,IAAI,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,GAAG,eAAe;CACzD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { OfflineSigner } from "@cosmjs/proto-signing";
|
|
2
|
+
import type { SigningStargateClientOptions } from "@cosmjs/stargate";
|
|
3
|
+
import { AssetValue, ChainId, type CosmosChain } from "@swapkit/helpers";
|
|
4
|
+
import type { CosmosCreateTransactionParams } from "./thorchainUtils";
|
|
5
|
+
export declare const USK_KUJIRA_FACTORY_DENOM = "FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK";
|
|
6
|
+
export declare const YUM_KUJIRA_FACTORY_DENOM = "FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM";
|
|
7
|
+
export declare const DEFAULT_COSMOS_FEE_MAINNET: {
|
|
8
|
+
amount: {
|
|
9
|
+
denom: string;
|
|
10
|
+
amount: string;
|
|
11
|
+
}[];
|
|
12
|
+
gas: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const DEFAULT_KUJI_FEE_MAINNET: {
|
|
15
|
+
amount: {
|
|
16
|
+
denom: string;
|
|
17
|
+
amount: string;
|
|
18
|
+
}[];
|
|
19
|
+
gas: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function getDefaultChainFee(chain: CosmosChain): {
|
|
22
|
+
amount: {
|
|
23
|
+
denom: string;
|
|
24
|
+
amount: string;
|
|
25
|
+
}[];
|
|
26
|
+
gas: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const getMsgSendDenom: (symbol: string, isThorchain?: boolean) => string;
|
|
29
|
+
export declare const getDenomWithChain: ({ symbol, chain }: AssetValue) => string;
|
|
30
|
+
export declare function createStargateClient(url: string): Promise<import("@cosmjs/stargate").StargateClient>;
|
|
31
|
+
export declare function createSigningStargateClient(url: string, signer: OfflineSigner, optionsOrBaseGas?: string | SigningStargateClientOptions): Promise<import("@cosmjs/stargate").SigningStargateClient>;
|
|
32
|
+
export declare function createOfflineStargateClient(wallet: OfflineSigner, registry?: SigningStargateClientOptions): Promise<import("@cosmjs/stargate").SigningStargateClient>;
|
|
33
|
+
export declare const getRPC: (chainId: ChainId) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Used to build tx for Cosmos and Kujira
|
|
36
|
+
*/
|
|
37
|
+
export declare const cosmosCreateTransaction: ({ sender, recipient, assetValue, memo, feeRate, sequence, accountNumber, }: CosmosCreateTransactionParams) => Promise<{
|
|
38
|
+
accountNumber: number;
|
|
39
|
+
chainId: ChainId;
|
|
40
|
+
fee: {
|
|
41
|
+
amount: {
|
|
42
|
+
denom: string;
|
|
43
|
+
amount: string;
|
|
44
|
+
}[];
|
|
45
|
+
gas: string;
|
|
46
|
+
};
|
|
47
|
+
memo: string;
|
|
48
|
+
sequence: number;
|
|
49
|
+
msgs: {
|
|
50
|
+
typeUrl: string;
|
|
51
|
+
value: {
|
|
52
|
+
fromAddress: string;
|
|
53
|
+
toAddress: string;
|
|
54
|
+
amount: {
|
|
55
|
+
amount: string;
|
|
56
|
+
denom: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Converts a Cosmos denom and amount to an AssetValue with proper decimal handling
|
|
63
|
+
* @param denom - The denomination string
|
|
64
|
+
* @param amount - The amount in base units as a string
|
|
65
|
+
* @returns AssetValue with the correct decimal conversion
|
|
66
|
+
*/
|
|
67
|
+
export declare const getAssetFromDenom: (denom: string, amount: string) => AssetValue;
|
|
68
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/cosmos/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,UAAU,EAGV,OAAO,EACP,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEtE,eAAO,MAAM,wBAAwB,mFAC6C,CAAC;AAEnF,eAAO,MAAM,wBAAwB,+DACyB,CAAC;AAE/D,eAAO,MAAM,0BAA0B;;;;;;CAGtC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;CAGpC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW;;;;;;EAWpD;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,qBAAmB,WAqBlE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,mBAAmB,UAAU,WAY9D,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,sDAcrD;AAED,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,aAAa,EACrB,gBAAgB,GAAE,MAAM,GAAG,4BAAiC,6DAa7D;AAED,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,aAAa,EACrB,QAAQ,CAAC,EAAE,4BAA4B,6DAMxC;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,OAAO,WAiBtC,CAAC;AAeF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAU,4EAQ3C,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;EAoC/B,CAAC;AA4BF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,eA4B9D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EVMChain } from "@swapkit/helpers";
|
|
2
|
+
export declare function getEvmApi(chain: EVMChain): {
|
|
3
|
+
getBalance: (address: string, scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
|
|
4
|
+
};
|
|
5
|
+
export declare function createCustomEvmApi(methods: ReturnType<typeof getEvmApi>): {
|
|
6
|
+
getBalance: (address: string, scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/evm/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAsB,MAAM,kBAAkB,CAAC;AAGrE,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ;;EASxC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC;;EAEvE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const multicallAbi: {
|
|
2
|
+
inputs: ({
|
|
3
|
+
internalType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
components?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
components: {
|
|
9
|
+
internalType: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
internalType: string;
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
})[];
|
|
17
|
+
name: string;
|
|
18
|
+
outputs: ({
|
|
19
|
+
internalType: string;
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
components?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
components: {
|
|
25
|
+
internalType: string;
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}[];
|
|
29
|
+
internalType: string;
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
})[];
|
|
33
|
+
stateMutability: string;
|
|
34
|
+
type: string;
|
|
35
|
+
}[];
|
|
36
|
+
//# sourceMappingURL=multicall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../../../../src/evm/contracts/eth/multicall.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoKxB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const gasOracleAbi: ({
|
|
2
|
+
inputs: {
|
|
3
|
+
internalType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}[];
|
|
7
|
+
stateMutability: string;
|
|
8
|
+
type: string;
|
|
9
|
+
anonymous?: undefined;
|
|
10
|
+
name?: undefined;
|
|
11
|
+
outputs?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
anonymous: boolean;
|
|
14
|
+
inputs: {
|
|
15
|
+
indexed: boolean;
|
|
16
|
+
internalType: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}[];
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
stateMutability?: undefined;
|
|
23
|
+
outputs?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
inputs: {
|
|
26
|
+
internalType: string;
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
}[];
|
|
30
|
+
name: string;
|
|
31
|
+
outputs: {
|
|
32
|
+
internalType: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: string;
|
|
35
|
+
}[];
|
|
36
|
+
stateMutability: string;
|
|
37
|
+
type: string;
|
|
38
|
+
anonymous?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
//# sourceMappingURL=gasOracle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gasOracle.d.ts","sourceRoot":"","sources":["../../../../../src/evm/contracts/op/gasOracle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsJxB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AssetValue, Chain, type EVMChain, FeeOption, type NetworkParams } from "@swapkit/helpers";
|
|
2
|
+
import type { BrowserProvider, Provider } from "ethers";
|
|
3
|
+
import type { EIP1559TxParams, EVMMaxSendableAmountsParams } from "./types";
|
|
4
|
+
export declare function getProvider(chain: EVMChain, customUrl?: string): Promise<import("ethers").JsonRpcProvider>;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
|
+
export declare const estimateMaxSendableAmount: ({ from, memo, feeOptionKey, assetValue, abi, funcName, funcParams, contractAddress, txOverrides, }: EVMMaxSendableAmountsParams) => Promise<AssetValue>;
|
|
9
|
+
export declare function toHexString(value: bigint): string;
|
|
10
|
+
export declare function getEstimateTransactionFee({ provider, isEIP1559Compatible, }: {
|
|
11
|
+
provider: Provider | BrowserProvider;
|
|
12
|
+
isEIP1559Compatible?: boolean;
|
|
13
|
+
chain: EVMChain;
|
|
14
|
+
}): ({ feeOption, chain, ...txObject }: EIP1559TxParams & {
|
|
15
|
+
feeOption: FeeOption;
|
|
16
|
+
chain: EVMChain;
|
|
17
|
+
}) => Promise<AssetValue>;
|
|
18
|
+
export declare function getNetworkParams<C extends EVMChain>(chain: C): () => C extends Chain.Ethereum ? undefined : NetworkParams;
|
|
19
|
+
export declare function getIsEIP1559Compatible<C extends EVMChain>(chain: C): boolean;
|
|
20
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/evm/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,KAAK,EAGL,KAAK,QAAQ,EACb,SAAS,EACT,KAAK,aAAa,EAInB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE5E,wBAAsB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,6CAIpE;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAU,oGAU7C,2BAA2B,KAAG,OAAO,CAAC,UAAU,CAkDlD,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAExC;AAED,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,mBAA0B,GAC3B,EAAE;IAAE,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,IAC5C,mCAI1C,eAAe,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,yBAoB/D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,SAS/C,CAAC,SAAS,KAAK,CAAC,QAAQ,GAAG,SAAS,GAAG,aAAa,CACjE;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,WAIlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/evm/index.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