@gardenfi/core 2.5.3-beta.0 → 2.5.3-beta.2
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-Cmo2J8uO.js → ccip-BE4ehdw2.js} +1 -1
- package/dist/{ccip-BixEUfCX.cjs → ccip-CWyEeg1d.cjs} +1 -1
- package/dist/{index-BsnXI660.js → index-3Y2kQfE0.js} +11944 -11296
- package/dist/index-Cnz5kiIK.cjs +106 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +30 -38
- package/dist/src/index.d.ts +0 -6
- package/dist/src/lib/bitcoin/API.d.ts +3 -1
- package/dist/src/lib/bitcoin/bitcoinHtlc.d.ts +5 -14
- package/dist/src/lib/bitcoin/bitcoinhtlc.types.d.ts +4 -4
- package/dist/src/lib/bitcoin/provider/provider.d.ts +2 -1
- package/dist/src/lib/bitcoin/wallet/abstractWallet.d.ts +1 -1
- package/dist/src/lib/bitcoin/wallet/wallet.d.ts +1 -1
- package/dist/src/lib/bitcoin/wallet/wallet.interface.d.ts +1 -1
- package/dist/src/lib/evm/htlc/evmHTLC.d.ts +42 -42
- package/dist/src/lib/evm/relay/evmRelay.d.ts +1 -1
- package/dist/src/lib/garden/cache/GardenCache.d.ts +1 -2
- package/dist/src/lib/garden/executor/executor.d.ts +3 -3
- package/dist/src/lib/garden/garden.d.ts +4 -7
- package/dist/src/lib/garden/garden.types.d.ts +15 -9
- package/dist/src/lib/quote/quote.d.ts +2 -2
- package/dist/src/lib/quote/quote.types.d.ts +2 -2
- package/dist/src/lib/solana/relayer/solanaRelay.d.ts +23 -19
- package/dist/src/lib/sui/relay/suiRelay.d.ts +1 -1
- package/dist/src/lib/switchOrAddNetwork.d.ts +4 -4
- package/dist/src/lib/utils.d.ts +3 -1
- package/package.json +4 -4
- package/dist/index-Bx--llHe.cjs +0 -106
- package/dist/src/lib/blockNumberFetcher/blockNumber.d.ts +0 -15
- package/dist/src/lib/evm/relay/evmRelay.types.d.ts +0 -26
- package/dist/src/lib/orderStatus/orderStatus.d.ts +0 -25
- package/dist/src/lib/orderStatus/status.d.ts +0 -130
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-Cnz5kiIK.cjs");exports.API=e.API;exports.BitcoinNetwork=e.BitcoinNetwork;exports.BitcoinProvider=e.BitcoinProvider;exports.BitcoinWallet=e.BitcoinWallet;exports.DEFAULT_AFFILIATE_ASSET=e.DEFAULT_AFFILIATE_ASSET;exports.EvmRelay=e.EvmRelay;exports.Garden=e.Garden;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.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.isStarknetAllowanceSufficient=e.isAllowanceSufficient;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,43 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { J as s, C as t, D as r, F as n, I as o, E as i, G as l, Q as d, R as A, K as c, L as S, m as k, k as C, j as T, M as h, h as u, S as m, u as p, O as y, p as I, n as R, q as v, w as F, x as N, y as w, z as E, o as O, r as L, N as M, A as f, t as g, v as x } from "./index-3Y2kQfE0.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
s as API,
|
|
4
4
|
t as BitcoinNetwork,
|
|
5
5
|
r as BitcoinProvider,
|
|
6
|
-
|
|
7
|
-
n as BlockNumberFetcher,
|
|
6
|
+
n as BitcoinWallet,
|
|
8
7
|
o as DEFAULT_AFFILIATE_ASSET,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
A as
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
k as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
m as
|
|
21
|
-
|
|
22
|
-
y as
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
w as
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
8
|
+
i as EvmRelay,
|
|
9
|
+
l as Garden,
|
|
10
|
+
d as Quote,
|
|
11
|
+
A as RouteValidator,
|
|
12
|
+
c as STARKNET_CONFIG,
|
|
13
|
+
S as SUI_CONFIG,
|
|
14
|
+
k as SecretManager,
|
|
15
|
+
C as SolanaHTLC,
|
|
16
|
+
T as SolanaRelay,
|
|
17
|
+
h as SolanaRelayerAddress,
|
|
18
|
+
u as StarknetHTLC,
|
|
19
|
+
m as StarknetRelay,
|
|
20
|
+
p as botanixMainnet,
|
|
21
|
+
y as buildRouteMatrix,
|
|
22
|
+
I as checkStarknetAlloance,
|
|
23
|
+
R as checkStarknetAllowanceAndApprove,
|
|
24
|
+
v as constructOrderPair,
|
|
25
|
+
F as evmToViemChainMap,
|
|
26
|
+
N as getChainNameFromChainId,
|
|
27
|
+
w as hyperliquid,
|
|
28
|
+
E as hyperliquidTestnet,
|
|
29
|
+
O as isStarknetAllowanceSufficient,
|
|
30
|
+
L as resolveApiConfig,
|
|
31
|
+
M as solanaProgramAddress,
|
|
32
|
+
f as switchOrAddNetwork,
|
|
33
|
+
g as toXOnly,
|
|
34
|
+
x as validateBTCAddress
|
|
43
35
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { Garden } from './lib/garden/garden';
|
|
2
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
3
|
export { EvmRelay } from './lib/evm/relay/evmRelay';
|
|
5
|
-
export type { IEVMRelay, EVMRelayOpts } from './lib/evm/relay/evmRelay.types';
|
|
6
4
|
export type { IEVMHTLC } from './lib/evm/htlc.types';
|
|
7
5
|
export { StarknetRelay } from './lib/starknet/relay/starknetRelay';
|
|
8
6
|
export type { IStarknetHTLC } from './lib/starknet/starknetHTLC.types';
|
|
@@ -10,10 +8,6 @@ export { StarknetHTLC } from './lib/starknet/htlc/starknetHTLC';
|
|
|
10
8
|
export { SolanaRelay } from './lib/solana/relayer/solanaRelay';
|
|
11
9
|
export type { ISolanaHTLC } from './lib/solana/htlc/ISolanaHTLC';
|
|
12
10
|
export { SolanaHTLC } from './lib/solana/htlc/solanaHTLC';
|
|
13
|
-
export { BlockNumberFetcher } from './lib/blockNumberFetcher/blockNumber';
|
|
14
|
-
export type { IBlockNumberFetcher } from './lib/blockNumberFetcher/blockNumber';
|
|
15
|
-
export { OrderStatus, SwapStatus } from './lib/orderStatus/status';
|
|
16
|
-
export { parseAction, ParseOrderStatus, isCompleted, isDeadlinePassed, } from './lib/orderStatus/orderStatus';
|
|
17
11
|
export { SecretManager } from './lib/secretManager/secretManager';
|
|
18
12
|
export type { ISecretManager, Secret, SecretManagerEvents, } from './lib/secretManager/secretManager.types';
|
|
19
13
|
export { checkAllowanceAndApprove as checkStarknetAllowanceAndApprove, isAllowanceSufficient as isStarknetAllowanceSufficient, checkAllowance as checkStarknetAlloance, } from './lib/starknet/checkAllowanceAndApprove';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Network } from '@gardenfi/utils';
|
|
2
|
+
|
|
1
3
|
export declare const verifyAPIs: (APIs: string[]) => string[];
|
|
2
|
-
export declare const getAPIs: (network:
|
|
4
|
+
export declare const getAPIs: (network: Network) => string[];
|
|
3
5
|
export declare const RPC_URLS_TESTNET: string[];
|
|
4
6
|
export declare const RPC_URLS_MAINNET: string[];
|
|
@@ -2,8 +2,8 @@ import { IBitcoinProvider } from './provider/provider.interface';
|
|
|
2
2
|
import { IBitcoinWallet } from './wallet/wallet.interface';
|
|
3
3
|
import { IBitcoinHTLC } from './bitcoinhtlc.types';
|
|
4
4
|
import { BitcoinOrderResponse, Order } from '@gardenfi/orderbook';
|
|
5
|
-
import { AsyncResult } from '@gardenfi/utils';
|
|
6
|
-
|
|
5
|
+
import { AsyncResult, Network } from '@gardenfi/utils';
|
|
6
|
+
|
|
7
7
|
export declare enum Leaf {
|
|
8
8
|
REFUND = 0,
|
|
9
9
|
REDEEM = 1,
|
|
@@ -25,16 +25,7 @@ export declare class BitcoinHTLC implements IBitcoinHTLC {
|
|
|
25
25
|
/**
|
|
26
26
|
* Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
|
|
27
27
|
*/
|
|
28
|
-
constructor(signer: IBitcoinWallet, 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>;
|
|
28
|
+
constructor(signer: IBitcoinWallet, network: Network);
|
|
38
29
|
/**
|
|
39
30
|
* Generates a taproot address for receiving the funds
|
|
40
31
|
* @param order The order object
|
|
@@ -102,6 +93,6 @@ export declare class BitcoinHTLC implements IBitcoinHTLC {
|
|
|
102
93
|
*/
|
|
103
94
|
private generateMerkleProofFor;
|
|
104
95
|
getProvider(): Promise<IBitcoinProvider>;
|
|
105
|
-
getPublicKey():
|
|
106
|
-
htlcActorAddress():
|
|
96
|
+
get getPublicKey(): string;
|
|
97
|
+
get htlcActorAddress(): string;
|
|
107
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Order } from '@gardenfi/orderbook';
|
|
1
|
+
import { BitcoinOrderResponse, Order } from '@gardenfi/orderbook';
|
|
2
2
|
import { AsyncResult } from '@gardenfi/utils';
|
|
3
3
|
import { IBitcoinProvider } from './provider/provider.interface';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ export interface IBitcoinHTLC {
|
|
|
8
8
|
* @param order - The matched order.
|
|
9
9
|
* @returns A promise resolving to the transaction hash of the initiation.
|
|
10
10
|
*/
|
|
11
|
-
initiate(order: Order, fee?: number): AsyncResult<string, string>;
|
|
11
|
+
initiate(order: Order | BitcoinOrderResponse, fee?: number): AsyncResult<string, string>;
|
|
12
12
|
/**
|
|
13
13
|
* Redeems funds from the HTLC contract to the actor's address.
|
|
14
14
|
* @param order - The matched order.
|
|
@@ -44,10 +44,10 @@ export interface IBitcoinHTLC {
|
|
|
44
44
|
* Gets the public key of the wallet.
|
|
45
45
|
* @returns A promise resolving to the public key.
|
|
46
46
|
*/
|
|
47
|
-
getPublicKey():
|
|
47
|
+
get getPublicKey(): string;
|
|
48
48
|
/**
|
|
49
49
|
* Returns the HTLC actor address.
|
|
50
50
|
* This is the user's wallet address in the case of EVM.
|
|
51
51
|
*/
|
|
52
|
-
htlcActorAddress():
|
|
52
|
+
get htlcActorAddress(): string;
|
|
53
53
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Network } from '@gardenfi/utils';
|
|
1
2
|
import { BitcoinNetwork, BitcoinTx, BitcoinTxType, BitcoinUTXO, FeeRates, IBitcoinProvider, Urgency } from './provider.interface';
|
|
2
3
|
|
|
3
4
|
export declare class BitcoinProvider implements IBitcoinProvider {
|
|
@@ -5,7 +6,7 @@ export declare class BitcoinProvider implements IBitcoinProvider {
|
|
|
5
6
|
private readonly APIs;
|
|
6
7
|
private cacheTimeout;
|
|
7
8
|
private readonly utxosCache;
|
|
8
|
-
constructor(network:
|
|
9
|
+
constructor(network: Network, API?: string);
|
|
9
10
|
/**
|
|
10
11
|
* Gets the output index of the UTXO
|
|
11
12
|
*
|
|
@@ -11,7 +11,7 @@ export declare abstract class AbstractBitcoinWallet implements IBitcoinWallet {
|
|
|
11
11
|
abstract getAddress(): Promise<string>;
|
|
12
12
|
abstract getBalance(): Promise<number>;
|
|
13
13
|
abstract sign(hexString: string): Promise<string>;
|
|
14
|
-
abstract getPublicKey():
|
|
14
|
+
abstract getPublicKey(): string;
|
|
15
15
|
abstract getNetwork(): Promise<Network>;
|
|
16
16
|
abstract getProvider(): Promise<IBitcoinProvider>;
|
|
17
17
|
abstract send(toAddress: string, amt: number, fee?: number): Promise<string>;
|
|
@@ -90,7 +90,7 @@ export declare class BitcoinWallet extends AbstractBitcoinWallet {
|
|
|
90
90
|
getAddress(): Promise<string>;
|
|
91
91
|
getProvider(): Promise<IBitcoinProvider>;
|
|
92
92
|
getBalance(): Promise<number>;
|
|
93
|
-
getPublicKey():
|
|
93
|
+
getPublicKey(): string;
|
|
94
94
|
getNetwork(): Promise<networks.Network>;
|
|
95
95
|
static generateUnsignedPSBT(provider: IBitcoinProvider, network: networks.Network, fromAddress: string, toAddress: string, amt: number, fee?: number): Promise<{
|
|
96
96
|
txHex: string;
|
|
@@ -14,7 +14,7 @@ export interface IBitcoinWallet extends IBaseWallet {
|
|
|
14
14
|
/**
|
|
15
15
|
* @returns {Promise<string>} Public key of the wallet
|
|
16
16
|
*/
|
|
17
|
-
getPublicKey():
|
|
17
|
+
getPublicKey(): string;
|
|
18
18
|
/**
|
|
19
19
|
* @returns {Promise<Network>} Network of the wallet provided during initialization
|
|
20
20
|
*/
|
|
@@ -8326,19 +8326,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
8326
8326
|
}[]], import('viem').Chain | undefined, import('viem').Account | undefined, chainOverride, accountOverride>>;
|
|
8327
8327
|
};
|
|
8328
8328
|
createEventFilter: {
|
|
8329
|
-
|
|
8330
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8331
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8332
|
-
} | undefined, strict extends boolean | undefined = undefined>(args: {
|
|
8333
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8334
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8335
|
-
} | ({
|
|
8336
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8337
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8338
|
-
} extends infer T ? T extends {
|
|
8339
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8340
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8341
|
-
} ? T extends args ? Readonly<args> : never : never : never), options?: ({
|
|
8329
|
+
EIP712DomainChanged: <const args extends readonly [] | undefined, strict extends boolean | undefined = undefined>(options?: ({
|
|
8342
8330
|
fromBlock?: bigint | import('viem').BlockTag | undefined;
|
|
8343
8331
|
toBlock?: bigint | import('viem').BlockTag | undefined;
|
|
8344
8332
|
} & {
|
|
@@ -8647,8 +8635,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
8647
8635
|
}];
|
|
8648
8636
|
readonly stateMutability: "view";
|
|
8649
8637
|
readonly type: "function";
|
|
8650
|
-
}], "
|
|
8651
|
-
|
|
8638
|
+
}], "EIP712DomainChanged", args, strict>>;
|
|
8639
|
+
Initiated: <const args extends {
|
|
8652
8640
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8653
8641
|
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8654
8642
|
} | undefined, strict extends boolean | undefined = undefined>(args: {
|
|
@@ -8969,15 +8957,19 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
8969
8957
|
}];
|
|
8970
8958
|
readonly stateMutability: "view";
|
|
8971
8959
|
readonly type: "function";
|
|
8972
|
-
}], "
|
|
8973
|
-
|
|
8960
|
+
}], "Initiated", args, strict>>;
|
|
8961
|
+
Redeemed: <const args extends {
|
|
8974
8962
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8963
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8975
8964
|
} | undefined, strict extends boolean | undefined = undefined>(args: {
|
|
8976
8965
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8966
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8977
8967
|
} | ({
|
|
8978
8968
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8969
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8979
8970
|
} extends infer T ? T extends {
|
|
8980
8971
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8972
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
8981
8973
|
} ? T extends args ? Readonly<args> : never : never : never), options?: ({
|
|
8982
8974
|
fromBlock?: bigint | import('viem').BlockTag | undefined;
|
|
8983
8975
|
toBlock?: bigint | import('viem').BlockTag | undefined;
|
|
@@ -9287,8 +9279,16 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
9287
9279
|
}];
|
|
9288
9280
|
readonly stateMutability: "view";
|
|
9289
9281
|
readonly type: "function";
|
|
9290
|
-
}], "
|
|
9291
|
-
|
|
9282
|
+
}], "Redeemed", args, strict>>;
|
|
9283
|
+
Refunded: <const args extends {
|
|
9284
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9285
|
+
} | undefined, strict extends boolean | undefined = undefined>(args: {
|
|
9286
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9287
|
+
} | ({
|
|
9288
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9289
|
+
} extends infer T ? T extends {
|
|
9290
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9291
|
+
} ? T extends args ? Readonly<args> : never : never : never), options?: ({
|
|
9292
9292
|
fromBlock?: bigint | import('viem').BlockTag | undefined;
|
|
9293
9293
|
toBlock?: bigint | import('viem').BlockTag | undefined;
|
|
9294
9294
|
} & {
|
|
@@ -9597,13 +9597,10 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
9597
9597
|
}];
|
|
9598
9598
|
readonly stateMutability: "view";
|
|
9599
9599
|
readonly type: "function";
|
|
9600
|
-
}], "
|
|
9600
|
+
}], "Refunded", args, strict>>;
|
|
9601
9601
|
};
|
|
9602
9602
|
getEvents: {
|
|
9603
|
-
|
|
9604
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9605
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9606
|
-
} | undefined, options?: {
|
|
9603
|
+
EIP712DomainChanged: (options?: {
|
|
9607
9604
|
blockHash?: `0x${string}` | undefined;
|
|
9608
9605
|
strict?: boolean | undefined;
|
|
9609
9606
|
fromBlock?: bigint | import('viem').BlockTag | undefined;
|
|
@@ -9912,8 +9909,8 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
9912
9909
|
}];
|
|
9913
9910
|
readonly stateMutability: "view";
|
|
9914
9911
|
readonly type: "function";
|
|
9915
|
-
}], "
|
|
9916
|
-
|
|
9912
|
+
}], "EIP712DomainChanged">>;
|
|
9913
|
+
Initiated: (args?: {
|
|
9917
9914
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9918
9915
|
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
9919
9916
|
} | undefined, options?: {
|
|
@@ -10225,9 +10222,10 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
10225
10222
|
}];
|
|
10226
10223
|
readonly stateMutability: "view";
|
|
10227
10224
|
readonly type: "function";
|
|
10228
|
-
}], "
|
|
10229
|
-
|
|
10225
|
+
}], "Initiated">>;
|
|
10226
|
+
Redeemed: (args?: {
|
|
10230
10227
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
10228
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
10231
10229
|
} | undefined, options?: {
|
|
10232
10230
|
blockHash?: `0x${string}` | undefined;
|
|
10233
10231
|
strict?: boolean | undefined;
|
|
@@ -10537,8 +10535,10 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
10537
10535
|
}];
|
|
10538
10536
|
readonly stateMutability: "view";
|
|
10539
10537
|
readonly type: "function";
|
|
10540
|
-
}], "
|
|
10541
|
-
|
|
10538
|
+
}], "Redeemed">>;
|
|
10539
|
+
Refunded: (args?: {
|
|
10540
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
10541
|
+
} | undefined, options?: {
|
|
10542
10542
|
blockHash?: `0x${string}` | undefined;
|
|
10543
10543
|
strict?: boolean | undefined;
|
|
10544
10544
|
fromBlock?: bigint | import('viem').BlockTag | undefined;
|
|
@@ -10847,13 +10847,10 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
10847
10847
|
}];
|
|
10848
10848
|
readonly stateMutability: "view";
|
|
10849
10849
|
readonly type: "function";
|
|
10850
|
-
}], "
|
|
10850
|
+
}], "Refunded">>;
|
|
10851
10851
|
};
|
|
10852
10852
|
watchEvent: {
|
|
10853
|
-
|
|
10854
|
-
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
10855
|
-
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
10856
|
-
}, options: {
|
|
10853
|
+
EIP712DomainChanged: (options: {
|
|
10857
10854
|
batch?: boolean | undefined | undefined;
|
|
10858
10855
|
pollingInterval?: number | undefined | undefined;
|
|
10859
10856
|
strict?: boolean | undefined;
|
|
@@ -11163,10 +11160,10 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
11163
11160
|
}];
|
|
11164
11161
|
readonly stateMutability: "view";
|
|
11165
11162
|
readonly type: "function";
|
|
11166
|
-
}], "
|
|
11163
|
+
}], "EIP712DomainChanged", undefined>;
|
|
11167
11164
|
poll?: true | undefined | undefined;
|
|
11168
11165
|
}) => import('viem').WatchContractEventReturnType;
|
|
11169
|
-
|
|
11166
|
+
Initiated: (args: {
|
|
11170
11167
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
11171
11168
|
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
11172
11169
|
}, options: {
|
|
@@ -11479,11 +11476,12 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
11479
11476
|
}];
|
|
11480
11477
|
readonly stateMutability: "view";
|
|
11481
11478
|
readonly type: "function";
|
|
11482
|
-
}], "
|
|
11479
|
+
}], "Initiated", undefined>;
|
|
11483
11480
|
poll?: true | undefined | undefined;
|
|
11484
11481
|
}) => import('viem').WatchContractEventReturnType;
|
|
11485
|
-
|
|
11482
|
+
Redeemed: (args: {
|
|
11486
11483
|
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
11484
|
+
secretHash?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
11487
11485
|
}, options: {
|
|
11488
11486
|
batch?: boolean | undefined | undefined;
|
|
11489
11487
|
pollingInterval?: number | undefined | undefined;
|
|
@@ -11794,10 +11792,12 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
11794
11792
|
}];
|
|
11795
11793
|
readonly stateMutability: "view";
|
|
11796
11794
|
readonly type: "function";
|
|
11797
|
-
}], "
|
|
11795
|
+
}], "Redeemed", undefined>;
|
|
11798
11796
|
poll?: true | undefined | undefined;
|
|
11799
11797
|
}) => import('viem').WatchContractEventReturnType;
|
|
11800
|
-
|
|
11798
|
+
Refunded: (args: {
|
|
11799
|
+
orderID?: `0x${string}` | `0x${string}`[] | null | undefined;
|
|
11800
|
+
}, options: {
|
|
11801
11801
|
batch?: boolean | undefined | undefined;
|
|
11802
11802
|
pollingInterval?: number | undefined | undefined;
|
|
11803
11803
|
strict?: boolean | undefined;
|
|
@@ -12107,7 +12107,7 @@ export declare class EVMHTLC implements IHTLCWallet {
|
|
|
12107
12107
|
}];
|
|
12108
12108
|
readonly stateMutability: "view";
|
|
12109
12109
|
readonly type: "function";
|
|
12110
|
-
}], "
|
|
12110
|
+
}], "Refunded", undefined>;
|
|
12111
12111
|
poll?: true | undefined | undefined;
|
|
12112
12112
|
}) => import('viem').WatchContractEventReturnType;
|
|
12113
12113
|
};
|
|
@@ -12,8 +12,8 @@ export declare class EvmRelay implements IEVMHTLC {
|
|
|
12
12
|
initiate(order: Order | EvmOrderResponse): AsyncResult<string, string>;
|
|
13
13
|
private _initiateOnNativeHTLC;
|
|
14
14
|
private _initiateOnErc20HTLC;
|
|
15
|
-
executeApprovalTransaction(order: EvmOrderResponse): AsyncResult<string, string>;
|
|
16
15
|
private initiateWithCreateOrderResponse;
|
|
16
|
+
private executeApprovalTransaction;
|
|
17
17
|
redeem(order: Order, secret: string): AsyncResult<string, string>;
|
|
18
18
|
refund(): AsyncResult<string, string>;
|
|
19
19
|
}
|
|
@@ -8,11 +8,11 @@ export declare class Executor {
|
|
|
8
8
|
private htlcs;
|
|
9
9
|
private events;
|
|
10
10
|
private isBackgroundServiceRunning;
|
|
11
|
-
private
|
|
11
|
+
private stopBackgroundExecution;
|
|
12
12
|
constructor(digestKey: DigestKey, htlcs: GardenHTLCModules, orderbook: IOrderbook, auth: IAuth, api: Api, events: GardenEventEmitter);
|
|
13
13
|
private getAddressesFromHTLCs;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
start(interval: number | undefined, redeemServiceEnabled: boolean): void;
|
|
15
|
+
stop(): void;
|
|
16
16
|
execute(interval?: number): Promise<() => void>;
|
|
17
17
|
private processOrderActions;
|
|
18
18
|
private handleRedeemAction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISecretManager } from './../secretManager/secretManager.types';
|
|
2
2
|
import { IGardenJS, SwapParams, GardenConfigWithHTLCs, GardenConfigWithWallets, GardenEvents } from './garden.types';
|
|
3
|
-
import { CreateOrderRequest,
|
|
3
|
+
import { BlockchainType, CreateOrderRequest, CreateOrderResponse, Orderbook } from '@gardenfi/orderbook';
|
|
4
4
|
import { IAuth, DigestKey, AsyncResult } from '@gardenfi/utils';
|
|
5
5
|
import { IQuote } from '../quote/quote.types';
|
|
6
6
|
import { Executor } from './executor/executor';
|
|
@@ -16,7 +16,7 @@ export declare class Garden extends Orderbook implements IGardenJS {
|
|
|
16
16
|
/**
|
|
17
17
|
* If true, the redeem service will be enabled.
|
|
18
18
|
*/
|
|
19
|
-
private
|
|
19
|
+
private _redeemServiceEnabled;
|
|
20
20
|
private _secretManager;
|
|
21
21
|
private _digestKey;
|
|
22
22
|
private executeInterval;
|
|
@@ -39,21 +39,18 @@ export declare class Garden extends Orderbook implements IGardenJS {
|
|
|
39
39
|
readonly bitcoin: import('../bitcoin/bitcoinhtlc.types').IBitcoinHTLC | undefined;
|
|
40
40
|
};
|
|
41
41
|
get quote(): IQuote;
|
|
42
|
-
get orderbook(): IOrderbook;
|
|
43
42
|
get secretManager(): ISecretManager;
|
|
44
43
|
get auth(): IAuth;
|
|
45
44
|
get digestKey(): DigestKey | undefined;
|
|
46
45
|
get executor(): Executor | undefined;
|
|
46
|
+
get redeemServiceEnabled(): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Creates an order for a swap operation and initiates the HTLC on the source chain.
|
|
49
49
|
* @param params SwapParams
|
|
50
50
|
* @returns AsyncResult<Order, string>
|
|
51
51
|
*/
|
|
52
52
|
createSwap(params: SwapParams): AsyncResult<string, string>;
|
|
53
|
-
|
|
54
|
-
* Create an order
|
|
55
|
-
*/
|
|
56
|
-
createOrder(arg: CreateOrderRequest | SwapParams, auth?: IAuth): AsyncResult<any, string>;
|
|
53
|
+
createOrder<T extends BlockchainType>(arg: CreateOrderRequest | SwapParams): AsyncResult<CreateOrderResponse<T>, string>;
|
|
57
54
|
private validateAndFillParams;
|
|
58
55
|
on<K extends keyof GardenEvents>(event: K, listener: GardenEvents[K]): this;
|
|
59
56
|
off<K extends keyof GardenEvents>(event: K, listener: GardenEvents[K]): this;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AffiliateFee,
|
|
2
|
-
import { OrderAction, OrderStatus } from '../orderStatus/orderStatus';
|
|
1
|
+
import { AffiliateFee, AssetLike, BitcoinOrderResponse, BlockchainType, EvmOrderResponse, IOrderbook, Order, OrderAction, OrderStatus, SolanaOrderResponse, StarknetOrderResponse, SuiOrderResponse } from '@gardenfi/orderbook';
|
|
3
2
|
import { ApiKey, AsyncResult, IAuth, Network, DigestKey } from '@gardenfi/utils';
|
|
4
3
|
import { ISecretManager } from '../secretManager/secretManager.types';
|
|
5
4
|
import { IQuote } from '../quote/quote.types';
|
|
@@ -20,11 +19,11 @@ export type SwapParams = {
|
|
|
20
19
|
/**
|
|
21
20
|
* Asset to be sent.
|
|
22
21
|
*/
|
|
23
|
-
fromAsset:
|
|
22
|
+
fromAsset: AssetLike;
|
|
24
23
|
/**
|
|
25
24
|
* Asset to be received.
|
|
26
25
|
*/
|
|
27
|
-
toAsset:
|
|
26
|
+
toAsset: AssetLike;
|
|
28
27
|
/**
|
|
29
28
|
* Amount in lowest denomination of the sendAsset.
|
|
30
29
|
*/
|
|
@@ -80,11 +79,6 @@ export interface IGardenJS extends IOrderbook {
|
|
|
80
79
|
* @readonly
|
|
81
80
|
*/
|
|
82
81
|
get htlcs(): GardenHTLCModules;
|
|
83
|
-
/**
|
|
84
|
-
* The orderbook.
|
|
85
|
-
* @readonly
|
|
86
|
-
*/
|
|
87
|
-
get orderbook(): IOrderbook;
|
|
88
82
|
/**
|
|
89
83
|
* The secret manager.
|
|
90
84
|
* @readonly
|
|
@@ -100,6 +94,11 @@ export interface IGardenJS extends IOrderbook {
|
|
|
100
94
|
* @readonly
|
|
101
95
|
*/
|
|
102
96
|
get digestKey(): DigestKey | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The redeem service enabled.
|
|
99
|
+
* @readonly
|
|
100
|
+
*/
|
|
101
|
+
get redeemServiceEnabled(): boolean;
|
|
103
102
|
/**
|
|
104
103
|
* The events.
|
|
105
104
|
*/
|
|
@@ -155,3 +154,10 @@ export type GardenConfigWithWallets = GardenCoreConfig & {
|
|
|
155
154
|
export type GardenConfigWithHTLCs = GardenCoreConfig & {
|
|
156
155
|
htlc?: GardenHTLCModules;
|
|
157
156
|
};
|
|
157
|
+
export type ResponseTypeMap = {
|
|
158
|
+
[BlockchainType.evm]: EvmOrderResponse;
|
|
159
|
+
[BlockchainType.bitcoin]: BitcoinOrderResponse;
|
|
160
|
+
[BlockchainType.starknet]: StarknetOrderResponse;
|
|
161
|
+
[BlockchainType.solana]: SolanaOrderResponse;
|
|
162
|
+
[BlockchainType.sui]: SuiOrderResponse;
|
|
163
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Err, Ok, Request as UtilsRequest } from '@gardenfi/utils';
|
|
2
2
|
import { IQuote, QuoteParamsForAssets, QuoteResponse, Strategies } from './quote.types';
|
|
3
|
-
import {
|
|
3
|
+
import { AssetLike } from '@gardenfi/orderbook';
|
|
4
4
|
|
|
5
5
|
export declare class Quote implements IQuote {
|
|
6
6
|
private quoteUrl;
|
|
7
7
|
constructor(quoteUrl: string);
|
|
8
8
|
getQuoteFromAssets({ fromAsset, toAsset, amount, isExactOut, options, }: QuoteParamsForAssets): Promise<Err<string> | Ok<QuoteResponse[]>>;
|
|
9
|
-
getQuote(from:
|
|
9
|
+
getQuote(from: AssetLike, to: AssetLike, amount: number, isExactOut?: boolean, options?: {
|
|
10
10
|
affiliateFee?: number;
|
|
11
11
|
request?: UtilsRequest;
|
|
12
12
|
}): Promise<Err<string> | Ok<QuoteResponse[]>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Asset, Chain, ChainAsset } from '@gardenfi/orderbook';
|
|
1
|
+
import { Asset, AssetLike, Chain, ChainAsset } from '@gardenfi/orderbook';
|
|
2
2
|
import { APIResponse, AsyncResult, Request } from '@gardenfi/utils';
|
|
3
3
|
|
|
4
4
|
export interface IQuote {
|
|
@@ -24,7 +24,7 @@ export interface IQuote {
|
|
|
24
24
|
* @param isExactOut - Whether the amount is exact out
|
|
25
25
|
* @param options { affiliateFee?: number; request?: Request } - The options for the quote request, affiliate fee in bps and request object
|
|
26
26
|
*/
|
|
27
|
-
getQuote(from:
|
|
27
|
+
getQuote(from: AssetLike, to: AssetLike, amount: number, isExactOut: boolean, options?: QuoteOptions): AsyncResult<QuoteResponse[], string>;
|
|
28
28
|
/**
|
|
29
29
|
* Get the strategies available for quoting
|
|
30
30
|
* @returns {Strategies} The strategies available
|