@gardenfi/core 2.5.2-beta.5 → 2.5.3-beta.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 (42) hide show
  1. package/dist/{ccip-DSGVoxhU.cjs → ccip-BixEUfCX.cjs} +1 -1
  2. package/dist/{ccip-Bg3f6Dwh.js → ccip-Cmo2J8uO.js} +1 -1
  3. package/dist/index-BsnXI660.js +33105 -0
  4. package/dist/index-Bx--llHe.cjs +106 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +35 -33
  7. package/dist/src/index.d.ts +12 -9
  8. package/dist/src/lib/bitcoin/bitcoinHtlc.d.ts +107 -0
  9. package/dist/src/lib/bitcoin/bitcoinhtlc.types.d.ts +53 -0
  10. package/dist/src/lib/blockNumberFetcher/blockNumber.d.ts +2 -2
  11. package/dist/src/lib/constants.d.ts +4 -8
  12. package/dist/src/lib/evm/htlc/evmHTLC.d.ts +27 -27
  13. package/dist/src/lib/evm/htlc.types.d.ts +4 -4
  14. package/dist/src/lib/evm/relay/evmRelay.d.ts +5 -4
  15. package/dist/src/lib/evm/relay/evmRelay.types.d.ts +2 -2
  16. package/dist/src/lib/garden/cache/GardenCache.d.ts +46 -0
  17. package/dist/src/lib/garden/executor/executor.d.ts +26 -0
  18. package/dist/src/lib/garden/garden.d.ts +44 -51
  19. package/dist/src/lib/garden/garden.types.d.ts +57 -100
  20. package/dist/src/lib/garden/utils.d.ts +4 -0
  21. package/dist/src/lib/orderStatus/orderStatus.d.ts +25 -0
  22. package/dist/src/lib/quote/quote.d.ts +4 -3
  23. package/dist/src/lib/quote/quote.types.d.ts +17 -8
  24. package/dist/src/lib/routeValidator/routeValidator.d.ts +30 -0
  25. package/dist/src/lib/solana/htlc/ISolanaHTLC.d.ts +4 -4
  26. package/dist/src/lib/solana/htlc/solanaHTLC.d.ts +7 -7
  27. package/dist/src/lib/solana/relayer/solanaRelay.d.ts +13 -25
  28. package/dist/src/lib/solana/solanaTypes.d.ts +3 -3
  29. package/dist/src/lib/starknet/htlc/starknetHTLC.d.ts +4 -4
  30. package/dist/src/lib/starknet/relay/starknetRelay.d.ts +8 -5
  31. package/dist/src/lib/starknet/starknetHTLC.types.d.ts +4 -4
  32. package/dist/src/lib/sui/htlc/suiHTLC.d.ts +7 -6
  33. package/dist/src/lib/sui/relay/suiRelay.d.ts +4 -3
  34. package/dist/src/lib/sui/suiHTLC.types.d.ts +4 -4
  35. package/dist/src/lib/switchOrAddNetwork.d.ts +1 -0
  36. package/dist/src/lib/utils.d.ts +26 -5
  37. package/package.json +5 -4
  38. package/dist/index-D-NHDZrP.js +0 -31936
  39. package/dist/index-s2tkcnpk.cjs +0 -105
  40. package/dist/src/lib/bitcoin/htlc.d.ts +0 -106
  41. package/dist/src/lib/garden/cache/executorCache.d.ts +0 -14
  42. package/dist/src/lib/orderStatus/orderStatusParser.d.ts +0 -37
