@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.
Files changed (232) hide show
  1. package/dist/src/cosmos/index.cjs +2 -2
  2. package/dist/src/cosmos/index.cjs.map +10 -6
  3. package/dist/src/cosmos/index.js +2 -2
  4. package/dist/src/cosmos/index.js.map +10 -6
  5. package/dist/src/evm/index.cjs +2 -2
  6. package/dist/src/evm/index.cjs.map +10 -8
  7. package/dist/src/evm/index.js +2 -2
  8. package/dist/src/evm/index.js.map +10 -8
  9. package/dist/src/index.cjs +4 -2
  10. package/dist/src/index.cjs.map +54 -4
  11. package/dist/src/index.js +4 -2
  12. package/dist/src/index.js.map +54 -4
  13. package/dist/src/near/index.cjs +2 -2
  14. package/dist/src/near/index.cjs.map +7 -5
  15. package/dist/src/near/index.js +2 -2
  16. package/dist/src/near/index.js.map +7 -5
  17. package/dist/src/radix/index.cjs +2 -2
  18. package/dist/src/radix/index.cjs.map +2 -2
  19. package/dist/src/radix/index.js +2 -2
  20. package/dist/src/radix/index.js.map +2 -2
  21. package/dist/src/ripple/index.cjs +2 -2
  22. package/dist/src/ripple/index.cjs.map +2 -2
  23. package/dist/src/ripple/index.js +2 -2
  24. package/dist/src/ripple/index.js.map +2 -2
  25. package/dist/src/solana/index.cjs +2 -2
  26. package/dist/src/solana/index.cjs.map +5 -4
  27. package/dist/src/solana/index.js +2 -2
  28. package/dist/src/solana/index.js.map +5 -4
  29. package/dist/src/substrate/index.cjs +2 -2
  30. package/dist/src/substrate/index.cjs.map +6 -5
  31. package/dist/src/substrate/index.js +2 -2
  32. package/dist/src/substrate/index.js.map +6 -5
  33. package/dist/src/tron/index.cjs +2 -2
  34. package/dist/src/tron/index.cjs.map +6 -5
  35. package/dist/src/tron/index.js +2 -2
  36. package/dist/src/tron/index.js.map +6 -5
  37. package/dist/src/utxo/index.cjs +4 -4
  38. package/dist/src/utxo/index.cjs.map +10 -7
  39. package/dist/src/utxo/index.js +4 -4
  40. package/dist/src/utxo/index.js.map +10 -7
  41. package/{src/cosmos/index.ts → dist/types/cosmos/index.d.ts} +1 -0
  42. package/dist/types/cosmos/index.d.ts.map +1 -0
  43. package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts +5 -0
  44. package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts.map +1 -0
  45. package/{src/cosmos/thorchainUtils/index.ts → dist/types/cosmos/thorchainUtils/index.d.ts} +1 -0
  46. package/dist/types/cosmos/thorchainUtils/index.d.ts.map +1 -0
  47. package/dist/types/cosmos/thorchainUtils/messages.d.ts +208 -0
  48. package/dist/types/cosmos/thorchainUtils/messages.d.ts.map +1 -0
  49. package/dist/types/cosmos/thorchainUtils/registry.d.ts +4 -0
  50. package/dist/types/cosmos/thorchainUtils/registry.d.ts.map +1 -0
  51. package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts +2 -0
  52. package/dist/types/cosmos/thorchainUtils/types/MsgCompiled.d.ts.map +1 -0
  53. package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts +66 -0
  54. package/dist/types/cosmos/thorchainUtils/types/client-types.d.ts.map +1 -0
  55. package/dist/types/cosmos/thorchainUtils/types/index.d.ts +2 -0
  56. package/dist/types/cosmos/thorchainUtils/types/index.d.ts.map +1 -0
  57. package/dist/types/cosmos/toolbox/cosmos.d.ts +93 -0
  58. package/dist/types/cosmos/toolbox/cosmos.d.ts.map +1 -0
  59. package/dist/types/cosmos/toolbox/index.d.ts +14 -0
  60. package/dist/types/cosmos/toolbox/index.d.ts.map +1 -0
  61. package/dist/types/cosmos/toolbox/thorchain.d.ts +158 -0
  62. package/dist/types/cosmos/toolbox/thorchain.d.ts.map +1 -0
  63. package/{src/cosmos/types.ts → dist/types/cosmos/types.d.ts} +24 -29
  64. package/dist/types/cosmos/types.d.ts.map +1 -0
  65. package/dist/types/cosmos/util.d.ts +68 -0
  66. package/dist/types/cosmos/util.d.ts.map +1 -0
  67. package/dist/types/evm/api.d.ts +8 -0
  68. package/dist/types/evm/api.d.ts.map +1 -0
  69. package/dist/types/evm/contracts/eth/multicall.d.ts +36 -0
  70. package/dist/types/evm/contracts/eth/multicall.d.ts.map +1 -0
  71. package/dist/types/evm/contracts/op/gasOracle.d.ts +40 -0
  72. package/dist/types/evm/contracts/op/gasOracle.d.ts.map +1 -0
  73. package/dist/types/evm/helpers.d.ts +20 -0
  74. package/dist/types/evm/helpers.d.ts.map +1 -0
  75. package/{src/evm/index.ts → dist/types/evm/index.d.ts} +1 -0
  76. package/dist/types/evm/index.d.ts.map +1 -0
  77. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +82 -0
  78. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts.map +1 -0
  79. package/dist/types/evm/toolbox/evm.d.ts +367 -0
  80. package/dist/types/evm/toolbox/evm.d.ts.map +1 -0
  81. package/dist/types/evm/toolbox/index.d.ts +89 -0
  82. package/dist/types/evm/toolbox/index.d.ts.map +1 -0
  83. package/dist/types/evm/toolbox/op.d.ts +62 -0
  84. package/dist/types/evm/toolbox/op.d.ts.map +1 -0
  85. package/dist/types/evm/types.d.ts +98 -0
  86. package/dist/types/evm/types.d.ts.map +1 -0
  87. package/dist/types/index.d.ts +63 -0
  88. package/dist/types/index.d.ts.map +1 -0
  89. package/dist/types/near/helpers/core.d.ts +15 -0
  90. package/dist/types/near/helpers/core.d.ts.map +1 -0
  91. package/dist/types/near/helpers/gasEstimation.d.ts +41 -0
  92. package/dist/types/near/helpers/gasEstimation.d.ts.map +1 -0
  93. package/dist/types/near/helpers/nep141.d.ts +72 -0
  94. package/dist/types/near/helpers/nep141.d.ts.map +1 -0
  95. package/dist/types/near/index.d.ts +10 -0
  96. package/dist/types/near/index.d.ts.map +1 -0
  97. package/dist/types/near/toolbox.d.ts +4 -0
  98. package/dist/types/near/toolbox.d.ts.map +1 -0
  99. package/dist/types/near/types/contract.d.ts +38 -0
  100. package/dist/types/near/types/contract.d.ts.map +1 -0
  101. package/dist/types/near/types/nep141.d.ts +56 -0
  102. package/dist/types/near/types/nep141.d.ts.map +1 -0
  103. package/dist/types/near/types/toolbox.d.ts +57 -0
  104. package/dist/types/near/types/toolbox.d.ts.map +1 -0
  105. package/dist/types/near/types.d.ts +44 -0
  106. package/dist/types/near/types.d.ts.map +1 -0
  107. package/dist/types/radix/index.d.ts +14 -0
  108. package/dist/types/radix/index.d.ts.map +1 -0
  109. package/dist/types/ripple/index.d.ts +43 -0
  110. package/dist/types/ripple/index.d.ts.map +1 -0
  111. package/dist/types/solana/index.d.ts +37 -0
  112. package/dist/types/solana/index.d.ts.map +1 -0
  113. package/dist/types/solana/toolbox.d.ts +41 -0
  114. package/dist/types/solana/toolbox.d.ts.map +1 -0
  115. package/dist/types/substrate/balance.d.ts +17 -0
  116. package/dist/types/substrate/balance.d.ts.map +1 -0
  117. package/{src/substrate/index.ts → dist/types/substrate/index.d.ts} +1 -0
  118. package/dist/types/substrate/index.d.ts.map +1 -0
  119. package/dist/types/substrate/substrate.d.ts +148 -0
  120. package/dist/types/substrate/substrate.d.ts.map +1 -0
  121. package/dist/types/substrate/types.d.ts +100 -0
  122. package/dist/types/substrate/types.d.ts.map +1 -0
  123. package/dist/types/tron/helpers/trc20.abi.d.ts +156 -0
  124. package/dist/types/tron/helpers/trc20.abi.d.ts.map +1 -0
  125. package/dist/types/tron/helpers/trongrid.d.ts +8 -0
  126. package/dist/types/tron/helpers/trongrid.d.ts.map +1 -0
  127. package/dist/types/tron/index.d.ts +6 -0
  128. package/dist/types/tron/index.d.ts.map +1 -0
  129. package/dist/types/tron/toolbox.d.ts +26 -0
  130. package/dist/types/tron/toolbox.d.ts.map +1 -0
  131. package/dist/types/tron/types.d.ts +101 -0
  132. package/dist/types/tron/types.d.ts.map +1 -0
  133. package/dist/types/types.d.ts +18 -0
  134. package/dist/types/types.d.ts.map +1 -0
  135. package/dist/types/utils.d.ts +4 -0
  136. package/dist/types/utils.d.ts.map +1 -0
  137. package/dist/types/utxo/helpers/api.d.ts +133 -0
  138. package/dist/types/utxo/helpers/api.d.ts.map +1 -0
  139. package/dist/types/utxo/helpers/bchaddrjs.d.ts +10 -0
  140. package/dist/types/utxo/helpers/bchaddrjs.d.ts.map +1 -0
  141. package/dist/types/utxo/helpers/coinselect.d.ts +16 -0
  142. package/dist/types/utxo/helpers/coinselect.d.ts.map +1 -0
  143. package/{src/utxo/helpers/index.ts → dist/types/utxo/helpers/index.d.ts} +1 -0
  144. package/dist/types/utxo/helpers/index.d.ts.map +1 -0
  145. package/dist/types/utxo/helpers/txSize.d.ts +21 -0
  146. package/dist/types/utxo/helpers/txSize.d.ts.map +1 -0
  147. package/{src/utxo/index.ts → dist/types/utxo/index.d.ts} +1 -0
  148. package/dist/types/utxo/index.d.ts.map +1 -0
  149. package/dist/types/utxo/toolbox/bitcoinCash.d.ts +104 -0
  150. package/dist/types/utxo/toolbox/bitcoinCash.d.ts.map +1 -0
  151. package/dist/types/utxo/toolbox/index.d.ts +50 -0
  152. package/dist/types/utxo/toolbox/index.d.ts.map +1 -0
  153. package/dist/types/utxo/toolbox/utxo.d.ts +102 -0
  154. package/dist/types/utxo/toolbox/utxo.d.ts.map +1 -0
  155. package/dist/types/utxo/toolbox/zcash.d.ts +83 -0
  156. package/dist/types/utxo/toolbox/zcash.d.ts.map +1 -0
  157. package/dist/types/utxo/types.d.ts +46 -0
  158. package/dist/types/utxo/types.d.ts.map +1 -0
  159. package/package.json +15 -18
  160. package/dist/chunk-0h4xdrwz.js +0 -5
  161. package/dist/chunk-0h4xdrwz.js.map +0 -10
  162. package/dist/chunk-4yap1fvd.js +0 -4
  163. package/dist/chunk-4yap1fvd.js.map +0 -10
  164. package/dist/chunk-9bqegm61.js +0 -4
  165. package/dist/chunk-9bqegm61.js.map +0 -10
  166. package/dist/chunk-fazw0jvt.js +0 -4
  167. package/dist/chunk-fazw0jvt.js.map +0 -9
  168. package/dist/chunk-fjfxga2v.js +0 -4
  169. package/dist/chunk-fjfxga2v.js.map +0 -10
  170. package/dist/chunk-s47y8512.js +0 -5
  171. package/dist/chunk-s47y8512.js.map +0 -9
  172. package/dist/chunk-vtd17cje.js +0 -4
  173. package/dist/chunk-vtd17cje.js.map +0 -10
  174. package/dist/chunk-zcdeg6h9.js +0 -5
  175. package/dist/chunk-zcdeg6h9.js.map +0 -10
  176. package/src/cosmos/thorchainUtils/addressFormat.ts +0 -26
  177. package/src/cosmos/thorchainUtils/messages.ts +0 -262
  178. package/src/cosmos/thorchainUtils/registry.ts +0 -44
  179. package/src/cosmos/thorchainUtils/types/MsgCompiled.ts +0 -2800
  180. package/src/cosmos/thorchainUtils/types/client-types.ts +0 -73
  181. package/src/cosmos/thorchainUtils/types/index.ts +0 -1
  182. package/src/cosmos/toolbox/cosmos.ts +0 -375
  183. package/src/cosmos/toolbox/index.ts +0 -33
  184. package/src/cosmos/toolbox/thorchain.ts +0 -313
  185. package/src/cosmos/util.ts +0 -266
  186. package/src/evm/__tests__/address-validation.test.ts +0 -86
  187. package/src/evm/__tests__/ethereum.test.ts +0 -141
  188. package/src/evm/api.ts +0 -21
  189. package/src/evm/contracts/eth/multicall.ts +0 -165
  190. package/src/evm/contracts/op/gasOracle.ts +0 -151
  191. package/src/evm/helpers.ts +0 -194
  192. package/src/evm/toolbox/baseEVMToolbox.ts +0 -762
  193. package/src/evm/toolbox/evm.ts +0 -66
  194. package/src/evm/toolbox/index.ts +0 -52
  195. package/src/evm/toolbox/op.ts +0 -131
  196. package/src/evm/types.ts +0 -146
  197. package/src/index.ts +0 -263
  198. package/src/near/__tests__/core.test.ts +0 -80
  199. package/src/near/helpers/contractFactory.ts +0 -22
  200. package/src/near/helpers/core.ts +0 -91
  201. package/src/near/helpers/gasEstimation.ts +0 -110
  202. package/src/near/helpers/index.ts +0 -5
  203. package/src/near/helpers/nep141.ts +0 -110
  204. package/src/near/index.ts +0 -24
  205. package/src/near/toolbox.ts +0 -509
  206. package/src/near/types/contract.ts +0 -48
  207. package/src/near/types/nep141.ts +0 -66
  208. package/src/near/types.ts +0 -57
  209. package/src/radix/index.ts +0 -156
  210. package/src/ripple/index.ts +0 -192
  211. package/src/solana/index.ts +0 -55
  212. package/src/solana/toolbox.ts +0 -433
  213. package/src/substrate/balance.ts +0 -92
  214. package/src/substrate/substrate.ts +0 -320
  215. package/src/substrate/types.ts +0 -120
  216. package/src/tron/__tests__/toolbox.test.ts +0 -147
  217. package/src/tron/helpers/trc20.abi.ts +0 -107
  218. package/src/tron/helpers/trongrid.ts +0 -54
  219. package/src/tron/index.ts +0 -17
  220. package/src/tron/toolbox.ts +0 -650
  221. package/src/tron/types.ts +0 -120
  222. package/src/utils.ts +0 -27
  223. package/src/utxo/__tests__/zcash-integration.test.ts +0 -114
  224. package/src/utxo/helpers/api.ts +0 -560
  225. package/src/utxo/helpers/bchaddrjs.ts +0 -183
  226. package/src/utxo/helpers/coinselect.ts +0 -98
  227. package/src/utxo/helpers/txSize.ts +0 -104
  228. package/src/utxo/toolbox/bitcoinCash.ts +0 -320
  229. package/src/utxo/toolbox/index.ts +0 -90
  230. package/src/utxo/toolbox/utxo.ts +0 -525
  231. package/src/utxo/toolbox/zcash.ts +0 -208
  232. package/src/utxo/types.ts +0 -57
