@gardenfi/core 0.2.0-beta.46 → 0.2.0-beta.48

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.
@@ -1,13 +1,14 @@
1
1
  export { Garden } from './lib/garden/garden';
2
- export type { IGardenJS, SwapParams, TimeLocks, OrderActions, GardenEvents, IOrderExecutorCache, OrderCacheValue, EventCallback, } from './lib/garden/garden.types';
2
+ export type { IGardenJS, SwapParams, GardenEvents, IOrderExecutorCache, OrderCacheValue, EventCallback, } from './lib/garden/garden.types';
3
+ export { OrderActions, TimeLocks } from './lib/garden/garden.types';
3
4
  export { BlockNumberFetcher } from './lib/garden/blockNumber';
4
5
  export type { IBlockNumberFetcher, Network } from './lib/garden/blockNumber';
5
6
  export { EvmRelay } from './lib/evm/relay/evmRelay';
6
7
  export type { IEVMRelay } from './lib/evm/relay/evmRelay.types';
7
- export type { OrderStatus, SwapStatus } from './lib/status';
8
+ export { OrderStatus, SwapStatus } from './lib/status';
8
9
  export { parseAction, ParseOrderStatus, ParseSwapStatus, } from './lib/garden/orderStatusParser';
9
10
  export { SecretManager } from './lib/secretManager/secretManager';
10
11
  export type { ISecretManager, Secret, } from './lib/secretManager/secretManager.types';
11
12
  export { Quote } from './lib/quote/quote';
12
13
  export type { IQuote, QuoteResponse } from './lib/quote/quote.types';
13
- export { switchOrAddNetwork } from './lib/utils';
14
+ export { switchOrAddNetwork, constructOrderPair } from './lib/utils';
@@ -1,5 +1,5 @@
1
1
  import { AsyncResult } from '@catalogfi/utils';
2
- import { IQuote, QuoteResponse } from './quote.types';
2
+ import { IQuote, QuoteResponse, Strategies } from './quote.types';
3
3
  import { CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
4
4
 
5
5
  export declare class Quote implements IQuote {
@@ -7,4 +7,5 @@ export declare class Quote implements IQuote {
7
7
  constructor(quoteUrl: string);
8
8
  getQuote(orderpair: string, amount: number, isExactOut?: boolean): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<QuoteResponse, never>>;
9
9
  getAttestedQuote(order: CreateOrderReqWithStrategyId): AsyncResult<CreateOrderRequestWithAdditionalData, string>;
10
+ getStrategies(): Promise<import('@catalogfi/utils').Result<never, string> | import('@catalogfi/utils').Result<Strategies, never>>;
10
11
  }
@@ -1,5 +1,6 @@
1
1
  import { AsyncResult } from '@catalogfi/utils';
2
- import { CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
2
+ import { Chain, CreateOrderRequestWithAdditionalData, CreateOrderReqWithStrategyId } from '@gardenfi/orderbook';
3
+ import { APIResponse } from '@gardenfi/utils';
3
4
 
4
5
  export interface IQuote {
5
6
  /**
@@ -19,6 +20,11 @@ export interface IQuote {
19
20
  * @returns {string} The attestation signature
20
21
  */
21
22
  getAttestedQuote(order: CreateOrderReqWithStrategyId): AsyncResult<CreateOrderRequestWithAdditionalData, string>;
23
+ /**
24
+ * Get the strategies available for quoting
25
+ * @returns {Strategies} The strategies available
26
+ */
27
+ getStrategies(): AsyncResult<Strategies, string>;
22
28
  }
23
29
  export type QuoteResponse = {
24
30
  quotes: {
@@ -27,3 +33,27 @@ export type QuoteResponse = {
27
33
  input_token_price: number;
28
34
  output_token_price: number;
29
35
  };
36
+ export type Strategies = Record<string, {
37
+ id: string;
38
+ minAmount: string;
39
+ maxAmount: string;
40
+ }>;
41
+ export type StrategiesResponse = APIResponse<{
42
+ [strategy: string]: {
43
+ id: string;
44
+ min_amount: string;
45
+ max_amount: string;
46
+ source_chain: Chain;
47
+ dest_chain: Chain;
48
+ source_asset: {
49
+ asset: string;
50
+ token_id: string;
51
+ decimals: number;
52
+ };
53
+ dest_asset: {
54
+ asset: string;
55
+ token_id: string;
56
+ decimals: number;
57
+ };
58
+ };
59
+ }>;
@@ -33,3 +33,4 @@ export declare const switchOrAddNetwork: (chain: Chain, walletClient: WalletClie
33
33
  message: string;
34
34
  walletClient: WalletClient;
35
35
  }, string>;
36
+ export declare const constructOrderPair: (sourceChain: Chain, sourceAsset: string, destChain: Chain, destAsset: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "0.2.0-beta.46",
3
+ "version": "0.2.0-beta.48",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"