@swapkit/toolboxes 4.28.4 → 5.1.0

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +17 -20
  2. package/dist/chunk-55jkfkar.js +2 -0
  3. package/dist/{chunk-ap5mzmjf.js → chunk-v9dcj9m7.js} +1 -1
  4. package/dist/src/aptos/index.js +1 -1
  5. package/dist/src/cosmos/index.js +1 -1
  6. package/dist/src/evm/index.js +1 -1
  7. package/dist/src/hypercore/index.js +1 -1
  8. package/dist/src/index.js +1 -1
  9. package/dist/src/near/index.js +1 -1
  10. package/dist/src/ripple/index.js +1 -1
  11. package/dist/src/solana/index.js +1 -1
  12. package/dist/src/stellar/index.js +1 -1
  13. package/dist/src/ton/index.js +1 -1
  14. package/dist/src/tron/index.js +1 -1
  15. package/dist/src/utxo/index.js +1 -1
  16. package/dist/types/aptos/toolbox.d.ts +5 -5
  17. package/dist/types/aptos/types.d.ts +4 -0
  18. package/dist/types/cosmos/thorchainUtils/messages.d.ts +30 -6
  19. package/dist/types/cosmos/thorchainUtils/registry.d.ts +72 -2
  20. package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts +6 -1
  21. package/dist/types/cosmos/toolbox/cosmos.d.ts +9 -11
  22. package/dist/types/cosmos/toolbox/thorchain.d.ts +83 -14
  23. package/dist/types/cosmos/types.d.ts +69 -3
  24. package/dist/types/cosmos/util.d.ts +150 -6
  25. package/dist/types/hypercore/__tests__/fixtures.d.ts +40 -0
  26. package/dist/types/hypercore/helpers.d.ts +12 -1
  27. package/dist/types/hypercore/index.d.ts +1 -0
  28. package/dist/types/hypercore/payin.d.ts +16 -0
  29. package/dist/types/hypercore/signing.d.ts +91 -0
  30. package/dist/types/hypercore/toolbox.d.ts +69 -6
  31. package/dist/types/hypercore/types.d.ts +25 -5
  32. package/dist/types/ripple/index.d.ts +5 -1
  33. package/dist/types/solana/index.d.ts +2 -0
  34. package/dist/types/solana/toolbox.d.ts +1 -1
  35. package/dist/types/ton/toolbox.d.ts +2 -0
  36. package/dist/types/tron/toolbox.d.ts +1 -1
  37. package/dist/types/tron/types.d.ts +2 -0
  38. package/package.json +22 -96
  39. package/dist/chunk-btth5bse.js +0 -1
  40. package/dist/chunk-z61r1327.js +0 -2
  41. package/dist/src/aleo/index.cjs +0 -1
  42. package/dist/src/aptos/index.cjs +0 -1
  43. package/dist/src/cardano/index.cjs +0 -1
  44. package/dist/src/cosmos/index.cjs +0 -1
  45. package/dist/src/evm/index.cjs +0 -1
  46. package/dist/src/hypercore/index.cjs +0 -1
  47. package/dist/src/index.cjs +0 -1
  48. package/dist/src/near/index.cjs +0 -1
  49. package/dist/src/radix/index.cjs +0 -1
  50. package/dist/src/ripple/index.cjs +0 -1
  51. package/dist/src/solana/index.cjs +0 -1
  52. package/dist/src/starknet/index.cjs +0 -1
  53. package/dist/src/stellar/index.cjs +0 -1
  54. package/dist/src/substrate/index.cjs +0 -1
  55. package/dist/src/sui/index.cjs +0 -1
  56. package/dist/src/ton/index.cjs +0 -1
  57. package/dist/src/tron/index.cjs +0 -1
  58. package/dist/src/utxo/index.cjs +0 -1
