@swapkit/toolboxes 1.0.0-beta.9 → 4.0.0-beta.35

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 (130) hide show
  1. package/dist/{chunk-fjfxga2v.js → chunk-5yxc1e69.js} +1 -1
  2. package/dist/{chunk-fjfxga2v.js.map → chunk-5yxc1e69.js.map} +1 -1
  3. package/dist/chunk-6f98phv2.js +4 -0
  4. package/dist/{chunk-0h4xdrwz.js.map → chunk-6f98phv2.js.map} +2 -2
  5. package/dist/{chunk-0f0249b1.js → chunk-9bqegm61.js} +1 -1
  6. package/dist/{chunk-p1kdg37m.js → chunk-s47y8512.js} +2 -2
  7. package/dist/{chunk-p1kdg37m.js.map → chunk-s47y8512.js.map} +1 -1
  8. package/dist/chunk-vtd17cje.js +3 -0
  9. package/dist/chunk-vtd17cje.js.map +10 -0
  10. package/dist/chunk-zcdeg6h9.js +4 -0
  11. package/dist/chunk-zcdeg6h9.js.map +10 -0
  12. package/dist/src/cosmos/index.cjs +3 -0
  13. package/dist/src/cosmos/index.cjs.map +16 -0
  14. package/dist/src/cosmos/index.js +3 -0
  15. package/dist/src/cosmos/index.js.map +16 -0
  16. package/dist/src/evm/index.cjs +3 -0
  17. package/dist/src/evm/index.cjs.map +18 -0
  18. package/dist/src/evm/index.js +3 -0
  19. package/dist/src/evm/index.js.map +18 -0
  20. package/dist/src/index.cjs +3 -0
  21. package/dist/src/index.cjs.map +10 -0
  22. package/dist/src/index.js +3 -0
  23. package/dist/src/index.js.map +10 -0
  24. package/dist/src/near/index.cjs +3 -0
  25. package/dist/src/near/index.cjs.map +13 -0
  26. package/dist/src/near/index.js +3 -0
  27. package/dist/src/near/index.js.map +13 -0
  28. package/dist/{radix → src/radix}/index.cjs +2 -2
  29. package/dist/src/radix/index.cjs.map +10 -0
  30. package/dist/src/radix/index.js +3 -0
  31. package/dist/src/radix/index.js.map +10 -0
  32. package/dist/src/ripple/index.cjs +3 -0
  33. package/dist/src/ripple/index.cjs.map +10 -0
  34. package/dist/src/ripple/index.js +3 -0
  35. package/dist/src/ripple/index.js.map +10 -0
  36. package/dist/src/solana/index.cjs +3 -0
  37. package/dist/src/solana/index.cjs.map +10 -0
  38. package/dist/src/solana/index.js +3 -0
  39. package/dist/src/solana/index.js.map +10 -0
  40. package/dist/src/substrate/index.cjs +3 -0
  41. package/dist/src/substrate/index.cjs.map +12 -0
  42. package/dist/src/substrate/index.js +3 -0
  43. package/dist/src/substrate/index.js.map +12 -0
  44. package/dist/src/tron/index.cjs +3 -0
  45. package/dist/src/tron/index.cjs.map +11 -0
  46. package/dist/src/tron/index.js +3 -0
  47. package/dist/src/tron/index.js.map +11 -0
  48. package/dist/src/utxo/index.cjs +5 -0
  49. package/dist/src/utxo/index.cjs.map +17 -0
  50. package/dist/src/utxo/index.js +5 -0
  51. package/dist/src/utxo/index.js.map +17 -0
  52. package/package.json +92 -43
  53. package/src/cosmos/thorchainUtils/addressFormat.ts +4 -1
  54. package/src/cosmos/thorchainUtils/messages.ts +2 -2
  55. package/src/cosmos/thorchainUtils/registry.ts +3 -3
  56. package/src/cosmos/toolbox/cosmos.ts +35 -16
  57. package/src/cosmos/toolbox/index.ts +2 -2
  58. package/src/cosmos/toolbox/thorchain.ts +11 -9
  59. package/src/cosmos/util.ts +87 -7
  60. package/src/evm/__tests__/address-validation.test.ts +86 -0
  61. package/src/evm/__tests__/ethereum.test.ts +1 -1
  62. package/src/evm/helpers.ts +4 -3
  63. package/src/evm/toolbox/baseEVMToolbox.ts +34 -24
  64. package/src/evm/toolbox/index.ts +2 -2
  65. package/src/evm/toolbox/op.ts +21 -7
  66. package/src/index.ts +118 -100
  67. package/src/near/__tests__/core.test.ts +80 -0
  68. package/src/near/helpers/contractFactory.ts +22 -0
  69. package/src/near/helpers/core.ts +89 -0
  70. package/src/near/helpers/gasEstimation.ts +110 -0
  71. package/src/near/helpers/index.ts +5 -0
  72. package/src/near/helpers/nep141.ts +110 -0
  73. package/src/near/index.ts +24 -0
  74. package/src/near/toolbox.ts +498 -0
  75. package/src/near/types/contract.ts +48 -0
  76. package/src/near/types/nep141.ts +66 -0
  77. package/src/near/types.ts +57 -0
  78. package/src/radix/index.ts +8 -2
  79. package/src/ripple/index.ts +14 -21
  80. package/src/solana/toolbox.ts +73 -2
  81. package/src/substrate/balance.ts +92 -0
  82. package/src/substrate/substrate.ts +7 -5
  83. package/src/tron/__tests__/toolbox.test.ts +147 -0
  84. package/src/tron/helpers/trc20.abi.ts +40 -0
  85. package/src/tron/index.ts +16 -0
  86. package/src/tron/toolbox.ts +336 -0
  87. package/src/tron/types.ts +31 -0
  88. package/src/utxo/__tests__/zcash-integration.test.ts +114 -0
  89. package/src/utxo/helpers/api.ts +66 -16
  90. package/src/utxo/helpers/bchaddrjs.ts +8 -8
  91. package/src/utxo/helpers/coinselect.ts +4 -2
  92. package/src/utxo/helpers/txSize.ts +4 -3
  93. package/src/utxo/index.ts +1 -0
  94. package/src/utxo/toolbox/bitcoinCash.ts +21 -13
  95. package/src/utxo/toolbox/index.ts +16 -4
  96. package/src/utxo/toolbox/utxo.ts +42 -27
  97. package/src/utxo/toolbox/zcash.ts +208 -0
  98. package/dist/chunk-0h4xdrwz.js +0 -4
  99. package/dist/cosmos/index.cjs +0 -3
  100. package/dist/cosmos/index.cjs.map +0 -16
  101. package/dist/cosmos/index.js +0 -3
  102. package/dist/cosmos/index.js.map +0 -16
  103. package/dist/evm/index.cjs +0 -3
  104. package/dist/evm/index.cjs.map +0 -18
  105. package/dist/evm/index.js +0 -3
  106. package/dist/evm/index.js.map +0 -18
  107. package/dist/index.cjs +0 -3
  108. package/dist/index.cjs.map +0 -10
  109. package/dist/index.js +0 -3
  110. package/dist/index.js.map +0 -10
  111. package/dist/radix/index.cjs.map +0 -10
  112. package/dist/radix/index.js +0 -3
  113. package/dist/radix/index.js.map +0 -10
  114. package/dist/ripple/index.cjs +0 -3
  115. package/dist/ripple/index.cjs.map +0 -10
  116. package/dist/ripple/index.js +0 -3
  117. package/dist/ripple/index.js.map +0 -10
  118. package/dist/solana/index.cjs +0 -3
  119. package/dist/solana/index.cjs.map +0 -10
  120. package/dist/solana/index.js +0 -3
  121. package/dist/solana/index.js.map +0 -10
  122. package/dist/substrate/index.cjs +0 -3
  123. package/dist/substrate/index.cjs.map +0 -11
  124. package/dist/substrate/index.js +0 -3
  125. package/dist/substrate/index.js.map +0 -11
  126. package/dist/utxo/index.cjs +0 -3
  127. package/dist/utxo/index.cjs.map +0 -16
  128. package/dist/utxo/index.js +0 -3
  129. package/dist/utxo/index.js.map +0 -16
  130. /package/dist/{chunk-0f0249b1.js.map → chunk-9bqegm61.js.map} +0 -0
