@gardenfi/core 2.2.1 → 2.3.0

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 (47) hide show
  1. package/dist/{ccip-l_tRzCaI.cjs → ccip-Bf6sMWsl.cjs} +1 -1
  2. package/dist/{ccip-BkdyF3_3.js → ccip-Nj9FMoDj.js} +1 -1
  3. package/dist/index-DVTNtaWz.cjs +99 -0
  4. package/dist/index-rQk9wiZU.js +24327 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +37 -34
  7. package/dist/src/index.d.ts +5 -1
  8. package/dist/src/lib/bitcoin/API.d.ts +4 -0
  9. package/dist/src/lib/bitcoin/ASConfig.d.ts +19 -0
  10. package/dist/src/lib/bitcoin/errors.d.ts +16 -0
  11. package/dist/src/lib/bitcoin/htlc.d.ts +2 -1
  12. package/dist/src/lib/bitcoin/htlcScript.d.ts +7 -0
  13. package/dist/src/lib/bitcoin/interface.d.ts +6 -0
  14. package/dist/src/lib/bitcoin/paths.d.ts +7 -0
  15. package/dist/src/lib/bitcoin/provider/provider.d.ts +118 -0
  16. package/dist/src/lib/bitcoin/provider/provider.interface.d.ts +99 -0
  17. package/dist/src/lib/bitcoin/script.d.ts +6 -0
  18. package/dist/src/lib/bitcoin/sig.d.ts +20 -0
  19. package/dist/src/lib/bitcoin/utils.d.ts +8 -0
  20. package/dist/src/lib/bitcoin/wallet/abstractWallet.d.ts +145 -0
  21. package/dist/src/lib/bitcoin/wallet/baseWallet.d.ts +13 -0
  22. package/dist/src/lib/bitcoin/wallet/wallet.d.ts +103 -0
  23. package/dist/src/lib/bitcoin/wallet/wallet.interface.d.ts +79 -0
  24. package/dist/src/lib/blockNumberFetcher/blockNumber.d.ts +1 -2
  25. package/dist/src/lib/evm/htlc/evmHTLC.d.ts +1 -1
  26. package/dist/src/lib/evm/htlc/evmHTLC.types.d.ts +2 -2
  27. package/dist/src/lib/evm/relay/evmRelay.types.d.ts +1 -2
  28. package/dist/src/lib/garden/garden.d.ts +2 -3
  29. package/dist/src/lib/garden/garden.types.d.ts +3 -4
  30. package/dist/src/lib/htlc.interface.d.ts +7 -0
  31. package/dist/src/lib/identifier.d.ts +19 -0
  32. package/dist/src/lib/quote/quote.d.ts +7 -10
  33. package/dist/src/lib/quote/quote.types.d.ts +19 -10
  34. package/dist/src/lib/secretManager/secretManager.d.ts +5 -5
  35. package/dist/src/lib/secretManager/secretManager.types.d.ts +1 -2
  36. package/dist/src/lib/solana/htlc/ISolanaHTLC.d.ts +1 -1
  37. package/dist/src/lib/solana/htlc/solanaHTLC.d.ts +1 -1
  38. package/dist/src/lib/solana/relayer/solanaRelay.d.ts +1 -2
  39. package/dist/src/lib/starknet/checkAllowanceAndApprove.d.ts +1 -1
  40. package/dist/src/lib/starknet/htlc/starknetHTLC.d.ts +1 -2
  41. package/dist/src/lib/starknet/relay/starknetRelay.d.ts +1 -2
  42. package/dist/src/lib/starknet/starknetHTLC.types.d.ts +1 -1
  43. package/dist/src/lib/switchOrAddNetwork.d.ts +1 -1
  44. package/dist/src/lib/utils.d.ts +7 -2
  45. package/package.json +9 -7
  46. package/dist/index-eHNvzW2C.js +0 -26591
  47. package/dist/index-lHPQc7tc.cjs +0 -84
