@avail-project/ca-common 2.2.1 → 3.0.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 (92) hide show
  1. package/dist/cjs/index.js +10593 -20
  2. package/dist/esm/index.mjs +10603 -0
  3. package/dist/types/index.d.ts +2608 -13
  4. package/package.json +41 -37
  5. package/dist/cjs/_polyfill.js +0 -147
  6. package/dist/cjs/balances/ub-api.js +0 -25
  7. package/dist/cjs/cosmos/index.js +0 -31
  8. package/dist/cjs/data/chaindata.js +0 -788
  9. package/dist/cjs/data/chainid.js +0 -93
  10. package/dist/cjs/data/currency.js +0 -78
  11. package/dist/cjs/data/index.js +0 -7
  12. package/dist/cjs/data/utils.js +0 -44
  13. package/dist/cjs/evmabi/erc20.abi.js +0 -349
  14. package/dist/cjs/evmabi/fibrousrouter.abi.js +0 -41
  15. package/dist/cjs/evmabi/index.js +0 -7
  16. package/dist/cjs/evmabi/vault.abi.js +0 -1021
  17. package/dist/cjs/evmabi/yakaggregator.abi.js +0 -275
  18. package/dist/cjs/permitutils/index.js +0 -186
  19. package/dist/cjs/proto/client.js +0 -48
  20. package/dist/cjs/proto/definition.js +0 -4131
  21. package/dist/cjs/proto/grpc.js +0 -298
  22. package/dist/cjs/rff/rff.js +0 -42
  23. package/dist/cjs/types/binarytypes.js +0 -2
  24. package/dist/cjs/types/index.js +0 -5
  25. package/dist/cjs/types/msgpack-axios.js +0 -22
  26. package/dist/cjs/vaultcontracts/index.js +0 -4
  27. package/dist/cjs/vaultcontracts/vaultcontracts.js +0 -222
  28. package/dist/cjs/xcs/autochoice.js +0 -570
  29. package/dist/cjs/xcs/bebop-agg.js +0 -156
  30. package/dist/cjs/xcs/fibrous-agg.js +0 -155
  31. package/dist/cjs/xcs/iface.js +0 -13
  32. package/dist/cjs/xcs/index.js +0 -8
  33. package/dist/cjs/xcs/lifi-agg.js +0 -155
  34. package/dist/esm/_polyfill.js +0 -143
  35. package/dist/esm/balances/ub-api.js +0 -21
  36. package/dist/esm/cosmos/index.js +0 -26
  37. package/dist/esm/data/chaindata.js +0 -785
  38. package/dist/esm/data/chainid.js +0 -87
  39. package/dist/esm/data/currency.js +0 -73
  40. package/dist/esm/data/index.js +0 -4
  41. package/dist/esm/data/utils.js +0 -34
  42. package/dist/esm/evmabi/erc20.abi.js +0 -346
  43. package/dist/esm/evmabi/fibrousrouter.abi.js +0 -38
  44. package/dist/esm/evmabi/index.js +0 -4
  45. package/dist/esm/evmabi/vault.abi.js +0 -1018
  46. package/dist/esm/evmabi/yakaggregator.abi.js +0 -272
  47. package/dist/esm/index.js +0 -13
  48. package/dist/esm/permitutils/index.js +0 -181
  49. package/dist/esm/proto/client.js +0 -11
  50. package/dist/esm/proto/definition.js +0 -4122
  51. package/dist/esm/proto/grpc.js +0 -292
  52. package/dist/esm/rff/rff.js +0 -38
  53. package/dist/esm/types/binarytypes.js +0 -1
  54. package/dist/esm/types/index.js +0 -2
  55. package/dist/esm/types/msgpack-axios.js +0 -18
  56. package/dist/esm/vaultcontracts/index.js +0 -1
  57. package/dist/esm/vaultcontracts/vaultcontracts.js +0 -218
  58. package/dist/esm/xcs/autochoice.js +0 -554
  59. package/dist/esm/xcs/bebop-agg.js +0 -151
  60. package/dist/esm/xcs/fibrous-agg.js +0 -150
  61. package/dist/esm/xcs/iface.js +0 -10
  62. package/dist/esm/xcs/index.js +0 -5
  63. package/dist/esm/xcs/lifi-agg.js +0 -150
  64. package/dist/types/_polyfill.d.ts +0 -1
  65. package/dist/types/balances/ub-api.d.ts +0 -14
  66. package/dist/types/cosmos/index.d.ts +0 -6
  67. package/dist/types/data/chaindata.d.ts +0 -20
  68. package/dist/types/data/chainid.d.ts +0 -31
  69. package/dist/types/data/currency.d.ts +0 -30
  70. package/dist/types/data/index.d.ts +0 -4
  71. package/dist/types/data/utils.d.ts +0 -10
  72. package/dist/types/evmabi/erc20.abi.d.ts +0 -264
  73. package/dist/types/evmabi/fibrousrouter.abi.d.ts +0 -77
  74. package/dist/types/evmabi/index.d.ts +0 -4
  75. package/dist/types/evmabi/vault.abi.d.ts +0 -785
  76. package/dist/types/evmabi/yakaggregator.abi.d.ts +0 -298
  77. package/dist/types/permitutils/index.d.ts +0 -13
  78. package/dist/types/proto/client.d.ts +0 -2
  79. package/dist/types/proto/definition.d.ts +0 -382
  80. package/dist/types/proto/grpc.d.ts +0 -75
  81. package/dist/types/rff/rff.d.ts +0 -9
  82. package/dist/types/types/binarytypes.d.ts +0 -1
  83. package/dist/types/types/index.d.ts +0 -2
  84. package/dist/types/types/msgpack-axios.d.ts +0 -1
  85. package/dist/types/vaultcontracts/index.d.ts +0 -22
  86. package/dist/types/vaultcontracts/vaultcontracts.d.ts +0 -8
  87. package/dist/types/xcs/autochoice.d.ts +0 -105
  88. package/dist/types/xcs/bebop-agg.d.ts +0 -104
  89. package/dist/types/xcs/fibrous-agg.d.ts +0 -56
  90. package/dist/types/xcs/iface.d.ts +0 -69
  91. package/dist/types/xcs/index.d.ts +0 -5
  92. package/dist/types/xcs/lifi-agg.d.ts +0 -39
