@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.
- package/dist/{ccip-DSGVoxhU.cjs → ccip-BixEUfCX.cjs} +1 -1
- package/dist/{ccip-Bg3f6Dwh.js → ccip-Cmo2J8uO.js} +1 -1
- package/dist/index-BsnXI660.js +33105 -0
- package/dist/index-Bx--llHe.cjs +106 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +35 -33
- package/dist/src/index.d.ts +12 -9
- package/dist/src/lib/bitcoin/bitcoinHtlc.d.ts +107 -0
- package/dist/src/lib/bitcoin/bitcoinhtlc.types.d.ts +53 -0
- package/dist/src/lib/blockNumberFetcher/blockNumber.d.ts +2 -2
- package/dist/src/lib/constants.d.ts +4 -8
- package/dist/src/lib/evm/htlc/evmHTLC.d.ts +27 -27
- package/dist/src/lib/evm/htlc.types.d.ts +4 -4
- package/dist/src/lib/evm/relay/evmRelay.d.ts +5 -4
- package/dist/src/lib/evm/relay/evmRelay.types.d.ts +2 -2
- package/dist/src/lib/garden/cache/GardenCache.d.ts +46 -0
- package/dist/src/lib/garden/executor/executor.d.ts +26 -0
- package/dist/src/lib/garden/garden.d.ts +44 -51
- package/dist/src/lib/garden/garden.types.d.ts +57 -100
- package/dist/src/lib/garden/utils.d.ts +4 -0
- package/dist/src/lib/orderStatus/orderStatus.d.ts +25 -0
- package/dist/src/lib/quote/quote.d.ts +4 -3
- package/dist/src/lib/quote/quote.types.d.ts +17 -8
- package/dist/src/lib/routeValidator/routeValidator.d.ts +30 -0
- package/dist/src/lib/solana/htlc/ISolanaHTLC.d.ts +4 -4
- package/dist/src/lib/solana/htlc/solanaHTLC.d.ts +7 -7
- package/dist/src/lib/solana/relayer/solanaRelay.d.ts +13 -25
- package/dist/src/lib/solana/solanaTypes.d.ts +3 -3
- package/dist/src/lib/starknet/htlc/starknetHTLC.d.ts +4 -4
- package/dist/src/lib/starknet/relay/starknetRelay.d.ts +8 -5
- package/dist/src/lib/starknet/starknetHTLC.types.d.ts +4 -4
- package/dist/src/lib/sui/htlc/suiHTLC.d.ts +7 -6
- package/dist/src/lib/sui/relay/suiRelay.d.ts +4 -3
- package/dist/src/lib/sui/suiHTLC.types.d.ts +4 -4
- package/dist/src/lib/switchOrAddNetwork.d.ts +1 -0
- package/dist/src/lib/utils.d.ts +26 -5
- package/package.json +5 -4
- package/dist/index-D-NHDZrP.js +0 -31936
- package/dist/index-s2tkcnpk.cjs +0 -105
- package/dist/src/lib/bitcoin/htlc.d.ts +0 -106
- package/dist/src/lib/garden/cache/executorCache.d.ts +0 -14
- package/dist/src/lib/orderStatus/orderStatusParser.d.ts +0 -37
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-Bx--llHe.cjs");exports.API=e.API;exports.BitcoinNetwork=e.BitcoinNetwork;exports.BitcoinProvider=e.BitcoinProvider;exports.BitcoinWallet=e.BitcoinWallet;exports.BlockNumberFetcher=e.BlockNumberFetcher;exports.DEFAULT_AFFILIATE_ASSET=e.DEFAULT_AFFILIATE_ASSET;exports.EvmRelay=e.EvmRelay;exports.Garden=e.Garden;exports.OrderAction=e.OrderAction;exports.OrderStatus=e.OrderStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.Quote=e.Quote;exports.RouteValidator=e.RouteValidator;exports.STARKNET_CONFIG=e.STARKNET_CONFIG;exports.SUI_CONFIG=e.SUI_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.botanixMainnet=e.botanixMainnet;exports.buildRouteMatrix=e.buildRouteMatrix;exports.checkStarknetAlloance=e.checkAllowance;exports.checkStarknetAllowanceAndApprove=e.checkAllowanceAndApprove;exports.constructOrderPair=e.constructOrderPair;exports.evmToViemChainMap=e.evmToViemChainMap;exports.getChainNameFromChainId=e.getChainNameFromChainId;exports.hyperliquid=e.hyperliquid;exports.hyperliquidTestnet=e.hyperliquidTestnet;exports.isCompleted=e.isCompleted;exports.isDeadlinePassed=e.isDeadlinePassed;exports.isStarknetAllowanceSufficient=e.isAllowanceSufficient;exports.parseAction=e.parseAction;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,41 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as e, L as t, M as r, N as i, m as n, R as o, E as l, G as d, O as c, n as A, P as S, Q as u, Y as k, U as p, V as C, t as T, k as h, j as m, W as O, h as y, S as F, o as I, C as N, Z as R, w as v, u as w, x as P, D as E, F as B, I as L, J as M, q as f, r as g, v as x, p as G, A as _, X as b, K as q, z as D, y as U } from "./index-BsnXI660.js";
|
|
2
2
|
export {
|
|
3
3
|
e as API,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
t as BitcoinNetwork,
|
|
5
|
+
r as BitcoinProvider,
|
|
6
6
|
i as BitcoinWallet,
|
|
7
7
|
n as BlockNumberFetcher,
|
|
8
|
-
o as
|
|
8
|
+
o as DEFAULT_AFFILIATE_ASSET,
|
|
9
|
+
l as EvmRelay,
|
|
9
10
|
d as Garden,
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
c as OrderAction,
|
|
12
|
+
A as OrderStatus,
|
|
12
13
|
S as ParseOrderStatus,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
h as
|
|
19
|
-
m as
|
|
20
|
-
|
|
21
|
-
y as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
u as Quote,
|
|
15
|
+
k as RouteValidator,
|
|
16
|
+
p as STARKNET_CONFIG,
|
|
17
|
+
C as SUI_CONFIG,
|
|
18
|
+
T as SecretManager,
|
|
19
|
+
h as SolanaHTLC,
|
|
20
|
+
m as SolanaRelay,
|
|
21
|
+
O as SolanaRelayerAddress,
|
|
22
|
+
y as StarknetHTLC,
|
|
23
|
+
F as StarknetRelay,
|
|
24
|
+
I as SwapStatus,
|
|
25
|
+
N as botanixMainnet,
|
|
26
|
+
R as buildRouteMatrix,
|
|
27
|
+
v as checkStarknetAlloance,
|
|
28
|
+
w as checkStarknetAllowanceAndApprove,
|
|
29
|
+
P as constructOrderPair,
|
|
27
30
|
E as evmToViemChainMap,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
D as validateBTCAddress
|
|
31
|
+
B as getChainNameFromChainId,
|
|
32
|
+
L as hyperliquid,
|
|
33
|
+
M as hyperliquidTestnet,
|
|
34
|
+
f as isCompleted,
|
|
35
|
+
g as isDeadlinePassed,
|
|
36
|
+
x as isStarknetAllowanceSufficient,
|
|
37
|
+
G as parseAction,
|
|
38
|
+
_ as resolveApiConfig,
|
|
39
|
+
b as solanaProgramAddress,
|
|
40
|
+
q as switchOrAddNetwork,
|
|
41
|
+
D as toXOnly,
|
|
42
|
+
U as validateBTCAddress
|
|
41
43
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { Garden } from './lib/garden/garden';
|
|
2
|
-
export type { IGardenJS, SwapParams, GardenEvents, IOrderExecutorCache, OrderCacheValue, EventCallback, OrderWithStatus, GardenCoreConfig, GardenWalletModules, GardenHTLCModules, GardenConfigWithWallets, GardenConfigWithHTLCs, } from './lib/garden/garden.types';
|
|
3
|
-
export {
|
|
2
|
+
export type { IGardenJS, SwapParams, GardenEvents, IOrderExecutorCache, OrderCacheValue, EventCallback, OrderWithStatus, GardenCoreConfig, GardenWalletModules, GardenHTLCModules, GardenConfigWithWallets, GardenConfigWithHTLCs, ApiConfig, } from './lib/garden/garden.types';
|
|
3
|
+
export { OrderAction } from './lib/orderStatus/orderStatus';
|
|
4
4
|
export { EvmRelay } from './lib/evm/relay/evmRelay';
|
|
5
|
-
export type { IEVMRelay } from './lib/evm/relay/evmRelay.types';
|
|
5
|
+
export type { IEVMRelay, EVMRelayOpts } from './lib/evm/relay/evmRelay.types';
|
|
6
6
|
export type { IEVMHTLC } from './lib/evm/htlc.types';
|
|
7
7
|
export { StarknetRelay } from './lib/starknet/relay/starknetRelay';
|
|
8
8
|
export type { IStarknetHTLC } from './lib/starknet/starknetHTLC.types';
|
|
@@ -13,16 +13,19 @@ export { SolanaHTLC } from './lib/solana/htlc/solanaHTLC';
|
|
|
13
13
|
export { BlockNumberFetcher } from './lib/blockNumberFetcher/blockNumber';
|
|
14
14
|
export type { IBlockNumberFetcher } from './lib/blockNumberFetcher/blockNumber';
|
|
15
15
|
export { OrderStatus, SwapStatus } from './lib/orderStatus/status';
|
|
16
|
-
export { parseAction, ParseOrderStatus,
|
|
16
|
+
export { parseAction, ParseOrderStatus, isCompleted, isDeadlinePassed, } from './lib/orderStatus/orderStatus';
|
|
17
17
|
export { SecretManager } from './lib/secretManager/secretManager';
|
|
18
|
-
export type { ISecretManager, Secret, } from './lib/secretManager/secretManager.types';
|
|
18
|
+
export type { ISecretManager, Secret, SecretManagerEvents, } from './lib/secretManager/secretManager.types';
|
|
19
19
|
export { checkAllowanceAndApprove as checkStarknetAllowanceAndApprove, isAllowanceSufficient as isStarknetAllowanceSufficient, checkAllowance as checkStarknetAlloance, } from './lib/starknet/checkAllowanceAndApprove';
|
|
20
20
|
export { Quote } from './lib/quote/quote';
|
|
21
|
-
export type {
|
|
21
|
+
export type { StrategiesResponse, BaseQuoteParams, IQuote, QuoteOptions, QuoteParamsForAssets, QuoteParamsForOrderPair, QuoteResponse, Strategies, } from './lib/quote/quote.types';
|
|
22
22
|
export { constructOrderPair, validateBTCAddress, toXOnly, resolveApiConfig, } from './lib/utils';
|
|
23
|
-
export {
|
|
23
|
+
export { botanixMainnet, evmToViemChainMap, getChainNameFromChainId, hyperliquid, hyperliquidTestnet, switchOrAddNetwork, } from './lib/switchOrAddNetwork';
|
|
24
24
|
export { BitcoinNetwork } from './lib/bitcoin/provider/provider.interface';
|
|
25
25
|
export { BitcoinProvider } from './lib/bitcoin/provider/provider';
|
|
26
26
|
export { BitcoinWallet } from './lib/bitcoin/wallet/wallet';
|
|
27
|
-
export type { IBitcoinProvider } from './lib/bitcoin/provider/provider.interface';
|
|
28
|
-
export { API, STARKNET_CONFIG, SolanaRelayerAddress, solanaProgramAddress, } from './lib/constants';
|
|
27
|
+
export type { UrgencyToFeeRateKey, Urgency, IBitcoinProvider, FeeRates, BitcoinTxType, BitcoinTx, BitcoinUTXO, FeeRateKeys, } from './lib/bitcoin/provider/provider.interface';
|
|
28
|
+
export { DEFAULT_AFFILIATE_ASSET, API, STARKNET_CONFIG, SUI_CONFIG, SolanaRelayerAddress, solanaProgramAddress, } from './lib/constants';
|
|
29
|
+
export type { Api } from './lib/constants';
|
|
30
|
+
export { RouteValidator, buildRouteMatrix, } from './lib/routeValidator/routeValidator';
|
|
31
|
+
export type { RoutePolicy } from './lib/routeValidator/routeValidator';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { IBitcoinProvider } from './provider/provider.interface';
|
|
2
|
+
import { IBitcoinWallet } from './wallet/wallet.interface';
|
|
3
|
+
import { IBitcoinHTLC } from './bitcoinhtlc.types';
|
|
4
|
+
import { BitcoinOrderResponse, Order } from '@gardenfi/orderbook';
|
|
5
|
+
import { AsyncResult } from '@gardenfi/utils';
|
|
6
|
+
import * as bitcoin from 'bitcoinjs-lib';
|
|
7
|
+
export declare enum Leaf {
|
|
8
|
+
REFUND = 0,
|
|
9
|
+
REDEEM = 1,
|
|
10
|
+
INSTANT_REFUND = 2
|
|
11
|
+
}
|
|
12
|
+
export type TxType = 'redeem' | 'refund' | 'instantRefund';
|
|
13
|
+
export type LeafScript = {
|
|
14
|
+
version: number;
|
|
15
|
+
output: Buffer;
|
|
16
|
+
};
|
|
17
|
+
export type LeafTree = LeafScript | [LeafScript, LeafScript];
|
|
18
|
+
export declare class BitcoinHTLC implements IBitcoinHTLC {
|
|
19
|
+
/**
|
|
20
|
+
* Signer of the HTLC can be either the initiator or the redeemer
|
|
21
|
+
*/
|
|
22
|
+
private signer;
|
|
23
|
+
private internalPubkey;
|
|
24
|
+
private network;
|
|
25
|
+
/**
|
|
26
|
+
* Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
|
|
27
|
+
*/
|
|
28
|
+
constructor(signer: IBitcoinWallet, network: bitcoin.networks.Network);
|
|
29
|
+
/**
|
|
30
|
+
* Creates a BitcoinHTLC instance
|
|
31
|
+
* @param signer Bitcoin wallet of the initiator or redeemer
|
|
32
|
+
* @returns Promise<BitcoinHTLC> instance
|
|
33
|
+
*
|
|
34
|
+
* Note: When the signer is the initiator, only refund and instant refund can be done
|
|
35
|
+
* When the signer is the redeemer, only redeem can be done
|
|
36
|
+
*/
|
|
37
|
+
static from(signer: IBitcoinWallet): Promise<BitcoinHTLC>;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a taproot address for receiving the funds
|
|
40
|
+
* @param order The order object
|
|
41
|
+
* @param type The type of address to generate ('redeem' | 'refund' | 'instantRefund')
|
|
42
|
+
* - 'redeem': uses destination_swap parameters (default)
|
|
43
|
+
* - 'refund': uses source_swap parameters
|
|
44
|
+
* - 'instantRefund': uses source_swap parameters with redeemer
|
|
45
|
+
*/
|
|
46
|
+
address(order: Order, type: TxType): string;
|
|
47
|
+
private _buildRawTx;
|
|
48
|
+
/**
|
|
49
|
+
* prevout script for the BitcoinHTLC address
|
|
50
|
+
*/
|
|
51
|
+
private getOutputScript;
|
|
52
|
+
initiate(order: Order | BitcoinOrderResponse, fee?: number): AsyncResult<string, string>;
|
|
53
|
+
generateRedeemSACP(order: Order, secret: string, fee?: number): Promise<string>;
|
|
54
|
+
generateInstantRefundSACP(order: Order): Promise<string>;
|
|
55
|
+
generateInstantRefundSACPWithHash(hash: string[]): AsyncResult<string[], string>;
|
|
56
|
+
/**
|
|
57
|
+
* Instantly refunds the funds to the initiator given the counterparty's signatures and pubkey
|
|
58
|
+
*
|
|
59
|
+
* Note: If there are multiple UTXOs being spend, there should be a signature for each UTXO in counterPartySigs
|
|
60
|
+
*/
|
|
61
|
+
instantRefund(order: Order, counterPartySigs: {
|
|
62
|
+
utxo: string;
|
|
63
|
+
sig: string;
|
|
64
|
+
}[], fee?: number): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Reveals the secret and redeems the HTLC
|
|
67
|
+
*/
|
|
68
|
+
redeem(order: Order, secret: string, utxoHashes?: string[]): AsyncResult<string, string>;
|
|
69
|
+
getRedeemHex(order: Order, secret: string, utxoHashes?: string[]): AsyncResult<string, string>;
|
|
70
|
+
/**
|
|
71
|
+
* Refunds the funds back to the initiator if the expiry block height + 1 is reached
|
|
72
|
+
*/
|
|
73
|
+
refund(order: Order, fee?: number): AsyncResult<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Given a list of UTXOs, checks if the HTLC can be refunded
|
|
76
|
+
*/
|
|
77
|
+
private canRefund;
|
|
78
|
+
/**
|
|
79
|
+
* Given a leaf, generates the control block necessary for spending the leaf
|
|
80
|
+
*/
|
|
81
|
+
private generateControlBlockFor;
|
|
82
|
+
/**
|
|
83
|
+
* Generates the hash of the leaf script
|
|
84
|
+
* @param leaf Use leaf enum or pass 0 for refund, 1 for redeem, 2 for instant refund
|
|
85
|
+
* @returns hash of the leaf script
|
|
86
|
+
*/
|
|
87
|
+
leafHash(leaf: Leaf, order: Order): Buffer;
|
|
88
|
+
private refundLeaf;
|
|
89
|
+
private redeemLeaf;
|
|
90
|
+
private instantRefundLeaf;
|
|
91
|
+
/**
|
|
92
|
+
* Generates leaves for a given action type (redeem, refund, instant refund)
|
|
93
|
+
* @param order The order object
|
|
94
|
+
* @param type 'redeem' | 'refund' | 'instantRefund'
|
|
95
|
+
* - 'redeem': uses destination_swap for all params
|
|
96
|
+
* - 'refund': uses source_swap for all params
|
|
97
|
+
* - 'instantRefund': uses source_swap, but redeem/instantRefund use .redeemer
|
|
98
|
+
*/
|
|
99
|
+
private generateLeaves;
|
|
100
|
+
/**
|
|
101
|
+
* Generates the merkle proof for the leaf script
|
|
102
|
+
*/
|
|
103
|
+
private generateMerkleProofFor;
|
|
104
|
+
getProvider(): Promise<IBitcoinProvider>;
|
|
105
|
+
getPublicKey(): Promise<string>;
|
|
106
|
+
htlcActorAddress(): Promise<string>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Order } from '@gardenfi/orderbook';
|
|
2
|
+
import { AsyncResult } from '@gardenfi/utils';
|
|
3
|
+
import { IBitcoinProvider } from './provider/provider.interface';
|
|
4
|
+
|
|
5
|
+
export interface IBitcoinHTLC {
|
|
6
|
+
/**
|
|
7
|
+
* Initiates the HTLC by sending funds to the HTLC contract.
|
|
8
|
+
* @param order - The matched order.
|
|
9
|
+
* @returns A promise resolving to the transaction hash of the initiation.
|
|
10
|
+
*/
|
|
11
|
+
initiate(order: Order, fee?: number): AsyncResult<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Redeems funds from the HTLC contract to the actor's address.
|
|
14
|
+
* @param order - The matched order.
|
|
15
|
+
* @param secret - The secret required to unlock the htlc.
|
|
16
|
+
* @returns A promise resolving to the transaction hash of the redemption.
|
|
17
|
+
*/
|
|
18
|
+
redeem(order: Order, secret: string): AsyncResult<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Refunds funds from the HTLC contract back to the actor's address upon expiration.
|
|
21
|
+
* @param order - The matched order.
|
|
22
|
+
* @returns A promise resolving to the transaction hash of the refund.
|
|
23
|
+
*/
|
|
24
|
+
refund(order: Order): AsyncResult<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* Generates the instant refund SACP with the hash of the refund transaction.
|
|
27
|
+
* @param hash - The hash of the refund transaction.
|
|
28
|
+
* @returns A promise resolving to the SACP.
|
|
29
|
+
*/
|
|
30
|
+
generateInstantRefundSACPWithHash(hash: string[]): AsyncResult<string[], string>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates the redeem SACP with the secret.
|
|
33
|
+
* @param order - The matched order.
|
|
34
|
+
* @param secret - The secret required to unlock the htlc.
|
|
35
|
+
* @returns A promise resolving to the SACP.
|
|
36
|
+
*/
|
|
37
|
+
getRedeemHex(order: Order, secret: string, utxoHashes?: string[]): AsyncResult<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the provider of the wallet.
|
|
40
|
+
* @returns A promise resolving to the provider.
|
|
41
|
+
*/
|
|
42
|
+
getProvider(): Promise<IBitcoinProvider>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the public key of the wallet.
|
|
45
|
+
* @returns A promise resolving to the public key.
|
|
46
|
+
*/
|
|
47
|
+
getPublicKey(): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the HTLC actor address.
|
|
50
|
+
* This is the user's wallet address in the case of EVM.
|
|
51
|
+
*/
|
|
52
|
+
htlcActorAddress(): Promise<string>;
|
|
53
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain } from '@gardenfi/orderbook';
|
|
2
|
-
import {
|
|
2
|
+
import { Network, Url, AsyncResult } from '@gardenfi/utils';
|
|
3
3
|
|
|
4
4
|
type Response = {
|
|
5
5
|
[key in Chain]: number;
|
|
@@ -9,7 +9,7 @@ export interface IBlockNumberFetcher {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class BlockNumberFetcher implements IBlockNumberFetcher {
|
|
11
11
|
private url;
|
|
12
|
-
constructor(url:
|
|
12
|
+
constructor(url: Url, network: Network);
|
|
13
13
|
fetchBlockNumbers(): AsyncResult<Response, string>;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
+
import { ChainAsset } from '@gardenfi/orderbook';
|
|
1
2
|
import { Environment, Network } from '@gardenfi/utils';
|
|
2
3
|
|
|
3
4
|
export type Api = {
|
|
4
|
-
|
|
5
|
+
baseurl: string;
|
|
5
6
|
auth: string;
|
|
6
|
-
quote: string;
|
|
7
7
|
info: string;
|
|
8
|
-
|
|
9
|
-
starknetRelay: string;
|
|
10
|
-
solanaRelay: string;
|
|
11
|
-
suiRelay: string;
|
|
8
|
+
relayer: string;
|
|
12
9
|
};
|
|
13
10
|
export declare const API: Record<Environment, Api>;
|
|
14
11
|
export declare const STARKNET_CONFIG: Record<Network, {
|
|
@@ -31,6 +28,5 @@ export declare const SUI_CONFIG: Record<Network, {
|
|
|
31
28
|
moduleName: string;
|
|
32
29
|
}>;
|
|
33
30
|
export declare const DEFAULT_AFFILIATE_ASSET: {
|
|
34
|
-
|
|
35
|
-
asset: "0xeae7721d779276eb0f5837e2fe260118724a2ba4";
|
|
31
|
+
asset: ChainAsset;
|
|
36
32
|
};
|
|
@@ -1540,7 +1540,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
1540
1540
|
readonly stateMutability: "view";
|
|
1541
1541
|
readonly type: "function";
|
|
1542
1542
|
}], "refund", readonly [`0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
1543
|
-
|
|
1543
|
+
instantRefund: (args: readonly [`0x${string}`, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
1544
1544
|
readonly inputs: readonly [{
|
|
1545
1545
|
readonly internalType: "address";
|
|
1546
1546
|
readonly name: "token_";
|
|
@@ -1844,8 +1844,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
1844
1844
|
}];
|
|
1845
1845
|
readonly stateMutability: "view";
|
|
1846
1846
|
readonly type: "function";
|
|
1847
|
-
}], "
|
|
1848
|
-
|
|
1847
|
+
}], "instantRefund", readonly [`0x${string}`, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
1848
|
+
initiate: (args: readonly [`0x${string}`, bigint, bigint, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
1849
1849
|
readonly inputs: readonly [{
|
|
1850
1850
|
readonly internalType: "address";
|
|
1851
1851
|
readonly name: "token_";
|
|
@@ -2149,8 +2149,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
2149
2149
|
}];
|
|
2150
2150
|
readonly stateMutability: "view";
|
|
2151
2151
|
readonly type: "function";
|
|
2152
|
-
}], "
|
|
2153
|
-
|
|
2152
|
+
}], "initiate", readonly [`0x${string}`, bigint, bigint, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
2153
|
+
initiateWithSignature: (args: readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
2154
2154
|
readonly inputs: readonly [{
|
|
2155
2155
|
readonly internalType: "address";
|
|
2156
2156
|
readonly name: "token_";
|
|
@@ -2454,7 +2454,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
2454
2454
|
}];
|
|
2455
2455
|
readonly stateMutability: "view";
|
|
2456
2456
|
readonly type: "function";
|
|
2457
|
-
}], "
|
|
2457
|
+
}], "initiateWithSignature", readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
2458
2458
|
multicall: (args: readonly [readonly {
|
|
2459
2459
|
redeemer: `0x${string}`;
|
|
2460
2460
|
expiry: bigint;
|
|
@@ -3393,7 +3393,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
3393
3393
|
readonly stateMutability: "view";
|
|
3394
3394
|
readonly type: "function";
|
|
3395
3395
|
}], "refund", readonly [`0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
3396
|
-
|
|
3396
|
+
instantRefund: (args: readonly [`0x${string}`, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
3397
3397
|
readonly inputs: readonly [{
|
|
3398
3398
|
readonly internalType: "address";
|
|
3399
3399
|
readonly name: "token_";
|
|
@@ -3697,8 +3697,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
3697
3697
|
}];
|
|
3698
3698
|
readonly stateMutability: "view";
|
|
3699
3699
|
readonly type: "function";
|
|
3700
|
-
}], "
|
|
3701
|
-
|
|
3700
|
+
}], "instantRefund", readonly [`0x${string}`, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
3701
|
+
initiate: (args: readonly [`0x${string}`, bigint, bigint, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
3702
3702
|
readonly inputs: readonly [{
|
|
3703
3703
|
readonly internalType: "address";
|
|
3704
3704
|
readonly name: "token_";
|
|
@@ -4002,8 +4002,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
4002
4002
|
}];
|
|
4003
4003
|
readonly stateMutability: "view";
|
|
4004
4004
|
readonly type: "function";
|
|
4005
|
-
}], "
|
|
4006
|
-
|
|
4005
|
+
}], "initiate", readonly [`0x${string}`, bigint, bigint, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
4006
|
+
initiateWithSignature: (args: readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], options: import('viem').Prettify<import('viem').UnionOmit<import('viem').EstimateContractGasParameters<readonly [{
|
|
4007
4007
|
readonly inputs: readonly [{
|
|
4008
4008
|
readonly internalType: "address";
|
|
4009
4009
|
readonly name: "token_";
|
|
@@ -4307,7 +4307,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
4307
4307
|
}];
|
|
4308
4308
|
readonly stateMutability: "view";
|
|
4309
4309
|
readonly type: "function";
|
|
4310
|
-
}], "
|
|
4310
|
+
}], "initiateWithSignature", readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], import('viem').Chain | undefined>, "address" | "args" | "abi" | "functionName">>) => Promise<import('viem').EstimateContractGasReturnType>;
|
|
4311
4311
|
multicall: (args: readonly [readonly {
|
|
4312
4312
|
redeemer: `0x${string}`;
|
|
4313
4313
|
expiry: bigint;
|
|
@@ -5855,7 +5855,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
5855
5855
|
readonly stateMutability: "view";
|
|
5856
5856
|
readonly type: "function";
|
|
5857
5857
|
}], "refund", readonly [`0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride, accountOverride>>;
|
|
5858
|
-
|
|
5858
|
+
instantRefund: <chainOverride extends import('viem').Chain | undefined = undefined, accountOverride extends import('viem').Account | Address | undefined = undefined>(args: readonly [`0x${string}`, `0x${string}`], options?: Omit<import('viem').SimulateContractParameters<readonly [{
|
|
5859
5859
|
readonly inputs: readonly [{
|
|
5860
5860
|
readonly internalType: "address";
|
|
5861
5861
|
readonly name: "token_";
|
|
@@ -6159,7 +6159,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
6159
6159
|
}];
|
|
6160
6160
|
readonly stateMutability: "view";
|
|
6161
6161
|
readonly type: "function";
|
|
6162
|
-
}], "
|
|
6162
|
+
}], "instantRefund", readonly [`0x${string}`, `0x${string}`], import('viem').Chain | undefined, chainOverride, accountOverride>, "address" | "args" | "abi" | "functionName"> | undefined) => Promise<import('viem').SimulateContractReturnType<readonly [{
|
|
6163
6163
|
readonly inputs: readonly [{
|
|
6164
6164
|
readonly internalType: "address";
|
|
6165
6165
|
readonly name: "token_";
|
|
@@ -6463,8 +6463,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
6463
6463
|
}];
|
|
6464
6464
|
readonly stateMutability: "view";
|
|
6465
6465
|
readonly type: "function";
|
|
6466
|
-
}], "
|
|
6467
|
-
|
|
6466
|
+
}], "instantRefund", readonly [`0x${string}`, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride, accountOverride>>;
|
|
6467
|
+
initiate: <chainOverride extends import('viem').Chain | undefined = undefined, accountOverride extends import('viem').Account | Address | undefined = undefined>(args: readonly [`0x${string}`, bigint, bigint, `0x${string}`], options?: Omit<import('viem').SimulateContractParameters<readonly [{
|
|
6468
6468
|
readonly inputs: readonly [{
|
|
6469
6469
|
readonly internalType: "address";
|
|
6470
6470
|
readonly name: "token_";
|
|
@@ -6768,7 +6768,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
6768
6768
|
}];
|
|
6769
6769
|
readonly stateMutability: "view";
|
|
6770
6770
|
readonly type: "function";
|
|
6771
|
-
}], "
|
|
6771
|
+
}], "initiate", readonly [`0x${string}`, bigint, bigint, `0x${string}`], import('viem').Chain | undefined, chainOverride, accountOverride>, "address" | "args" | "abi" | "functionName"> | undefined) => Promise<import('viem').SimulateContractReturnType<readonly [{
|
|
6772
6772
|
readonly inputs: readonly [{
|
|
6773
6773
|
readonly internalType: "address";
|
|
6774
6774
|
readonly name: "token_";
|
|
@@ -7072,8 +7072,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
7072
7072
|
}];
|
|
7073
7073
|
readonly stateMutability: "view";
|
|
7074
7074
|
readonly type: "function";
|
|
7075
|
-
}], "
|
|
7076
|
-
|
|
7075
|
+
}], "initiate", readonly [`0x${string}`, bigint, bigint, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride, accountOverride>>;
|
|
7076
|
+
initiateWithSignature: <chainOverride extends import('viem').Chain | undefined = undefined, accountOverride extends import('viem').Account | Address | undefined = undefined>(args: readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], options?: Omit<import('viem').SimulateContractParameters<readonly [{
|
|
7077
7077
|
readonly inputs: readonly [{
|
|
7078
7078
|
readonly internalType: "address";
|
|
7079
7079
|
readonly name: "token_";
|
|
@@ -7377,7 +7377,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
7377
7377
|
}];
|
|
7378
7378
|
readonly stateMutability: "view";
|
|
7379
7379
|
readonly type: "function";
|
|
7380
|
-
}], "
|
|
7380
|
+
}], "initiateWithSignature", readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], import('viem').Chain | undefined, chainOverride, accountOverride>, "address" | "args" | "abi" | "functionName"> | undefined) => Promise<import('viem').SimulateContractReturnType<readonly [{
|
|
7381
7381
|
readonly inputs: readonly [{
|
|
7382
7382
|
readonly internalType: "address";
|
|
7383
7383
|
readonly name: "token_";
|
|
@@ -7681,7 +7681,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
7681
7681
|
}];
|
|
7682
7682
|
readonly stateMutability: "view";
|
|
7683
7683
|
readonly type: "function";
|
|
7684
|
-
}], "
|
|
7684
|
+
}], "initiateWithSignature", readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride, accountOverride>>;
|
|
7685
7685
|
multicall: <chainOverride extends import('viem').Chain | undefined = undefined, accountOverride extends import('viem').Account | Address | undefined = undefined>(args: readonly [readonly {
|
|
7686
7686
|
redeemer: `0x${string}`;
|
|
7687
7687
|
expiry: bigint;
|
|
@@ -12722,7 +12722,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
12722
12722
|
readonly stateMutability: "view";
|
|
12723
12723
|
readonly type: "function";
|
|
12724
12724
|
}], "refund", readonly [`0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride>, "address" | "args" | "abi" | "functionName"> extends infer T ? { [K in keyof T]: T[K]; } : never>(args: readonly [`0x${string}`], options: options) => Promise<import('viem').WriteContractReturnType>;
|
|
12725
|
-
|
|
12725
|
+
instantRefund: <chainOverride extends import('viem').Chain | undefined, options extends import('viem').UnionOmit<import('viem').WriteContractParameters<readonly [{
|
|
12726
12726
|
readonly inputs: readonly [{
|
|
12727
12727
|
readonly internalType: "address";
|
|
12728
12728
|
readonly name: "token_";
|
|
@@ -13026,8 +13026,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
13026
13026
|
}];
|
|
13027
13027
|
readonly stateMutability: "view";
|
|
13028
13028
|
readonly type: "function";
|
|
13029
|
-
}], "
|
|
13030
|
-
|
|
13029
|
+
}], "instantRefund", readonly [`0x${string}`, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride>, "address" | "args" | "abi" | "functionName"> extends infer T ? { [K in keyof T]: T[K]; } : never>(args: readonly [`0x${string}`, `0x${string}`], options: options) => Promise<import('viem').WriteContractReturnType>;
|
|
13030
|
+
initiate: <chainOverride extends import('viem').Chain | undefined, options extends import('viem').UnionOmit<import('viem').WriteContractParameters<readonly [{
|
|
13031
13031
|
readonly inputs: readonly [{
|
|
13032
13032
|
readonly internalType: "address";
|
|
13033
13033
|
readonly name: "token_";
|
|
@@ -13331,8 +13331,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
13331
13331
|
}];
|
|
13332
13332
|
readonly stateMutability: "view";
|
|
13333
13333
|
readonly type: "function";
|
|
13334
|
-
}], "
|
|
13335
|
-
|
|
13334
|
+
}], "initiate", readonly [`0x${string}`, bigint, bigint, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride>, "address" | "args" | "abi" | "functionName"> extends infer T ? { [K in keyof T]: T[K]; } : never>(args: readonly [`0x${string}`, bigint, bigint, `0x${string}`], options: options) => Promise<import('viem').WriteContractReturnType>;
|
|
13335
|
+
initiateWithSignature: <chainOverride extends import('viem').Chain | undefined, options extends import('viem').UnionOmit<import('viem').WriteContractParameters<readonly [{
|
|
13336
13336
|
readonly inputs: readonly [{
|
|
13337
13337
|
readonly internalType: "address";
|
|
13338
13338
|
readonly name: "token_";
|
|
@@ -13636,7 +13636,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
13636
13636
|
}];
|
|
13637
13637
|
readonly stateMutability: "view";
|
|
13638
13638
|
readonly type: "function";
|
|
13639
|
-
}], "
|
|
13639
|
+
}], "initiateWithSignature", readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride>, "address" | "args" | "abi" | "functionName"> extends infer T ? { [K in keyof T]: T[K]; } : never>(args: readonly [`0x${string}`, bigint, bigint, `0x${string}`, `0x${string}`], options: options) => Promise<import('viem').WriteContractReturnType>;
|
|
13640
13640
|
multicall: <chainOverride extends import('viem').Chain | undefined, options extends import('viem').UnionOmit<import('viem').WriteContractParameters<readonly [{
|
|
13641
13641
|
readonly inputs: readonly [{
|
|
13642
13642
|
readonly internalType: "address";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EvmOrderResponse, Order } from '@gardenfi/orderbook';
|
|
2
2
|
import { AsyncResult } from '@gardenfi/utils';
|
|
3
3
|
|
|
4
4
|
export interface IEVMHTLC {
|
|
@@ -12,18 +12,18 @@ export interface IEVMHTLC {
|
|
|
12
12
|
* @param order - The matched order.
|
|
13
13
|
* @returns A promise resolving to the transaction hash of the initiation.
|
|
14
14
|
*/
|
|
15
|
-
initiate(order:
|
|
15
|
+
initiate(order: Order | EvmOrderResponse): AsyncResult<string, string>;
|
|
16
16
|
/**
|
|
17
17
|
* Redeems funds from the HTLC contract to the actor's address.
|
|
18
18
|
* @param order - The matched order.
|
|
19
19
|
* @param secret - The secret required to unlock the htlc.
|
|
20
20
|
* @returns A promise resolving to the transaction hash of the redemption.
|
|
21
21
|
*/
|
|
22
|
-
redeem(order:
|
|
22
|
+
redeem(order: Order, secret: string): AsyncResult<string, string>;
|
|
23
23
|
/**
|
|
24
24
|
* Refunds funds from the HTLC contract back to the actor's address upon expiration.
|
|
25
25
|
* @param order - The matched order.
|
|
26
26
|
* @returns A promise resolving to the transaction hash of the refund.
|
|
27
27
|
*/
|
|
28
|
-
refund(order:
|
|
28
|
+
refund(order: Order): AsyncResult<string, string>;
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncResult, IAuth, Url } from '@gardenfi/utils';
|
|
2
2
|
import { WalletClient } from 'viem';
|
|
3
|
-
import {
|
|
3
|
+
import { EvmOrderResponse, Order } from '@gardenfi/orderbook';
|
|
4
4
|
import { IEVMHTLC } from '../htlc.types';
|
|
5
5
|
|
|
6
6
|
export declare class EvmRelay implements IEVMHTLC {
|
|
@@ -9,10 +9,11 @@ export declare class EvmRelay implements IEVMHTLC {
|
|
|
9
9
|
private wallet;
|
|
10
10
|
constructor(url: string | Url, wallet: WalletClient, auth: IAuth);
|
|
11
11
|
get htlcActorAddress(): string;
|
|
12
|
-
initiate(order:
|
|
13
|
-
private getTokenAddress;
|
|
12
|
+
initiate(order: Order | EvmOrderResponse): AsyncResult<string, string>;
|
|
14
13
|
private _initiateOnNativeHTLC;
|
|
15
14
|
private _initiateOnErc20HTLC;
|
|
16
|
-
|
|
15
|
+
executeApprovalTransaction(order: EvmOrderResponse): AsyncResult<string, string>;
|
|
16
|
+
private initiateWithCreateOrderResponse;
|
|
17
|
+
redeem(order: Order, secret: string): AsyncResult<string, string>;
|
|
17
18
|
refund(): AsyncResult<string, string>;
|
|
18
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Order } from '@gardenfi/orderbook';
|
|
2
2
|
import { AsyncResult, IStore } from '@gardenfi/utils';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export interface IEVMRelay {
|
|
|
15
15
|
* @NOTE send the current block number of the L1 chain, if the order is on L2 chain (arbitrum).
|
|
16
16
|
* @returns txHash of Initiation
|
|
17
17
|
*/
|
|
18
|
-
init(walletClient: WalletClient, order:
|
|
18
|
+
init(walletClient: WalletClient, order: Order): AsyncResult<string, string>;
|
|
19
19
|
/**
|
|
20
20
|
* Redeems funds from the EVM atomic swap contract using relay service.
|
|
21
21
|
* Sends the secret to the relay service.
|