@@ -0,0 +1,103 @@
1
+ import { networks, payments } from 'bitcoinjs-lib';
2
+ import { IBitcoinProvider } from '../provider/provider.interface';
3
+ import { AddressType } from '../interface';
4
+ import { AbstractBitcoinWallet } from './abstractWallet';
5
+ import { BitcoinWalletConfig } from './wallet.interface';
6
+ import { AddSignature } from '../sig';
7
+
8
+ export type BitcoinWalletOpts = {
9
+ privateKey: string;
10
+ provider: IBitcoinProvider;
11
+ pkPath: string;
12
+ pkType: AddressType;
13
+ };
14
+ export declare class BitcoinWallet extends AbstractBitcoinWallet {
15
+ private readonly provider;
16
+ private signer;
17
+ private readonly minAmt;
18
+ private readonly network;
19
+ private pkType;
20
+ private readonly path;
21
+ /**
22
+ * @constructor
23
+ * @param {BitcoinWalletOpts} opts
24
+ * @param {string} opts.privateKey
25
+ * @param {IBitcoinProvider} opts.provider
26
+ * @param {number} opts.pkIndex - The address_index as per BIP44
27
+ */
28
+ constructor({ privateKey, provider, pkPath, pkType }: BitcoinWalletOpts);
29
+ /**
30
+ * @deprecated
31
+ * Switch to `fromPrivateKey` if you have the private key
32
+ * else use multi-key wallet's `fromMnemonic`
33
+ */
34
+ static fromMnemonic(mnemonic: string, provider: IBitcoinProvider, opts?: {
35
+ index: number;
36
+ }): BitcoinWallet;
37
+ /**
38
+ * Initiates a Bitcoin wallet from a private key
39
+ *
40
+ * @param {string} privateKey - The private key
41
+ * @param {IBitcoinProvider} provider - The Bitcoin provider
42
+ *
43
+ * Note: Make sure to pass the pkType if you want to use a specific address type (p2wpkh(segwit), p2sh-p2wpkh, p2pkh(legacy))
44
+ */
45
+ static fromPrivateKey(privateKey: string, provider: IBitcoinProvider, opts?: {
46
+ /**
47
+ * The address type - p2wpkh (segwit), p2sh-p2wpkh, p2pkh(legacy)
48
+ */
49
+ pkType?: AddressType;
50
+ pkPath?: string;
51
+ }): BitcoinWallet;
52
+ /**
53
+ * Creates a random Bitcoin wallet
54
+ */
55
+ static createRandom(provider: IBitcoinProvider): BitcoinWallet;
56
+ static fromWIF(wif: string, provider: IBitcoinProvider, opts?: {
57
+ pkType?: AddressType;
58
+ pkPath?: string;
59
+ }): BitcoinWallet;
60
+ /**
61
+ * @override
62
+ * @returns {Promise<BitcoinWalletConfig>} Bitcoin wallet config including network, derivation path, and index
63
+ */
64
+ walletConfig(): BitcoinWalletConfig;
65
+ /**
66
+ * Spends bitcoin from a script to a given address.
67
+ *
68
+ * @param {Buffer} script - The locking script
69
+ * @param {string} scriptAddress - The address of the script
70
+ * @param {Object} opts - The options
71
+ * @param {string} [opts.toAddress] - The address of the recipient. If not provided then the wallet address is used as the recipient.
72
+ * @param {number} [opts.fee] - The fee
73
+ * @param {number} [opts.nSequence] - The sequence number
74
+ * @param {Buffer[]} [opts.unlockScript] - The unlock script. Required for p2sh
75
+ * @param {Buffer[]} [opts.witness] - The witness. Required for p2wsh, p2tr
76
+ * @returns {Promise<string>} Transaction ID
77
+ */
78
+ spend(script: Buffer, scriptAddress: string, { toAddress, fee, nSequence, unlockScript, // only for p2sh
79
+ witness, }: {
80
+ toAddress?: string;
81
+ fee?: number;
82
+ nSequence?: number;
83
+ witness?: (Buffer | AddSignature)[];
84
+ unlockScript?: (payments.StackElement | AddSignature)[];
85
+ }): Promise<string>;
86
+ /**
87
+ * Returns the address of the wallet
88
+ * @returns {Promise<string>}
89
+ */
90
+ getAddress(): Promise<string>;
91
+ getProvider(): Promise<IBitcoinProvider>;
92
+ getBalance(): Promise<number>;
93
+ getPublicKey(): Promise<string>;
94
+ getNetwork(): Promise<networks.Network>;
95
+ static generateUnsignedPSBT(provider: IBitcoinProvider, network: networks.Network, fromAddress: string, toAddress: string, amt: number, fee?: number): Promise<{
96
+ txHex: string;
97
+ utxoCount: number;
98
+ }>;
99
+ private _send;
100
+ send(toAddress: string, amt: number, fee?: number): Promise<string>;
101
+ sign(hexMsg: string): Promise<string>;
102
+ signSchnorr(buf: Buffer): Promise<Buffer>;
103
+ }
@@ -0,0 +1,79 @@
1
+ import { Network, payments } from 'bitcoinjs-lib';
2
+ import { IBaseWallet } from './baseWallet';
3
+ import { BitcoinNetwork, IBitcoinProvider, Urgency } from '../provider/provider.interface';
4
+ import { AddSignature, SigHashType } from '../sig';
5
+
6
+ /**
7
+ * @interface IBitcoinWallet
8
+ */
9
+ export interface IBitcoinWallet extends IBaseWallet {
10
+ /**
11
+ * @returns {Promise<number>} Balance held by the wallet in satoshis.
12
+ */
13
+ getBalance(): Promise<number>;
14
+ /**
15
+ * @returns {Promise<string>} Public key of the wallet
16
+ */
17
+ getPublicKey(): Promise<string>;
18
+ /**
19
+ * @returns {Promise<Network>} Network of the wallet provided during initialization
20
+ */
21
+ getNetwork(): Promise<Network>;
22
+ /**
23
+ * @returns {Promise<IBitcoinProvider>} Provider of the wallet that gives read only access to the mempool
24
+ */
25
+ getProvider(): Promise<IBitcoinProvider>;
26
+ /**
27
+ * Fee for a transaction according to the urgency
28
+ *
29
+ * @param {number} amount - in satoshis
30
+ * @param {Urgency} urgency - urgency of the fee
31
+ * @returns {Promise<number>} Fee suggested by the provider
32
+ */
33
+ suggestFee(amount: number, urgency: Urgency): Promise<number>;
34
+ signSchnorr(buf: Buffer): Promise<Buffer>;
35
+ /**
36
+ * Sends bitcoins to a recipient
37
+ *
38
+ * @param {string} toAddress - Address of the recipient
39
+ * @param {number} amt - in satoshis
40
+ * @param {number} [fee]
41
+ * @returns {Promise<string>} Tx id of the sent transaction
42
+ */
43
+ send(toAddress: string, amt: number, fee?: number): Promise<string>;
44
+ /**
45
+ * Spends bitcoin from a script to a given address.
46
+ *
47
+ * @param {Buffer} script - The locking script
48
+ * @param {Buffer[]} witness - The witnesses
49
+ * @param {string} [toAddress] - The address of the recipient. If not provided then the wallet address is used as the recipient.
50
+ * @param {number} [nSequence] - The sequence number
51
+ * @returns {Promise<string>} Transaction ID
52
+ */
53
+ spend(script: Buffer, scriptAddress: string, { toAddress, fee, nSequence, unlockScript, // only for p2sh
54
+ witness, }: {
55
+ toAddress?: string;
56
+ fee?: number;
57
+ nSequence?: number;
58
+ witness?: (Buffer | AddSignature)[];
59
+ unlockScript?: (payments.StackElement | AddSignature)[];
60
+ }): Promise<string>;
61
+ /**
62
+ * @returns {BitcoinWalletConfig}
63
+ */
64
+ walletConfig(): BitcoinWalletConfig;
65
+ addSignatureSegwitV0(type?: SigHashType): AddSignature;
66
+ addSignatureP2sh(type?: SigHashType): AddSignature;
67
+ addSignatureSegwitV1(type?: SigHashType): AddSignature;
68
+ }
69
+ /**
70
+ * @typedef {Object} BitcoinWalletConfig
71
+ *
72
+ * @property {Network} network - The network of the wallet
73
+ * @property {string} path - The derivation path
74
+ */
75
+ export type BitcoinWalletConfig = {
76
+ network: BitcoinNetwork;
77
+ path: string;
78
+ addressType?: string;
79
+ };
@@ -1,6 +1,5 @@
1
- import { AsyncResult } from '@catalogfi/utils';
2
1
  import { Chain } from '@gardenfi/orderbook';
