@swapkit/toolboxes 1.0.0-beta.19 → 1.0.0-beta.20

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 (54) hide show
  1. package/dist/{chunk-vhc011em.js → chunk-12xtvbsp.js} +3 -3
  2. package/dist/{chunk-vhc011em.js.map → chunk-12xtvbsp.js.map} +1 -1
  3. package/dist/{chunk-cv69ewns.js → chunk-9bqegm61.js} +1 -1
  4. package/dist/chunk-kbnwrc5b.js +4 -0
  5. package/dist/chunk-kbnwrc5b.js.map +10 -0
  6. package/dist/{chunk-38ztynv0.js → chunk-s47y8512.js} +2 -2
  7. package/dist/{chunk-38ztynv0.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/src/cosmos/index.cjs +2 -2
  11. package/dist/src/cosmos/index.cjs.map +3 -3
  12. package/dist/src/cosmos/index.js +2 -2
  13. package/dist/src/cosmos/index.js.map +3 -3
  14. package/dist/src/evm/index.cjs +2 -2
  15. package/dist/src/evm/index.cjs.map +3 -3
  16. package/dist/src/evm/index.js +2 -2
  17. package/dist/src/evm/index.js.map +3 -3
  18. package/dist/src/index.cjs +2 -2
  19. package/dist/src/index.cjs.map +3 -3
  20. package/dist/src/index.js +2 -2
  21. package/dist/src/index.js.map +3 -3
  22. package/dist/src/near/index.cjs +3 -0
  23. package/dist/src/near/index.cjs.map +13 -0
  24. package/dist/src/near/index.js +3 -0
  25. package/dist/src/near/index.js.map +13 -0
  26. package/dist/src/radix/index.js +2 -2
  27. package/dist/src/radix/index.js.map +1 -1
  28. package/dist/src/ripple/index.js +1 -1
  29. package/dist/src/solana/index.js +2 -2
  30. package/dist/src/solana/index.js.map +1 -1
  31. package/dist/src/substrate/index.js +2 -2
  32. package/dist/src/substrate/index.js.map +1 -1
  33. package/dist/src/tron/index.js +2 -2
  34. package/dist/src/tron/index.js.map +1 -1
  35. package/dist/src/utxo/index.cjs +2 -2
  36. package/dist/src/utxo/index.cjs.map +3 -3
  37. package/dist/src/utxo/index.js +2 -2
  38. package/dist/src/utxo/index.js.map +3 -3
  39. package/package.json +10 -2
  40. package/src/cosmos/toolbox/cosmos.ts +9 -2
  41. package/src/evm/toolbox/baseEVMToolbox.ts +19 -12
  42. package/src/index.ts +12 -0
  43. package/src/near/helpers/contractFactory.ts +22 -0
  44. package/src/near/helpers/core.ts +86 -0
  45. package/src/near/helpers/gasEstimation.ts +110 -0
  46. package/src/near/helpers/index.ts +5 -0
  47. package/src/near/helpers/nep141.ts +110 -0
  48. package/src/near/index.ts +24 -0
  49. package/src/near/toolbox.ts +497 -0
  50. package/src/near/types/contract.ts +48 -0
  51. package/src/near/types/nep141.ts +66 -0
  52. package/src/near/types.ts +58 -0
  53. package/src/utxo/toolbox/utxo.ts +3 -2
  54. /package/dist/{chunk-cv69ewns.js.map → chunk-9bqegm61.js.map} +0 -0
@@ -0,0 +1,66 @@
1
+ // NEP-141 Fungible Token Standard Types
2
+
3
+ export interface FungibleTokenMetadata {
4
+ spec: string; // e.g., "ft-1.0.0"
5
+ name: string; // e.g., "Wrapped NEAR"
6
+ symbol: string; // e.g., "wNEAR"
7
+ icon?: string; // Data URL or IPFS link
8
+ reference?: string; // URL to additional metadata
9
+ reference_hash?: string; // Base64-encoded hash of reference content
10
+ decimals: number; // e.g., 24 for NEAR
11
+ }
12
+
13
+ export interface StorageBalance {
14
+ total: string;
15
+ available: string;
16
+ }
17
+
18
+ export interface StorageBalanceBounds {
19
+ min: string;
20
+ max?: string;
21
+ }
22
+
23
+ // NEP-141 Contract Interface
24
+ export interface NEP141Contract {
25
+ // View methods
26
+ ft_balance_of(args: { account_id: string }): Promise<string>;
27
+ ft_total_supply(): Promise<string>;
28
+ ft_metadata(): Promise<FungibleTokenMetadata>;
29
+ storage_balance_of(args: { account_id: string }): Promise<StorageBalance | null>;
30
+ storage_balance_bounds(): Promise<StorageBalanceBounds>;
31
+
32
+ // Change methods
33
+ ft_transfer(
34
+ args: { receiver_id: string; amount: string; memo?: string | null },
35
+ gas?: any, // BN type
36
+ deposit?: any, // BN type
37
+ ): Promise<any>; // Returns transaction result
38
+
39
+ ft_transfer_call(
40
+ args: {
41
+ receiver_id: string;
42
+ amount: string;
43
+ memo?: string | null;
44
+ msg: string;
45
+ },
46
+ gas?: any,
47
+ deposit?: any,
48
+ ): Promise<any>; // Returns transaction result
49
+
50
+ storage_deposit(
51
+ args: { account_id?: string; registration_only?: boolean },
52
+ gas?: any,
53
+ deposit?: any,
54
+ ): Promise<StorageBalance>;
55
+
56
+ storage_withdraw(args: { amount?: string }, gas?: any, deposit?: any): Promise<StorageBalance>;
57
+
58
+ storage_unregister(args: { force?: boolean }, gas?: any, deposit?: any): Promise<boolean>;
59
+ }
60
+
61
+ // Token transfer parameters
62
+ export interface TokenTransferParams {
63
+ recipient: string;
64
+ amount: string;
65
+ memo?: string;
66
+ }
@@ -0,0 +1,58 @@
1
+ import type {
2
+ ChainSigner,
3
+ DerivationPathArray,
4
+ GenericCreateTransactionParams,
5
+ GenericTransferParams,
6
+ } from "@swapkit/helpers";
7
+ import type { KeyPairSigner, Signer, transactions } from "near-api-js";
8
+
9
+ interface NearKeyPairSigner
10
+ extends KeyPairSigner,
11
+ Omit<
12
+ ChainSigner<transactions.Transaction, transactions.SignedTransaction>,
13
+ "signTransaction"
14
+ > {}
15
+
16
+ interface NearGeneralSigner
17
+ extends Signer,
18
+ Omit<
19
+ ChainSigner<transactions.Transaction, transactions.SignedTransaction>,
20
+ "signTransaction"
21
+ > {}
22
+
23
+ // Extend both ChainSigner and NEAR's Signer class, omitting signTransaction
24
+ export type NearSigner = NearKeyPairSigner | NearGeneralSigner;
25
+
26
+ export type NearToolboxParams =
27
+ | { signer?: NearSigner; accountId?: string }
28
+ | { phrase?: string; index?: number; derivationPath?: DerivationPathArray };
29
+
30
+ export interface NearTransferParams extends GenericTransferParams {}
31
+
32
+ export interface NearConfig {
33
+ networkId: "mainnet" | "testnet" | "betanet";
34
+ nodeUrl: string;
35
+ walletUrl?: string;
36
+ helperUrl?: string;
37
+ keyStore?: any;
38
+ }
39
+
40
+ export interface NearFunctionCallParams {
41
+ contractId: string;
42
+ methodName: string;
43
+ args: Uint8Array | Record<string, any>;
44
+ deposit?: bigint | string | number;
45
+ gas?: bigint | string | number;
46
+ }
47
+
48
+ export interface NearCreateTransactionParams extends GenericCreateTransactionParams {
49
+ // NEAR-specific options
50
+ publicKey: string; // Public key for the transaction
51
+ attachedDeposit?: string;
52
+ // Function call parameters
53
+ functionCall?: {
54
+ methodName: string;
55
+ args: object;
56
+ attachedDeposit: string;
57
+ };
58
+ }
@@ -9,6 +9,7 @@ import {
9
9
  SwapKitError,
10
10
  SwapKitNumber,
11
11
  type UTXOChain,
12
+ applyFeeMultiplier,
12
13
  derivationPathToString,
13
14
  updateDerivationPath,
14
15
  } from "@swapkit/helpers";
@@ -483,8 +484,8 @@ async function getFeeRates(chain: UTXOChain) {
483
484
 
484
485
  return {
485
486
  [FeeOption.Average]: suggestedFeeRate,
486
- [FeeOption.Fast]: suggestedFeeRate * 1.5,
487
- [FeeOption.Fastest]: suggestedFeeRate * 2.0,
487
+ [FeeOption.Fast]: applyFeeMultiplier(suggestedFeeRate, FeeOption.Fast),
488
+ [FeeOption.Fastest]: applyFeeMultiplier(suggestedFeeRate, FeeOption.Fastest),
488
489
  };
489
490
  }
490
491