@@ -1,106 +0,0 @@
1
- import { IHTLCWallet } from '../htlc.interface';
2
- import { IBitcoinWallet } from './wallet/wallet.interface';
3
-
4
- export declare enum Leaf {
5
- REFUND = 0,
6
- REDEEM = 1,
7
- INSTANT_REFUND = 2
8
- }
9
- export declare class GardenHTLC implements IHTLCWallet {
10
- /**
11
- * Signer of the HTLC can be either the initiator or the redeemer
12
- */
13
- private signer;
14
- private secretHash;
15
- /**
16
- * redeemer's x-only public key without 02 or 03 prefix
17
- */
18
- private redeemerPubkey;
19
- /**
20
- * initiator's x-only public key without 02 or 03 prefix
21
- */
22
- private initiatorPubkey;
23
- private expiry;
24
- /**
25
- * NUMS internal key which blocks key path spending
26
- */
27
- private internalPubkey;
28
- private network;
29
- private initiateAmount;
30
- private utxoHashes?;
31
- /**
32
- * Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
33
- */
34
- private constructor();
35
- /**
36
- * Creates a GardenHTLC instance
37
- * @param signer Bitcoin wallet of the initiator or redeemer
38
- * @param secretHash 32 bytes secret hash
39
- * @param initiatorPubkey initiator's x-only public key without 02 or 03 prefix
40
- * @param redeemerPubkey redeemer's x-only public key without 02 or 03 prefix
41
- * @param expiry block height after which the funds can be refunded
42
- * @returns GardenHTLC instance
43
- *
44
- *
45
- * Note: When the signer is the initiator, only refund and instant refund can be done
46
- * When the signer is the redeemer, only redeem can be done
47
- */
48
- static from(signer: IBitcoinWallet, initiateAmount: number, secretHash: string, initiatorPubkey: string, redeemerPubkey: string, expiry: number, utxoHashes?: string[]): Promise<GardenHTLC>;
49
- /**
50
- * Generates a taproot address for receiving the funds
51
- */
52
- address(): string;
53
- /**
54
- * returns the address of the HTLC
55
- */
56
- id(): string;
57
- private _buildRawTx;
58
- /**
59
- * prevout script for the gardenHTLC address
60
- */
61
- private getOutputScript;
62
- init(fee?: number): Promise<string>;
63
- generateRedeemSACP(secret: string, receiver: string, fee?: number): Promise<string>;
64
- generateInstantRefundSACP(receiver: string): Promise<string>;
65
- generateInstantRefundSACPWithHash(hash: string[]): Promise<string[]>;
66
- /**
67
- * Instantly refunds the funds to the initiator given the counterparty's signatures and pubkey
68
- *
69
- * Note: If there are multiple UTXOs being spend, there should be a signature for each UTXO in counterPartySigs
70
- */
71
- instantRefund(counterPartySigs: {
72
- utxo: string;
73
- sig: string;
74
- }[], fee?: number): Promise<string>;
75
- /**
76
- * Reveals the secret and redeems the HTLC
77
- */
78
- redeem(secret: string, receiver?: string): Promise<string>;
79
- getRedeemHex(secret: string, receiver?: string): Promise<string>;
80
- /**
81
- * Refunds the funds back to the initiator if the expiry block height + 1 is reached
82
- */
83
- refund(receiver?: string, fee?: number): Promise<string>;
84
- /**
85
- * Given a list of UTXOs, checks if the HTLC can be refunded
86
- */
87
- private canRefund;
88
- /**
89
- * Given a leaf, generates the control block necessary for spending the leaf
90
- */
91
- private generateControlBlockFor;
92
- /**
93
- * Generates the hash of the leaf script
94
- * @param leaf Use leaf enum or pass 0 for refund, 1 for redeem, 2 for instant refund
95
- * @returns hash of the leaf script
96
- */
97
- leafHash(leaf: Leaf): Buffer;
98
- private refundLeaf;
99
- private redeemLeaf;
100
- private instantRefundLeaf;
101
- private leaves;
102
- /**
103
- * Generates the merkle proof for the leaf script
104
- */
105
- private generateMerkleProofFor;
106
- }
@@ -1,14 +0,0 @@
1
- import { MatchedOrder } from '@gardenfi/orderbook';
2
- import { IOrderExecutorCache, OrderActions, OrderCacheValue } from '../garden.types';
3
-
4
- export declare class ExecutorCache implements IOrderExecutorCache {
5
- private cache;
6
- set(order: MatchedOrder, action: OrderActions, txHash: string, utxo?: string): void;
7
- get(order: MatchedOrder, action: OrderActions): OrderCacheValue | null;
8
- remove(order: MatchedOrder, action: OrderActions): void;
9
- }
10
- export declare class Cache<T> {
11
- private cache;
12
- set(key: string, value: T): void;
13
- get(key: string): T | null;
14
- }
@@ -1,37 +0,0 @@
1
- import { MatchedOrder, Swap } from '@gardenfi/orderbook';
2
- import { OrderActions } from '../garden/garden.types';
3
- import { OrderStatus, SwapStatus } from './status';
4
-
5
- /**
6
- * Parse the order status based on the current block number and checks if its expired or initiated or redeemed or refunded
7
- * @param order Order object
8
- * @param sourceChainCurrentBlockNumber source chain current block number
9
- * @param destChainCurrentBlockNumber destination chain current block number
10
- * @note send the current block number of the L1 chain even if the order is on L2 chain.
11
- * @returns {OrderStatus} The status of the order
12
- */
13
- export declare const ParseOrderStatus: (order: MatchedOrder, sourceChainCurrentBlockNumber: number, destChainCurrentBlockNumber: number) => OrderStatus;
14
- /**
15
- * Parse the swap status based on the current block number and checks if its expired or initiated or redeemed or refunded
16
- * @param swap The swap object
17
- * @param currentBlockNumber
18
- */
19
- export declare const ParseSwapStatus: (swap: Swap, currentBlockNumber: number) => SwapStatus;
20
- /**
21
- * Parse the action to be performed on the.
22
- * @param order Order object
23
- * @param sourceChainCurrentBlockNumber source chain current block number
24
- * @param destChainCurrentBlockNumber destination chain current block number
25
- * @note send the current block number of the L1 chain even if the order is on L2 chain.
26
- * @returns {OrderActions} The action to be performed on the order
27
- */
28
- export declare const parseAction: (order: MatchedOrder, sourceChainCurrentBlockNumber: number, destChainCurrentBlockNumber: number) => OrderActions;
29
- /**
30
- * Parse the action to be performed on the order based on the order status.
31
- * @param status Order status
32
- * @returns {OrderActions} The action to be performed on the order
33
- */
34
- export declare const parseActionFromStatus: (status: OrderStatus) => OrderActions;
35
- export declare const isExpired: (unixTime: number, tillHours?: number) => boolean;
36
- export declare const filterDeadlineExpiredOrders: (orders: MatchedOrder[]) => MatchedOrder[];
37
- export declare const isOrderExpired: (order: MatchedOrder) => boolean;