@gardenfi/core 2.4.6-beta.7 → 2.4.6-beta.8

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.
@@ -8,7 +8,6 @@ import { IEVMHTLC } from '../evm/htlc.types';
8
8
  import { IStarknetHTLC } from '../starknet/starknetHTLC.types';
9
9
  import { IBitcoinWallet } from '../bitcoin/wallet/wallet.interface';
10
10
  import { ISolanaHTLC } from '../solana/htlc/ISolanaHTLC';
11
- import { ISuiHTLC } from '../sui/suiHTLC.types';
12
11
 
13
12
  export declare class Garden extends EventBroker<GardenEvents> implements IGardenJS {
14
13
  private environment;
@@ -23,7 +22,6 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
23
22
  private _evmHTLC;
24
23
  private _starknetHTLC;
25
24
  private _solanaHTLC;
26
- private _suiHTLC;
27
25
  private _btcWallet;
28
26
  private bitcoinRedeemCache;
29
27
  private _digestKey;
@@ -35,7 +33,6 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
35
33
  get evmHTLC(): IEVMHTLC | undefined;
36
34
  get starknetHTLC(): IStarknetHTLC | undefined;
37
35
  get solanaHTLC(): ISolanaHTLC | undefined;
38
- get suiHTLC(): ISuiHTLC | undefined;
39
36
  get quote(): IQuote;
40
37
  get btcWallet(): IBitcoinWallet | undefined;
41
38
  get orderbook(): IOrderbook;
@@ -56,7 +53,6 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
56
53
  private validateAmount;
57
54
  execute(interval?: number): Promise<() => void>;
58
55
  private solRedeem;
59
- private suiRedeem;
60
56
  private evmRedeem;
61
57
  private starknetRedeem;
62
58
  private btcRedeem;
@@ -12,8 +12,6 @@ import { Api } from '../constants';
12
12
  import { IBitcoinWallet } from '../bitcoin/wallet/wallet.interface';
13
13
  import { ISolanaHTLC } from '../solana/htlc/ISolanaHTLC';
14
14
  import { AnchorProvider } from '@coral-xyz/anchor';
15
- import { ISuiHTLC } from '../sui/suiHTLC.types';
16
- import { WalletWithRequiredFeatures } from '@mysten/wallet-standard';
17
15
 
18
16
  export type SwapParams = {
19
17
  /**
@@ -103,11 +101,6 @@ export interface IGardenJS extends EventBroker<GardenEvents> {
103
101
  * @readonly
104
102
  */
105
103
  get solanaHTLC(): ISolanaHTLC | undefined;
106
- /**
107
- * The Sui relay.
108
- * @readonly
109
- */
110
- get suiHTLC(): ISuiHTLC | undefined;
111
104
  /**
112
105
  * The current quote.
113
106
  * @readonly
@@ -166,17 +159,13 @@ export type GardenCoreConfig = {
166
159
  quote?: IQuote;
167
160
  blockNumberFetcher?: IBlockNumberFetcher;
168
161
  btcWallet?: IBitcoinWallet;
169
- solanaProgramAddress?: {
170
- native?: string;
171
- spl?: string;
172
- };
162
+ solanaProgramAddress?: string;
173
163
  };
174
164
  export type GardenHTLCModules = {
175
165
  htlc: {
176
166
  evm?: IEVMHTLC;
177
167
  starknet?: IStarknetHTLC;
178
168
  solana?: ISolanaHTLC;
179
- sui?: ISuiHTLC;
180
169
  };
181
170
  };
182
171
  export type GardenWalletModules = {
@@ -184,7 +173,6 @@ export type GardenWalletModules = {
184
173
  evm?: WalletClient;
185
174
  starknet?: AccountInterface;
186
175
  solana?: AnchorProvider;
187
- sui?: WalletWithRequiredFeatures;
188
176
  };
189
177
  };
190
178
  export type GardenConfigWithWallets = GardenCoreConfig & GardenWalletModules;
@@ -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,86 +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
- private splProgram?;
19
- private nativeProgram?;
18
+ private swapAccount?;
19
+ private program;
20
20
  private relayer;
21
21
  /**
22
22
  * Creates a new instance of SolanaRelay.
23
23
  * @param {AnchorProvider} provider - An abstraction of RPC connection and a Wallet
24
24
  * @param {Url} endpoint - API endpoint of the relayer node
25
25
  * @param {string} relayer - On-chain address of the relayer in base58 format
26
- * @param {string} splProgramAddress - On-chain address of the SPL token swap program
27
- * @param {string} nativeProgramAddress - On-chain address of the native token swap program
28
26
  * @throws {Error} If any required parameters are missing or invalid
29
27
  */
30
- constructor(provider: AnchorProvider, url: Url, relayer: string, programAddress: {
31
- native?: string;
32
- spl?: string;
33
- });
28
+ constructor(provider: AnchorProvider, url: Url, relayer: string, programAddress: string);
34
29
  /**
35
- * Gets the on-chain address of the current user's wallet.
36
- * @returns {string} The wallet's on-chain address in base58 format
37
- * @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
38
33
  */
39
34
  get htlcActorAddress(): string;
40
35
  /**
41
- * Determines if the given order is for a native Solana token (SOL).
42
- * @param {MatchedOrder} order - The matched order to check
43
- * @returns {boolean} True if it's a native token, false if it's an SPL token
44
- * @private
45
- */
46
- private isNativeToken;
47
- /**
48
- * Sends a transaction via the relayer for SPL tokens.
49
- * @param {web3.Transaction} transaction - The transaction to send
50
- * @param {string} orderId - The order ID for tracking
51
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
52
- * - Ok with the transaction ID on success
53
- * - Err with an error message on failure
54
- * @private
55
- */
56
- private sendSplViaRelayer;
57
- /**
58
- * Initiates a swap directly via HTLC (without relayer).
36
+ * Sends a transaction via the relayer.
59
37
  * @param {web3.Transaction} transaction - The transaction to send
60
- * @param {MatchedOrder} order - The matched order
61
38
  * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
62
39
  * - Ok with the transaction ID on success
63
40
  * - Err with an error message on failure
64
41
  * @private
65
42
  */
43
+ private sendViaRelayer;
66
44
  private initiateViaHTLC;
67
- /**
68
- * Creates a PDA (Program Derived Address) for the swap account.
69
- * @param {Buffer} secretHash - The secret hash buffer
70
- * @param {web3.PublicKey} programId - The program ID to use for PDA derivation
71
- * @returns {web3.PublicKey} The derived PDA
72
- * @private
73
- */
74
- private createSwapPDA;
75
- /**
76
- * Initiates a swap for SPL tokens.
77
- * @param {MatchedOrder} order - The matched order containing swap details
78
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
79
- * - Ok with the transaction ID on success
80
- * - Err with an error message on failure
81
- * @private
82
- */
83
- private initiateSplSwap;
84
- /**
85
- * Initiates a swap for native tokens (SOL).
86
- * @param {MatchedOrder} order - The matched order containing swap details
87
- * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
88
- * - Ok with the transaction ID on success
89
- * - Err with an error message on failure
90
- * @private
91
- */
92
- private initiateNativeSwap;
93
45
  /**
94
46
  * Initiates a swap by creating a new swap account and locking funds.
95
- * Automatically detects whether to use SPL or native token handling.
96
47
  * @param {MatchedOrder} order - The matched order containing swap details
97
48
  * @returns {Promise<AsyncResult<string, string>>} A promise that resolves to either:
98
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.4.6-beta.7",
3
+ "version": "2.4.6-beta.8",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -28,12 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@coral-xyz/anchor": "^0.31.1",
31
- "@gardenfi/orderbook": "2.4.6-beta.7",
31
+ "@gardenfi/orderbook": "2.4.6",
32
32
  "@gardenfi/utils": "2.4.6",
33
- "@mysten/signers": "^0.3.4",
34
- "@mysten/sui": "^1.37.1",
35
- "@mysten/wallet-standard": "^0.16.9",
36
- "@solana/spl-token": "^0.4.13",
37
33
  "bignumber.js": "^9.1.2",
38
34
  "bip32": "^4.0.0",
39
35
  "bip39": "^3.1.0",