@gardenfi/core 2.3.1-beta.4 → 2.3.1-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CVfLtKrr.cjs");exports.API=e.API;exports.BitcoinNetwork=e.BitcoinNetwork;exports.BitcoinProvider=e.BitcoinProvider;exports.BitcoinWallet=e.BitcoinWallet;exports.BlockNumberFetcher=e.BlockNumberFetcher;exports.EvmRelay=e.EvmRelay;exports.Garden=e.Garden;exports.OrderActions=e.OrderActions;exports.OrderStatus=e.OrderStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.ParseSwapStatus=e.ParseSwapStatus;exports.Quote=e.Quote;exports.STARKNET_CONFIG=e.STARKNET_CONFIG;exports.SecretManager=e.SecretManager;exports.SolanaHTLC=e.SolanaHTLC;exports.SolanaRelay=e.SolanaRelay;exports.SolanaRelayerAddress=e.SolanaRelayerAddress;exports.StarknetHTLC=e.StarknetHTLC;exports.StarknetRelay=e.StarknetRelay;exports.SwapStatus=e.SwapStatus;exports.botanix=e.botanixMainnet;exports.checkStarknetAlloance=e.checkAllowance;exports.checkStarknetAllowanceAndApprove=e.checkAllowanceAndApprove;exports.constructOrderPair=e.constructOrderPair;exports.evmToViemChainMap=e.evmToViemChainMap;exports.filterDeadlineExpiredOrders=e.filterDeadlineExpiredOrders;exports.hyperliquid=e.hyperliquid;exports.hyperliquidTestnet=e.hyperliquidTestnet;exports.isExpired=e.isExpired;exports.isStarknetAllowanceSufficient=e.isAllowanceSufficient;exports.parseAction=e.parseAction;exports.parseActionFromStatus=e.parseActionFromStatus;exports.resolveApiConfig=e.resolveApiConfig;exports.solanaProgramAddress=e.solanaProgramAddress;exports.switchOrAddNetwork=e.switchOrAddNetwork;exports.toXOnly=e.toXOnly;exports.validateBTCAddress=e.validateBTCAddress;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-K8fs0tKV.cjs");exports.API=e.API;exports.BitcoinNetwork=e.BitcoinNetwork;exports.BitcoinProvider=e.BitcoinProvider;exports.BitcoinWallet=e.BitcoinWallet;exports.BlockNumberFetcher=e.BlockNumberFetcher;exports.EvmRelay=e.EvmRelay;exports.Garden=e.Garden;exports.OrderActions=e.OrderActions;exports.OrderStatus=e.OrderStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.ParseSwapStatus=e.ParseSwapStatus;exports.Quote=e.Quote;exports.STARKNET_CONFIG=e.STARKNET_CONFIG;exports.SecretManager=e.SecretManager;exports.SolanaHTLC=e.SolanaHTLC;exports.SolanaRelay=e.SolanaRelay;exports.SolanaRelayerAddress=e.SolanaRelayerAddress;exports.StarknetHTLC=e.StarknetHTLC;exports.StarknetRelay=e.StarknetRelay;exports.SwapStatus=e.SwapStatus;exports.botanix=e.botanixMainnet;exports.checkStarknetAlloance=e.checkAllowance;exports.checkStarknetAllowanceAndApprove=e.checkAllowanceAndApprove;exports.constructOrderPair=e.constructOrderPair;exports.evmToViemChainMap=e.evmToViemChainMap;exports.filterDeadlineExpiredOrders=e.filterDeadlineExpiredOrders;exports.hyperliquid=e.hyperliquid;exports.hyperliquidTestnet=e.hyperliquidTestnet;exports.isExpired=e.isExpired;exports.isStarknetAllowanceSufficient=e.isAllowanceSufficient;exports.parseAction=e.parseAction;exports.parseActionFromStatus=e.parseActionFromStatus;exports.resolveApiConfig=e.resolveApiConfig;exports.solanaProgramAddress=e.solanaProgramAddress;exports.switchOrAddNetwork=e.switchOrAddNetwork;exports.toXOnly=e.toXOnly;exports.validateBTCAddress=e.validateBTCAddress;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { T as e, M as r, N as t, R as i, m as n, E as o, G as l, O as d, n as c, P as S, q as A, Q as p, U as u, v as k, k as O, j as h, V as m, h as w, S as y, o as T, L as v, y as C, w as P, z as N, F as R, t as f, K as x, J as B, r as E, x as F, p as g, u as q, D as G, W as I, I as L, C as M, A as b } from "./index-DB2fEXhu.js";
1
+ import { T as e, M as r, N as t, R as i, m as n, E as o, G as l, O as d, n as c, P as S, q as A, Q as p, U as u, v as k, k as O, j as h, V as m, h as w, S as y, o as T, L as v, y as C, w as P, z as N, F as R, t as f, K as x, J as B, r as E, x as F, p as g, u as q, D as G, W as I, I as L, C as M, A as b } from "./index-C4i5UzzH.js";
2
2
  export {
3
3
  e as API,
4
4
  r as BitcoinNetwork,
@@ -16,14 +16,8 @@ export declare const STARKNET_CONFIG: Record<Network, {
16
16
  }>;
17
17
  export declare const SolanaRelayerAddress: Record<Network, string>;
18
18
  export declare const solanaProgramAddress: {
19
- mainnet: {
20
- native: string;
21
- spl: string;
22
- };
23
- staging: {
24
- native: string;
25
- spl: string;
26
- };
19
+ mainnet: string;
20
+ staging: string;
27
21
  };
28
22
  export declare const DEFAULT_AFFILIATE_ASSET: {
29
23
  chain: "base";
@@ -159,10 +159,7 @@ export type GardenCoreConfig = {
159
159
  quote?: IQuote;
160
160
  blockNumberFetcher?: IBlockNumberFetcher;
161
161
  btcWallet?: IBitcoinWallet;
162
- solanaProgramAddress?: {
163
- native?: string;
164
- spl?: string;
165
- };
162
+ solanaProgramAddress?: string;
166
163
  };
167
164
  export type GardenHTLCModules = {
168
165
  htlc: {
@@ -5,7 +5,7 @@ import { MatchedOrder } from '@gardenfi/orderbook';
5
5
 
6
6
  /**
7
7
  * A Relay is an endpoint that submits the transaction on-chain on one's behalf, paying any fees.
8
- * SolanaRelay is a unified implementation that performs atomic swaps for both SPL and native tokens.
8
+ * SolanaRelay is one such implementation performs the atomic swaps through a given relayer url.
9
9
  */
10
10
  export declare class SolanaRelay implements ISolanaHTLC {
11
11
  private provider;
@@ -13,84 +13,37 @@ export declare class SolanaRelay implements ISolanaHTLC {
13
13
  /**
14
14
  * The on-chain Program Derived Address (PDA) that facilitates this swap.
15
15
  * A PDA represents an on-chain memory space. It can store SOL too and is owned by a program (that derived it).
16
- * This PDA stores the swap state (initiator, redeemer, secrethash etc) on-chain and also escrows the tokens/SOL.
16
+ * This PDA stores the swap state (initiator, redeemer, secrethash etc) on-chain and also escrows the SOL.
17
17
  */
18
18
  private swapAccount?;
19
- private splProgram;
20
- private nativeProgram;
19
+ private program;
21
20
  private relayer;
22
21
  /**
23
22
  * Creates a new instance of SolanaRelay.
24
23
  * @param {AnchorProvider} provider - An abstraction of RPC connection and a Wallet
25
24
  * @param {Url} endpoint - API endpoint of the relayer node
26
25
  * @param {string} relayer - On-chain address of the relayer in base58 format
27
- * @param {string} splProgramAddress - On-chain address of the SPL token swap program
28
- * @param {string} nativeProgramAddress - On-chain address of the native token swap program
29
26
  * @throws {Error} If any required parameters are missing or invalid
30
27
  */
31
- constructor(provider: AnchorProvider, url: Url, relayer: string, nativeProgramAddress: string, splProgramAddress: string);
28
+ constructor(provider: AnchorProvider, url: Url, relayer: string, programAddress: string);
32
29
  /**
33
- * Gets the on-chain address of the current user's wallet.
34
- * @returns {string} The wallet's on-chain address in base58 format
35
- * @throws {Error} If no provider public key is found
30
+ * Gets the on-chain address of the atomic swap program.
31
+ * @returns {string} The program's on-chain address in base58 format
32
+ * @throws {Error} If no program ID is found
36
33
  */
37
34
  get htlcActorAddress(): string;
38
35
  /**
39
- * Determines if the given order is for a native Solana token (SOL).
40
- * @param {MatchedOrder} order - The matched order to check
41
- * @returns {boolean} True if it's a native token, false if it's an SPL token
42
- * @private
43
- */
44
- private isNativeToken;
45
- /**
46
- * Sends a transaction via the relayer for SPL tokens.
47
- * @param {web3.Transaction} transaction - The transaction to send
48
- * @param {string} orderId - The order ID for tracking
49
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
50
- * - Ok with the transaction ID on success
51
- * - Err with an error message on failure
52
- * @private
53
- */
54
- private sendSplViaRelayer;
55
- /**
56
- * Initiates a swap directly via HTLC (without relayer).
36
+ * Sends a transaction via the relayer.
57
37
  * @param {web3.Transaction} transaction - The transaction to send
58
- * @param {MatchedOrder} order - The matched order
59
38
  * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
60
39
  * - Ok with the transaction ID on success
61
40
  * - Err with an error message on failure
62
41
  * @private
63
42
  */
43
+ private sendViaRelayer;
64
44
  private initiateViaHTLC;
65
- /**
66
- * Creates a PDA (Program Derived Address) for the swap account.
67
- * @param {Buffer} secretHash - The secret hash buffer
68
- * @param {web3.PublicKey} programId - The program ID to use for PDA derivation
69
- * @returns {web3.PublicKey} The derived PDA
70
- * @private
71
- */
72
- private createSwapPDA;
73
- /**
74
- * Initiates a swap for SPL tokens.
75
- * @param {MatchedOrder} order - The matched order containing swap details
76
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
77
- * - Ok with the transaction ID on success
78
- * - Err with an error message on failure
79
- * @private
80
- */
81
- private initiateSplSwap;
82
- /**
83
- * Initiates a swap for native tokens (SOL).
84
- * @param {MatchedOrder} order - The matched order containing swap details
85
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
86
- * - Ok with the transaction ID on success
87
- * - Err with an error message on failure
88
- * @private
89
- */
90
- private initiateNativeSwap;
91
45
  /**
92
46
  * Initiates a swap by creating a new swap account and locking funds.
93
- * Automatically detects whether to use SPL or native token handling.
94
47
  * @param {MatchedOrder} order - The matched order containing swap details
95
48
  * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
96
49
  * - Ok with the transaction ID on success
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "2.3.1-beta.4",
3
+ "version": "2.3.1-beta.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -27,9 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@coral-xyz/anchor": "^0.30.1",
30
- "@gardenfi/orderbook": "2.3.1-beta.2",
31
- "@gardenfi/utils": "2.3.0",
32
- "@solana/spl-token": "^0.4.13",
30
+ "@gardenfi/orderbook": "2.3.1",
31
+ "@gardenfi/utils": "2.3.1",
33
32
  "bignumber.js": "^9.1.2",
34
33
  "bip32": "^4.0.0",
35
34
  "bip39": "^3.1.0",