@gardenfi/core 2.4.3-beta.5 → 2.4.3-beta.7
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/{ccip-pXCeAfmp.js → ccip-ZkIgcVu1.js} +1 -1
- package/dist/{ccip-Etc0FLIo.cjs → ccip-zRBTY1vL.cjs} +1 -1
- package/dist/{index-DFY2Tld-.js → index-BcHwWFv2.js} +3992 -4720
- package/dist/{index-DkssHOBr.cjs → index-DpRp0W1D.cjs} +42 -42
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/src/lib/constants.d.ts +2 -8
- package/dist/src/lib/garden/garden.types.d.ts +1 -4
- package/dist/src/lib/solana/relayer/solanaRelay.d.ts +10 -59
- package/package.json +3 -4
- package/dist/src/lib/solana/idl/spl/solana_spl_swaps.d.ts +0 -637
- package/dist/src/lib/solana/idl/spl/solana_spl_swaps.json.d.ts +0 -633
- /package/dist/src/lib/solana/idl/{native/solana_native_swaps.d.ts → solana_native_swaps.d.ts} +0 -0
- /package/dist/src/lib/solana/idl/{native/solana_native_swaps.json.d.ts → solana_native_swaps.json.d.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DpRp0W1D.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.isOrderExpired=e.isOrderExpired;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 { U as e, N as r, R as t, T as i, m as n, E as o, G as d, O as l, n as c, P as S, q as A, Q as p, V as u, w as k, k as O, j as h, W as m, h as w, S as y, o as T, M as v, z as C, x as P, A as x, I as E, u as N, L as R, K as f, r as B, t as F, y as g, p as q, v as G, F as I, X as L, J as M, D as b, C as D } from "./index-
|
|
1
|
+
import { U as e, N as r, R as t, T as i, m as n, E as o, G as d, O as l, n as c, P as S, q as A, Q as p, V as u, w as k, k as O, j as h, W as m, h as w, S as y, o as T, M as v, z as C, x as P, A as x, I as E, u as N, L as R, K as f, r as B, t as F, y as g, p as q, v as G, F as I, X as L, J as M, D as b, C as D } from "./index-BcHwWFv2.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
|
-
|
|
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
|
|
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
|
|
16
|
+
* This PDA stores the swap state (initiator, redeemer, secrethash etc) on-chain and also escrows the SOL.
|
|
17
17
|
*/
|
|
18
|
-
private
|
|
19
|
-
private
|
|
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
|
|
36
|
-
* @returns {string} The
|
|
37
|
-
* @throws {Error} If no
|
|
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
|
-
*
|
|
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.3-beta.
|
|
3
|
+
"version": "2.4.3-beta.7",
|
|
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.4.3-beta.
|
|
31
|
-
"@gardenfi/utils": "2.4.
|
|
32
|
-
"@solana/spl-token": "^0.4.13",
|
|
30
|
+
"@gardenfi/orderbook": "2.4.3-beta.6",
|
|
31
|
+
"@gardenfi/utils": "2.4.3",
|
|
33
32
|
"bignumber.js": "^9.1.2",
|
|
34
33
|
"bip32": "^4.0.0",
|
|
35
34
|
"bip39": "^3.1.0",
|