@gardenfi/core 2.4.3-beta.1 → 2.4.3-beta.3

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-CkRQbABK.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DpnMUMIm.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-BosLoEd2.js";
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-B7OvSSzK.js";
2
2
  export {
3
3
  e as API,
4
4
  r as BitcoinNetwork,
@@ -8,6 +8,7 @@ export type Api = {
8
8
  evmRelay: string;
9
9
  starknetRelay: string;
10
10
  solanaRelay: string;
11
+ suiRelay: string;
11
12
  };
12
13
  export declare const API: Record<Environment, Api>;
13
14
  export declare const STARKNET_CONFIG: Record<Network, {
@@ -19,6 +20,10 @@ export declare const solanaProgramAddress: {
19
20
  mainnet: string;
20
21
  staging: string;
21
22
  };
23
+ export declare const SUI_CONFIG: Record<Network, {
24
+ packageId: string;
25
+ moduleName: string;
26
+ }>;
22
27
  export declare const DEFAULT_AFFILIATE_ASSET: {
23
28
  chain: "base";
24
29
  asset: "0xeae7721d779276eb0f5837e2fe260118724a2ba4";
@@ -8,6 +8,7 @@ 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';
11
12
 
12
13
  export declare class Garden extends EventBroker<GardenEvents> implements IGardenJS {
13
14
  private environment;
@@ -22,6 +23,7 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
22
23
  private _evmHTLC;
23
24
  private _starknetHTLC;
24
25
  private _solanaHTLC;
26
+ private _suiHTLC;
25
27
  private _btcWallet;
26
28
  private bitcoinRedeemCache;
27
29
  private _digestKey;
@@ -33,6 +35,7 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
33
35
  get evmHTLC(): IEVMHTLC | undefined;
34
36
  get starknetHTLC(): IStarknetHTLC | undefined;
35
37
  get solanaHTLC(): ISolanaHTLC | undefined;
38
+ get suiHTLC(): ISuiHTLC | undefined;
36
39
  get quote(): IQuote;
37
40
  get btcWallet(): IBitcoinWallet | undefined;
38
41
  get orderbook(): IOrderbook;
@@ -53,6 +56,7 @@ export declare class Garden extends EventBroker<GardenEvents> implements IGarden
53
56
  private validateAmount;
54
57
  execute(interval?: number): Promise<() => void>;
55
58
  private solRedeem;
59
+ private suiRedeem;
56
60
  private evmRedeem;
57
61
  private starknetRedeem;
58
62
  private btcRedeem;
@@ -12,6 +12,8 @@ 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';
15
17
 
16
18
  export type SwapParams = {
17
19
  /**
@@ -101,6 +103,11 @@ export interface IGardenJS extends EventBroker<GardenEvents> {
101
103
  * @readonly
102
104
  */
103
105
  get solanaHTLC(): ISolanaHTLC | undefined;
106
+ /**
107
+ * The Sui relay.
108
+ * @readonly
109
+ */
110
+ get suiHTLC(): ISuiHTLC | undefined;
104
111
  /**
105
112
  * The current quote.
106
113
  * @readonly
@@ -166,6 +173,7 @@ export type GardenHTLCModules = {
166
173
  evm?: IEVMHTLC;
167
174
  starknet?: IStarknetHTLC;
168
175
  solana?: ISolanaHTLC;
176
+ sui?: ISuiHTLC;
169
177
  };
170
178
  };
171
179
  export type GardenWalletModules = {
@@ -173,6 +181,7 @@ export type GardenWalletModules = {
173
181
  evm?: WalletClient;
174
182
  starknet?: AccountInterface;
175
183
  solana?: AnchorProvider;
184
+ sui?: WalletWithRequiredFeatures;
176
185
  };
177
186
  };
178
187
  export type GardenConfigWithWallets = GardenCoreConfig & GardenWalletModules;
@@ -0,0 +1,35 @@
1
+ import { MatchedOrder } from '@gardenfi/orderbook';
2
+ import { AsyncResult, Network } from '@gardenfi/utils';
3
+ import { ISuiHTLC } from '../suiHTLC.types';
4
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
5
+ import { WalletWithRequiredFeatures } from '@mysten/wallet-standard';
6
+
7
+ export declare class SuiHTLC implements ISuiHTLC {
8
+ private client;
9
+ private account;
10
+ private network;
11
+ constructor(account: WalletWithRequiredFeatures | Ed25519Keypair, network: Network);
12
+ get htlcActorAddress(): string;
13
+ get userSuiAddress(): string;
14
+ /**
15
+ * Initiates the HTLC
16
+ * @param order Order to initiate HTLC for
17
+ * @returns Transaction ID
18
+ */
19
+ initiate(order: MatchedOrder): AsyncResult<string, string>;
20
+ /**
21
+ * Redeems the HTLC
22
+ *
23
+ * @param order Order to redeem HTLC for
24
+ * @param secret Secret to redeem HTLC with
25
+ * @returns Transaction ID
26
+ */
27
+ redeem(order: MatchedOrder, secret: string): AsyncResult<string, string>;
28
+ /**
29
+ * Refunds the HTLC
30
+ *
31
+ * @param order Order to refund HTLC for
32
+ * @returns Refund transaction ID
33
+ */
34
+ refund(order: MatchedOrder): AsyncResult<string, string>;
35
+ }
@@ -0,0 +1,18 @@
1
+ import { MatchedOrder } from '@gardenfi/orderbook';
2
+ import { AsyncResult, Network, Url } from '@gardenfi/utils';
3
+ import { ISuiHTLC } from '../suiHTLC.types';
4
+ import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
5
+ import { WalletWithRequiredFeatures } from '@mysten/wallet-standard';
6
+
7
+ export declare class SuiRelay implements ISuiHTLC {
8
+ private client;
9
+ private url;
10
+ private account;
11
+ private network;
12
+ constructor(relayerUrl: string | Url, account: WalletWithRequiredFeatures | Ed25519Keypair, network: Network);
13
+ get htlcActorAddress(): string;
14
+ get userSuiAddress(): string;
15
+ initiate(order: MatchedOrder): AsyncResult<string, string>;
16
+ redeem(order: MatchedOrder, secret: string): AsyncResult<string, string>;
17
+ refund(): AsyncResult<string, string>;
18
+ }
@@ -0,0 +1,28 @@
1
+ import { MatchedOrder } from '@gardenfi/orderbook';
2
+ import { AsyncResult } from '@gardenfi/utils';
3
+
4
+ export interface ISuiHTLC {
5
+ /**
6
+ * The address of the HTLC actor.
7
+ */
8
+ get htlcActorAddress(): string;
9
+ /**
10
+ * Initiates the HTLC by sending funds to the HTLC contract.
11
+ * @param order - The matched order.
12
+ * @returns A promise resolving to the transaction hash of the initiation.
13
+ */
14
+ initiate(order: MatchedOrder): AsyncResult<string, string>;
15
+ /**
16
+ * Redeems funds from the HTLC contract to the actor's address.
17
+ * @param order - The matched order.
18
+ * @param secret - The secret required to unlock the htlc.
19
+ * @returns A promise resolving to the transaction hash of the redemption.
20
+ */
21
+ redeem(order: MatchedOrder, secret: string): AsyncResult<string, string>;
22
+ /**
23
+ * Refunds funds from the HTLC contract back to the actor's address upon expiration.
24
+ * @param order - The matched order.
25
+ * @returns A promise resolving to the transaction hash of the refund.
26
+ */
27
+ refund(order: MatchedOrder): AsyncResult<string, string>;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "2.4.3-beta.1",
3
+ "version": "2.4.3-beta.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -27,8 +27,11 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@coral-xyz/anchor": "^0.30.1",
30
- "@gardenfi/orderbook": "2.4.3-beta.1",
31
- "@gardenfi/utils": "2.4.3",
30
+ "@gardenfi/orderbook": "2.4.3-beta.2",
31
+ "@gardenfi/utils": "2.4.2",
32
+ "@mysten/signers": "^0.3.4",
33
+ "@mysten/sui": "^1.37.1",
34
+ "@mysten/wallet-standard": "^0.16.9",
32
35
  "bignumber.js": "^9.1.2",
33
36
  "bip32": "^4.0.0",
34
37
  "bip39": "^3.1.0",