@@ -0,0 +1,62 @@
1
+ import { Chain, ChainId } from "@swapkit/helpers";
2
+ import type { BrowserProvider, JsonRpcProvider, Provider, TransactionRequest } from "ethers";
3
+ import { Contract } from "ethers";
4
+ import type { EVMToolboxParams } from "../types";
5
+ export declare function getL1GasPriceFetcher<P extends Provider>(provider: P): () => bigint | undefined;
6
+ export declare function estimateL1Gas<P extends JsonRpcProvider | BrowserProvider>(provider: P): (tx: TransactionRequest) => Promise<any>;
7
+ export declare function OPToolbox({ provider: providerParam, ...toolboxSignerParams }: EVMToolboxParams): Promise<{
8
+ estimateL1Gas: (tx: TransactionRequest) => Promise<any>;
9
+ estimateL1GasCost: (tx: TransactionRequest) => Promise<any>;
10
+ estimateL2GasCost: (tx: TransactionRequest) => Promise<any>;
11
+ estimateTotalGasCost: (tx: TransactionRequest) => Promise<any>;
12
+ getBalance: (address: string, scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
13
+ getL1GasPrice: () => bigint | undefined;
14
+ getNetworkParams: () => {
15
+ chainId: ChainId;
16
+ chainName: string;
17
+ nativeCurrency: {
18
+ name: string;
19
+ symbol: Chain;
20
+ decimals: number;
21
+ };
22
+ rpcUrls: string[];
23
+ blockExplorerUrls: string[];
24
+ };
25
+ getAddress: () => Promise<string> | undefined;
26
+ estimateTransactionFee: ({ feeOption, chain, ...txObject }: import("..").EIP1559TxParams & {
27
+ feeOption: import("@swapkit/helpers").FeeOption;
28
+ chain: import("@swapkit/helpers").EVMChain;
29
+ }) => Promise<import("@swapkit/helpers").AssetValue>;
30
+ call: <T>({ callProvider, contractAddress, abi, funcName, funcParams, txOverrides, feeOption, }: import("..").CallParams) => Promise<T>;
31
+ estimateCall: ({ contractAddress, abi, funcName, funcParams, txOverrides, }: import("..").EstimateCallParams) => Promise<bigint>;
32
+ EIP1193SendTransaction: ({ value, ...params }: import("..").EVMTxParams | import("ethers").ContractTransaction) => Promise<string>;
33
+ approve: ({ assetAddress, spenderAddress, feeOptionKey, amount, gasLimitFallback, from: fromParam, nonce, }: import("..").ApproveParams) => Promise<string>;
34
+ approvedAmount: ({ assetAddress, spenderAddress, from }: import("..").IsApprovedParams) => Promise<bigint>;
35
+ broadcastTransaction: ((signedTx: string) => Promise<import("ethers").TransactionResponse>) | ((signedTx: string) => Promise<import("ethers").TransactionResponse>);
36
+ createApprovalTx: ({ assetAddress, spenderAddress, amount, from: fromParam, }: import("..").ApproveParams) => Promise<import("ethers").ContractTransaction>;
37
+ createContract: (address: string, abi: readonly (import("ethers").JsonFragment | import("ethers").Fragment)[]) => Contract;
38
+ createContractTxObject: ({ contractAddress, abi, funcName, funcParams, txOverrides }: import("..").CallParams) => Promise<import("ethers").ContractTransaction>;
39
+ createTransferTx: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<import("ethers").ContractTransaction>;
40
+ createTransaction: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<import("ethers").ContractTransaction>;
41
+ estimateGasLimit: ({ assetValue, recipient, memo, data, sender, funcName, funcParams, txOverrides, }: import("..").EVMTransferParams & {
42
+ assetValue: import("@swapkit/helpers").AssetValue;
43
+ funcName?: string;
44
+ funcParams?: unknown[];
45
+ txOverrides?: import("..").EVMTxParams;
46
+ data?: string;
47
+ }) => Promise<bigint>;
48
+ estimateGasPrices: () => Promise<{ [key in import("@swapkit/helpers").FeeOption]: {
49
+ l1GasPrice?: bigint;
50
+ gasPrice?: bigint;
51
+ maxFeePerGas?: bigint;
52
+ maxPriorityFeePerGas?: bigint;
53
+ }; }>;
54
+ isApproved: ({ assetAddress, spenderAddress, from, amount, }: import("..").IsApprovedParams) => Promise<boolean>;
55
+ sendTransaction: ({ feeOptionKey, ...tx }: import("..").EVMTxParams & {
56
+ feeOptionKey?: import("@swapkit/helpers").FeeOption;
57
+ }) => Promise<string>;
58
+ signMessage: ((message: string | Uint8Array) => Promise<string>) | ((message: string | Uint8Array) => Promise<string>) | ((_message: string | Uint8Array) => Promise<string>) | undefined;
59
+ transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, ...tx }: import("..").EVMTransferParams) => Promise<string>;
60
+ validateAddress: (address: string) => boolean;
61
+ }>;
62
+ //# sourceMappingURL=op.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op.d.ts","sourceRoot":"","sources":["../../../../src/evm/toolbox/op.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,OAAO,EAIR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAEV,eAAe,EACf,eAAe,EACf,QAAQ,EACR,kBAAkB,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,QAAQ,EAAgB,MAAM,QAAQ,CAAC;AAOhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,4BAUnE;AA6CD,wBAAgB,aAAa,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,QAAQ,EAAE,CAAC,IAChD,IAAI,kBAAkB,kBAQ3D;AAUD,wBAAsB,SAAS,CAAC,EAC9B,QAAQ,EAAE,aAAa,EACvB,GAAG,mBAAmB,EACvB,EAAE,gBAAgB;wBArBuB,kBAAkB;4BA3Bd,kBAAkB;4BAWlB,kBAAkB;+BAQf,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAoDwoa,CAAC;kBAAwB,CAAC;mBAA4B,CAAC;YAAuB,CAAC;;;kBAAhjW,CAAC;gBAAsB,CAAC;oBAA0B,CAAC;4BAAkC,CAAC;;;;oBAAkuY,CAAC;;;;;GADlid"}
@@ -0,0 +1,98 @@
1
+ import type { AssetValue, ChainSigner, DerivationPathArray, FeeOption, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
2
+ import { Chain } from "@swapkit/helpers";
3
+ import type { BigNumberish, BrowserProvider, JsonFragment, JsonRpcProvider, JsonRpcSigner, Signer, Transaction } from "ethers";
4
+ import type { ARBToolbox, AURORAToolbox, AVAXToolbox, BASEToolbox, BERAToolbox, BSCToolbox, ETHToolbox, GNOToolbox, MATICToolbox, OPToolbox } from "./toolbox";
5
+ import type { getProvider } from "./index";
6
+ export declare enum EthNetwork {
7
+ Test = "goerli",
8
+ Main = "homestead"
9
+ }
10
+ export type ApproveParams = {
11
+ assetAddress: string;
12
+ spenderAddress: string;
13
+ feeOptionKey?: FeeOption;
14
+ amount?: BigNumberish;
15
+ from?: string;
16
+ gasLimitFallback?: BigNumberish;
17
+ nonce?: number;
18
+ };
19
+ export type ApprovedParams = {
20
+ assetAddress: string;
21
+ spenderAddress: string;
22
+ from: string;
23
+ };
24
+ export type IsApprovedParams = ApprovedParams & {
25
+ amount?: BigNumberish;
26
+ };
27
+ export type CallParams = {
28
+ callProvider?: Awaited<ReturnType<typeof getProvider>>;
29
+ contractAddress: string;
30
+ abi: readonly JsonFragment[];
31
+ funcName: string;
32
+ funcParams?: unknown[];
33
+ txOverrides?: Partial<Transaction>;
34
+ feeOption?: FeeOption;
35
+ };
36
+ export type EstimateCallParams = Pick<CallParams, "contractAddress" | "abi" | "funcName" | "funcParams" | "txOverrides">;
37
+ export type EVMTransferParams = GenericTransferParams & {
38
+ sender?: string;
39
+ };
40
+ export type EVMCreateTransactionParams = Omit<GenericCreateTransactionParams, "feeRate"> & {
41
+ gasLimit?: bigint;
42
+ gasPrice?: bigint;
43
+ maxFeePerGas?: bigint;
44
+ maxPriorityFeePerGas?: bigint;
45
+ data?: string;
46
+ nonce?: number;
47
+ };
48
+ export type EVMMaxSendableAmountsParams = {
49
+ from: string;
50
+ assetValue: AssetValue;
51
+ feeOptionKey?: FeeOption;
52
+ memo?: string;
53
+ abi?: readonly JsonFragment[];
54
+ funcName?: string;
55
+ contractAddress?: string;
56
+ funcParams?: unknown[];
57
+ txOverrides?: Partial<Transaction>;
58
+ };
59
+ export type EVMTxBaseParams<T = bigint> = {
60
+ to?: string;
61
+ from?: string;
62
+ nonce?: number;
63
+ gasLimit?: T;
64
+ data?: string;
65
+ value?: T;
66
+ chainId?: T;
67
+ };
68
+ export type EIP1559TxParams<T = bigint> = EVMTxBaseParams<T> & {
69
+ type?: number;
70
+ maxFeePerGas?: T;
71
+ maxPriorityFeePerGas?: T;
72
+ };
73
+ export type LegacyEVMTxParams<T = bigint> = EVMTxBaseParams<T> & {
74
+ gasPrice?: T;
75
+ };
76
+ export type EVMTxParams = EIP1559TxParams | LegacyEVMTxParams;
77
+ export type EVMToolboxParams = {
78
+ provider?: BrowserProvider | JsonRpcProvider;
79
+ } & ({
80
+ signer?: (ChainSigner<EVMTransferParams, string> & Signer) | JsonRpcSigner;
81
+ } | {
82
+ phrase?: string;
83
+ derivationPath?: DerivationPathArray;
84
+ index?: number;
85
+ });
86
+ export type EVMToolboxes = {
87
+ [Chain.Arbitrum]: Awaited<ReturnType<typeof ARBToolbox>>;
88
+ [Chain.Aurora]: Awaited<ReturnType<typeof AURORAToolbox>>;
89
+ [Chain.Avalanche]: Awaited<ReturnType<typeof AVAXToolbox>>;
90
+ [Chain.Base]: Awaited<ReturnType<typeof BASEToolbox>>;
91
+ [Chain.Berachain]: Awaited<ReturnType<typeof BERAToolbox>>;
92
+ [Chain.BinanceSmartChain]: Awaited<ReturnType<typeof BSCToolbox>>;
93
+ [Chain.Ethereum]: Awaited<ReturnType<typeof ETHToolbox>>;
94
+ [Chain.Gnosis]: Awaited<ReturnType<typeof GNOToolbox>>;
95
+ [Chain.Optimism]: Awaited<ReturnType<typeof OPToolbox>>;
96
+ [Chain.Polygon]: Awaited<ReturnType<typeof MATICToolbox>>;
97
+ };
98
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,8BAA8B,EAC9B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,aAAa,EACb,MAAM,EACN,WAAW,EACZ,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,WAAW,EAAE,MA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AU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;IACvD,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC;CAC3D,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { AssetValue, Chain, type CosmosChain, type EVMChain, type GenericCreateTransactionParams, type SubstrateChain, type UTXOChain } from "@swapkit/helpers";
2
+ import type { getCosmosToolbox } from "./cosmos";
3
+ import type { EVMCreateTransactionParams, getEvmToolbox } from "./evm";
4
+ import type { getNearToolbox } from "./near";
5
+ import type { RadixToolbox } from "./radix";
6
+ import type { getRippleToolbox } from "./ripple";
7
+ import type { SolanaCreateTransactionParams, getSolanaToolbox } from "./solana";
8
+ import type { getSubstrateToolbox } from "./substrate";
9
+ import type { createTronToolbox } from "./tron";
10
+ import type { getUtxoToolbox } from "./utxo";
11
+ export * from "./types";
12
+ export declare function getAddressValidator(): Promise<({ address, chain }: {
13
+ address: string;
14
+ chain: Chain;
15
+ }) => boolean>;
16
+ export declare function getFeeEstimator<T extends keyof CreateTransactionParams>(chain: T): (params: CreateTransactionParams[T]) => Promise<AssetValue>;
17
+ type Toolboxes = {
18
+ [key in EVMChain]: Awaited<ReturnType<typeof getEvmToolbox>>;
19
+ } & {
20
+ [key in UTXOChain]: Awaited<ReturnType<typeof getUtxoToolbox>>;
21
+ } & {
22
+ [key in CosmosChain]: Awaited<ReturnType<typeof getCosmosToolbox>>;
23
+ } & {
24
+ [key in SubstrateChain]: Awaited<ReturnType<typeof getSubstrateToolbox>>;
25
+ } & {
26
+ [Chain.Radix]: Awaited<ReturnType<typeof RadixToolbox>>;
27
+ [Chain.Near]: Awaited<ReturnType<typeof getNearToolbox>>;
28
+ [Chain.Ripple]: Awaited<ReturnType<typeof getRippleToolbox>>;
29
+ [Chain.Solana]: Awaited<ReturnType<typeof getSolanaToolbox>>;
30
+ [Chain.Tron]: Awaited<ReturnType<typeof createTronToolbox>>;
31
+ };
32
+ type ToolboxParams = {
33
+ [key in EVMChain]: Parameters<typeof getEvmToolbox>[1];
34
+ } & {
35
+ [key in UTXOChain]: undefined;
36
+ } & {
37
+ [key in CosmosChain]: Parameters<typeof getCosmosToolbox>[1];
38
+ } & {
39
+ [key in SubstrateChain]: Parameters<typeof getSubstrateToolbox>[1];
40
+ } & {
41
+ [Chain.Radix]: Parameters<typeof RadixToolbox>[0];
42
+ [Chain.Near]: Parameters<typeof getNearToolbox>[0];
43
+ [Chain.Ripple]: Parameters<typeof getRippleToolbox>[0];
44
+ [Chain.Solana]: Parameters<typeof getSolanaToolbox>[0];
45
+ [Chain.Tron]: Parameters<typeof createTronToolbox>[0];
46
+ };
47
+ type CreateTransactionParams = {
48
+ [key in EVMChain]: EVMCreateTransactionParams;
49
+ } & {
50
+ [key in UTXOChain]: GenericCreateTransactionParams;
51
+ } & {
52
+ [key in CosmosChain]: GenericCreateTransactionParams;
53
+ } & {
54
+ [key in SubstrateChain]: GenericCreateTransactionParams;
55
+ } & {
56
+ [Chain.Radix]: GenericCreateTransactionParams;
57
+ [Chain.Ripple]: GenericCreateTransactionParams;
58
+ [Chain.Near]: GenericCreateTransactionParams;
59
+ [Chain.Solana]: SolanaCreateTransactionParams;
60
+ [Chain.Tron]: GenericCreateTransactionParams;
61
+ };
62
+ export declare function getToolbox<T extends keyof Toolboxes>(chain: T, params?: ToolboxParams[T]): Promise<Toolboxes[T]>;
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,KAAK,WAAW,EAChB,KAAK,QAAQ,EAEb,KAAK,8BAA8B,EACnC,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,kBAAkB,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EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,KAAK,uBAAuB,GAAG;KAAG,GAAG,IAAI,QAAQ,GAAG,0BAA0B;CAAE,GAAG;KAChF,GAAG,IAAI,SAAS,GAAG,8BAA8B;CACnD,GAAG;KACD,GAAG,IAAI,WAAW,GAAG,8BAA8B;CACrD,GAAG;KACD,GAAG,IAAI,cAAc,GAAG,8BAA8B;CACxD,GAAG;IACF,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,8BAA8B,CAAC;IAC9C,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,8BAA8B,CAAC;IAC/C,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,8BAA8B,CAAC;IAC7C,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC;IAC9C,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,8BAA8B,CAAC;CAC9C,CAAC;AAEF,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,SAAS,EACxD,KAAK,EAAE,CAAC,EACR,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAyFvB"}
@@ -0,0 +1,15 @@
1
+ import type { Provider } from "@near-js/providers";
2
+ import { type DerivationPathArray } from "@swapkit/helpers";
3
+ import type { NearSigner } from "../types";
4
+ export declare function getValidateNearAddress(): Promise<(address: string) => boolean>;
5
+ export declare function getNearSignerFromPhrase(params: {
6
+ phrase: string;
7
+ derivationPath?: DerivationPathArray;
8
+ index?: number;
9
+ }): Promise<NearSigner>;
10
+ export declare function getNearSignerFromPrivateKey(privateKey: string): Promise<NearSigner>;
11
+ export declare function getFullAccessPublicKey(provider: Provider, accountId: string): Promise<{
12
+ publicKey: import("@near-js/crypto").PublicKey;
13
+ nonce: number;
14
+ }>;
15
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/near/helpers/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,KAAK,mBAAmB,EAAwC,MAAM,kBAAkB,CAAC;AAElG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAsB,sBAAsB,sBAEzB,MAAM,cAUxB;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,uBAeA;AAED,wBAAsB,2BAA2B,CAAC,UAAU,EAAE,MAAM,uBAInE;AAyBD,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;;;GAqBjF"}
@@ -0,0 +1,41 @@
1
+ import type { Account } from "near-api-js";
2
+ import type { NearGasEstimateParams } from "../types/contract";
3
+ export declare const GAS_COSTS: {
4
+ readonly SIMPLE_TRANSFER: "1";
5
+ readonly TOKEN_TRANSFER: "100";
6
+ readonly CONTRACT_CALL: "100";
7
+ readonly ACCOUNT_CREATION: "30";
8
+ readonly CONTRACT_DEPLOYMENT: "200";
9
+ readonly ACCESS_KEY_ADDITION: "5";
10
+ readonly ACCESS_KEY_DELETION: "5";
11
+ readonly STAKE: "10";
12
+ readonly STORAGE_DEPOSIT: "100";
13
+ };
14
+ export declare function isSimpleTransfer(params: NearGasEstimateParams): params is {
15
+ recipient: string;
16
+ amount: string;
17
+ };
18
+ export declare function isContractCall(params: NearGasEstimateParams): params is {
19
+ contractId: string;
20
+ methodName: string;
21
+ args?: Record<string, any>;
22
+ attachedDeposit?: string;
23
+ };
24
+ export declare function isBatchTransaction(params: NearGasEstimateParams): params is {
25
+ actions: any[];
26
+ };
27
+ export declare function isAccountCreation(params: NearGasEstimateParams): params is {
28
+ newAccountId: string;
29
+ publicKey?: string;
30
+ };
31
+ export declare function isContractDeployment(params: NearGasEstimateParams): params is {
32
+ contractCode: Uint8Array;
33
+ };
34
+ export declare function isCustomEstimator(params: NearGasEstimateParams): params is {
35
+ customEstimator: (account: Account) => Promise<string>;
36
+ };
37
+ export declare function estimateBatchGas(actions: any[]): string;
38
+ export declare function getContractMethodGas(methodName: string): "100";
39
+ export declare function tgasToGas(tgas: string): string;
40
+ export declare function gasToTGas(gas: string): string;
41
+ //# sourceMappingURL=gasEstimation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gasEstimation.d.ts","sourceRoot":"","sources":["../../../../src/near/helpers/gasEstimation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC;AAGX,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,GAC5B,MAAM,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAEjD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,IAAI;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAEA;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,IAAI;IAAE,OAAO,EAAE,GAAG,EAAE,CAAA;CAAE,CAE9F;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,IAAI;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAEA;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,qBAAqB,GAC5B,MAAM,IAAI;IAAE,YAAY,EAAE,UAAU,CAAA;CAAE,CAExC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,IAAI;IAC1E,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACxD,CAEA;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,UAgC9C;AAGD,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,SAQtD;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAGD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,72 @@
1
+ import type { Account, Contract } from "near-api-js";
2
+ export interface NEP141Metadata {
3
+ spec: string;
4
+ name: string;
5
+ symbol: string;
6
+ icon?: string;
7
+ reference?: string;
8
+ reference_hash?: string;
9
+ decimals: number;
10
+ }
11
+ export interface StorageBalance {
12
+ total: string;
13
+ available: string;
14
+ }
15
+ export interface StorageBalanceBounds {
16
+ min: string;
17
+ max?: string;
18
+ }
19
+ type BN = any;
20
+ export interface NEP141Contract extends Contract {
21
+ ft_balance_of(args: {
22
+ account_id: string;
23
+ }): Promise<string>;
24
+ ft_total_supply(): Promise<string>;
25
+ ft_metadata(): Promise<NEP141Metadata>;
26
+ storage_balance_of(args: {
27
+ account_id: string;
28
+ }): Promise<StorageBalance | null>;
29
+ storage_balance_bounds(): Promise<StorageBalanceBounds>;
30
+ ft_transfer(args: {
31
+ receiver_id: string;
32
+ amount: string;
33
+ memo?: string;
34
+ }, gas: BN, deposit: BN): Promise<void>;
35
+ ft_transfer_call(args: {
36
+ receiver_id: string;
37
+ amount: string;
38
+ msg: string;
39
+ memo?: string;
40
+ }, gas: BN, deposit: BN): Promise<void>;
41
+ storage_deposit(args: {
42
+ account_id?: string;
43
+ registration_only?: boolean;
44
+ }, gas: BN, deposit: BN): Promise<StorageBalance>;
45
+ storage_withdraw(args: {
46
+ amount?: string;
47
+ }, gas: BN, deposit?: BN): Promise<StorageBalance>;
48
+ storage_unregister(force?: boolean, gas?: BN): Promise<boolean>;
49
+ }
50
+ export type NEP141Token = {
51
+ transfer: (receiverId: string, amount: string, memo?: string) => Promise<void>;
52
+ transferCall: (receiverId: string, amount: string, msg: string, memo?: string) => Promise<void>;
53
+ balanceOf: (accountId: string) => Promise<string>;
54
+ totalSupply: () => Promise<string>;
55
+ metadata: () => Promise<NEP141Metadata>;
56
+ storageBalanceOf: (accountId: string) => Promise<StorageBalance | null>;
57
+ storageDeposit: (accountId?: string, amount?: string) => Promise<StorageBalance>;
58
+ ensureStorage: (accountId: string) => Promise<void>;
59
+ contract: NEP141Contract;
60
+ };
61
+ export declare function createNearContract<T extends Contract>({ account, contractId, viewMethods, changeMethods, }: {
62
+ account: Account;
63
+ contractId: string;
64
+ viewMethods: string[];
65
+ changeMethods: string[];
66
+ }): Promise<T>;
67
+ export declare function createNEP141Token({ contractId, account, }: {
68
+ contractId: string;
69
+ account: Account;
70
+ }): Promise<NEP141Token>;
71
+ export {};
72
+ //# sourceMappingURL=nep141.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nep141.d.ts","sourceRoot":"","sources":["../../../../src/near/helpers/nep141.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKrD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM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Q,EAAE,EAC3D,OAAO,EACP,UAAU,EACV,WAAW,EACX,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,GAAG,OAAO,CAAC,CAAC,CAAC,CAQb;AAED,wBAAsB,iBAAiB,CAAC,EACtC,UAAU,EACV,OAAO,GACR,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,WAAW,CAAC,CAiFvB"}
@@ -0,0 +1,10 @@
1
+ import type { getNearToolbox } from "./toolbox";
2
+ export * from "./toolbox";
3
+ export * from "./types";
4
+ export * from "./helpers/core";
5
+ export * from "./helpers/gasEstimation";
6
+ export * from "./helpers/nep141";
7
+ export type NearWallet = Awaited<ReturnType<typeof getNearToolbox>>;
8
+ export type { NearContractInterface, NearCallParams, NearGasEstimateParams, } from "./types/contract";
9
+ export type { FungibleTokenMetadata, StorageBalance, StorageBalanceBounds, NEP141Contract, TokenTransferParams, } from "./types/nep141";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/near/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AAEjC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;AAEpE,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,mBAAmB,GACpB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { NearToolboxParams } from "./types";
2
+ import type { NearToolbox } from "./types/toolbox";
3
+ export declare function getNearToolbox(toolboxParams?: NearToolboxParams): Promise<NearToolbox>;
4
+ //# sourceMappingURL=toolbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../../src/near/toolbox.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAGV,iBAAiB,EAElB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAIV,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AAEzB,wBAAsB,cAAc,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsd5F"}
@@ -0,0 +1,38 @@
1
+ import type { Account } from "near-api-js";
2
+ import type { Action } from "near-api-js/lib/transaction";
3
+ export interface NearContractInterface {
4
+ contractId: string;
5
+ viewMethods: string[];
6
+ changeMethods: string[];
7
+ metadata?: {
8
+ version: string;
9
+ standards: string[];
10
+ };
11
+ }
12
+ export interface NearCallParams {
13
+ contractId: string;
14
+ methodName: string;
15
+ args?: Record<string, any>;
16
+ gas?: string | bigint;
17
+ attachedDeposit?: string | bigint;
18
+ isView?: boolean;
19
+ }
20
+ export type NearGasEstimateParams = {
21
+ recipient: string;
22
+ amount: string;
23
+ } | {
24
+ contractId: string;
25
+ methodName: string;
26
+ args?: Record<string, any>;
27
+ attachedDeposit?: string;
28
+ } | {
29
+ actions: Action[];
30
+ } | {
31
+ newAccountId: string;
32
+ publicKey?: string;
33
+ } | {
34
+ contractCode: Uint8Array;
35
+ } | {
36
+ customEstimator: (account: Account) => Promise<string>;
37
+ };
38
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/near/types/contract.ts"],"names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ec: string;
3
+ name: string;
4
+ symbol: string;
5
+ icon?: string;
6
+ reference?: string;
7
+ reference_hash?: string;
8
+ decimals: number;
9
+ }
10
+ export interface StorageBalance {
11
+ total: string;
12
+ available: string;
13
+ }
14
+ export interface StorageBalanceBounds {
15
+ min: string;
16
+ max?: string;
17
+ }
18
+ export interface NEP141Contract {
19
+ ft_balance_of(args: {
20
+ account_id: string;
21
+ }): Promise<string>;
22
+ ft_total_supply(): Promise<string>;
23
+ ft_metadata(): Promise<FungibleTokenMetadata>;
24
+ storage_balance_of(args: {
25
+ account_id: string;
26
+ }): Promise<StorageBalance | null>;
27
+ storage_balance_bounds(): Promise<StorageBalanceBounds>;
28
+ ft_transfer(args: {
29
+ receiver_id: string;
30
+ amount: string;
31
+ memo?: string | null;
32
+ }, gas?: any, // BN type
33
+ deposit?: any): Promise<any>;
34
+ ft_transfer_call(args: {
35
+ receiver_id: string;
36
+ amount: string;
37
+ memo?: string | null;
38
+ msg: string;
39
+ }, gas?: any, deposit?: any): Promise<any>;
40
+ storage_deposit(args: {
41
+ account_id?: string;
42
+ registration_only?: boolean;
43
+ }, gas?: any, deposit?: any): Promise<StorageBalance>;
44
+ storage_withdraw(args: {
45
+ amount?: string;
46
+ }, gas?: any, deposit?: any): Promise<StorageBalance>;
47
+ storage_unregister(args: {
48
+ force?: boolean;
49
+ }, gas?: any, deposit?: any): Promise<boolean>;
50
+ }
51
+ export interface TokenTransferParams {
52
+ recipient: string;
53
+ amount: string;
54
+ memo?: string;
55
+ }
56
+ //# sourceMappingURL=nep141.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nep141.d.ts","sourceRoot":"","sources":["../../../../src/near/types/nep141.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,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CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAAE,EAC1D,GAAG,CAAC,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B,gBAAgB,CAAC,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE/F,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3F;AAGD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,57 @@
1
+ import type { AssetValue, DerivationPathArray } from "@swapkit/helpers";
2
+ import type { Account, Contract, providers } from "near-api-js";
3
+ import type { Action, SignedTransaction, Transaction } from "near-api-js/lib/transaction";
4
+ import type { NEP141Token } from "../helpers/nep141";
5
+ import type { NearCreateTransactionParams, NearFunctionCallParams, NearSigner, NearTransferParams } from "../types";
6
+ import type { NearContractInterface, NearGasEstimateParams } from "../types/contract";
7
+ export interface SerializedTransaction {
8
+ serialized: string;
9
+ publicKey: string;
10
+ details: {
11
+ signerId: string;
12
+ receiverId?: string;
13
+ methodName?: string;
14
+ nonce: number;
15
+ blockHash: string;
16
+ };
17
+ }
18
+ export interface BatchTransaction {
19
+ receiverId: string;
20
+ actions: Action[];
21
+ }
22
+ export interface ContractFunctionCallParams {
23
+ sender: string;
24
+ contractId: string;
25
+ methodName: string;
26
+ args: Record<string, any>;
27
+ gas: string;
28
+ attachedDeposit: string;
29
+ }
30
+ export interface GetSignerFromPhraseParams {
31
+ phrase: string;
32
+ derivationPath?: DerivationPathArray;
33
+ index?: number;
34
+ }
35
+ export interface NearToolbox {
36
+ getAddress: () => Promise<string>;
37
+ getPublicKey: () => Promise<string>;
38
+ provider: providers.JsonRpcProvider;
39
+ transfer: (params: NearTransferParams) => Promise<string>;
40
+ createTransaction: (params: NearCreateTransactionParams) => Promise<SerializedTransaction>;
41
+ createContractFunctionCall: (params: ContractFunctionCallParams) => Promise<SerializedTransaction>;
42
+ estimateTransactionFee: (params: NearTransferParams | NearGasEstimateParams) => Promise<AssetValue>;
43
+ broadcastTransaction: (signedTransaction: SignedTransaction) => Promise<string>;
44
+ signTransaction: (transaction: Transaction) => Promise<SignedTransaction>;
45
+ getBalance: (address: string) => Promise<AssetValue[]>;
46
+ validateAddress: (address: string) => boolean;
47
+ getSignerFromPhrase: (params: GetSignerFromPhraseParams) => Promise<NearSigner>;
48
+ getSignerFromPrivateKey: (privateKey: string) => Promise<NearSigner>;
49
+ callFunction: (params: NearFunctionCallParams) => Promise<string>;
50
+ createSubAccount: (subAccountId: string, publicKey: string, initialBalance: string) => Promise<string>;
51
+ createContract: <T extends Contract = Contract>(contractInterface: NearContractInterface) => Promise<T>;
52
+ executeBatchTransaction: (batch: BatchTransaction) => Promise<string>;
53
+ nep141: (contractId: string) => Promise<NEP141Token>;
54
+ getGasPrice: () => Promise<string>;
55
+ estimateGas: (params: NearGasEstimateParams, account?: Account) => Promise<AssetValue>;
56
+ }
57
+ //# sourceMappingURL=toolbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../../../src/near/types/toolbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,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AC,CAAC;IACtE,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACrD,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACxF"}
@@ -0,0 +1,44 @@
1
+ import type { ChainSigner, DerivationPathArray, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
2
+ import type { KeyPairSigner, Signer, transactions } from "near-api-js";
3
+ interface NearKeyPairSigner extends KeyPairSigner, Omit<ChainSigner<typeof transactions.Transaction, typeof transactions.SignedTransaction>, "signTransaction"> {
4
+ }
5
+ interface NearGeneralSigner extends Signer, Omit<ChainSigner<typeof transactions.Transaction, typeof transactions.SignedTransaction>, "signTransaction"> {
6
+ }
7
+ export type NearSigner = NearKeyPairSigner | NearGeneralSigner;
8
+ export type NearToolboxParams = {
9
+ signer?: NearSigner;
10
+ accountId?: string;
11
+ } | {
12
+ phrase?: string;
13
+ index?: number;
14
+ derivationPath?: DerivationPathArray;
15
+ };
16
+ export interface NearTransferParams extends GenericTransferParams {
17
+ }
18
+ export interface NearConfig {
19
+ networkId: "mainnet" | "testnet" | "betanet";
20
+ nodeUrl: string;
21
+ walletUrl?: string;
22
+ helperUrl?: string;
23
+ keyStore?: any;
24
+ }
25
+ export interface NearFunctionCallParams {
26
+ contractId: string;
27
+ methodName: string;
28
+ args: Uint8Array | Record<string, any>;
29
+ deposit?: bigint | string | number;
30
+ gas?: bigint | string | number;
31
+ }
32
+ export interface NearCreateTransactionParams extends GenericCreateTransactionParams {
33
+ attachedDeposit?: string;
34
+ functionCall?: {
35
+ methodName: string;
36
+ args: object;
37
+ attachedDeposit: string;
38
+ };
39
+ }
40
+ export * from "./toolbox";
41
+ export * from "./types/toolbox";
42
+ export * from "./types/nep141";
43
+ export * from "./types/cont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