@@ -1,75 +0,0 @@
1
- import { grpc } from "@improbable-eng/grpc-web";
2
- import Long from "long";
3
- import { QueryAllRequestForFundsRequest, QueryAllRequestForFundsResponse, QueryAllSettlementRequest, QueryAllSettlementResponse, QueryAllSolverDataRequest, QueryAllSolverDataResponse, QueryGetPriceOracleDataRequest, QueryGetPriceOracleDataResponse, QueryGetProtocolFeesRequest, QueryGetProtocolFeesResponse, QueryGetRequestForFundsRequest, QueryGetRequestForFundsResponse, QueryGetSettlementRequest, QueryGetSettlementResponse, QueryGetSolverDataRequest, QueryGetSolverDataResponse, QueryRequestForFundsByAddressRequest } from "./definition";
4
- export declare const protobufPackage = "xarchain.chainabstraction";
5
- export interface Query {
6
- RequestForFunds(request: DeepPartial<QueryGetRequestForFundsRequest>, metadata?: grpc.Metadata): Promise<QueryGetRequestForFundsResponse>;
7
- RequestForFundsAll(request: DeepPartial<QueryAllRequestForFundsRequest>, metadata?: grpc.Metadata): Promise<QueryAllRequestForFundsResponse>;
8
- RequestForFundsByAddress(request: DeepPartial<QueryRequestForFundsByAddressRequest>, metadata?: grpc.Metadata): Promise<QueryAllRequestForFundsResponse>;
9
- SolverData(request: DeepPartial<QueryGetSolverDataRequest>, metadata?: grpc.Metadata): Promise<QueryGetSolverDataResponse>;
10
- SolverDataAll(request: DeepPartial<QueryAllSolverDataRequest>, metadata?: grpc.Metadata): Promise<QueryAllSolverDataResponse>;
11
- Settlement(request: DeepPartial<QueryGetSettlementRequest>, metadata?: grpc.Metadata): Promise<QueryGetSettlementResponse>;
12
- SettlementAll(request: DeepPartial<QueryAllSettlementRequest>, metadata?: grpc.Metadata): Promise<QueryAllSettlementResponse>;
13
- ProtocolFees(request: DeepPartial<QueryGetProtocolFeesRequest>, metadata?: grpc.Metadata): Promise<QueryGetProtocolFeesResponse>;
14
- PriceOracleData(request: DeepPartial<QueryGetPriceOracleDataRequest>, metadata?: grpc.Metadata): Promise<QueryGetPriceOracleDataResponse>;
15
- }
16
- export declare class QueryClientImpl implements Query {
17
- private readonly rpc;
18
- constructor(rpc: Rpc);
19
- RequestForFunds(request: DeepPartial<QueryGetRequestForFundsRequest>, metadata?: grpc.Metadata): Promise<QueryGetRequestForFundsResponse>;
20
- RequestForFundsAll(request: DeepPartial<QueryAllRequestForFundsRequest>, metadata?: grpc.Metadata): Promise<QueryAllRequestForFundsResponse>;
21
- RequestForFundsByAddress(request: DeepPartial<QueryRequestForFundsByAddressRequest>, metadata?: grpc.Metadata): Promise<QueryAllRequestForFundsResponse>;
22
- SolverData(request: DeepPartial<QueryGetSolverDataRequest>, metadata?: grpc.Metadata): Promise<QueryGetSolverDataResponse>;
23
- SolverDataAll(request: DeepPartial<QueryAllSolverDataRequest>, metadata?: grpc.Metadata): Promise<QueryAllSolverDataResponse>;
24
- Settlement(request: DeepPartial<QueryGetSettlementRequest>, metadata?: grpc.Metadata): Promise<QueryGetSettlementResponse>;
25
- SettlementAll(request: DeepPartial<QueryAllSettlementRequest>, metadata?: grpc.Metadata): Promise<QueryAllSettlementResponse>;
26
- ProtocolFees(request: DeepPartial<QueryGetProtocolFeesRequest>, metadata?: grpc.Metadata): Promise<QueryGetProtocolFeesResponse>;
27
- PriceOracleData(request: DeepPartial<QueryGetPriceOracleDataRequest>, metadata?: grpc.Metadata): Promise<QueryGetPriceOracleDataResponse>;
28
- }
29
- export declare const QueryDesc: {
30
- serviceName: string;
31
- };
32
- export declare const QueryRequestForFundsDesc: UnaryMethodDefinitionish;
33
- export declare const QueryRequestForFundsAllDesc: UnaryMethodDefinitionish;
34
- export declare const QueryRequestForFundsByAddressDesc: UnaryMethodDefinitionish;
35
- export declare const QuerySolverDataDesc: UnaryMethodDefinitionish;
36
- export declare const QuerySolverDataAllDesc: UnaryMethodDefinitionish;
37
- export declare const QuerySettlementDesc: UnaryMethodDefinitionish;
38
- export declare const QuerySettlementAllDesc: UnaryMethodDefinitionish;
39
- export declare const QueryProtocolFeesDesc: UnaryMethodDefinitionish;
40
- export declare const QueryPriceOracleDataDesc: UnaryMethodDefinitionish;
41
- interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition<any, any> {
42
- requestStream: any;
43
- responseStream: any;
44
- }
45
- type UnaryMethodDefinitionish = UnaryMethodDefinitionishR;
46
- interface Rpc {
47
- unary<T extends UnaryMethodDefinitionish>(methodDesc: T, request: any, metadata: grpc.Metadata | undefined): Promise<any>;
48
- }
49
- export declare class GrpcWebImpl {
50
- private host;
51
- private options;
52
- constructor(host: string, options: {
53
- transport?: grpc.TransportFactory;
54
- debug?: boolean;
55
- metadata?: grpc.Metadata;
56
- upStreamRetryCodes?: number[];
57
- });
58
- unary<T extends UnaryMethodDefinitionish>(methodDesc: T, _request: any, metadata: grpc.Metadata | undefined): Promise<any>;
59
- }
60
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
61
- export type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
62
- $case: string;
63
- value: unknown;
64
- } ? {
65
- $case: T["$case"];
66
- value?: DeepPartial<T["value"]>;
67
- } : T extends {} ? {
68
- [K in keyof T]?: DeepPartial<T[K]>;
69
- } : Partial<T>;
70
- export declare class GrpcWebError extends globalThis.Error {
71
- code: grpc.Code;
72
- metadata: grpc.Metadata;
73
- constructor(message: string, code: grpc.Code, metadata: grpc.Metadata);
74
- }
75
- export {};
@@ -1,9 +0,0 @@
1
- import { RequestForFunds } from "../proto/definition";
2
- import { type EVMRFF } from "../vaultcontracts";
3
- export declare class OmniversalRFF {
4
- readonly protobufRFF: RequestForFunds;
5
- private evmRFF;
6
- constructor(protobufRFF: RequestForFunds);
7
- asEVMRFF(): EVMRFF;
8
- asProtobufRFF(): RequestForFunds;
9
- }
@@ -1 +0,0 @@
1
- export type Bytes = Buffer | Uint8Array;
@@ -1,2 +0,0 @@
1
- export * from './binarytypes';
2
- export * from './msgpack-axios';
@@ -1 +0,0 @@
1
- export declare const msgpackableAxios: import("axios").AxiosInstance;
@@ -1,22 +0,0 @@
1
- export type EVMRFF = {
2
- sources: readonly {
3
- universe: number;
4
- chainID: bigint;
5
- contractAddress: `0x${string}`;
6
- value: bigint;
7
- }[];
8
- destinationUniverse: number;
9
- destinationChainID: bigint;
10
- recipientAddress: `0x${string}`;
11
- destinations: readonly {
12
- contractAddress: `0x${string}`;
13
- value: bigint;
14
- }[];
15
- nonce: bigint;
16
- expiry: bigint;
17
- parties: readonly {
18
- universe: number;
19
- address_: `0x${string}`;
20
- }[];
21
- };
22
- export * from "./vaultcontracts";
@@ -1,8 +0,0 @@
1
- import { ChainIDKeyedMap } from "../data";
2
- export declare enum Environment {
3
- FOLLY = 0,// Dev with test-net tokens
4
- CERISE = 1,// Dev with main-net tokens
5
- CORAL = 2,// Test-net with main-net tokens
6
- JADE = 3
7
- }
8
- export declare function getVaultContractMap(environment: Environment): ChainIDKeyedMap<Buffer<ArrayBufferLike>>;
@@ -1,105 +0,0 @@
1
- import Decimal from "decimal.js";
2
- import { Aggregator, Quote, QuoteRequestExactInput, QuoteRequestExactOutput, QuoteResponse } from "./iface";
3
- import { Currency, CurrencyID, OmniversalChainID } from "../data";
4
- import { Bytes } from "../types";
5
- import { Holding } from "./iface";
6
- export type HoldingWithRecipient = Holding & {
7
- recipient: Bytes;
8
- receiverAddress?: Bytes;
9
- };
10
- export type HoldingWithSwapAddresses = Holding & {
11
- takerAddress: Bytes;
12
- receiverAddress: Bytes;
13
- };
14
- export declare class AutoSelectionError extends Error {
15
- }
16
- declare const enum AggregateAggregatorsMode {
17
- MaximizeOutput = 0,
18
- MinimizeInput = 1
19
- }
20
- export declare function aggregateAggregators(requests: (QuoteRequestExactInput | QuoteRequestExactOutput)[], aggregators: Aggregator[], mode: AggregateAggregatorsMode): Promise<{
21
- quote: Quote | null;
22
- aggregator: Aggregator;
23
- }[]>;
24
- /**
25
- * @deprecated Use {@link autoSelectSources} (object args; per-holding `takerAddress` and
26
- * `receiverAddress` on each `HoldingWithSwapAddresses`).
27
- */
28
- export declare function autoSelectSourcesV2(userAddress: Bytes, holdings: Holding[], outputRequired: Decimal, aggregators: Aggregator[], commonCurrencyID?: CurrencyID): Promise<{
29
- quoteResponses: QuoteResponse[];
30
- usedCOTs: {
31
- originalHolding: Holding;
32
- amountUsed: Decimal;
33
- idx: number;
34
- cur: Currency;
35
- }[];
36
- }>;
37
- /**
38
- * @deprecated Use {@link autoSelectSources} (object args; per-holding `takerAddress` and
39
- * `receiverAddress` on each `HoldingWithSwapAddresses`).
40
- */
41
- export declare function autoSelectSourcesV2ByRecipient(holdings: HoldingWithRecipient[], outputRequired: Decimal, aggregators: Aggregator[], commonCurrencyID?: CurrencyID): Promise<{
42
- quoteResponses: QuoteResponse[];
43
- usedCOTs: {
44
- originalHolding: Holding;
45
- amountUsed: Decimal;
46
- idx: number;
47
- cur: Currency;
48
- }[];
49
- }>;
50
- /**
51
- * @deprecated Use {@link getDestinationExactOutSwap} (object args; explicit `takerAddress` and
52
- * `receiverAddress`, both required).
53
- */
54
- export declare function determineDestinationSwaps(userAddress: Bytes, requirement: Holding, aggregators: Aggregator[], commonCurrencyID?: CurrencyID, receiverAddress?: Bytes): Promise<QuoteResponse>;
55
- /**
56
- * @deprecated Use {@link liquidateSourceHoldings} (object args; per-holding `takerAddress`
57
- * and `receiverAddress` on each `HoldingWithSwapAddresses`).
58
- */
59
- export declare function liquidateInputHoldings(userAddress: Bytes, holdings: Holding[], aggregators: Aggregator[], commonCurrencyID?: CurrencyID, receiverAddress?: Bytes): Promise<QuoteResponse[]>;
60
- /**
61
- * @deprecated Use {@link liquidateSourceHoldings} (object args; per-holding `takerAddress`
62
- * and `receiverAddress` on each `HoldingWithSwapAddresses`).
63
- */
64
- export declare function liquidateInputHoldingsByRecipient(holdings: HoldingWithRecipient[], aggregators: Aggregator[], commonCurrencyID?: CurrencyID, receiverAddress?: Bytes): Promise<QuoteResponse[]>;
65
- /**
66
- * @deprecated Use {@link getDestinationExactInSwap} (object args; explicit `takerAddress`
67
- * and `receiverAddress`, both required).
68
- */
69
- export declare function destinationSwapWithExactIn(userAddress: Bytes, omniChainID: OmniversalChainID, inputAmount: bigint, outputToken: Bytes, aggregators: Aggregator[], inputCurrency?: CurrencyID, receiverAddress?: Bytes): Promise<QuoteResponse>;
70
- export declare function getDestinationExactOutSwap(args: {
71
- takerAddress: Bytes;
72
- receiverAddress: Bytes;
73
- requirement: Holding;
74
- aggregators: Aggregator[];
75
- commonCurrencyID?: CurrencyID;
76
- }): Promise<QuoteResponse>;
77
- export declare function getDestinationExactInSwap(args: {
78
- takerAddress: Bytes;
79
- receiverAddress: Bytes;
80
- chain: OmniversalChainID;
81
- inputAmount: bigint;
82
- outputToken: Bytes;
83
- aggregators: Aggregator[];
84
- inputCurrency?: CurrencyID;
85
- }): Promise<QuoteResponse>;
86
- export declare function liquidateSourceHoldings(args: {
87
- holdings: HoldingWithSwapAddresses[];
88
- aggregators: Aggregator[];
89
- commonCurrencyID?: CurrencyID;
90
- }): Promise<QuoteResponse[]>;
91
- export declare function autoSelectSources(args: {
92
- holdings: HoldingWithSwapAddresses[];
93
- outputRequired: Decimal;
94
- aggregators: Aggregator[];
95
- commonCurrencyID?: CurrencyID;
96
- }): Promise<{
97
- quoteResponses: QuoteResponse[];
98
- usedCOTs: {
99
- originalHolding: Holding;
100
- amountUsed: Decimal;
101
- idx: number;
102
- cur: Currency;
103
- }[];
104
- }>;
105
- export {};
@@ -1,104 +0,0 @@
1
- import { Hex } from "viem";
2
- import { Aggregator, Quote, QuoteRequestExactInput, QuoteRequestExactOutput } from "./iface";
3
- export type BebopCommonQuote = {
4
- type: string;
5
- status: string;
6
- quoteId: string;
7
- chainId: number;
8
- approvalType: string;
9
- nativeToken: string;
10
- taker: string;
11
- receiver: string;
12
- expiry: number;
13
- slippage: number;
14
- gasFee: {
15
- native: string;
16
- usd: number;
17
- };
18
- buyTokens: Record<Hex, {
19
- amount: string;
20
- decimals: number;
21
- priceUsd: number;
22
- symbol: string;
23
- minimumAmount: string;
24
- price: number;
25
- priceBeforeFee: number;
26
- amountBeforeFee: string;
27
- deltaFromExpected: number;
28
- }>;
29
- sellTokens: Record<Hex, {
30
- amount: string;
31
- decimals: number;
32
- priceUsd: number;
33
- symbol: string;
34
- price: number;
35
- priceBeforeFee: number;
36
- }>;
37
- settlementAddress: string;
38
- approvalTarget: Hex;
39
- requiredSignatures: Array<never>;
40
- priceImpact: number;
41
- warnings: Array<never>;
42
- tx: {
43
- from: Hex;
44
- to: Hex;
45
- value: Hex;
46
- data: Hex;
47
- gas: number;
48
- };
49
- };
50
- export type BebopPMMv3Quote = {
51
- type: "PMMv3";
52
- quote: BebopCommonQuote & {
53
- makers: Array<string>;
54
- toSign: {
55
- partner_id: number;
56
- expiry: number;
57
- taker_address: string;
58
- maker_address: string;
59
- maker_nonce: string;
60
- taker_token: string;
61
- maker_token: string;
62
- taker_amount: string;
63
- maker_amount: string;
64
- receiver: string;
65
- packed_commands: string;
66
- };
67
- onchainOrderType: string;
68
- tx: BebopCommonQuote["tx"] & {
69
- gasPrice: number;
70
- chainId: number;
71
- };
72
- };
73
- };
74
- export type BebopJAMv2Quote = {
75
- type: "JAMv2";
76
- quote: BebopCommonQuote & {
77
- hooksHash: string;
78
- toSign: {
79
- taker: string;
80
- receiver: string;
81
- expiry: number;
82
- exclusivityDeadline: number;
83
- nonce: string;
84
- executor: string;
85
- partnerInfo: string;
86
- sellTokens: Array<string>;
87
- buyTokens: Array<string>;
88
- sellAmounts: Array<string>;
89
- buyAmounts: Array<string>;
90
- hooksHash: string;
91
- };
92
- solver: string;
93
- };
94
- };
95
- export type BebopQuote = Quote & {
96
- originalResponse: BebopPMMv3Quote | BebopJAMv2Quote;
97
- };
98
- export declare class BebopAggregator implements Aggregator {
99
- private static readonly BASE_URL;
100
- private static readonly COMMON_OPTIONS;
101
- private readonly axios;
102
- constructor(apiKey: string);
103
- getQuotes(requests: (QuoteRequestExactInput | QuoteRequestExactOutput)[]): Promise<(Quote | null)[]>;
104
- }
@@ -1,56 +0,0 @@
1
- import { Hex } from "viem";
2
- import { Aggregator, Quote, QuoteRequestExactInput, QuoteRequestExactOutput } from "./iface";
3
- export type FibrousToken = {
4
- name: string;
5
- symbol?: string;
6
- address: Hex;
7
- decimals: number;
8
- price: number | string | null;
9
- };
10
- export type FibrousResponse = {
11
- route: {
12
- success: boolean;
13
- routeSwapType: number;
14
- inputToken: FibrousToken;
15
- inputAmount: string;
16
- outputToken: FibrousToken;
17
- outputAmount: string;
18
- };
19
- calldata: {
20
- route: {
21
- token_in: Hex;
22
- token_out: Hex;
23
- amount_in: string;
24
- amount_out: string;
25
- min_received: string;
26
- destination: Hex;
27
- swap_type: number;
28
- };
29
- swap_parameters: Array<{
30
- token_in: Hex;
31
- token_out: Hex;
32
- rate: string;
33
- protocol_id: string;
34
- pool_address: Hex;
35
- swap_type: number;
36
- extra_data: Hex;
37
- }>;
38
- };
39
- router_address: Hex;
40
- };
41
- export type FibrousQuote = Quote & {
42
- originalResponse: FibrousResponse;
43
- };
44
- export type FibrousAggregatorOptions = {
45
- apiKey?: string;
46
- slippage?: number;
47
- excludeProtocols?: string;
48
- };
49
- export declare class FibrousAggregator implements Aggregator {
50
- private static readonly BASE_URL;
51
- private readonly axios;
52
- private readonly slippage;
53
- private readonly excludeProtocols;
54
- constructor(options?: FibrousAggregatorOptions);
55
- getQuotes(requests: (QuoteRequestExactInput | QuoteRequestExactOutput)[]): Promise<(Quote | null)[]>;
56
- }
@@ -1,69 +0,0 @@
1
- import { Bytes } from "../types";
2
- import { OmniversalChainID } from "../data";
3
- import { Hex } from "viem";
4
- export declare enum QuoteType {
5
- EXACT_IN = 0,
6
- EXACT_OUT = 1
7
- }
8
- export declare enum QuoteSeriousness {
9
- PRICE_SURVEY = 0,
10
- SERIOUS = 1
11
- }
12
- export type QuoteResponse = {
13
- chainID: number;
14
- quote: Quote;
15
- holding: Holding;
16
- aggregator: Aggregator;
17
- };
18
- export type Holding = {
19
- chainID: OmniversalChainID;
20
- tokenAddress: Bytes;
21
- amountRaw: bigint;
22
- };
23
- export interface Quote {
24
- expiry?: number;
25
- input: {
26
- contractAddress: Hex;
27
- amount: string;
28
- amountRaw: bigint;
29
- decimals: number;
30
- value: number;
31
- symbol: string;
32
- };
33
- output: {
34
- contractAddress: Hex;
35
- amount: string;
36
- amountRaw: bigint;
37
- decimals: number;
38
- value: number;
39
- symbol: string;
40
- };
41
- txData: {
42
- approvalAddress: Hex;
43
- tx: {
44
- to: Hex;
45
- data: Hex;
46
- value: Hex;
47
- };
48
- };
49
- }
50
- type CommonQuoteParameters = {
51
- userAddress: Bytes;
52
- receiverAddress?: Bytes;
53
- chain: OmniversalChainID;
54
- inputToken: Bytes;
55
- outputToken: Bytes;
56
- seriousness: QuoteSeriousness;
57
- };
58
- export type QuoteRequestExactInput = CommonQuoteParameters & {
59
- type: QuoteType.EXACT_IN;
60
- inputAmount: bigint;
61
- };
62
- export type QuoteRequestExactOutput = CommonQuoteParameters & {
63
- type: QuoteType.EXACT_OUT;
64
- outputAmount: bigint;
65
- };
66
- export interface Aggregator {
67
- getQuotes(requests: (QuoteRequestExactInput | QuoteRequestExactOutput)[]): Promise<(Quote | null)[]>;
68
- }
69
- export {};
@@ -1,5 +0,0 @@
1
- export * from './iface';
2
- export * from './lifi-agg';
3
- export * from './bebop-agg';
4
- export * from './fibrous-agg';
5
- export * from './autochoice';
@@ -1,39 +0,0 @@
1
- import { Hex } from "viem";
2
- import { Aggregator, Quote, QuoteRequestExactInput, QuoteRequestExactOutput } from "./iface";
3
- export type LiFiResponse = {
4
- type: string;
5
- id: string;
6
- estimate: {
7
- tool: string;
8
- approvalAddress: Hex;
9
- toAmountMin: string;
10
- toAmount: string;
11
- fromAmount: string;
12
- executionDuration: number;
13
- };
14
- action: {
15
- fromToken: {
16
- symbol: string;
17
- decimals: number;
18
- priceUSD: string;
19
- };
20
- toToken: {
21
- symbol: string;
22
- decimals: number;
23
- priceUSD: string;
24
- };
25
- };
26
- integrator: string;
27
- transactionRequest: {
28
- value: Hex;
29
- to: Hex;
30
- data: Hex;
31
- };
32
- };
33
- export declare class LiFiAggregator implements Aggregator {
34
- private static readonly BASE_URL_V1;
35
- private static readonly COMMON_OPTIONS;
36
- private readonly axios;
37
- constructor(apiKey: string);
38
- getQuotes(requests: (QuoteRequestExactInput | QuoteRequestExactOutput)[]): Promise<(Quote | null)[]>;
39
- }