@@ -9,7 +9,18 @@ export declare function buildUpdateIsolatedMarginAction({ asset, isBuy, ntli, }:
9
9
  export declare function buildTopUpIsolatedOnlyMarginAction({ asset, leverage, }: Omit<HyperCoreTopUpIsolatedOnlyMarginAction, "type">): HyperCoreTopUpIsolatedOnlyMarginAction;
10
10
  export declare function buildScheduleCancelAction({ time, }: Omit<HyperCoreScheduleCancelAction, "type">): HyperCoreScheduleCancelAction;
11
11
  export declare function buildUsdClassTransferAction({ amount, hyperliquidChain, nonce, signatureChainId, toPerp, }: Omit<HyperCoreUsdClassTransferAction, "type">): HyperCoreUsdClassTransferAction;
12
- export declare function buildSendAssetAction({ amount, destination, destinationDex, fromSubAccount, hyperliquidChain, nonce, signatureChainId, sourceDex, token, }: Omit<HyperCoreSendAssetAction, "type">): HyperCoreSendAssetAction;
12
+ export declare function buildSendAssetAction({ amount, destination, destinationDex, fromSubAccount, hyperliquidChain, nonce, signatureChainId, sourceDex, token, }: Omit<HyperCoreSendAssetAction, "type">): {
13
+ amount: string;
14
+ destination: string;
15
+ destinationDex: string;
16
+ fromSubAccount: string;
17
+ hyperliquidChain: "Mainnet" | undefined;
18
+ nonce: number;
19
+ signatureChainId: string | undefined;
20
+ sourceDex: string;
21
+ token: string;
22
+ type: "sendAsset";
23
+ };
13
24
  export declare function buildApproveAgentAction({ agentAddress, agentName, hyperliquidChain, nonce, signatureChainId, }: Omit<HyperCoreApproveAgentAction, "type">): HyperCoreApproveAgentAction;
14
25
  export declare function buildApproveBuilderFeeAction({ builder, hyperliquidChain, maxFeeRate, nonce, signatureChainId, }: Omit<HyperCoreApproveBuilderFeeAction, "type">): HyperCoreApproveBuilderFeeAction;
15
26
  export declare function buildTokenDelegateAction({ hyperliquidChain, isUndelegate, nonce, signatureChainId, validator, wei, }: Omit<HyperCoreTokenDelegateAction, "type">): HyperCoreTokenDelegateAction;
@@ -1,5 +1,6 @@
1
1
  import type { getHyperCoreToolbox } from "./toolbox";
2
2
  export type HyperCoreWallet = ReturnType<typeof getHyperCoreToolbox>;
3
3
  export * from "./helpers";
4
+ export { HYPERCORE_USDC_TOKEN_ID } from "./payin";
4
5
  export * from "./toolbox";
5
6
  export * from "./types";
@@ -0,0 +1,16 @@
1
+ import { HYPERCORE_USDC_TOKEN_ID } from "@swapkit/helpers/api";
2
+ import type { HyperCoreTypedData } from "./types";
3
+ export { HYPERCORE_USDC_TOKEN_ID };
4
+ interface AssertSendAssetPayloadParams {
5
+ action: Record<string, unknown>;
6
+ allowedEndpoints: string[];
7
+ expectedAmount: string;
8
+ expectedDestination: string;
9
+ expectedFromSubAccount: string;
10
+ expectedSourceDex: "" | "spot";
11
+ expectedToken: string;
12
+ submitTo: string;
13
+ typedData: HyperCoreTypedData;
14
+ }
15
+ export declare function sanitizeTypedDataForSigner<TTypedData extends HyperCoreTypedData>(typedData: TTypedData): TTypedData;
16
+ export declare function assertSendAssetPayload({ action, allowedEndpoints, expectedAmount, expectedDestination, expectedFromSubAccount, expectedSourceDex, expectedToken, submitTo, typedData, }: AssertSendAssetPayloadParams): void;
@@ -1,4 +1,95 @@
1
1
  import type { HyperCoreActionSignature, HyperCoreL1Action, HyperCoreTypedData, HyperCoreUserSignedAction } from "./index";
2
+ export declare const zeroAddress = "0x0000000000000000000000000000000000000000";
3
+ export declare const defaultSignatureChainId = "0xa4b1";
4
+ /** Domain for user-signed actions; `chainId` is stamped per action from its `signatureChainId`. */
5
+ export declare const userSignedDomain: {
6
+ readonly name: "HyperliquidSignTransaction";
7
+ readonly verifyingContract: "0x0000000000000000000000000000000000000000";
8
+ readonly version: "1";
9
+ };
10
+ export declare const userSignedActionTypes: {
11
+ readonly approveAgent: [{
12
+ readonly name: "hyperliquidChain";
13
+ readonly type: "string";
14
+ }, {
15
+ readonly name: "agentAddress";
16
+ readonly type: "address";
17
+ }, {
18
+ readonly name: "agentName";
19
+ readonly type: "string";
20
+ }, {
21
+ readonly name: "nonce";
22
+ readonly type: "uint64";
23
+ }];
24
+ readonly approveBuilderFee: [{
25
+ readonly name: "hyperliquidChain";
26
+ readonly type: "string";
27
+ }, {
28
+ readonly name: "maxFeeRate";
29
+ readonly type: "string";
30
+ }, {
31
+ readonly name: "builder";
32
+ readonly type: "address";
33
+ }, {
34
+ readonly name: "nonce";
35
+ readonly type: "uint64";
36
+ }];
37
+ readonly sendAsset: [{
38
+ readonly name: "hyperliquidChain";
39
+ readonly type: "string";
40
+ }, {
41
+ readonly name: "destination";
42
+ readonly type: "string";
43
+ }, {
44
+ readonly name: "sourceDex";
45
+ readonly type: "string";
46
+ }, {
47
+ readonly name: "destinationDex";
48
+ readonly type: "string";
49
+ }, {
50
+ readonly name: "token";
51
+ readonly type: "string";
52
+ }, {
53
+ readonly name: "amount";
54
+ readonly type: "string";
55
+ }, {
56
+ readonly name: "fromSubAccount";
57
+ readonly type: "string";
58
+ }, {
59
+ readonly name: "nonce";
60
+ readonly type: "uint64";
61
+ }];
62
+ readonly tokenDelegate: [{
63
+ readonly name: "hyperliquidChain";
64
+ readonly type: "string";
65
+ }, {
66
+ readonly name: "validator";
67
+ readonly type: "address";
68
+ }, {
69
+ readonly name: "wei";
70
+ readonly type: "uint64";
71
+ }, {
72
+ readonly name: "isUndelegate";
73
+ readonly type: "bool";
74
+ }, {
75
+ readonly name: "nonce";
76
+ readonly type: "uint64";
77
+ }];
78
+ readonly usdClassTransfer: [{
79
+ readonly name: "hyperliquidChain";
80
+ readonly type: "string";
81
+ }, {
82
+ readonly name: "amount";
83
+ readonly type: "string";
84
+ }, {
85
+ readonly name: "toPerp";
86
+ readonly type: "bool";
87
+ }, {
88
+ readonly name: "nonce";
89
+ readonly type: "uint64";
90
+ }];
91
+ };
92
+ export declare const primaryTypes: Record<HyperCoreUserSignedAction["type"], string>;
2
93
  export declare function getL1TypedData(connectionId: string): HyperCoreTypedData;
3
94
  export declare function getUserSignedTypedData<TAction extends HyperCoreUserSignedAction>(action: TAction): HyperCoreTypedData;
4
95
  export declare function getSignatureValues(signatureHex: string): HyperCoreActionSignature;
@@ -1,7 +1,7 @@
1
1
  import type { ChainSigner, DerivationPathArray } from "@swapkit/helpers";
2
2
  import { AssetValue } from "@swapkit/helpers";
3
3
  import { type Signer } from "ethers";
4
- import type { HyperCoreCreateTransactionParams, HyperCoreFill, HyperCoreL1Action, HyperCoreL1RequestParams, HyperCoreOpenOrder, HyperCoreOrderStatusResponse, HyperCoreSignedRequest, HyperCoreTransferParams, HyperCoreTransferTransaction, HyperCoreUnsignedL1ActionRequest, HyperCoreUnsignedRequest, HyperCoreUnsignedUserSignedActionRequest, HyperCoreUserFillsByTimeQueryParams, HyperCoreUserFillsQueryParams, HyperCoreUserSignedAction, HyperCoreUserSignedRequestParams, HyperCoreUserStateQueryParams } from "./index";
4
+ import type { HyperCoreCreateSendAssetTransactionParams, HyperCoreCreateTransactionParams, HyperCoreFill, HyperCoreL1Action, HyperCoreL1RequestParams, HyperCoreOpenOrder, HyperCoreOrderStatusResponse, HyperCoreSendAssetPayinParams, HyperCoreSignedRequest, HyperCoreTransferParams, HyperCoreUnsignedL1ActionRequest, HyperCoreUnsignedRequest, HyperCoreUnsignedUserSignedActionRequest, HyperCoreUserFillsByTimeQueryParams, HyperCoreUserFillsQueryParams, HyperCoreUserSignedAction, HyperCoreUserSignedRequestParams, HyperCoreUserStateQueryParams } from "./index";
5
5
  type HyperCoreSigner = ChainSigner<HyperCoreTransferParams, string> & Pick<Signer, "getAddress" | "signTypedData">;
6
6
  type HyperCoreToolboxParams = {
7
7
  derivationPath?: DerivationPathArray;
@@ -11,11 +11,12 @@ type HyperCoreToolboxParams = {
11
11
  } | {
12
12
  signer: HyperCoreSigner;
13
13
  };
14
- type HyperliquidSpotBalance = {
14
+ export interface HyperliquidSpotBalance {
15
15
  coin?: string;
16
+ hold?: string;
16
17
  token?: number | string;
17
18
  total?: string;
18
- };
19
+ }
19
20
  type HyperliquidSpotStateResponse = {
20
21
  balances?: HyperliquidSpotBalance[];
21
22
  spotState?: {
@@ -43,8 +44,67 @@ declare function getOrderStatus({ oidOrCloid, user }: {
43
44
  declare function getUserFills({ aggregateByTime, user }: HyperCoreUserFillsQueryParams): Promise<HyperCoreFill[]>;
44
45
  declare function getUserFillsByTime({ aggregateByTime, endTime, startTime, user }: HyperCoreUserFillsByTimeQueryParams): Promise<HyperCoreFill[]>;
45
46
  export declare function createL1ActionRequest<TAction extends HyperCoreL1Action>({ action, expiresAfter, nonce, vaultAddress, }: HyperCoreL1RequestParams<TAction>): Promise<HyperCoreUnsignedL1ActionRequest<TAction>>;
46
- export declare function createUserSignedActionRequest<TAction extends HyperCoreUserSignedAction>({ action, nonce, signatureChainId, }: HyperCoreUserSignedRequestParams<TAction>): Promise<HyperCoreUnsignedUserSignedActionRequest<TAction>>;
47
- export declare function createTransaction({ assetValue, recipient, sender, signatureChainId: customSignatureChainId, sweep, time, }: HyperCoreCreateTransactionParams): Promise<HyperCoreTransferTransaction>;
47
+ export declare function createUserSignedActionRequest<TAction extends HyperCoreUserSignedAction>({ action, endpoint, nonce, signatureChainId, }: HyperCoreUserSignedRequestParams<TAction>): Promise<HyperCoreUnsignedUserSignedActionRequest<TAction>>;
48
+ export declare function createTransaction({ assetValue, recipient, sender, signatureChainId: customSignatureChainId, sweep, time, endpoint: providedEndpoint, }: HyperCoreCreateTransactionParams): Promise<{
49
+ action: {
50
+ amount: string;
51
+ destination: string;
52
+ hyperliquidChain: "Mainnet";
53
+ signatureChainId: string;
54
+ time: number;
55
+ token: string;
56
+ type: "spotSend";
57
+ };
58
+ endpoint: string;
59
+ nonce: number;
60
+ typedData: {
61
+ domain: {
62
+ chainId: number;
63
+ name: string;
64
+ verifyingContract: string;
65
+ version: string;
66
+ };
67
+ message: {
68
+ amount: string;
69
+ destination: string;
70
+ hyperliquidChain: "Mainnet";
71
+ signatureChainId: string;
72
+ time: number;
73
+ token: string;
74
+ };
75
+ primaryType: string;
76
+ types: {
77
+ [x: string]: [{
78
+ readonly name: "hyperliquidChain";
79
+ readonly type: "string";
80
+ }, {
81
+ readonly name: "destination";
82
+ readonly type: "string";
83
+ }, {
84
+ readonly name: "token";
85
+ readonly type: "string";
86
+ }, {
87
+ readonly name: "amount";
88
+ readonly type: "string";
89
+ }, {
90
+ readonly name: "time";
91
+ readonly type: "uint64";
92
+ }];
93
+ };
94
+ };
95
+ }>;
96
+ export declare function createSendAssetTransaction({ assetValue, destinationDex, endpoint, fromSubAccount, recipient, sender, signatureChainId: customSignatureChainId, sourceDex, sweep, time, }: HyperCoreCreateSendAssetTransactionParams): Promise<HyperCoreUnsignedUserSignedActionRequest<{
97
+ amount: string;
98
+ destination: string;
99
+ destinationDex: string;
100
+ fromSubAccount: string;
101
+ hyperliquidChain: "Mainnet" | undefined;
102
+ nonce: number;
103
+ signatureChainId: string | undefined;
104
+ sourceDex: string;
105
+ token: string;
106
+ type: "sendAsset";
107
+ }>>;
48
108
  declare function broadcastTransaction(signed: HyperCoreSignedRequest): Promise<{
49
109
  response?: {
50
110
  data?: {
@@ -57,11 +117,13 @@ export declare function validateHyperCoreAddress(address: string): boolean;
57
117
  export declare function getHyperCoreToolbox(toolboxParams?: HyperCoreToolboxParams): {
58
118
  broadcastTransaction: typeof broadcastTransaction;
59
119
  createL1ActionRequest: typeof createL1ActionRequest;
120
+ createSendAssetTransaction: typeof createSendAssetTransaction;
60
121
  createTransaction: typeof createTransaction;
61
122
  createUserSignedActionRequest: typeof createUserSignedActionRequest;
62
123
  estimateTransactionFee: () => AssetValue;
63
124
  getAddress: () => Promise<string>;
64
- getBalance: (address: string) => Promise<AssetValue[]>;
125
+ getBalance: (address: string, scamFilter?: boolean) => Promise<AssetValue[]>;
126
+ getBalanceFromChain: (address: string) => Promise<AssetValue[]>;
65
127
  getState: {
66
128
  clearinghouse: typeof getClearinghouseState;
67
129
  frontendOpenOrders: typeof getFrontendOpenOrders;
@@ -71,6 +133,7 @@ export declare function getHyperCoreToolbox(toolboxParams?: HyperCoreToolboxPara
71
133
  userFills: typeof getUserFills;
72
134
  userFillsByTime: typeof getUserFillsByTime;
73
135
  };
136
+ signAndBroadcastSendAsset: (params: HyperCoreSendAssetPayinParams) => Promise<string>;
74
137
  signTransaction: (request: HyperCoreUnsignedRequest) => Promise<HyperCoreSignedRequest>;
75
138
  transfer: ({ sweep, ...params }: HyperCoreTransferParams) => Promise<string>;
76
139
  validateAddress: typeof validateHyperCoreAddress;
@@ -1,14 +1,21 @@
1
1
  import type { GenericCreateTransactionParams } from "@swapkit/helpers";
2
2
  import type { TypedDataDomain, TypedDataField } from "ethers";
3
- export type HyperCoreCreateTransactionParams = Omit<GenericCreateTransactionParams, "sweep"> & {
3
+ export interface HyperCoreCreateTransactionParams extends Omit<GenericCreateTransactionParams, "sweep"> {
4
+ /** Pre-resolved exchange endpoint; when provided, skips the getExchangeEndpoint round-trip. */
5
+ endpoint?: string;
4
6
  signatureChainId?: string;
5
- /** Drains the full spot token balance to another HyperCore account. Withdrawing off the exchange is out of scope. */
7
+ /** Drains the available spot balance (total minus hold) to another HyperCore account; withdrawals out of scope. */
6
8
  sweep?: boolean;
7
9
  time?: number;
8
- };
9
- export type HyperCoreTransferParams = Omit<HyperCoreCreateTransactionParams, "feeRate" | "sender"> & {
10
+ }
11
+ export interface HyperCoreCreateSendAssetTransactionParams extends HyperCoreCreateTransactionParams {
12
+ destinationDex?: string;
13
+ fromSubAccount?: string;
14
+ sourceDex?: string;
15
+ }
16
+ export interface HyperCoreTransferParams extends Omit<HyperCoreCreateSendAssetTransactionParams, "feeRate" | "sender"> {
10
17
  sender?: string;
11
- };
18
+ }
12
19
  export type HyperCoreTransferActionType = HyperCoreTransferAction["type"];
13
20
  type HyperCoreTransferActionBase = {
14
21
  amount: string;
@@ -159,6 +166,7 @@ export type HyperCoreL1RequestParams<TAction extends HyperCoreL1Action = HyperCo
159
166
  };
160
167
  export type HyperCoreUserSignedRequestParams<TAction extends HyperCoreUserSignedAction = HyperCoreUserSignedAction> = {
161
168
  action: TAction;
169
+ endpoint?: string;
162
170
  nonce?: number;
163
171
  signatureChainId?: string;
164
172
  };
@@ -228,6 +236,18 @@ export type HyperCoreTransferTransaction = {
228
236
  nonce: number;
229
237
  typedData: HyperCoreTypedData;
230
238
  };
239
+ export interface HyperCoreSendAssetPayinParams {
240
+ action: Omit<HyperCoreSendAssetAction, "hyperliquidChain"> & {
241
+ hyperliquidChain?: string;
242
+ };
243
+ expectedAmount: string;
244
+ expectedDestination: string;
245
+ expectedFromSubAccount: string;
246
+ expectedSourceDex: "" | "spot";
247
+ expectedToken: string;
248
+ submitTo: string;
249
+ typedData: HyperCoreTypedData;
250
+ }
231
251
  export type HyperCoreUnsignedL1ActionRequest<TAction extends HyperCoreL1Action = HyperCoreL1Action> = {
232
252
  action: TAction;
233
253
  endpoint: string;
@@ -54,7 +54,7 @@ type RippleToolboxParams = {
54
54
  export declare function getRippleToolbox(params?: RippleToolboxParams): {
55
55
  broadcastTransaction: (signedTxHex: string) => Promise<string>;
56
56
  createSigner: typeof createSigner;
57
- createTransaction: ({ assetValue, recipient, memo, sender, sweep, destinationTag, extendBySeconds, }: {
57
+ createTransaction: ({ assetValue, recipient, memo, sender, sweep, destinationTag, extendBySeconds, sequence, fee, lastLedgerSequence, }: {
58
58
  assetValue: AssetValue;
59
59
  recipient: string;
60
60
  sender?: string;
@@ -62,6 +62,10 @@ export declare function getRippleToolbox(params?: RippleToolboxParams): {
62
62
  sweep?: boolean;
63
63
  destinationTag?: number;
64
64
  extendBySeconds?: number;
65
+ /** Pre-fetched fields; any provided value lets `autofill` skip its corresponding lookup. */
66
+ sequence?: number;
67
+ fee?: string;
68
+ lastLedgerSequence?: number;
65
69
  }) => Promise<Payment>;
66
70
  disconnect: () => void;
67
71
  estimateTransactionFee: () => Promise<AssetValue>;
@@ -16,6 +16,8 @@ export interface SolanaProvider {
16
16
  }
17
17
  export type SolanaCreateTransactionParams = Omit<GenericCreateTransactionParams, "feeRate"> & {
18
18
  isProgramDerivedAddress?: boolean;
19
+ /** Pre-fetched recent blockhash; when provided, skips the getLatestBlockhash round-trip. */
20
+ recentBlockhash?: string;
19
21
  };
20
22
  export type SolanaTransferParams = Omit<GenericTransferParams, "feeRate"> & {
21
23
  isProgramDerivedAddress?: boolean;
@@ -23,7 +23,7 @@ export declare function getSolanaToolbox(toolboxParams?: {
23
23
  }): {
24
24
  broadcastTransaction: (transaction: Transaction | VersionedTransaction) => Promise<string>;
25
25
  createKeysForPath: typeof createKeysForPath;
26
- createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, sweep, }: SolanaCreateTransactionParams) => Promise<Transaction>;
26
+ createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, recentBlockhash, sweep, }: SolanaCreateTransactionParams) => Promise<Transaction>;
27
27
  createTransactionFromInstructions: typeof createTransactionFromInstructions;
28
28
  estimateTransactionFee: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, }: Omit<GenericCreateTransactionParams, "feeRate"> & {
29
29
  isProgramDerivedAddress?: boolean;
@@ -5,6 +5,8 @@ export declare function getTONToolbox(toolboxParams?: TONToolboxParams): {
5
5
  broadcastTransaction: (transferCell: Cell) => Promise<string>;
6
6
  createTransaction: ({ sender, sweep, ...params }: GenericTransferParams & {
7
7
  sender?: string;
8
+ sweep?: boolean;
9
+ jettonWalletAddress?: string;
8
10
  }) => Promise<TONToolboxTransaction>;
9
11
  estimateTransactionFee: ({ sender, ...params }: GenericTransferParams & {
10
12
  sender?: string;
@@ -13,7 +13,7 @@ export declare function getTronPrivateKeyFromMnemonic({ phrase, derivationPath:
13
13
  export declare function getTronToolbox(options?: TronToolboxOptions): {
14
14
  approve: ({ assetAddress, spenderAddress, amount, from }: TronApproveParams) => Promise<string>;
15
15
  broadcastTransaction: typeof broadcastTronTransaction;
16
- createTransaction: ({ recipient, assetValue, memo, sender, expiration, sweep, }: TronCreateTransactionParams) => Promise<TronTransaction>;
16
+ createTransaction: ({ recipient, assetValue, memo, sender, expiration, sweep, recipientExists: providedRecipientExists, }: TronCreateTransactionParams) => Promise<TronTransaction>;
17
17
  estimateTransactionFee: ({ assetValue, memo, recipient, sender, }: TronTransferParams & {
18
18
  sender?: string;
19
19
  }) => Promise<AssetValue>;
@@ -48,6 +48,8 @@ export interface TronTransferParams extends GenericTransferParams {
48
48
  }
49
49
  export interface TronCreateTransactionParams extends Omit<GenericCreateTransactionParams, "feeRate"> {
50
50
  expiration?: number;
51
+ /** Whether the recipient account already exists; when provided, skips the account lookup (TRC20 only). */
52
+ recipientExists?: boolean;
51
53
  }
52
54
  export type TronApproveParams = {
53
55
  assetAddress: string;
package/package.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
- "dependencies": { "@swapkit/helpers": "4.20.5", "@swapkit/utxo-signer": "2.3.0" },
2
+ "dependencies": { "@swapkit/helpers": "5.0.1", "@swapkit/utxo-signer": "3.0.0" },
3
3
  "description": "SwapKit - Toolboxes",
4
4
  "devDependencies": {
5
5
  "@aptos-labs/ts-sdk": "7.0.1",
6
- "@cosmjs/amino": "0.39.0",
7
- "@cosmjs/crypto": "0.39.0",
8
- "@cosmjs/proto-signing": "0.39.0",
9
- "@cosmjs/stargate": "0.39.0",
10
6
  "@mysten/sui": "2.17.0",
11
7
  "@near-js/accounts": "2.5.1",
12
8
  "@near-js/crypto": "2.5.1",
@@ -38,6 +34,7 @@
38
34
  "@stricahq/bip32ed25519": "1.1.2",
39
35
  "@stricahq/cbors": "1.0.4",
40
36
  "@stricahq/typhonjs": "3.1.0",
37
+ "@swapkit/cosmos-signer": "0.2.0",
41
38
  "@ton/core": "0.63.1",
42
39
  "@ton/crypto": "3.3.0",
43
40
  "@ton/ton": "16.2.4",
@@ -56,92 +53,24 @@
56
53
  "xrpl": "4.6.0"
57
54
  },
58
55
  "exports": {
59
- ".": { "default": "./dist/src/index.js", "require": "./dist/src/index.cjs", "types": "./dist/types/index.d.ts" },
60
- "./aleo": {
61
- "default": "./dist/src/aleo/index.js",
62
- "require": "./dist/src/aleo/index.cjs",
63
- "types": "./dist/types/aleo/index.d.ts"
64
- },
65
- "./aptos": {
66
- "default": "./dist/src/aptos/index.js",
67
- "require": "./dist/src/aptos/index.cjs",
68
- "types": "./dist/types/aptos/index.d.ts"
69
- },
70
- "./cardano": {
71
- "default": "./dist/src/cardano/index.js",
72
- "require": "./dist/src/cardano/index.cjs",
73
- "types": "./dist/types/cardano/index.d.ts"
74
- },
75
- "./cosmos": {
76
- "default": "./dist/src/cosmos/index.js",
77
- "require": "./dist/src/cosmos/index.cjs",
78
- "types": "./dist/types/cosmos/index.d.ts"
79
- },
80
- "./evm": {
81
- "default": "./dist/src/evm/index.js",
82
- "require": "./dist/src/evm/index.cjs",
83
- "types": "./dist/types/evm/index.d.ts"
84
- },
85
- "./hypercore": {
86
- "default": "./dist/src/hypercore/index.js",
87
- "require": "./dist/src/hypercore/index.cjs",
88
- "types": "./dist/types/hypercore/index.d.ts"
89
- },
90
- "./near": {
91
- "default": "./dist/src/near/index.js",
92
- "require": "./dist/src/near/index.cjs",
93
- "types": "./dist/types/near/index.d.ts"
94
- },
95
- "./radix": {
96
- "default": "./dist/src/radix/index.js",
97
- "require": "./dist/src/radix/index.cjs",
98
- "types": "./dist/types/radix/index.d.ts"
99
- },
100
- "./ripple": {
101
- "default": "./dist/src/ripple/index.js",
102
- "require": "./dist/src/ripple/index.cjs",
103
- "types": "./dist/types/ripple/index.d.ts"
104
- },
105
- "./solana": {
106
- "default": "./dist/src/solana/index.js",
107
- "require": "./dist/src/solana/index.cjs",
108
- "types": "./dist/types/solana/index.d.ts"
109
- },
110
- "./starknet": {
111
- "default": "./dist/src/starknet/index.js",
112
- "require": "./dist/src/starknet/index.cjs",
113
- "types": "./dist/types/starknet/index.d.ts"
114
- },
115
- "./stellar": {
116
- "default": "./dist/src/stellar/index.js",
117
- "require": "./dist/src/stellar/index.cjs",
118
- "types": "./dist/types/stellar/index.d.ts"
119
- },
120
- "./substrate": {
121
- "default": "./dist/src/substrate/index.js",
122
- "require": "./dist/src/substrate/index.cjs",
123
- "types": "./dist/types/substrate/index.d.ts"
124
- },
125
- "./sui": {
126
- "default": "./dist/src/sui/index.js",
127
- "require": "./dist/src/sui/index.cjs",
128
- "types": "./dist/types/sui/index.d.ts"
129
- },
130
- "./ton": {
131
- "default": "./dist/src/ton/index.js",
132
- "require": "./dist/src/ton/index.cjs",
133
- "types": "./dist/types/ton/index.d.ts"
134
- },
135
- "./tron": {
136
- "default": "./dist/src/tron/index.js",
137
- "require": "./dist/src/tron/index.cjs",
138
- "types": "./dist/types/tron/index.d.ts"
139
- },
140
- "./utxo": {
141
- "default": "./dist/src/utxo/index.js",
142
- "require": "./dist/src/utxo/index.cjs",
143
- "types": "./dist/types/utxo/index.d.ts"
144
- }
56
+ ".": { "default": "./dist/src/index.js", "types": "./dist/types/index.d.ts" },
57
+ "./aleo": { "default": "./dist/src/aleo/index.js", "types": "./dist/types/aleo/index.d.ts" },
58
+ "./aptos": { "default": "./dist/src/aptos/index.js", "types": "./dist/types/aptos/index.d.ts" },
59
+ "./cardano": { "default": "./dist/src/cardano/index.js", "types": "./dist/types/cardano/index.d.ts" },
60
+ "./cosmos": { "default": "./dist/src/cosmos/index.js", "types": "./dist/types/cosmos/index.d.ts" },
61
+ "./evm": { "default": "./dist/src/evm/index.js", "types": "./dist/types/evm/index.d.ts" },
62
+ "./hypercore": { "default": "./dist/src/hypercore/index.js", "types": "./dist/types/hypercore/index.d.ts" },
63
+ "./near": { "default": "./dist/src/near/index.js", "types": "./dist/types/near/index.d.ts" },
64
+ "./radix": { "default": "./dist/src/radix/index.js", "types": "./dist/types/radix/index.d.ts" },
65
+ "./ripple": { "default": "./dist/src/ripple/index.js", "types": "./dist/types/ripple/index.d.ts" },
66
+ "./solana": { "default": "./dist/src/solana/index.js", "types": "./dist/types/solana/index.d.ts" },
67
+ "./starknet": { "default": "./dist/src/starknet/index.js", "types": "./dist/types/starknet/index.d.ts" },
68
+ "./stellar": { "default": "./dist/src/stellar/index.js", "types": "./dist/types/stellar/index.d.ts" },
69
+ "./substrate": { "default": "./dist/src/substrate/index.js", "types": "./dist/types/substrate/index.d.ts" },
70
+ "./sui": { "default": "./dist/src/sui/index.js", "types": "./dist/types/sui/index.d.ts" },
71
+ "./ton": { "default": "./dist/src/ton/index.js", "types": "./dist/types/ton/index.d.ts" },
72
+ "./tron": { "default": "./dist/src/tron/index.js", "types": "./dist/types/tron/index.d.ts" },
73
+ "./utxo": { "default": "./dist/src/utxo/index.js", "types": "./dist/types/utxo/index.d.ts" }
145
74
  },
146
75
  "files": ["dist/", "CHANGELOG.md"],
147
76
  "homepage": "https://github.com/swapkit/SwapKit",
@@ -149,10 +78,6 @@
149
78
  "name": "@swapkit/toolboxes",
150
79
  "peerDependencies": {
151
80
  "@aptos-labs/ts-sdk": "7.0.1",
152
- "@cosmjs/amino": "0.39.0",
153
- "@cosmjs/crypto": "0.39.0",
154
- "@cosmjs/proto-signing": "0.39.0",
155
- "@cosmjs/stargate": "0.39.0",
156
81
  "@mysten/sui": "2.17.0",
157
82
  "@near-js/accounts": "2.5.1",
158
83
  "@near-js/crypto": "2.5.1",
@@ -181,6 +106,7 @@
181
106
  "@stricahq/bip32ed25519": "1.1.2",
182
107
  "@stricahq/cbors": "1.0.4",
183
108
  "@stricahq/typhonjs": "3.1.0",
109
+ "@swapkit/cosmos-signer": "0.2.0",
184
110
  "@ton/core": "0.63.1",
185
111
  "@ton/crypto": "3.3.0",
186
112
  "@ton/ton": "16.2.4",
@@ -205,5 +131,5 @@
205
131
  "type-check:go": "tsgo"
206
132
  },
207
133
  "type": "module",
208
- "version": "4.28.4"
134
+ "version": "5.1.0"
209
135
  }
@@ -1 +0,0 @@
1
- import"./chunk-xbdjxeqd.js";import Y from"protobufjs/minimal.js";var X=Y.Reader,J=Y.Writer,Q=Y.util,L=Y.roots.default||(Y.roots.default={});L.common=(()=>{let Z={};return Z.Asset=(()=>{function G(H){if(H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.chain="",G.prototype.symbol="",G.prototype.ticker="",G.prototype.synth=!1,G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.chain!=null&&Object.hasOwnProperty.call(q,"chain"))B.uint32(10).string(q.chain);if(q.symbol!=null&&Object.hasOwnProperty.call(q,"symbol"))B.uint32(18).string(q.symbol);if(q.ticker!=null&&Object.hasOwnProperty.call(q,"ticker"))B.uint32(26).string(q.ticker);if(q.synth!=null&&Object.hasOwnProperty.call(q,"synth"))B.uint32(32).bool(q.synth);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.Asset;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.chain=q.string();break;case 2:E.symbol=q.string();break;case 3:E.ticker=q.string();break;case 4:E.synth=q.bool();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.chain!=null&&q.hasOwnProperty("chain")){if(!Q.isString(q.chain))return"chain: string expected"}if(q.symbol!=null&&q.hasOwnProperty("symbol")){if(!Q.isString(q.symbol))return"symbol: string expected"}if(q.ticker!=null&&q.hasOwnProperty("ticker")){if(!Q.isString(q.ticker))return"ticker: string expected"}if(q.synth!=null&&q.hasOwnProperty("synth")){if(typeof q.synth!=="boolean")return"synth: boolean expected"}return null},G.fromObject=function(q){if(q instanceof L.common.Asset)return q;let B=new L.common.Asset;if(q.chain!=null)B.chain=String(q.chain);if(q.symbol!=null)B.symbol=String(q.symbol);if(q.ticker!=null)B.ticker=String(q.ticker);if(q.synth!=null)B.synth=Boolean(q.synth);return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.defaults)z.chain="",z.symbol="",z.ticker="",z.synth=!1;if(q.chain!=null&&q.hasOwnProperty("chain"))z.chain=q.chain;if(q.symbol!=null&&q.hasOwnProperty("symbol"))z.symbol=q.symbol;if(q.ticker!=null&&q.hasOwnProperty("ticker"))z.ticker=q.ticker;if(q.synth!=null&&q.hasOwnProperty("synth"))z.synth=q.synth;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.Coin=(()=>{function G(H){if(H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.asset=null,G.prototype.amount="",G.prototype.decimals=Q.Long?Q.Long.fromBits(0,0,!1):0,G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.asset!=null&&Object.hasOwnProperty.call(q,"asset"))L.common.Asset.encode(q.asset,B.uint32(10).fork()).ldelim();if(q.amount!=null&&Object.hasOwnProperty.call(q,"amount"))B.uint32(18).string(q.amount);if(q.decimals!=null&&Object.hasOwnProperty.call(q,"decimals"))B.uint32(24).int64(q.decimals);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.Coin;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.asset=L.common.Asset.decode(q,q.uint32());break;case 2:E.amount=q.string();break;case 3:E.decimals=q.int64();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.asset!=null&&q.hasOwnProperty("asset")){let B=L.common.Asset.verify(q.asset);if(B)return"asset."+B}if(q.amount!=null&&q.hasOwnProperty("amount")){if(!Q.isString(q.amount))return"amount: string expected"}if(q.decimals!=null&&q.hasOwnProperty("decimals")){if(!Q.isInteger(q.decimals)&&!(q.decimals&&Q.isInteger(q.decimals.low)&&Q.isInteger(q.decimals.high)))return"decimals: integer|Long expected"}return null},G.fromObject=function(q){if(q instanceof L.common.Coin)return q;let B=new L.common.Coin;if(q.asset!=null){if(typeof q.asset!=="object")throw TypeError(".common.Coin.asset: object expected");B.asset=L.common.Asset.fromObject(q.asset)}if(q.amount!=null)B.amount=String(q.amount);if(q.decimals!=null){if(Q.Long)(B.decimals=Q.Long.fromValue(q.decimals)).unsigned=!1;else if(typeof q.decimals==="string")B.decimals=Number.parseInt(q.decimals,10);else if(typeof q.decimals==="number")B.decimals=q.decimals;else if(typeof q.decimals==="object")B.decimals=new Q.LongBits(q.decimals.low>>>0,q.decimals.high>>>0).toNumber()}return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.defaults)if(z.asset=null,z.amount="",Q.Long){let E=new Q.Long(0,0,!1);z.decimals=B.longs===String?E.toString():B.longs===Number?E.toNumber():E}else z.decimals=B.longs===String?"0":0;if(q.asset!=null&&q.hasOwnProperty("asset"))z.asset=L.common.Asset.toObject(q.asset,B);if(q.amount!=null&&q.hasOwnProperty("amount"))z.amount=q.amount;if(q.decimals!=null&&q.hasOwnProperty("decimals"))if(typeof q.decimals==="number")z.decimals=B.longs===String?String(q.decimals):q.decimals;else z.decimals=B.longs===String?Q.Long.prototype.toString.call(q.decimals):B.longs===Number?new Q.LongBits(q.decimals.low>>>0,q.decimals.high>>>0).toNumber():q.decimals;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.PubKeySet=(()=>{function G(H){if(H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.secp256k1="",G.prototype.ed25519="",G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.secp256k1!=null&&Object.hasOwnProperty.call(q,"secp256k1"))B.uint32(10).string(q.secp256k1);if(q.ed25519!=null&&Object.hasOwnProperty.call(q,"ed25519"))B.uint32(18).string(q.ed25519);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.PubKeySet;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.secp256k1=q.string();break;case 2:E.ed25519=q.string();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.secp256k1!=null&&q.hasOwnProperty("secp256k1")){if(!Q.isString(q.secp256k1))return"secp256k1: string expected"}if(q.ed25519!=null&&q.hasOwnProperty("ed25519")){if(!Q.isString(q.ed25519))return"ed25519: string expected"}return null},G.fromObject=function(q){if(q instanceof L.common.PubKeySet)return q;let B=new L.common.PubKeySet;if(q.secp256k1!=null)B.secp256k1=String(q.secp256k1);if(q.ed25519!=null)B.ed25519=String(q.ed25519);return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.defaults)z.secp256k1="",z.ed25519="";if(q.secp256k1!=null&&q.hasOwnProperty("secp256k1"))z.secp256k1=q.secp256k1;if(q.ed25519!=null&&q.hasOwnProperty("ed25519"))z.ed25519=q.ed25519;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.Tx=(()=>{function G(H){if(this.coins=[],this.gas=[],H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.id="",G.prototype.chain="",G.prototype.fromAddress="",G.prototype.toAddress="",G.prototype.coins=Q.emptyArray,G.prototype.gas=Q.emptyArray,G.prototype.memo="",G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.id!=null&&Object.hasOwnProperty.call(q,"id"))B.uint32(10).string(q.id);if(q.chain!=null&&Object.hasOwnProperty.call(q,"chain"))B.uint32(18).string(q.chain);if(q.fromAddress!=null&&Object.hasOwnProperty.call(q,"fromAddress"))B.uint32(26).string(q.fromAddress);if(q.toAddress!=null&&Object.hasOwnProperty.call(q,"toAddress"))B.uint32(34).string(q.toAddress);if(q.coins?.length)for(let z=0;z<q.coins.length;++z)L.common.Coin.encode(q.coins[z],B.uint32(42).fork()).ldelim();if(q.gas?.length)for(let z=0;z<q.gas.length;++z)L.common.Coin.encode(q.gas[z],B.uint32(50).fork()).ldelim();if(q.memo!=null&&Object.hasOwnProperty.call(q,"memo"))B.uint32(58).string(q.memo);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.Tx;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.id=q.string();break;case 2:E.chain=q.string();break;case 3:E.fromAddress=q.string();break;case 4:E.toAddress=q.string();break;case 5:if(!E.coins?.length)E.coins=[];E.coins.push(L.common.Coin.decode(q,q.uint32()));break;case 6:if(!E.gas?.length)E.gas=[];E.gas.push(L.common.Coin.decode(q,q.uint32()));break;case 7:E.memo=q.string();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.id!=null&&q.hasOwnProperty("id")){if(!Q.isString(q.id))return"id: string expected"}if(q.chain!=null&&q.hasOwnProperty("chain")){if(!Q.isString(q.chain))return"chain: string expected"}if(q.fromAddress!=null&&q.hasOwnProperty("fromAddress")){if(!Q.isString(q.fromAddress))return"fromAddress: string expected"}if(q.toAddress!=null&&q.hasOwnProperty("toAddress")){if(!Q.isString(q.toAddress))return"toAddress: string expected"}if(q.coins!=null&&q.hasOwnProperty("coins")){if(!Array.isArray(q.coins))return"coins: array expected";for(let B=0;B<q.coins.length;++B){let z=L.common.Coin.verify(q.coins[B]);if(z)return"coins."+z}}if(q.gas!=null&&q.hasOwnProperty("gas")){if(!Array.isArray(q.gas))return"gas: array expected";for(let B=0;B<q.gas.length;++B){let z=L.common.Coin.verify(q.gas[B]);if(z)return"gas."+z}}if(q.memo!=null&&q.hasOwnProperty("memo")){if(!Q.isString(q.memo))return"memo: string expected"}return null},G.fromObject=function(q){if(q instanceof L.common.Tx)return q;let B=new L.common.Tx;if(q.id!=null)B.id=String(q.id);if(q.chain!=null)B.chain=String(q.chain);if(q.fromAddress!=null)B.fromAddress=String(q.fromAddress);if(q.toAddress!=null)B.toAddress=String(q.toAddress);if(q.coins){if(!Array.isArray(q.coins))throw TypeError(".common.Tx.coins: array expected");B.coins=[];for(let z=0;z<q.coins.length;++z){if(typeof q.coins[z]!=="object")throw TypeError(".common.Tx.coins: object expected");B.coins[z]=L.common.Coin.fromObject(q.coins[z])}}if(q.gas){if(!Array.isArray(q.gas))throw TypeError(".common.Tx.gas: array expected");B.gas=[];for(let z=0;z<q.gas.length;++z){if(typeof q.gas[z]!=="object")throw TypeError(".common.Tx.gas: object expected");B.gas[z]=L.common.Coin.fromObject(q.gas[z])}}if(q.memo!=null)B.memo=String(q.memo);return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.arrays||B.defaults)z.coins=[],z.gas=[];if(B.defaults)z.id="",z.chain="",z.fromAddress="",z.toAddress="",z.memo="";if(q.id!=null&&q.hasOwnProperty("id"))z.id=q.id;if(q.chain!=null&&q.hasOwnProperty("chain"))z.chain=q.chain;if(q.fromAddress!=null&&q.hasOwnProperty("fromAddress"))z.fromAddress=q.fromAddress;if(q.toAddress!=null&&q.hasOwnProperty("toAddress"))z.toAddress=q.toAddress;if(q.coins?.length){z.coins=[];for(let E=0;E<q.coins.length;++E)z.coins[E]=L.common.Coin.toObject(q.coins[E],B)}if(q.gas?.length){z.gas=[];for(let E=0;E<q.gas.length;++E)z.gas[E]=L.common.Coin.toObject(q.gas[E],B)}if(q.memo!=null&&q.hasOwnProperty("memo"))z.memo=q.memo;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.Fee=(()=>{function G(H){if(this.coins=[],H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.coins=Q.emptyArray,G.prototype.poolDeduct="",G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.coins?.length)for(let z=0;z<q.coins.length;++z)L.common.Coin.encode(q.coins[z],B.uint32(10).fork()).ldelim();if(q.poolDeduct!=null&&Object.hasOwnProperty.call(q,"poolDeduct"))B.uint32(18).string(q.poolDeduct);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.Fee;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:if(!E.coins?.length)E.coins=[];E.coins.push(L.common.Coin.decode(q,q.uint32()));break;case 2:E.poolDeduct=q.string();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.coins!=null&&q.hasOwnProperty("coins")){if(!Array.isArray(q.coins))return"coins: array expected";for(let B=0;B<q.coins.length;++B){let z=L.common.Coin.verify(q.coins[B]);if(z)return"coins."+z}}if(q.poolDeduct!=null&&q.hasOwnProperty("poolDeduct")){if(!Q.isString(q.poolDeduct))return"poolDeduct: string expected"}return null},G.fromObject=function(q){if(q instanceof L.common.Fee)return q;let B=new L.common.Fee;if(q.coins){if(!Array.isArray(q.coins))throw TypeError(".common.Fee.coins: array expected");B.coins=[];for(let z=0;z<q.coins.length;++z){if(typeof q.coins[z]!=="object")throw TypeError(".common.Fee.coins: object expected");B.coins[z]=L.common.Coin.fromObject(q.coins[z])}}if(q.poolDeduct!=null)B.poolDeduct=String(q.poolDeduct);return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.arrays||B.defaults)z.coins=[];if(B.defaults)z.poolDeduct="";if(q.coins?.length){z.coins=[];for(let E=0;E<q.coins.length;++E)z.coins[E]=L.common.Coin.toObject(q.coins[E],B)}if(q.poolDeduct!=null&&q.hasOwnProperty("poolDeduct"))z.poolDeduct=q.poolDeduct;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.ProtoUint=(()=>{function G(H){if(H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.value="",G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.value!=null&&Object.hasOwnProperty.call(q,"value"))B.uint32(10).string(q.value);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.common.ProtoUint;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.value=q.string();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.value!=null&&q.hasOwnProperty("value")){if(!Q.isString(q.value))return"value: string expected"}return null},G.fromObject=function(q){if(q instanceof L.common.ProtoUint)return q;let B=new L.common.ProtoUint;if(q.value!=null)B.value=String(q.value);return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.defaults)z.value="";if(q.value!=null&&q.hasOwnProperty("value"))z.value=q.value;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z})();L.types=(()=>{let Z={};return Z.MsgDeposit=(()=>{function G(H){if(this.coins=[],H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.coins=Q.emptyArray,G.prototype.memo="",G.prototype.signer=Q.newBuffer([]),G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.coins?.length)for(let z=0;z<q.coins.length;++z)L.common.Coin.encode(q.coins[z],B.uint32(10).fork()).ldelim();if(q.memo!=null&&Object.hasOwnProperty.call(q,"memo"))B.uint32(18).string(q.memo);if(q.signer!=null&&Object.hasOwnProperty.call(q,"signer"))B.uint32(26).bytes(q.signer);return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.types.MsgDeposit;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:if(!E.coins?.length)E.coins=[];E.coins.push(L.common.Coin.decode(q,q.uint32()));break;case 2:E.memo=q.string();break;case 3:E.signer=q.bytes();break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.coins!=null&&q.hasOwnProperty("coins")){if(!Array.isArray(q.coins))return"coins: array expected";for(let B=0;B<q.coins.length;++B){let z=L.common.Coin.verify(q.coins[B]);if(z)return"coins."+z}}if(q.memo!=null&&q.hasOwnProperty("memo")){if(!Q.isString(q.memo))return"memo: string expected"}if(q.signer!=null&&q.hasOwnProperty("signer")){if(!(q.signer&&typeof q.signer.length==="number"||Q.isString(q.signer)))return"signer: buffer expected"}return null},G.fromObject=function(q){if(q instanceof L.types.MsgDeposit)return q;let B=new L.types.MsgDeposit;if(q.coins){if(!Array.isArray(q.coins))throw TypeError(".types.MsgDeposit.coins: array expected");B.coins=[];for(let z=0;z<q.coins.length;++z){if(typeof q.coins[z]!=="object")throw TypeError(".types.MsgDeposit.coins: object expected");B.coins[z]=L.common.Coin.fromObject(q.coins[z])}}if(q.memo!=null)B.memo=String(q.memo);if(q.signer!=null){if(typeof q.signer==="string")Q.base64.decode(q.signer,B.signer=Q.newBuffer(Q.base64.length(q.signer)),0);else if(q.signer.length)B.signer=q.signer}return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.arrays||B.defaults)z.coins=[];if(B.defaults){if(z.memo="",B.bytes===String)z.signer="";else if(z.signer=[],B.bytes!==Array)z.signer=Q.newBuffer(z.signer)}if(q.coins?.length){z.coins=[];for(let E=0;E<q.coins.length;++E)z.coins[E]=L.common.Coin.toObject(q.coins[E],B)}if(q.memo!=null&&q.hasOwnProperty("memo"))z.memo=q.memo;if(q.signer!=null&&q.hasOwnProperty("signer"))z.signer=B.bytes===String?Q.base64.encode(q.signer,0,q.signer.length):B.bytes===Array?Array.prototype.slice.call(q.signer):q.signer;return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z.MsgSend=(()=>{function G(H){if(this.amount=[],H){for(let q=Object.keys(H),B=0;B<q.length;++B)if(H[q[B]]!=null)this[q[B]]=H[q[B]]}}return G.prototype.fromAddress=Q.newBuffer([]),G.prototype.toAddress=Q.newBuffer([]),G.prototype.amount=Q.emptyArray,G.create=function(q){return new G(q)},G.encode=function(q,B){if(!B)B=J.create();if(q.fromAddress!=null&&Object.hasOwnProperty.call(q,"fromAddress"))B.uint32(10).bytes(q.fromAddress);if(q.toAddress!=null&&Object.hasOwnProperty.call(q,"toAddress"))B.uint32(18).bytes(q.toAddress);if(q.amount?.length)for(let z=0;z<q.amount.length;++z)L.cosmos.base.v1beta1.Coin.encode(q.amount[z],B.uint32(26).fork()).ldelim();return B},G.encodeDelimited=function(q,B){return this.encode(q,B).ldelim()},G.decode=function(q,B){if(!(q instanceof X))q=X.create(q);let z=B===void 0?q.len:q.pos+B,E=new L.types.MsgSend;while(q.pos<z){let V=q.uint32();switch(V>>>3){case 1:E.fromAddress=q.bytes();break;case 2:E.toAddress=q.bytes();break;case 3:if(!E.amount?.length)E.amount=[];E.amount.push(L.cosmos.base.v1beta1.Coin.decode(q,q.uint32()));break;default:q.skipType(V&7);break}}return E},G.decodeDelimited=function(q){if(!(q instanceof X))q=new X(q);return this.decode(q,q.uint32())},G.verify=function(q){if(typeof q!=="object"||q===null)return"object expected";if(q.fromAddress!=null&&q.hasOwnProperty("fromAddress")){if(!(q.fromAddress&&typeof q.fromAddress.length==="number"||Q.isString(q.fromAddress)))return"fromAddress: buffer expected"}if(q.toAddress!=null&&q.hasOwnProperty("toAddress")){if(!(q.toAddress&&typeof q.toAddress.length==="number"||Q.isString(q.toAddress)))return"toAddress: buffer expected"}if(q.amount!=null&&q.hasOwnProperty("amount")){if(!Array.isArray(q.amount))return"amount: array expected";for(let B=0;B<q.amount.length;++B){let z=L.cosmos.base.v1beta1.Coin.verify(q.amount[B]);if(z)return"amount."+z}}return null},G.fromObject=function(q){if(q instanceof L.types.MsgSend)return q;let B=new L.types.MsgSend;if(q.fromAddress!=null){if(typeof q.fromAddress==="string")Q.base64.decode(q.fromAddress,B.fromAddress=Q.newBuffer(Q.base64.length(q.fromAddress)),0);else if(q.fromAddress.length)B.fromAddress=q.fromAddress}if(q.toAddress!=null){if(typeof q.toAddress==="string")Q.base64.decode(q.toAddress,B.toAddress=Q.newBuffer(Q.base64.length(q.toAddress)),0);else if(q.toAddress.length)B.toAddress=q.toAddress}if(q.amount){if(!Array.isArray(q.amount))throw TypeError(".types.MsgSend.amount: array expected");B.amount=[];for(let z=0;z<q.amount.length;++z){if(typeof q.amount[z]!=="object")throw TypeError(".types.MsgSend.amount: object expected");B.amount[z]=L.cosmos.base.v1beta1.Coin.fromObject(q.amount[z])}}return B},G.toObject=function(q,B){if(!B)B={};let z={};if(B.arrays||B.defaults)z.amount=[];if(B.defaults){if(B.bytes===String)z.fromAddress="";else if(z.fromAddress=[],B.bytes!==Array)z.fromAddress=Q.newBuffer(z.fromAddress);if(B.bytes===String)z.toAddress="";else if(z.toAddress=[],B.bytes!==Array)z.toAddress=Q.newBuffer(z.toAddress)}if(q.fromAddress!=null&&q.hasOwnProperty("fromAddress"))z.fromAddress=B.bytes===String?Q.base64.encode(q.fromAddress,0,q.fromAddress.length):B.bytes===Array?Array.prototype.slice.call(q.fromAddress):q.fromAddress;if(q.toAddress!=null&&q.hasOwnProperty("toAddress"))z.toAddress=B.bytes===String?Q.base64.encode(q.toAddress,0,q.toAddress.length):B.bytes===Array?Array.prototype.slice.call(q.toAddress):q.toAddress;if(q.amount?.length){z.amount=[];for(let E=0;E<q.amount.length;++E)z.amount[E]=L.cosmos.base.v1beta1.Coin.toObject(q.amount[E],B)}return z},G.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},G})(),Z})();L.cosmos=(()=>{let Z={};return Z.base=(()=>{let G={};return G.v1beta1=(()=>{let H={};return H.Coin=(()=>{function q(B){if(B){for(let z=Object.keys(B),E=0;E<z.length;++E)if(B[z[E]]!=null)this[z[E]]=B[z[E]]}}return q.prototype.denom="",q.prototype.amount="",q.create=function(z){return new q(z)},q.encode=function(z,E){if(!E)E=J.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))E.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))E.uint32(18).string(z.amount);return E},q.encodeDelimited=function(z,E){return this.encode(z,E).ldelim()},q.decode=function(z,E){if(!(z instanceof X))z=X.create(z);let V=E===void 0?z.len:z.pos+E,_=new L.cosmos.base.v1beta1.Coin;while(z.pos<V){let N=z.uint32();switch(N>>>3){case 1:_.denom=z.string();break;case 2:_.amount=z.string();break;default:z.skipType(N&7);break}}return _},q.decodeDelimited=function(z){if(!(z instanceof X))z=new X(z);return this.decode(z,z.uint32())},q.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!Q.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!Q.isString(z.amount))return"amount: string expected"}return null},q.fromObject=function(z){if(z instanceof L.cosmos.base.v1beta1.Coin)return z;let E=new L.cosmos.base.v1beta1.Coin;if(z.denom!=null)E.denom=String(z.denom);if(z.amount!=null)E.amount=String(z.amount);return E},q.toObject=function(z,E){if(!E)E={};let V={};if(E.defaults)V.denom="",V.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))V.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))V.amount=z.amount;return V},q.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},q})(),H.DecCoin=(()=>{function q(B){if(B){for(let z=Object.keys(B),E=0;E<z.length;++E)if(B[z[E]]!=null)this[z[E]]=B[z[E]]}}return q.prototype.denom="",q.prototype.amount="",q.create=function(z){return new q(z)},q.encode=function(z,E){if(!E)E=J.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))E.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))E.uint32(18).string(z.amount);return E},q.encodeDelimited=function(z,E){return this.encode(z,E).ldelim()},q.decode=function(z,E){if(!(z instanceof X))z=X.create(z);let V=E===void 0?z.len:z.pos+E,_=new L.cosmos.base.v1beta1.DecCoin;while(z.pos<V){let N=z.uint32();switch(N>>>3){case 1:_.denom=z.string();break;case 2:_.amount=z.string();break;default:z.skipType(N&7);break}}return _},q.decodeDelimited=function(z){if(!(z instanceof X))z=new X(z);return this.decode(z,z.uint32())},q.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!Q.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!Q.isString(z.amount))return"amount: string expected"}return null},q.fromObject=function(z){if(z instanceof L.cosmos.base.v1beta1.DecCoin)return z;let E=new L.cosmos.base.v1beta1.DecCoin;if(z.denom!=null)E.denom=String(z.denom);if(z.amount!=null)E.amount=String(z.amount);return E},q.toObject=function(z,E){if(!E)E={};let V={};if(E.defaults)V.denom="",V.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))V.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))V.amount=z.amount;return V},q.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},q})(),H.IntProto=(()=>{function q(B){if(B){for(let z=Object.keys(B),E=0;E<z.length;++E)if(B[z[E]]!=null)this[z[E]]=B[z[E]]}}return q.prototype.int="",q.create=function(z){return new q(z)},q.encode=function(z,E){if(!E)E=J.create();if(z.int!=null&&Object.hasOwnProperty.call(z,"int"))E.uint32(10).string(z.int);return E},q.encodeDelimited=function(z,E){return this.encode(z,E).ldelim()},q.decode=function(z,E){if(!(z instanceof X))z=X.create(z);let V=E===void 0?z.len:z.pos+E,_=new L.cosmos.base.v1beta1.IntProto;while(z.pos<V){let N=z.uint32();switch(N>>>3){case 1:_.int=z.string();break;default:z.skipType(N&7);break}}return _},q.decodeDelimited=function(z){if(!(z instanceof X))z=new X(z);return this.decode(z,z.uint32())},q.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.int!=null&&z.hasOwnProperty("int")){if(!Q.isString(z.int))return"int: string expected"}return null},q.fromObject=function(z){if(z instanceof L.cosmos.base.v1beta1.IntProto)return z;let E=new L.cosmos.base.v1beta1.IntProto;if(z.int!=null)E.int=String(z.int);return E},q.toObject=function(z,E){if(!E)E={};let V={};if(E.defaults)V.int="";if(z.int!=null&&z.hasOwnProperty("int"))V.int=z.int;return V},q.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},q})(),H.DecProto=(()=>{function q(B){if(B){for(let z=Object.keys(B),E=0;E<z.length;++E)if(B[z[E]]!=null)this[z[E]]=B[z[E]]}}return q.prototype.dec="",q.create=function(z){return new q(z)},q.encode=function(z,E){if(!E)E=J.create();if(z.dec!=null&&Object.hasOwnProperty.call(z,"dec"))E.uint32(10).string(z.dec);return E},q.encodeDelimited=function(z,E){return this.encode(z,E).ldelim()},q.decode=function(z,E){if(!(z instanceof X))z=X.create(z);let V=E===void 0?z.len:z.pos+E,_=new L.cosmos.base.v1beta1.DecProto;while(z.pos<V){let N=z.uint32();switch(N>>>3){case 1:_.dec=z.string();break;default:z.skipType(N&7);break}}return _},q.decodeDelimited=function(z){if(!(z instanceof X))z=new X(z);return this.decode(z,z.uint32())},q.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.dec!=null&&z.hasOwnProperty("dec")){if(!Q.isString(z.dec))return"dec: string expected"}return null},q.fromObject=function(z){if(z instanceof L.cosmos.base.v1beta1.DecProto)return z;let E=new L.cosmos.base.v1beta1.DecProto;if(z.dec!=null)E.dec=String(z.dec);return E},q.toObject=function(z,E){if(!E)E={};let V={};if(E.defaults)V.dec="";if(z.dec!=null&&z.hasOwnProperty("dec"))V.dec=z.dec;return V},q.prototype.toJSON=function(){return this.constructor.toObject(this,Y.util.toJSONOptions)},q})(),H})(),G})(),Z})();export{L as $root};