@@ -0,0 +1,80 @@
1
+ import { beforeAll, beforeEach, describe, expect, test } from "bun:test";
2
+ import { AssetValue, Chain, SKConfig } from "@swapkit/helpers";
3
+ import { providers } from "near-api-js";
4
+ import { getFullAccessPublicKey } from "../helpers/core";
5
+ import { getNearToolbox } from "../toolbox";
6
+
7
+ const accountId = "ea03292d08136cca439513a33c76af083e5204eceb4ce720320fff84071a447f";
8
+
9
+ const context: {
10
+ provider: providers.JsonRpcProvider;
11
+ toolbox: Awaited<ReturnType<typeof getNearToolbox>>;
12
+ } = {} as any;
13
+
14
+ beforeAll(() => {
15
+ context.provider = new providers.JsonRpcProvider({
16
+ url: SKConfig.get("rpcUrls")[Chain.Near],
17
+ });
18
+ });
19
+
20
+ beforeEach(async () => {
21
+ context.toolbox = await getNearToolbox();
22
+ });
23
+
24
+ describe("NEAR createTransaction", () => {
25
+ test("should retrieve full access public key for valid account", async () => {
26
+ const toolbox = context.toolbox;
27
+
28
+ const transaction = await toolbox.createTransaction({
29
+ recipient: accountId, // Self transfer
30
+ assetValue: AssetValue.from({
31
+ chain: Chain.Near,
32
+ value: "0.001", // Small amount
33
+ }),
34
+ sender: accountId,
35
+ feeRate: 300000000000000, // 300 TGas
36
+ });
37
+
38
+ expect(transaction).toBeDefined();
39
+ expect(transaction.publicKey).toBeDefined();
40
+ expect(transaction.serialized).toBeDefined();
41
+ }, 30000);
42
+
43
+ test("should throw error for invalid account", async () => {
44
+ const provider = context.provider;
45
+ const invalidAccountId = "non-existent-account-12345.testnet";
46
+
47
+ await expect(async () => {
48
+ await getFullAccessPublicKey(provider, invalidAccountId);
49
+ }).toThrow();
50
+ }, 10000);
51
+
52
+ test("should handle network errors gracefully", async () => {
53
+ const invalidProvider = new providers.JsonRpcProvider({ url: "https://invalid-rpc-url.test" });
54
+
55
+ await expect(async () => {
56
+ await getFullAccessPublicKey(invalidProvider, "any-account.testnet");
57
+ }).toThrow();
58
+ }, 10000);
59
+
60
+ test("should work with contract function call transaction", async () => {
61
+ const toolbox = context.toolbox;
62
+ const provider = context.provider;
63
+
64
+ const contractTransaction = await toolbox.createContractFunctionCall({
65
+ sender: accountId,
66
+ contractId: "wrap.testnet", // Known testnet contract
67
+ methodName: "storage_deposit",
68
+ args: { account_id: accountId },
69
+ gas: "300000000000000", // 300 TGas
70
+ attachedDeposit: "1250000000000000000000", // 0.00125 NEAR for storage
71
+ });
72
+
73
+ expect(contractTransaction).toBeDefined();
74
+ expect(contractTransaction.publicKey).toBeDefined();
75
+
76
+ // Verify the public key can be retrieved directly
77
+ const { publicKey } = await getFullAccessPublicKey(provider, accountId);
78
+ expect(publicKey.toString()).toBe(contractTransaction.publicKey);
79
+ }, 30000);
80
+ });
@@ -0,0 +1,22 @@
1
+ import type { Account, Contract } from "near-api-js";
2
+
3
+ // Create a Near contract instance
4
+ export async function createNearContract<T extends Contract>({
5
+ account,
6
+ contractId,
7
+ viewMethods,
8
+ changeMethods,
9
+ }: {
10
+ account: Account;
11
+ contractId: string;
12
+ viewMethods: string[];
13
+ changeMethods: string[];
14
+ }): Promise<T> {
15
+ const { Contract } = await import("near-api-js");
16
+
17
+ return new Contract(account, contractId, {
18
+ viewMethods,
19
+ changeMethods,
20
+ useLocalViewExecution: true, // Enable local view execution for efficiency
21
+ }) as T;
22
+ }
@@ -0,0 +1,89 @@
1
+ import type { Provider } from "@near-js/providers";
2
+ import { type DerivationPathArray, SwapKitError, derivationPathToString } from "@swapkit/helpers";
3
+ import { type KeyPair, KeyPairSigner } from "near-api-js";
4
+ import type { NearSigner } from "../types";
5
+
6
+ export async function validateNearAddress(address: string) {
7
+ // Use the official NEAR SDK validation function if available
8
+ try {
9
+ const { validateAccountId } = await import("near-sdk-js");
10
+ return validateAccountId(address);
11
+ } catch {
12
+ const ACCOUNT_ID_REGEX = /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/;
13
+
14
+ return address.length >= 2 && address.length <= 64 && ACCOUNT_ID_REGEX.test(address);
15
+ }
16
+ }
17
+
18
+ export async function getNearSignerFromPhrase(params: {
19
+ phrase: string;
20
+ derivationPath?: DerivationPathArray;
21
+ index?: number;
22
+ }) {
23
+ const { parseSeedPhrase } = await import("near-seed-phrase");
24
+ const { KeyPair } = await import("near-api-js");
25
+
26
+ // Handle derivation path logic here
27
+ // NEAR uses a 3-level derivation path: m/44'/397'/index'
28
+ const index = params.index || 0;
29
+ const derivationPath = params.derivationPath
30
+ ? derivationPathToString(params.derivationPath.slice(0, 3) as [number, number, number])
31
+ : `m/44'/397'/${index}'`;
32
+
33
+ const { secretKey } = parseSeedPhrase(params.phrase, derivationPath);
34
+ const keyPair = KeyPair.fromString(secretKey as any);
35
+
36
+ return createNearSignerFromKeyPair(keyPair);
37
+ }
38
+
39
+ export async function getNearSignerFromPrivateKey(privateKey: string) {
40
+ const { KeyPair } = await import("near-api-js/lib/utils");
41
+ const keyPair = KeyPair.fromString(privateKey as any);
42
+ return createNearSignerFromKeyPair(keyPair);
43
+ }
44
+
45
+ class SKKeyPairSigner extends KeyPairSigner {
46
+ #keyPair: KeyPair;
47
+
48
+ constructor(keyPair: KeyPair) {
49
+ super(keyPair);
50
+ this.#keyPair = keyPair;
51
+ }
52
+
53
+ getAddress(): Promise<string> {
54
+ // For implicit accounts, derive account ID from public key
55
+ // NEAR implicit accounts use hex representation of the public key
56
+ const publicKey = this.#keyPair.getPublicKey();
57
+ const hexAddress = Buffer.from(publicKey.data).toString("hex");
58
+ return Promise.resolve(hexAddress);
59
+ }
60
+ }
61
+
62
+ function createNearSignerFromKeyPair(keyPair: KeyPair): NearSigner {
63
+ const keyPairSigner = new SKKeyPairSigner(keyPair);
64
+
65
+ return keyPairSigner;
66
+ }
67
+
68
+ export async function getFullAccessPublicKey(provider: Provider, accountId: string) {
69
+ // Get the first full access key for the account
70
+ const response = await provider.query({
71
+ request_type: "view_access_key_list",
72
+ finality: "final",
73
+ account_id: accountId,
74
+ });
75
+
76
+ const fullAccessKey = (response as any).keys.find(
77
+ (key: any) => key.access_key.permission === "FullAccess",
78
+ );
79
+
80
+ if (!fullAccessKey) {
81
+ throw new SwapKitError("toolbox_near_invalid_address");
82
+ }
83
+
84
+ const { utils } = await import("near-api-js");
85
+ const publicKey = utils.PublicKey.fromString(fullAccessKey.public_key);
86
+ const nonce = (fullAccessKey.access_key.nonce as number) || 0;
87
+
88
+ return { publicKey, nonce };
89
+ }
@@ -0,0 +1,110 @@
1
+ import type { Account } from "near-api-js";
2
+ import type { NearGasEstimateParams } from "../types/contract";
3
+
4
+ // Gas constants (in TGas - 10^12 gas units)
5
+ export const GAS_COSTS = {
6
+ SIMPLE_TRANSFER: "1", // 1 TGas
7
+ TOKEN_TRANSFER: "100", // 100 TGas
8
+ CONTRACT_CALL: "100", // 100 TGas base
9
+ ACCOUNT_CREATION: "30", // 30 TGas
10
+ CONTRACT_DEPLOYMENT: "200", // 200 TGas
11
+ ACCESS_KEY_ADDITION: "5", // 5 TGas
12
+ ACCESS_KEY_DELETION: "5", // 5 TGas
13
+ STAKE: "10", // 10 TGas
14
+ STORAGE_DEPOSIT: "100", // 100 TGas
15
+ } as const;
16
+
17
+ // Type guards for discriminated union
18
+ export function isSimpleTransfer(
19
+ params: NearGasEstimateParams,
20
+ ): params is { recipient: string; amount: string } {
21
+ return "recipient" in params && "amount" in params && !("contractId" in params);
22
+ }
23
+
24
+ export function isContractCall(params: NearGasEstimateParams): params is {
25
+ contractId: string;
26
+ methodName: string;
27
+ args?: Record<string, any>;
28
+ attachedDeposit?: string;
29
+ } {
30
+ return "contractId" in params && "methodName" in params;
31
+ }
32
+
33
+ export function isBatchTransaction(params: NearGasEstimateParams): params is { actions: any[] } {
34
+ return "actions" in params;
35
+ }
36
+
37
+ export function isAccountCreation(params: NearGasEstimateParams): params is {
38
+ newAccountId: string;
39
+ publicKey?: string;
40
+ } {
41
+ return "newAccountId" in params;
42
+ }
43
+
44
+ export function isContractDeployment(
45
+ params: NearGasEstimateParams,
46
+ ): params is { contractCode: Uint8Array } {
47
+ return "contractCode" in params;
48
+ }
49
+
50
+ export function isCustomEstimator(params: NearGasEstimateParams): params is {
51
+ customEstimator: (account: Account) => Promise<string>;
52
+ } {
53
+ return "customEstimator" in params;
54
+ }
55
+
56
+ // Helper function to estimate gas for batch actions
57
+ export function estimateBatchGas(actions: any[]) {
58
+ let totalGas = 0;
59
+
60
+ for (const action of actions) {
61
+ switch (action.enum) {
62
+ case "transfer":
63
+ totalGas += Number(GAS_COSTS.SIMPLE_TRANSFER);
64
+ break;
65
+ case "functionCall":
66
+ totalGas += Number(GAS_COSTS.CONTRACT_CALL);
67
+ break;
68
+ case "createAccount":
69
+ totalGas += Number(GAS_COSTS.ACCOUNT_CREATION);
70
+ break;
71
+ case "deployContract":
72
+ totalGas += Number(GAS_COSTS.CONTRACT_DEPLOYMENT);
73
+ break;
74
+ case "addKey":
75
+ totalGas += Number(GAS_COSTS.ACCESS_KEY_ADDITION);
76
+ break;
77
+ case "deleteKey":
78
+ totalGas += Number(GAS_COSTS.ACCESS_KEY_DELETION);
79
+ break;
80
+ case "stake":
81
+ totalGas += Number(GAS_COSTS.STAKE);
82
+ break;
83
+ default:
84
+ totalGas += Number(GAS_COSTS.CONTRACT_CALL);
85
+ }
86
+ }
87
+
88
+ return totalGas.toString();
89
+ }
90
+
91
+ // Helper function to get gas cost for contract methods
92
+ export function getContractMethodGas(methodName: string) {
93
+ if (methodName === "ft_transfer" || methodName === "ft_transfer_call") {
94
+ return GAS_COSTS.TOKEN_TRANSFER;
95
+ }
96
+ if (methodName === "storage_deposit") {
97
+ return GAS_COSTS.STORAGE_DEPOSIT;
98
+ }
99
+ return GAS_COSTS.CONTRACT_CALL;
100
+ }
101
+
102
+ // Convert TGas string to gas units
103
+ export function tgasToGas(tgas: string): string {
104
+ return (BigInt(tgas) * BigInt(10 ** 12)).toString();
105
+ }
106
+
107
+ // Convert gas units to TGas
108
+ export function gasToTGas(gas: string): string {
109
+ return (BigInt(gas) / BigInt(10 ** 12)).toString();
110
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./core";
2
+
3
+ export { createNearContract } from "./contractFactory";
4
+ export * from "./gasEstimation";
5
+ export { createNEP141Token } from "./nep141";
@@ -0,0 +1,110 @@
1
+ import type { Account, Contract } from "near-api-js";
2
+ import { createNearContract } from "./contractFactory";
3
+
4
+ const DEFAULT_STORAGE_DEPOSIT = "1250000000000000000000"; // 0.00125 NEAR
5
+
6
+ // Define NEP-141 contract interface
7
+ interface NEP141Contract extends Contract {
8
+ // View methods
9
+ ft_balance_of(args: { account_id: string }): Promise<string>;
10
+ ft_total_supply(): Promise<string>;
11
+ ft_metadata(): Promise<any>;
12
+ storage_balance_of(args: { account_id: string }): Promise<any>;
13
+ storage_balance_bounds(): Promise<any>;
14
+
15
+ // Change methods
16
+ ft_transfer(args: any, gas: any, deposit: any): Promise<any>;
17
+ ft_transfer_call(args: any, gas: any, deposit: any): Promise<any>;
18
+ storage_deposit(args: any, gas: any, deposit: any): Promise<any>;
19
+ storage_withdraw(args: any, gas: any, deposit: any): Promise<any>;
20
+ storage_unregister(force?: boolean, gas?: any): Promise<any>;
21
+ }
22
+
23
+ export async function createNEP141Token({
24
+ contractId,
25
+ account,
26
+ }: {
27
+ contractId: string;
28
+ account: Account;
29
+ }) {
30
+ const BN = (await import("bn.js")).default;
31
+
32
+ const contract = await createNearContract<NEP141Contract>({
33
+ account,
34
+ contractId,
35
+ viewMethods: [
36
+ "ft_balance_of",
37
+ "ft_total_supply",
38
+ "ft_metadata",
39
+ "storage_balance_of",
40
+ "storage_balance_bounds",
41
+ ],
42
+ changeMethods: [
43
+ "ft_transfer",
44
+ "ft_transfer_call",
45
+ "storage_deposit",
46
+ "storage_withdraw",
47
+ "storage_unregister",
48
+ ],
49
+ });
50
+
51
+ // Helper to ensure storage before transfers
52
+ const ensureStorageFor = async (accountId: string) => {
53
+ const balance = await contract.storage_balance_of({ account_id: accountId });
54
+ if (!balance) {
55
+ // Get minimum storage requirement
56
+ const bounds = await contract.storage_balance_bounds();
57
+ const deposit = bounds?.min || DEFAULT_STORAGE_DEPOSIT;
58
+
59
+ await contract.storage_deposit(
60
+ { account_id: accountId },
61
+ new BN("100000000000000"), // 100 TGas
62
+ new BN(deposit),
63
+ );
64
+ }
65
+ };
66
+
67
+ return {
68
+ transfer: async (receiverId: string, amount: string, memo?: string) => {
69
+ // Ensure recipient has storage before transfer
70
+ await ensureStorageFor(receiverId);
71
+
72
+ return contract.ft_transfer(
73
+ { receiver_id: receiverId, amount, memo },
74
+ new BN("100000000000000"), // 100 TGas
75
+ new BN("1"), // 1 yoctoNEAR for security
76
+ );
77
+ },
78
+
79
+ transferCall: async (receiverId: string, amount: string, msg: string, memo?: string) => {
80
+ // Ensure recipient has storage before transfer
81
+ await ensureStorageFor(receiverId);
82
+
83
+ return contract.ft_transfer_call(
84
+ { receiver_id: receiverId, amount, memo, msg },
85
+ new BN("100000000000000"), // 100 TGas
86
+ new BN("1"), // 1 yoctoNEAR for security
87
+ );
88
+ },
89
+
90
+ balanceOf: (accountId: string) => contract.ft_balance_of({ account_id: accountId }),
91
+
92
+ totalSupply: () => contract.ft_total_supply(),
93
+
94
+ metadata: () => contract.ft_metadata(),
95
+
96
+ storageBalanceOf: (accountId: string) => contract.storage_balance_of({ account_id: accountId }),
97
+
98
+ storageDeposit: (accountId?: string, amount?: string) =>
99
+ contract.storage_deposit(
100
+ { account_id: accountId },
101
+ new BN("100000000000000"),
102
+ new BN(amount || DEFAULT_STORAGE_DEPOSIT),
103
+ ),
104
+
105
+ ensureStorage: ensureStorageFor,
106
+
107
+ // Raw contract access for advanced use cases
108
+ contract,
109
+ };
110
+ }
@@ -0,0 +1,24 @@
1
+ export * from "./toolbox";
2
+ export * from "./types";
3
+ export * from "./helpers";
4
+
5
+ import type { getNearToolbox } from "./toolbox";
6
+
7
+ export type NearWallet = Awaited<ReturnType<typeof getNearToolbox>>;
8
+
9
+ export type {
10
+ NearContractInterface,
11
+ NearCallParams,
12
+ NearGasEstimateParams,
13
+ } from "./types/contract";
14
+ export type {
15
+ FungibleTokenMetadata,
16
+ StorageBalance,
17
+ StorageBalanceBounds,
18
+ NEP141Contract,
19
+ TokenTransferParams,
20
+ } from "./types/nep141";
21
+
22
+ export { createNEP141Token } from "./helpers/nep141";
23
+ export { tgasToGas, gasToTGas } from "./helpers/gasEstimation";
24
+ export { createNearContract } from "./helpers/contractFactory";