3
- import { Environment } from '@gardenfi/utils';
2
+ import { Environment, AsyncResult } from '@gardenfi/utils';
4
3
 
5
4
  type Response = {
6
5
  [key in Chain]: number;
@@ -1,6 +1,6 @@
1
- import { IHTLCWallet } from '@catalogfi/wallets';
2
1
  import { EVMSwapConfig } from './evmHTLC.types';
3
2
  import { Address, WalletClient } from 'viem';
3
+ import { IHTLCWallet } from '../../htlc.interface';
4
4
 
5
5
  export declare class EVMHTLC implements IHTLCWallet {
6
6
  private swap;
@@ -1,5 +1,5 @@
1
- import { MarkRequired } from '@catalogfi/utils';
2
- import { OnChainIdentifier } from '@catalogfi/wallets';
1
+ import { MarkRequired } from '@gardenfi/utils';
2
+ import { OnChainIdentifier } from '../../identifier';
3
3
  import { Address } from 'viem';
4
4
 
5
5
  export type AtomicSwapConfig = {
@@ -1,6 +1,5 @@
1
- import { AsyncResult } from '@catalogfi/utils';
2
1
  import { MatchedOrder } from '@gardenfi/orderbook';
3
- import { IStore } from '@gardenfi/utils';
2
+ import { AsyncResult, IStore } from '@gardenfi/utils';
4
3
  import { WalletClient } from 'viem';
5
4
 
6
5
  export type EVMRelayOpts = {
@@ -1,13 +1,12 @@
1
1
  import { ISecretManager } from './../secretManager/secretManager.types';
2
- import { AsyncResult } from '@catalogfi/utils';
3
2
  import { GardenEvents, IGardenJS, SwapParams, GardenConfigWithHTLCs, GardenConfigWithWallets } from './garden.types';
4
3
  import { IOrderbook, MatchedOrder } from '@gardenfi/orderbook';
5
- import { EventBroker, IAuth, DigestKey } from '@gardenfi/utils';
4
+ import { EventBroker, IAuth, DigestKey, AsyncResult } from '@gardenfi/utils';
6
5
  import { IQuote } from '../quote/quote.types';
7
- import { IBitcoinWallet } from '@catalogfi/wallets';
8
6
  import { IBlockNumberFetcher } from '../blockNumberFetcher/blockNumber';
9
7
  import { IEVMHTLC } from '../evm/htlc.types';
10
8
  import { IStarknetHTLC } from '../starknet/starknetHTLC.types';
9
+ import { IBitcoinWallet } from '../bitcoin/wallet/wallet.interface';
11
10
  import { ISolanaHTLC } from '../solana/htlc/ISolanaHTLC';
12
11
 
13
12
  export declare class Garden extends EventBroker<GardenEvents> implements IGardenJS {
@@ -1,16 +1,15 @@
1
- import { AsyncResult } from '@catalogfi/utils';
2
1
  import { AffiliateFeeOptionalChainAsset, Asset, IOrderbook, MatchedOrder } from '@gardenfi/orderbook';
3
2
  import { OrderStatus } from '../orderStatus/status';
4
- import { Environment, EventBroker, IAuth, DigestKey } from '@gardenfi/utils';
3
+ import { AsyncResult, Environment, EventBroker, IAuth, DigestKey } from '@gardenfi/utils';
5
4
  import { ISecretManager } from '../secretManager/secretManager.types';
6
5
  import { IQuote } from '../quote/quote.types';
7
6
  import { IBlockNumberFetcher } from '../blockNumberFetcher/blockNumber';
8
- import { BitcoinWallet, IBitcoinWallet } from '@catalogfi/wallets';
9
7
  import { IEVMHTLC } from '../evm/htlc.types';
10
8
  import { IStarknetHTLC } from '../starknet/starknetHTLC.types';
11
9
  import { AccountInterface } from 'starknet';
12
10
  import { WalletClient } from 'viem';
13
11
  import { Api } from '../constants';
12
+ import { IBitcoinWallet } from '../bitcoin/wallet/wallet.interface';
14
13
  import { ISolanaHTLC } from '../solana/htlc/ISolanaHTLC';
15
14
  import { AnchorProvider } from '@coral-xyz/anchor';
16
15
 
@@ -159,7 +158,7 @@ export type GardenCoreConfig = {
159
158
  orderbook?: IOrderbook;
160
159
  quote?: IQuote;
161
160
  blockNumberFetcher?: IBlockNumberFetcher;
162
- btcWallet?: BitcoinWallet;
161
+ btcWallet?: IBitcoinWallet;
163
162
  solanaProgramAddress?: string;
164
163
  };
165
164
  export type GardenHTLCModules = {
@@ -0,0 +1,7 @@
1
+ interface IHTLCWallet {
2
+ id(): string;
3
+ init(): Promise<string>;
4
+ redeem(secret: string, receiver?: string): Promise<string>;
5
+ refund(receiver?: string): Promise<string>;
6
+ }
7
+ export type { IHTLCWallet };
@@ -0,0 +1,19 @@
1
+ import { Address } from 'viem';
2
+
3
+ export declare class OnChainIdentifier {
4
+ isEVM: boolean;
5
+ address: string | Address;
6
+ private constructor();
7
+ static from_evm(address: Address): OnChainIdentifier;
8
+ static from_btc(address: string): OnChainIdentifier;
9
+ unwrap_evm(): Address;
10
+ unwrap_btc(): string;
11
+ isEvm(): this is {
12
+ address: Address;
13
+ isEVM: true;
14
+ };
15
+ isBtc(): this is {
16
+ address: string;
17
+ isEVM: false;
18
+ };
19
+ }
@@ -1,18 +1,15 @@
1
- import { AsyncResult, Request } from '@catalogfi/utils';
2
- import { IQuote, QuoteResponse, Strategies } from './quote.types';
3
- import { Asset, CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
1
+ import { IQuote, QuoteResponse, Strategies, QuoteParamsForAssets } from './quote.types';
2
+ import { CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
3
+ import { AsyncResult, Err, Ok, Request as UtilsRequest } from '@gardenfi/utils';
4
4
 
5
5
  export declare class Quote implements IQuote {
6
6
  private quoteUrl;
7
7
  constructor(quoteUrl: string);
8
- getQuoteFromAssets(fromAsset: Asset, toAsset: Asset, amount: number, isExactOut?: boolean, options?: {
9
- affiliateFee?: number;
10
- request?: Request;
11
- }): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<QuoteResponse, never>>;
8
+ getQuoteFromAssets({ fromAsset, toAsset, amount, isExactOut, options, }: QuoteParamsForAssets): Promise<Err<string> | Ok<QuoteResponse>>;
12
9
  getQuote(orderpair: string, amount: number, isExactOut?: boolean, options?: {
13
10
  affiliateFee?: number;
14
- request?: Request;
15
- }): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<QuoteResponse, never>>;
11
+ request?: UtilsRequest;
12
+ }): Promise<Err<string> | Ok<QuoteResponse>>;
16
13
  getAttestedQuote(order: CreateOrderReqWithStrategyId): AsyncResult<CreateOrderRequestWithAdditionalData, string>;
17
- getStrategies(): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<Strategies, never>>;
14
+ getStrategies(): Promise<Err<string> | Ok<Strategies>>;
18
15
  }
@@ -1,6 +1,5 @@
1
- import { AsyncResult, Request } from '@catalogfi/utils';
2
1
  import { Asset, Chain, CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
3
- import { APIResponse } from '@gardenfi/utils';
2
+ import { APIResponse, AsyncResult, Request } from '@gardenfi/utils';
4
3
 
5
4
  export interface IQuote {
6
5
  /**
@@ -13,10 +12,7 @@ export interface IQuote {
13
12
  * @param options { affiliateFee?: number; request?: Request } - The options for the quote request, affiliate fee in bps and request object
14
13
  *
15
14
  */
16
- getQuoteFromAssets(fromAsset: Asset, toAsset: Asset, amount: number, isExactOut: boolean, options?: {
17
- affiliateFee?: number;
18
- request?: Request;
19
- }): AsyncResult<QuoteResponse, string>;
15
+ getQuoteFromAssets(params: QuoteParamsForAssets): AsyncResult<QuoteResponse, string>;
20
16
  /**
21
17
  * Get a quote for the given orderpair and amount
22
18
  * @param orderpair - A string representing the order pair for which the quote is requested.
@@ -28,10 +24,7 @@ export interface IQuote {
28
24
  * @param isExactOut - Whether the amount is exact out
29
25
  * @param options { affiliateFee?: number; request?: Request } - The options for the quote request, affiliate fee in bps and request object
30
26
  */
31
- getQuote(orderpair: string, amount: number, isExactOut: boolean, options?: {
32
- affiliateFee?: number;
33
- request?: Request;
34
- }): AsyncResult<QuoteResponse, string>;
27
+ getQuote(orderpair: string, amount: number, isExactOut: boolean, options?: QuoteOptions): AsyncResult<QuoteResponse, string>;
35
28
  /**
36
29
  * Attest the quote, server will return a signature by verifying and signing the quote according to the provided `strategy_id`
37
30
  * @param order - The order for which the attestation is requested. Order should include `strategy_id` in the `additional_data` field.
@@ -44,6 +37,22 @@ export interface IQuote {
44
37
  */
45
38
  getStrategies(): AsyncResult<Strategies, string>;
46
39
  }
40
+ export type QuoteOptions = {
41
+ affiliateFee?: number;
42
+ request?: Request;
43
+ };
44
+ export type BaseQuoteParams = {
45
+ amount: number;
46
+ isExactOut?: boolean;
47
+ options?: QuoteOptions;
48
+ };
49
+ export type QuoteParamsForAssets = BaseQuoteParams & {
50
+ fromAsset: Asset;
51
+ toAsset: Asset;
52
+ };
53
+ export type QuoteParamsForOrderPair = BaseQuoteParams & {
54
+ orderpair: string;
55
+ };
47
56
  export type QuoteResponse = {
48
57
  quotes: {
49
58
  [strategy_id: string]: string;
@@ -1,5 +1,5 @@
1
1
  import { WalletClient } from 'viem';
2
- import { EventBroker } from '@gardenfi/utils';
2
+ import { Err, EventBroker, Ok } from '@gardenfi/utils';
3
3
  import { ISecretManager, SecretManagerEvents } from './secretManager.types';
4
4
 
5
5
  export declare class SecretManager extends EventBroker<SecretManagerEvents> implements ISecretManager {
@@ -9,12 +9,12 @@ export declare class SecretManager extends EventBroker<SecretManagerEvents> impl
9
9
  private constructor();
10
10
  static fromDigestKey(digestKey: string): SecretManager;
11
11
  static fromWalletClient(walletClient: WalletClient): SecretManager;
12
- initialize(): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<string, never>>;
12
+ initialize(): Promise<Err<string> | Ok<string>>;
13
13
  private deriveDigestKeyFromWalletClient;
14
- getDigestKey(): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<string, never>>;
15
- generateSecret(nonce: string): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<{
14
+ getDigestKey(): Promise<Err<string> | Ok<string>>;
15
+ generateSecret(nonce: string): Promise<Err<string> | Ok<{
16
16
  secret: `0x${string}`;
17
17
  secretHash: `0x${string}`;
18
- }, never>>;
18
+ }>>;
19
19
  private signMessage;
20
20
  }
@@ -1,5 +1,4 @@
1
- import { AsyncResult } from '@catalogfi/utils';
2
- import { EventBroker } from '@gardenfi/utils';
1
+ import { AsyncResult, EventBroker } from '@gardenfi/utils';
3
2
 
4
3
  export type Secret = {
5
4
  secretHash: string;
@@ -1,5 +1,5 @@
1
1
  import { MatchedOrder } from '@gardenfi/orderbook';
2
- import { AsyncResult } from '@catalogfi/utils';
2
+ import { AsyncResult } from '@gardenfi/utils';
3
3
 
4
4
  export interface ISolanaHTLC {
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  import { AnchorProvider } from '@coral-xyz/anchor';
2
2
  import { ISolanaHTLC } from './ISolanaHTLC';
3
3
  import { MatchedOrder } from '@gardenfi/orderbook';
4
- import { AsyncResult } from '@catalogfi/utils';
4
+ import { AsyncResult } from '@gardenfi/utils';
5
5
 
6
6
  /**
7
7
  * SolanaHTLC is an implementation of ISolanaHTLC that performs atomic swaps directly on-chain.
@@ -1,6 +1,5 @@
1
1
  import { AnchorProvider } from '@coral-xyz/anchor';
2
- import { AsyncResult } from '@catalogfi/utils';
3
- import { Url } from '@gardenfi/utils';
2
+ import { AsyncResult, Url } from '@gardenfi/utils';
4
3
  import { ISolanaHTLC } from '../htlc/ISolanaHTLC';
5
4
  import { MatchedOrder } from '@gardenfi/orderbook';
6
5
 
@@ -1,5 +1,5 @@
1
1
  import { AccountInterface, RpcProvider } from 'starknet';
2
- import { AsyncResult } from '@catalogfi/utils';
2
+ import { AsyncResult } from '@gardenfi/utils';
3
3
 
4
4
  export declare const checkAllowanceAndApprove: (account: AccountInterface, tokenAddress: string, htlcAddress: string, amount: bigint, starknetProvider: RpcProvider) => AsyncResult<string, string>;
5
5
  export declare const checkAllowance: (accountAddress: string, tokenAddress: string, htlcAddress: string, starknetProvider: RpcProvider) => AsyncResult<bigint, string>;
@@ -1,7 +1,6 @@
1
1
  import { MatchedOrder } from '@gardenfi/orderbook';
2
- import { AsyncResult } from '@catalogfi/utils';
3
2
  import { Account, CallData } from 'starknet';
4
- import { Network } from '@gardenfi/utils';
3
+ import { AsyncResult, Network } from '@gardenfi/utils';
5
4
  import { IStarknetHTLC } from '../starknetHTLC.types';
6
5
 
7
6
  export declare class StarknetHTLC implements IStarknetHTLC {
@@ -1,7 +1,6 @@
1
1
  import { AccountInterface } from 'starknet';
2
2
  import { MatchedOrder } from '@gardenfi/orderbook';
3
- import { AsyncResult } from '@catalogfi/utils';
4
- import { Network, Url } from '@gardenfi/utils';
3
+ import { AsyncResult, Network, Url } from '@gardenfi/utils';
5
4
  import { IStarknetHTLC } from '../starknetHTLC.types';
6
5
 
7
6
  export declare class StarknetRelay implements IStarknetHTLC {
@@ -1,5 +1,5 @@
1
1
  import { MatchedOrder } from '@gardenfi/orderbook';
2
- import { AsyncResult } from '@catalogfi/utils';
2
+ import { AsyncResult } from '@gardenfi/utils';
3
3
 
4
4
  export interface IStarknetHTLC {
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  import { Chain as viemChain } from 'viem/chains';
2
2
  import { EvmChain } from '@gardenfi/orderbook';
3
3
  import { WalletClient } from 'viem';
4
- import { AsyncResult } from '@catalogfi/utils';
4
+ import { AsyncResult } from '@gardenfi/utils';
5
5
 
6
6
  export declare const botanixMainnet: viemChain;
7
7
  export declare const hyperliquidTestnet: viemChain;
@@ -1,9 +1,10 @@
1
- import { BitcoinNetwork, IBaseWallet } from '@catalogfi/wallets';
2
1
  import { Environment, Err, Ok } from '@gardenfi/utils';
3
2
  import { Chain } from '@gardenfi/orderbook';
4
3
  import { Signature } from 'starknet';
5
4
  import { Api } from './constants';
6
5
  import { ApiConfig } from './garden/garden.types';
6
+ import { BitcoinNetwork } from './bitcoin/provider/provider.interface';
7
+ import { IBaseWallet } from './bitcoin/wallet/baseWallet';
7
8
  import { web3 } from '@coral-xyz/anchor';
8
9
 
9
10
  export declare function resolveApiConfig(env: ApiConfig): {
@@ -32,5 +33,9 @@ export declare const constructOrderPair: (sourceChain: Chain, sourceAsset: strin
32
33
  export declare function validateBTCAddress(address: string, networkType: Environment): boolean;
33
34
  export declare const getBitcoinNetwork: (network: Environment) => BitcoinNetwork;
34
35
  export declare const isHexString: (value: string) => boolean;
35
- export declare const formatStarknetSignature: (sig: Signature) => Ok<string[]> | Err<string>;
36
+ export declare const formatStarknetSignature: (sig: Signature) => Err<string> | Ok<string[]>;
37
+ export declare function reversify(val: string): Buffer;
38
+ export declare function isErrorWithMessage(err: unknown): err is {
39
+ message: string;
40
+ };
36
41
  export declare const waitForSolanaTxConfirmation: (connection: web3.Connection, txHash: string) => Promise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",
@@ -26,16 +26,18 @@
26
26
  "registry": "https://registry.npmjs.org/"
27
27
  },
28
28
  "dependencies": {
29
- "@catalogfi/utils": "^0.1.6",
30
- "@catalogfi/wallets": "^0.2.59",
31
29
  "@coral-xyz/anchor": "^0.30.1",
32
- "@gardenfi/orderbook": "2.2.1",
33
- "@gardenfi/utils": "2.2.1",
30
+ "@gardenfi/orderbook": "2.3.0",
31
+ "@gardenfi/utils": "2.3.0",
34
32
  "bignumber.js": "^9.1.2",
35
- "bitcoinjs-lib": "^6.1.6",
33
+ "bip32": "^4.0.0",
34
+ "bip39": "^3.1.0",
35
+ "bitcoinjs-lib": "^6.1.5",
36
+ "ecpair": "^2.1.0",
36
37
  "starknet": "6.23.1",
37
38
  "tiny-secp256k1": "^2.2.3",
38
- "varuint-bitcoin": "^1.1.2"
39
+ "varuint-bitcoin": "^1.1.2",
40
+ "yup": "^1.4.0"
39
41
  },
40
42
  "devDependencies": {
41
43
  "dotenv": "^16.3.1",