@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,14 @@
|
|
|
1
|
+
import type { GatewayApiClient } from "@radixdlt/babylon-gateway-api-sdk";
|
|
2
|
+
import { AssetValue, type SKConfigIntegrations } from "@swapkit/helpers";
|
|
3
|
+
export type RadixWallet = Awaited<ReturnType<typeof RadixToolbox>>;
|
|
4
|
+
export declare function radixValidateAddress(address: string): boolean;
|
|
5
|
+
export declare const RadixToolbox: ({ dappConfig, }?: {
|
|
6
|
+
dappConfig?: SKConfigIntegrations["radix"];
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
getAddress: () => string;
|
|
9
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
10
|
+
networkApi: GatewayApiClient;
|
|
11
|
+
validateAddress: typeof radixValidateAddress;
|
|
12
|
+
signAndBroadcast: (params: any) => Promise<string>;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/radix/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAIjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,UAAU,EAGV,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC;AAOnE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,WAEnD;AA4GD,eAAO,MAAM,YAAY,GAAU,kBAEhC;IAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAA;CAAO;;0BA3GV,MAAM;;;sBA8HxC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC;EAEzC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AssetValue, type ChainSigner, type GenericTransferParams } from "@swapkit/helpers";
|
|
2
|
+
import type { Transaction } from "xrpl";
|
|
3
|
+
import { type Payment } from "xrpl";
|
|
4
|
+
export type RippleWallet = Awaited<ReturnType<typeof getRippleToolbox>>;
|
|
5
|
+
export { hashes, type Transaction } from "xrpl";
|
|
6
|
+
declare function createSigner(phrase: string): ChainSigner<Transaction, {
|
|
7
|
+
tx_blob: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function rippleValidateAddress(address: string): boolean;
|
|
11
|
+
type RippleToolboxParams = {
|
|
12
|
+
phrase: string;
|
|
13
|
+
} | {
|
|
14
|
+
signer: ChainSigner<Transaction, {
|
|
15
|
+
tx_blob: string;
|
|
16
|
+
hash: string;
|
|
17
|
+
}>;
|
|
18
|
+
} | {};
|
|
19
|
+
export declare const getRippleToolbox: (params?: RippleToolboxParams) => Promise<{
|
|
20
|
+
signer: ChainSigner<Transaction, {
|
|
21
|
+
tx_blob: string;
|
|
22
|
+
hash: string;
|
|
23
|
+
}> | undefined;
|
|
24
|
+
createSigner: typeof createSigner;
|
|
25
|
+
getAddress: () => Promise<string>;
|
|
26
|
+
validateAddress: typeof rippleValidateAddress;
|
|
27
|
+
getBalance: (address?: string) => Promise<AssetValue[]>;
|
|
28
|
+
createTransaction: ({ assetValue, recipient, memo, sender, }: {
|
|
29
|
+
assetValue: AssetValue;
|
|
30
|
+
recipient: string;
|
|
31
|
+
sender?: string;
|
|
32
|
+
memo?: string;
|
|
33
|
+
}) => Promise<Payment>;
|
|
34
|
+
signTransaction: (tx: Transaction) => Promise<{
|
|
35
|
+
tx_blob: string;
|
|
36
|
+
hash: string;
|
|
37
|
+
}>;
|
|
38
|
+
broadcastTransaction: (signedTxHex: string) => Promise<string>;
|
|
39
|
+
transfer: (params: GenericTransferParams) => Promise<string>;
|
|
40
|
+
estimateTransactionFee: () => Promise<AssetValue>;
|
|
41
|
+
disconnect: () => Promise<void>;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ripple/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAI3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAU,KAAK,OAAO,EAAsC,MAAM,MAAM,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAOhD,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CASjG;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,WAEpD;AAED,KAAK,mBAAmB,GACpB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,WAAW,CAAC,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GACvE,EAAE,CAAC;AAEP,eAAO,MAAM,gBAAgB,GAAU,SAAQ,mBAAwB;;iBAHrB,MAAM;cAAQ,MAAM;;;;;2BA6BhC,MAAM;kEA8CvC;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;0BA6BnD,WAAW;iBAxGQ,MAAM;cAAQ,MAAM;;wCA+GnB,MAAM;uBAcvB,qBAAqB;;;EA2BtD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PublicKey, SendOptions, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
2
|
+
import type { GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
|
|
3
|
+
import type { getSolanaToolbox } from "./toolbox";
|
|
4
|
+
type DisplayEncoding = "utf8" | "hex";
|
|
5
|
+
type PhantomEvent = "connect" | "disconnect" | "accountChanged";
|
|
6
|
+
type PhantomRequestMethod = "connect" | "disconnect" | "signAndSendTransaction" | "signAndSendTransactionV0" | "signAndSendTransactionV0WithLookupTable" | "signTransaction" | "signAllTransactions" | "signMessage";
|
|
7
|
+
interface ConnectOpts {
|
|
8
|
+
onlyIfTrusted: boolean;
|
|
9
|
+
}
|
|
10
|
+
export * from "./toolbox";
|
|
11
|
+
export type SolanaWallet = Awaited<ReturnType<typeof getSolanaToolbox>>;
|
|
12
|
+
export interface SolanaProvider {
|
|
13
|
+
connect: (opts?: Partial<ConnectOpts>) => Promise<{
|
|
14
|
+
publicKey: PublicKey;
|
|
15
|
+
}>;
|
|
16
|
+
disconnect: () => Promise<void>;
|
|
17
|
+
getAddress: () => Promise<string>;
|
|
18
|
+
isConnected: boolean | null;
|
|
19
|
+
isPhantom: boolean;
|
|
20
|
+
on: (event: PhantomEvent, handler: (args: any) => void) => void;
|
|
21
|
+
publicKey: PublicKey | null;
|
|
22
|
+
request: (method: PhantomRequestMethod, params: any) => Promise<unknown>;
|
|
23
|
+
signMessage: (message: Uint8Array | string, display?: DisplayEncoding) => Promise<any>;
|
|
24
|
+
signAndSendTransaction: (transaction: Transaction | VersionedTransaction, opts?: SendOptions) => Promise<{
|
|
25
|
+
signature: string;
|
|
26
|
+
publicKey: PublicKey;
|
|
27
|
+
}>;
|
|
28
|
+
signTransaction: <T extends Transaction | VersionedTransaction = Transaction>(transaction: T) => Promise<T>;
|
|
29
|
+
signAllTransactions: <T extends Transaction | VersionedTransaction = Transaction>(transactions: T[]) => Promise<T[]>;
|
|
30
|
+
}
|
|
31
|
+
export type SolanaCreateTransactionParams = Omit<GenericCreateTransactionParams, "feeRate"> & {
|
|
32
|
+
isProgramDerivedAddress?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type SolanaTransferParams = Omit<GenericTransferParams, "feeRate"> & {
|
|
35
|
+
isProgramDerivedAddress?: boolean;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/solana/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,KAAK,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,KAAK,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtC,KAAK,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEhE,KAAK,oBAAoB,GACrB,SAAS,GACT,YAAY,GACZ,wBAAwB,GACxB,0BAA0B,GAC1B,yCAAyC,GACzC,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,CAAC;AAElB,UAAU,WAAW;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,cAAc,WAAW,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,KA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,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG;IAC1E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Connection, PublicKey, Signer, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
|
|
2
|
+
import { AssetValue, type DerivationPathArray, type GenericCreateTransactionParams } from "@swapkit/helpers";
|
|
3
|
+
import type { SolanaCreateTransactionParams, SolanaProvider, SolanaTransferParams } from "./index";
|
|
4
|
+
type SolanaSigner = SolanaProvider | Signer;
|
|
5
|
+
export declare function getSolanaAddressValidator(): Promise<(address: string) => boolean>;
|
|
6
|
+
export declare function getSolanaToolbox(toolboxParams?: {
|
|
7
|
+
signer?: SolanaSigner;
|
|
8
|
+
} | {
|
|
9
|
+
phrase?: string;
|
|
10
|
+
index?: number;
|
|
11
|
+
derivationPath?: DerivationPathArray;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
getConnection: typeof getConnection;
|
|
14
|
+
getAddress: () => string;
|
|
15
|
+
createKeysForPath: typeof createKeysForPath;
|
|
16
|
+
getAddressFromPubKey: typeof getAddressFromPubKey;
|
|
17
|
+
getPubkeyFromAddress: typeof getPubkeyFromAddress;
|
|
18
|
+
createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, }: SolanaCreateTransactionParams) => Promise<Transaction>;
|
|
19
|
+
createTransactionFromInstructions: typeof createTransactionFromInstructions;
|
|
20
|
+
getBalance: (addressParam?: string) => Promise<AssetValue[]>;
|
|
21
|
+
transfer: ({ recipient, assetValue, memo, isProgramDerivedAddress }: SolanaTransferParams) => Promise<string>;
|
|
22
|
+
broadcastTransaction: (transaction: Transaction | VersionedTransaction) => Promise<string>;
|
|
23
|
+
getAddressValidator: typeof getSolanaAddressValidator;
|
|
24
|
+
signTransaction: (transaction: Transaction | VersionedTransaction) => Promise<Transaction | VersionedTransaction>;
|
|
25
|
+
estimateTransactionFee: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, }: Omit<GenericCreateTransactionParams, "feeRate"> & {
|
|
26
|
+
isProgramDerivedAddress?: boolean;
|
|
27
|
+
}) => Promise<AssetValue>;
|
|
28
|
+
}>;
|
|
29
|
+
declare function getConnection(): Promise<Connection>;
|
|
30
|
+
declare function createTransactionFromInstructions({ instructions, }: {
|
|
31
|
+
instructions: TransactionInstruction[];
|
|
32
|
+
isProgramDerivedAddress?: boolean;
|
|
33
|
+
}): Promise<Transaction>;
|
|
34
|
+
export declare function createKeysForPath({ phrase, derivationPath, }: {
|
|
35
|
+
phrase: string;
|
|
36
|
+
derivationPath?: string;
|
|
37
|
+
}): Promise<import("@solana/web3.js").Keypair>;
|
|
38
|
+
declare function getAddressFromPubKey(publicKey: PublicKey): string;
|
|
39
|
+
declare function getPubkeyFromAddress(address: string): Promise<PublicKey>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../../src/solana/toolbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,UAAU,EAIV,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EAMpC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,6BAA6B,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnG,KAAK,YAAY,GAAG,cAAc,GAAG,MAAM,CAAC;AAsE5C,wBAAsB,yBAAyB,sBAG5B,MAAM,cAQxB;AAED,wBAAsB,gBAAgB,CACpC,aAAa,CAAC,EACV;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE,GACzB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,mBAAmB,CAAA;CAAE;;;;;;2FAmM1E,6BAA6B;;gCAzKF,MAAM;yEAuNoC,oBAAoB;wCA6BjE,WAAW,GAAG,oBAAoB;;mCAOlC,WAAW,GAAG,oBAAoB;gGAvO1D,IAAI,CAAC,8BAA8B,EAAE,SAAS,CAAC,GAAG;QACnD,uBAAuB,CAAC,EAAE,OAAO,CAAC;KACnC;GAXF;AAwCD,iBAAe,aAAa,wBAG3B;AAmJD,iBAAe,iCAAiC,CAAC,EAC/C,YAAY,GACb,EAAE;IAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC;IAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAE,wBAS/E;AA+DD,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,cAAmC,GACpC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,8CAQ7C;AAED,iBAAS,oBAAoB,CAAC,SAAS,EAAE,SAAS,UAEjD;AAED,iBAAe,oBAAoB,CAAC,OAAO,EAAE,MAAM,sBAGlD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ApiPromise } from "@polkadot/api";
|
|
2
|
+
import { AssetValue, Chain } from "@swapkit/helpers";
|
|
3
|
+
/**
|
|
4
|
+
* Get balance for standard Substrate chains (Polkadot, etc.)
|
|
5
|
+
* Uses api.query.system.account to query free and reserved balances
|
|
6
|
+
*/
|
|
7
|
+
export declare function getSubstrateBalance(api: ApiPromise, gasAsset: AssetValue, address: string): Promise<AssetValue[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Get balance for Chainflip chain
|
|
10
|
+
* Uses api.query.flip.account to query FLIP balances
|
|
11
|
+
*/
|
|
12
|
+
export declare function getChainflipBalance(api: ApiPromise, gasAsset: AssetValue, address: string): Promise<AssetValue[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Factory function to create chain-specific balance getter
|
|
15
|
+
*/
|
|
16
|
+
export declare function createBalanceGetter(chain: Chain, api: ApiPromise): (address: string) => Promise<AssetValue[]>;
|
|
17
|
+
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/substrate/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAiB,MAAM,kBAAkB,CAAC;AAEpE;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,EAAE,CAAC,CAwBvB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,EAAE,CAAC,CA6BvB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,IACpC,SAAS,MAAM,KAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAWnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/substrate/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { ApiPromise } from "@polkadot/api";
|
|
2
|
+
import type { SubmittableExtrinsic } from "@polkadot/api/types";
|
|
3
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
4
|
+
import type { Callback, IKeyringPair, ISubmittableResult, Signer } from "@polkadot/types/types";
|
|
5
|
+
import { AssetValue, Chain, type DerivationPathArray, type GenericCreateTransactionParams, type SubstrateChain } from "@swapkit/helpers";
|
|
6
|
+
import { SubstrateNetwork, type SubstrateTransferParams } from "./types";
|
|
7
|
+
export declare const PolkadotToolbox: ({ generic, ...signerParams }?: ToolboxParams) => Promise<{
|
|
8
|
+
api: ApiPromise;
|
|
9
|
+
network: SubstrateNetwork;
|
|
10
|
+
gasAsset: AssetValue;
|
|
11
|
+
decodeAddress: typeof decodeAddress;
|
|
12
|
+
encodeAddress: typeof encodeAddress;
|
|
13
|
+
convertAddress: typeof convertAddress;
|
|
14
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
15
|
+
createKeyring: (phrase: string) => Promise<KeyringPair>;
|
|
16
|
+
getAddress: (keyring?: IKeyringPair | Signer) => string | undefined;
|
|
17
|
+
createTransaction: (params: GenericCreateTransactionParams) => SubmittableExtrinsic<"promise", ISubmittableResult> | undefined;
|
|
18
|
+
validateAddress: (address: string) => boolean;
|
|
19
|
+
transfer: (params: SubstrateTransferParams) => Promise<string | undefined>;
|
|
20
|
+
estimateTransactionFee: (params: SubstrateTransferParams) => Promise<AssetValue | undefined>;
|
|
21
|
+
sign: (tx: SubmittableExtrinsic<"promise">) => Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
22
|
+
broadcast: (tx: SubmittableExtrinsic<"promise">, callback?: Callback<ISubmittableResult>) => Promise<string | (() => void)>;
|
|
23
|
+
signAndBroadcast: ({ tx, callback, address, }: {
|
|
24
|
+
tx: SubmittableExtrinsic<"promise">;
|
|
25
|
+
callback?: Callback<ISubmittableResult>;
|
|
26
|
+
address?: string;
|
|
27
|
+
}) => string | Promise<string> | Promise<() => void>;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const ChainflipToolbox: ({ generic, ...signerParams }?: ToolboxParams) => Promise<{
|
|
30
|
+
api: ApiPromise;
|
|
31
|
+
network: SubstrateNetwork;
|
|
32
|
+
gasAsset: AssetValue;
|
|
33
|
+
decodeAddress: typeof decodeAddress;
|
|
34
|
+
encodeAddress: typeof encodeAddress;
|
|
35
|
+
convertAddress: typeof convertAddress;
|
|
36
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
37
|
+
createKeyring: (phrase: string) => Promise<KeyringPair>;
|
|
38
|
+
getAddress: (keyring?: IKeyringPair | Signer) => string | undefined;
|
|
39
|
+
createTransaction: (params: GenericCreateTransactionParams) => SubmittableExtrinsic<"promise", ISubmittableResult> | undefined;
|
|
40
|
+
validateAddress: (address: string) => boolean;
|
|
41
|
+
transfer: (params: SubstrateTransferParams) => Promise<string | undefined>;
|
|
42
|
+
estimateTransactionFee: (params: SubstrateTransferParams) => Promise<AssetValue | undefined>;
|
|
43
|
+
sign: (tx: SubmittableExtrinsic<"promise">) => Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
44
|
+
broadcast: (tx: SubmittableExtrinsic<"promise">, callback?: Callback<ISubmittableResult>) => Promise<string | (() => void)>;
|
|
45
|
+
signAndBroadcast: ({ tx, callback, address, }: {
|
|
46
|
+
tx: SubmittableExtrinsic<"promise">;
|
|
47
|
+
callback?: Callback<ISubmittableResult>;
|
|
48
|
+
address?: string;
|
|
49
|
+
}) => string | Promise<string> | Promise<() => void>;
|
|
50
|
+
}>;
|
|
51
|
+
export type SubstrateToolboxes = {
|
|
52
|
+
DOT: Awaited<ReturnType<typeof PolkadotToolbox>>;
|
|
53
|
+
FLIP: Awaited<ReturnType<typeof ChainflipToolbox>>;
|
|
54
|
+
};
|
|
55
|
+
export declare function getSubstrateToolbox<T extends SubstrateChain>(chain: T, params?: ToolboxParams): Promise<{
|
|
56
|
+
api: ApiPromise;
|
|
57
|
+
network: SubstrateNetwork;
|
|
58
|
+
gasAsset: AssetValue;
|
|
59
|
+
decodeAddress: typeof decodeAddress;
|
|
60
|
+
encodeAddress: typeof encodeAddress;
|
|
61
|
+
convertAddress: typeof convertAddress;
|
|
62
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
63
|
+
createKeyring: (phrase: string) => Promise<KeyringPair>;
|
|
64
|
+
getAddress: (keyring?: IKeyringPair | Signer) => string | undefined;
|
|
65
|
+
createTransaction: (params: GenericCreateTransactionParams) => SubmittableExtrinsic<"promise", ISubmittableResult> | undefined;
|
|
66
|
+
validateAddress: (address: string) => boolean;
|
|
67
|
+
transfer: (params: SubstrateTransferParams) => Promise<string | undefined>;
|
|
68
|
+
estimateTransactionFee: (params: SubstrateTransferParams) => Promise<AssetValue | undefined>;
|
|
69
|
+
sign: (tx: SubmittableExtrinsic<"promise">) => Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
70
|
+
broadcast: (tx: SubmittableExtrinsic<"promise">, callback?: Callback<ISubmittableResult>) => Promise<string | (() => void)>;
|
|
71
|
+
signAndBroadcast: ({ tx, callback, address, }: {
|
|
72
|
+
tx: SubmittableExtrinsic<"promise">;
|
|
73
|
+
callback?: Callback<ISubmittableResult>;
|
|
74
|
+
address?: string;
|
|
75
|
+
}) => string | Promise<string> | Promise<() => void>;
|
|
76
|
+
}>;
|
|
77
|
+
export declare function isKeyringPair(account: IKeyringPair | Signer): account is IKeyringPair;
|
|
78
|
+
export declare function createKeyring(phrase: string, networkPrefix: number): Promise<KeyringPair>;
|
|
79
|
+
declare function convertAddress(address: string, newPrefix: number): string;
|
|
80
|
+
declare function decodeAddress(address: string, networkPrefix?: number): Uint8Array<ArrayBufferLike>;
|
|
81
|
+
declare function encodeAddress(address: Uint8Array, encoding?: "ss58" | "hex", networkPrefix?: number): string;
|
|
82
|
+
export declare const BaseSubstrateToolbox: ({ api, network, gasAsset, signer, chain, }: {
|
|
83
|
+
api: ApiPromise;
|
|
84
|
+
network: SubstrateNetwork;
|
|
85
|
+
gasAsset: AssetValue;
|
|
86
|
+
signer?: IKeyringPair | Signer;
|
|
87
|
+
chain?: SubstrateChain;
|
|
88
|
+
}) => {
|
|
89
|
+
api: ApiPromise;
|
|
90
|
+
network: SubstrateNetwork;
|
|
91
|
+
gasAsset: AssetValue;
|
|
92
|
+
decodeAddress: typeof decodeAddress;
|
|
93
|
+
encodeAddress: typeof encodeAddress;
|
|
94
|
+
convertAddress: typeof convertAddress;
|
|
95
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
96
|
+
createKeyring: (phrase: string) => Promise<KeyringPair>;
|
|
97
|
+
getAddress: (keyring?: IKeyringPair | Signer) => string | undefined;
|
|
98
|
+
createTransaction: (params: GenericCreateTransactionParams) => SubmittableExtrinsic<"promise", ISubmittableResult> | undefined;
|
|
99
|
+
validateAddress: (address: string) => boolean;
|
|
100
|
+
transfer: (params: SubstrateTransferParams) => Promise<string | undefined>;
|
|
101
|
+
estimateTransactionFee: (params: SubstrateTransferParams) => Promise<AssetValue | undefined>;
|
|
102
|
+
sign: (tx: SubmittableExtrinsic<"promise">) => Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
103
|
+
broadcast: (tx: SubmittableExtrinsic<"promise">, callback?: Callback<ISubmittableResult>) => Promise<string | (() => void)>;
|
|
104
|
+
signAndBroadcast: ({ tx, callback, address, }: {
|
|
105
|
+
tx: SubmittableExtrinsic<"promise">;
|
|
106
|
+
callback?: Callback<ISubmittableResult>;
|
|
107
|
+
address?: string;
|
|
108
|
+
}) => string | Promise<string> | Promise<() => void>;
|
|
109
|
+
};
|
|
110
|
+
export declare const substrateValidateAddress: ({ address, chain, }: {
|
|
111
|
+
address: string;
|
|
112
|
+
chain: Chain.Polkadot | Chain.Chainflip;
|
|
113
|
+
}) => boolean;
|
|
114
|
+
export declare function createSubstrateToolbox({ generic, chain, ...signerParams }: ToolboxParams & {
|
|
115
|
+
chain: SubstrateChain;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
api: ApiPromise;
|
|
118
|
+
network: SubstrateNetwork;
|
|
119
|
+
gasAsset: AssetValue;
|
|
120
|
+
decodeAddress: typeof decodeAddress;
|
|
121
|
+
encodeAddress: typeof encodeAddress;
|
|
122
|
+
convertAddress: typeof convertAddress;
|
|
123
|
+
getBalance: (address: string) => Promise<AssetValue[]>;
|
|
124
|
+
createKeyring: (phrase: string) => Promise<KeyringPair>;
|
|
125
|
+
getAddress: (keyring?: IKeyringPair | Signer) => string | undefined;
|
|
126
|
+
createTransaction: (params: GenericCreateTransactionParams) => SubmittableExtrinsic<"promise", ISubmittableResult> | undefined;
|
|
127
|
+
validateAddress: (address: string) => boolean;
|
|
128
|
+
transfer: (params: SubstrateTransferParams) => Promise<string | undefined>;
|
|
129
|
+
estimateTransactionFee: (params: SubstrateTransferParams) => Promise<AssetValue | undefined>;
|
|
130
|
+
sign: (tx: SubmittableExtrinsic<"promise">) => Promise<SubmittableExtrinsic<"promise", ISubmittableResult>>;
|
|
131
|
+
broadcast: (tx: SubmittableExtrinsic<"promise">, callback?: Callback<ISubmittableResult>) => Promise<string | (() => void)>;
|
|
132
|
+
signAndBroadcast: ({ tx, callback, address, }: {
|
|
133
|
+
tx: SubmittableExtrinsic<"promise">;
|
|
134
|
+
callback?: Callback<ISubmittableResult>;
|
|
135
|
+
address?: string;
|
|
136
|
+
}) => string | Promise<string> | Promise<() => void>;
|
|
137
|
+
}>;
|
|
138
|
+
export type ToolboxParams = {
|
|
139
|
+
generic?: boolean;
|
|
140
|
+
} & ({
|
|
141
|
+
signer?: KeyringPair | Signer;
|
|
142
|
+
} | {
|
|
143
|
+
phrase?: string;
|
|
144
|
+
derivationPath?: DerivationPathArray;
|
|
145
|
+
index?: number;
|
|
146
|
+
});
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=substrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"substrate.d.ts","sourceRoot":"","sources":["../../../src/substrate/substrate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAA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AC,EAAE,mBAAmB,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CACJ,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Signer as InjectedSigner } from "@polkadot/api/types";
|
|
2
|
+
import type { ProviderInterface } from "@polkadot/rpc-provider/types";
|
|
3
|
+
import type { ExtDef } from "@polkadot/types/extrinsic/signedExtensions/types";
|
|
4
|
+
import type { KeypairType } from "@polkadot/util-crypto/types";
|
|
5
|
+
import type { GenericTransferParams, SubstrateChain } from "@swapkit/helpers";
|
|
6
|
+
declare const polkadotNetwork: {
|
|
7
|
+
prefix: number;
|
|
8
|
+
network: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
symbols: string[];
|
|
11
|
+
decimals: number[];
|
|
12
|
+
standardAccount: string;
|
|
13
|
+
website: string;
|
|
14
|
+
};
|
|
15
|
+
declare const chainflipNetwork: {
|
|
16
|
+
prefix: number;
|
|
17
|
+
network: string;
|
|
18
|
+
displayName: string;
|
|
19
|
+
symbols: string[];
|
|
20
|
+
decimals: number[];
|
|
21
|
+
standardAccount: string;
|
|
22
|
+
website: string;
|
|
23
|
+
};
|
|
24
|
+
declare const subtrateNetwork: {
|
|
25
|
+
prefix: number;
|
|
26
|
+
network: string;
|
|
27
|
+
displayName: string;
|
|
28
|
+
symbols: never[];
|
|
29
|
+
decimals: never[];
|
|
30
|
+
standardAccount: string;
|
|
31
|
+
website: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const SubstrateNetwork: Record<SubstrateChain | "GENERIC", SubstrateNetwork>;
|
|
34
|
+
export type SubstrateNetwork = typeof polkadotNetwork | typeof chainflipNetwork | typeof subtrateNetwork;
|
|
35
|
+
export type SubstrateTransferParams = GenericTransferParams & {
|
|
36
|
+
sender?: string;
|
|
37
|
+
};
|
|
38
|
+
type Unsubcall = () => void;
|
|
39
|
+
interface InjectedAccount {
|
|
40
|
+
address: string;
|
|
41
|
+
genesisHash?: string | null;
|
|
42
|
+
name?: string;
|
|
43
|
+
type?: KeypairType;
|
|
44
|
+
}
|
|
45
|
+
interface InjectedAccounts {
|
|
46
|
+
get: (anyType?: boolean) => Promise<InjectedAccount[]>;
|
|
47
|
+
subscribe: (cb: (accounts: InjectedAccount[]) => void | Promise<void>) => Unsubcall;
|
|
48
|
+
}
|
|
49
|
+
interface InjectedExtensionInfo {
|
|
50
|
+
name: string;
|
|
51
|
+
version: string;
|
|
52
|
+
}
|
|
53
|
+
interface ProviderMeta {
|
|
54
|
+
network: string;
|
|
55
|
+
node: "full" | "light";
|
|
56
|
+
source: string;
|
|
57
|
+
transport: string;
|
|
58
|
+
}
|
|
59
|
+
interface MetadataDefBase {
|
|
60
|
+
chain: string;
|
|
61
|
+
genesisHash: string;
|
|
62
|
+
icon: string;
|
|
63
|
+
ss58Format: number;
|
|
64
|
+
chainType?: "substrate" | "ethereum";
|
|
65
|
+
}
|
|
66
|
+
interface MetadataDef extends MetadataDefBase {
|
|
67
|
+
color?: string;
|
|
68
|
+
specVersion: number;
|
|
69
|
+
tokenDecimals: number;
|
|
70
|
+
tokenSymbol: string;
|
|
71
|
+
types: Record<string, Record<string, string> | string>;
|
|
72
|
+
metaCalls?: string;
|
|
73
|
+
userExtensions?: ExtDef;
|
|
74
|
+
}
|
|
75
|
+
interface InjectedMetadataKnown {
|
|
76
|
+
genesisHash: string;
|
|
77
|
+
specVersion: number;
|
|
78
|
+
}
|
|
79
|
+
interface InjectedMetadata {
|
|
80
|
+
get: () => Promise<InjectedMetadataKnown[]>;
|
|
81
|
+
provide: (definition: MetadataDef) => Promise<boolean>;
|
|
82
|
+
}
|
|
83
|
+
type ProviderList = Record<string, ProviderMeta>;
|
|
84
|
+
interface InjectedProvider extends ProviderInterface {
|
|
85
|
+
listProviders: () => Promise<ProviderList>;
|
|
86
|
+
startProvider: (key: string) => Promise<ProviderMeta>;
|
|
87
|
+
}
|
|
88
|
+
type InjectedWalletData = {
|
|
89
|
+
accounts: InjectedAccounts;
|
|
90
|
+
metadata?: InjectedMetadata;
|
|
91
|
+
provider?: InjectedProvider;
|
|
92
|
+
signer: InjectedSigner;
|
|
93
|
+
};
|
|
94
|
+
export type SubstrateInjectedExtension = Record<string, {
|
|
95
|
+
connect?: (origin: string) => Promise<InjectedExtensionInfo & InjectedWalletData>;
|
|
96
|
+
enable?: (origin: string) => Promise<InjectedWalletData>;
|
|
97
|
+
version?: string;
|
|
98
|
+
}>;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/substrate/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9E,QAAA,MAAM,eAAe;;;;;;;;CAQpB,CAAC;AAEF,QAAA,MAAM,gBAAgB;;;;;;;;CAQrB,CAAC;AAEF,QAAA,MAAM,eAAe;;;;;;;;CAQpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,GAAG,SAAS,EAAE,gBAAgB,CAIjF,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,OAAO,eAAe,GACtB,OAAO,gBAAgB,GACvB,OAAO,eAAe,CAAC;AAE3B,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GAAG;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,SAAS,GAAG,MAAM,IAAI,CAAC;AAE5B,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM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,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC5C,OAAO,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AACD,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAEjD,UAAU,gBAAiB,SAAQ,iBAAiB;IAClD,aAAa,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3C,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACvD;AAED,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAC7C,MAAM,EACN;IACE,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,GAAG,kBAAkB,CAAC,CAAC;IAClF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CACF,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export declare const trc20ABI: readonly [{
|
|
2
|
+
readonly constant: true;
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly name: "_owner";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly name: "balanceOf";
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly name: "balance";
|
|
10
|
+
readonly type: "uint256";
|
|
11
|
+
}];
|
|
12
|
+
readonly stateMutability: "view";
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
}, {
|
|
15
|
+
readonly constant: false;
|
|
16
|
+
readonly inputs: readonly [{
|
|
17
|
+
readonly name: "_to";
|
|
18
|
+
readonly type: "address";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "_value";
|
|
21
|
+
readonly type: "uint256";
|
|
22
|
+
}];
|
|
23
|
+
readonly name: "transfer";
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly name: "success";
|
|
26
|
+
readonly type: "bool";
|
|
27
|
+
}];
|
|
28
|
+
readonly stateMutability: "nonpayable";
|
|
29
|
+
readonly type: "function";
|
|
30
|
+
}, {
|
|
31
|
+
readonly constant: true;
|
|
32
|
+
readonly inputs: readonly [];
|
|
33
|
+
readonly name: "decimals";
|
|
34
|
+
readonly outputs: readonly [{
|
|
35
|
+
readonly name: "";
|
|
36
|
+
readonly type: "uint8";
|
|
37
|
+
}];
|
|
38
|
+
readonly stateMutability: "view";
|
|
39
|
+
readonly type: "function";
|
|
40
|
+
}, {
|
|
41
|
+
readonly constant: true;
|
|
42
|
+
readonly inputs: readonly [];
|
|
43
|
+
readonly name: "symbol";
|
|
44
|
+
readonly outputs: readonly [{
|
|
45
|
+
readonly name: "";
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
}];
|
|
48
|
+
readonly stateMutability: "view";
|
|
49
|
+
readonly type: "function";
|
|
50
|
+
}, {
|
|
51
|
+
readonly constant: true;
|
|
52
|
+
readonly inputs: readonly [];
|
|
53
|
+
readonly name: "name";
|
|
54
|
+
readonly outputs: readonly [{
|
|
55
|
+
readonly name: "";
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
}];
|
|
58
|
+
readonly stateMutability: "view";
|
|
59
|
+
readonly type: "function";
|
|
60
|
+
}, {
|
|
61
|
+
readonly constant: true;
|
|
62
|
+
readonly inputs: readonly [{
|
|
63
|
+
readonly name: "_owner";
|
|
64
|
+
readonly type: "address";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "_spender";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}];
|
|
69
|
+
readonly name: "allowance";
|
|
70
|
+
readonly outputs: readonly [{
|
|
71
|
+
readonly name: "remaining";
|
|
72
|
+
readonly type: "uint256";
|
|
73
|
+
}];
|
|
74
|
+
readonly stateMutability: "view";
|
|
75
|
+
readonly type: "function";
|
|
76
|
+
}, {
|
|
77
|
+
readonly constant: false;
|
|
78
|
+
readonly inputs: readonly [{
|
|
79
|
+
readonly name: "_spender";
|
|
80
|
+
readonly type: "address";
|
|
81
|
+
}, {
|
|
82
|
+
readonly name: "_value";
|
|
83
|
+
readonly type: "uint256";
|
|
84
|
+
}];
|
|
85
|
+
readonly name: "approve";
|
|
86
|
+
readonly outputs: readonly [{
|
|
87
|
+
readonly name: "success";
|
|
88
|
+
readonly type: "bool";
|
|
89
|
+
}];
|
|
90
|
+
readonly stateMutability: "nonpayable";
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
}, {
|
|
93
|
+
readonly constant: true;
|
|
94
|
+
readonly inputs: readonly [];
|
|
95
|
+
readonly name: "totalSupply";
|
|
96
|
+
readonly outputs: readonly [{
|
|
97
|
+
readonly name: "";
|
|
98
|
+
readonly type: "uint256";
|
|
99
|
+
}];
|
|
100
|
+
readonly stateMutability: "view";
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
}, {
|
|
103
|
+
readonly constant: false;
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly name: "_from";
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "_to";
|
|
109
|
+
readonly type: "address";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "_value";
|
|
112
|
+
readonly type: "uint256";
|
|
113
|
+
}];
|
|
114
|
+
readonly name: "transferFrom";
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly name: "success";
|
|
117
|
+
readonly type: "bool";
|
|
118
|
+
}];
|
|
119
|
+
readonly stateMutability: "nonpayable";
|
|
120
|
+
readonly type: "function";
|
|
121
|
+
}, {
|
|
122
|
+
readonly anonymous: false;
|
|
123
|
+
readonly inputs: readonly [{
|
|
124
|
+
readonly indexed: true;
|
|
125
|
+
readonly name: "_from";
|
|
126
|
+
readonly type: "address";
|
|
127
|
+
}, {
|
|
128
|
+
readonly indexed: true;
|
|
129
|
+
readonly name: "_to";
|
|
130
|
+
readonly type: "address";
|
|
131
|
+
}, {
|
|
132
|
+
readonly indexed: false;
|
|
133
|
+
readonly name: "_value";
|
|
134
|
+
readonly type: "uint256";
|
|
135
|
+
}];
|
|
136
|
+
readonly name: "Transfer";
|
|
137
|
+
readonly type: "event";
|
|
138
|
+
}, {
|
|
139
|
+
readonly anonymous: false;
|
|
140
|
+
readonly inputs: readonly [{
|
|
141
|
+
readonly indexed: true;
|
|
142
|
+
readonly name: "_owner";
|
|
143
|
+
readonly type: "address";
|
|
144
|
+
}, {
|
|
145
|
+
readonly indexed: true;
|
|
146
|
+
readonly name: "_spender";
|
|
147
|
+
readonly type: "address";
|
|
148
|
+
}, {
|
|
149
|
+
readonly indexed: false;
|
|
150
|
+
readonly name: "_value";
|
|
151
|
+
readonly type: "uint256";
|
|
152
|
+
}];
|
|
153
|
+
readonly name: "Approval";
|
|
154
|
+
readonly type: "event";
|
|
155
|
+
}];
|
|
156
|
+
//# sourceMappingURL=trc20.abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trc20.abi.d.ts","sourceRoot":"","sources":["../../../../src/tron/helpers/trc20.abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GX,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch account information including TRC20 balances from TronGrid API
|
|
3
|
+
*/
|
|
4
|
+
export declare function fetchAccountFromTronGrid(address: string): Promise<{
|
|
5
|
+
balance: number;
|
|
6
|
+
trc20: import("../types").TronGridTRC20Balance;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
//# sourceMappingURL=trongrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trongrid.d.ts","sourceRoot":"","sources":["../../../../src/tron/helpers/trongrid.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM;;;eA+C7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createTronToolbox, getTronAddressValidator, getTronPrivateKeyFromMnemonic, } from "./toolbox";
|
|
2
|
+
export type { TronSigner, TronToolboxOptions, TronTransferParams, TronContract, TronTransaction, TronSignedTransaction, TronCreateTransactionParams, ApproveParams, ApprovedParams, IsApprovedParams, } from "./types";
|
|
3
|
+
export { trc20ABI } from "./helpers/trc20.abi";
|
|
4
|
+
import type { createTronToolbox } from "./toolbox";
|
|
5
|
+
export type TronWallet = Awaited<ReturnType<typeof createTronToolbox>>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tron/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,2BAA2B,EAC3B,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC"}
|