@relayprotocol/relay-sdk 8.2.0 → 8.3.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/_cjs/src/routes/index.js +6 -1
- package/_cjs/src/routes/index.js.map +1 -1
- package/_cjs/src/types/Order.js.map +1 -1
- package/_cjs/src/types/api.js.map +1 -1
- package/_cjs/src/version.js +1 -1
- package/_cjs/src/version.js.map +1 -1
- package/_cjs/tsconfig.build.tsbuildinfo +1 -1
- package/_esm/src/routes/index.js +6 -1
- package/_esm/src/routes/index.js.map +1 -1
- package/_esm/src/types/Order.js.map +1 -1
- package/_esm/src/types/api.js +0 -4
- package/_esm/src/types/api.js.map +1 -1
- package/_esm/src/version.js +1 -1
- package/_esm/src/version.js.map +1 -1
- package/_esm/tsconfig.build.tsbuildinfo +1 -1
- package/_types/src/client.d.ts +6 -6
- package/_types/src/routes/index.d.ts.map +1 -1
- package/_types/src/types/Order.d.ts +28 -98
- package/_types/src/types/Order.d.ts.map +1 -1
- package/_types/src/types/api.d.ts +5929 -2645
- package/_types/src/types/api.d.ts.map +1 -1
- package/_types/src/utils/getCurrentStepData.d.ts +2 -2
- package/_types/src/utils/prepareBatchTransaction.d.ts +1 -1
- package/_types/src/version.d.ts +1 -1
- package/_types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/_types/src/client.d.ts
CHANGED
|
@@ -88,8 +88,8 @@ export declare class RelayClient {
|
|
|
88
88
|
deployContract: <const abi extends import("viem").Abi | readonly unknown[], chainOverride extends import("viem/chains").Chain | undefined>(args: import("viem").DeployContractParameters<abi, import("viem/chains").Chain | undefined, import("viem").Account | undefined, chainOverride>) => Promise<`0x${string}`>;
|
|
89
89
|
getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
|
|
90
90
|
getCallsStatus: (parameters: import("viem").GetCallsStatusParameters) => Promise<{
|
|
91
|
-
version: string;
|
|
92
91
|
id: string;
|
|
92
|
+
version: string;
|
|
93
93
|
chainId: number;
|
|
94
94
|
atomic: boolean;
|
|
95
95
|
capabilities?: {
|
|
@@ -7776,8 +7776,8 @@ export declare class RelayClient {
|
|
|
7776
7776
|
}, primaryType extends string>(args: import("viem").SignTypedDataParameters<typedData, primaryType, import("viem").Account | undefined>) => Promise<`0x${string}`>;
|
|
7777
7777
|
switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
|
|
7778
7778
|
waitForCallsStatus: (parameters: import("viem").WaitForCallsStatusParameters) => Promise<{
|
|
7779
|
-
version: string;
|
|
7780
7779
|
id: string;
|
|
7780
|
+
version: string;
|
|
7781
7781
|
chainId: number;
|
|
7782
7782
|
atomic: boolean;
|
|
7783
7783
|
capabilities?: {
|
|
@@ -7821,7 +7821,7 @@ export declare class RelayClient {
|
|
|
7821
7821
|
items: {
|
|
7822
7822
|
status: "incomplete" | "complete";
|
|
7823
7823
|
receipt?: import("viem").TransactionReceipt | import("./types/AdaptedWallet.js").SvmReceipt | import("./types/AdaptedWallet.js").TronReceipt | import("./types/AdaptedWallet.js").TonReceipt | import("./types/AdaptedWallet.js").LvmReceipt | import("./types/AdaptedWallet.js").XrpReceipt | undefined;
|
|
7824
|
-
checkStatus?: "
|
|
7824
|
+
checkStatus?: "pending" | "refund" | "submitted" | "success" | "failure" | "waiting" | "unknown" | undefined;
|
|
7825
7825
|
progressState?: "complete" | "confirming" | "validating" | "signing" | "posting" | undefined;
|
|
7826
7826
|
data?: any;
|
|
7827
7827
|
check?: {
|
|
@@ -7862,7 +7862,7 @@ export declare class RelayClient {
|
|
|
7862
7862
|
items: {
|
|
7863
7863
|
status: "incomplete" | "complete";
|
|
7864
7864
|
receipt?: import("viem").TransactionReceipt | import("./types/AdaptedWallet.js").SvmReceipt | import("./types/AdaptedWallet.js").TronReceipt | import("./types/AdaptedWallet.js").TonReceipt | import("./types/AdaptedWallet.js").LvmReceipt | import("./types/AdaptedWallet.js").XrpReceipt | undefined;
|
|
7865
|
-
checkStatus?: "
|
|
7865
|
+
checkStatus?: "pending" | "refund" | "submitted" | "success" | "failure" | "waiting" | "unknown" | undefined;
|
|
7866
7866
|
progressState?: "complete" | "confirming" | "validating" | "signing" | "posting" | undefined;
|
|
7867
7867
|
data?: any;
|
|
7868
7868
|
check?: {
|
|
@@ -7894,7 +7894,7 @@ export declare class RelayClient {
|
|
|
7894
7894
|
currentStepItem: {
|
|
7895
7895
|
status: "incomplete" | "complete";
|
|
7896
7896
|
receipt?: import("viem").TransactionReceipt | import("./types/AdaptedWallet.js").SvmReceipt | import("./types/AdaptedWallet.js").TronReceipt | import("./types/AdaptedWallet.js").TonReceipt | import("./types/AdaptedWallet.js").LvmReceipt | import("./types/AdaptedWallet.js").XrpReceipt | undefined;
|
|
7897
|
-
checkStatus?: "
|
|
7897
|
+
checkStatus?: "pending" | "refund" | "submitted" | "success" | "failure" | "waiting" | "unknown" | undefined;
|
|
7898
7898
|
progressState?: "complete" | "confirming" | "validating" | "signing" | "posting" | undefined;
|
|
7899
7899
|
data?: any;
|
|
7900
7900
|
check?: {
|
|
@@ -7939,7 +7939,7 @@ export declare class RelayClient {
|
|
|
7939
7939
|
items: {
|
|
7940
7940
|
status: "incomplete" | "complete";
|
|
7941
7941
|
receipt?: import("viem").TransactionReceipt | import("./types/AdaptedWallet.js").SvmReceipt | import("./types/AdaptedWallet.js").TronReceipt | import("./types/AdaptedWallet.js").TonReceipt | import("./types/AdaptedWallet.js").LvmReceipt | import("./types/AdaptedWallet.js").XrpReceipt | undefined;
|
|
7942
|
-
checkStatus?: "
|
|
7942
|
+
checkStatus?: "pending" | "refund" | "submitted" | "success" | "failure" | "waiting" | "unknown" | undefined;
|
|
7943
7943
|
progressState?: "complete" | "confirming" | "validating" | "signing" | "posting" | undefined;
|
|
7944
7944
|
data?: any;
|
|
7945
7945
|
check?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,UA2DlB,CAAC"}
|
|
@@ -1,114 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export type CreateOrderBody = {
|
|
21
|
-
type: 'limit';
|
|
22
|
-
user: string;
|
|
23
|
-
recipient?: string;
|
|
24
|
-
refundTo?: string;
|
|
25
|
-
side: 'buy' | 'sell';
|
|
26
|
-
targetCurrency: string;
|
|
27
|
-
targetChainId: number;
|
|
28
|
-
settlementCurrency: string;
|
|
29
|
-
settlementChainId: number;
|
|
30
|
-
targetPrice: string;
|
|
31
|
-
amount: string;
|
|
32
|
-
expiresAt: string;
|
|
33
|
-
appFees?: OrderAppFee[];
|
|
34
|
-
subsidizeFees?: boolean;
|
|
35
|
-
sponsoredFeeComponents?: OrderSponsoredFeeComponent[];
|
|
36
|
-
maxSubsidizationAmount?: string;
|
|
37
|
-
subsidizationBps?: number;
|
|
38
|
-
clientOrderId?: string;
|
|
39
|
-
};
|
|
40
|
-
export type OrderStep = {
|
|
41
|
-
id: OrderStepId;
|
|
42
|
-
action: string;
|
|
43
|
-
description: string;
|
|
44
|
-
kind: 'transaction' | 'signature';
|
|
45
|
-
status: 'incomplete' | 'complete';
|
|
1
|
+
import type { paths } from './api.js';
|
|
2
|
+
type OrdersRoute = paths['/orders'];
|
|
3
|
+
type ListOrdersResponse = OrdersRoute['get']['responses']['200']['content']['application/json'];
|
|
4
|
+
type ApiOrder = ListOrdersResponse['orders'][number];
|
|
5
|
+
type ApiOrderStep = NonNullable<ApiOrder['steps']>[number];
|
|
6
|
+
type ApiPriceCheck = NonNullable<ApiOrder['latestPriceCheck']>;
|
|
7
|
+
/** Body of `POST /orders`. */
|
|
8
|
+
export type CreateOrderBody = OrdersRoute['post']['requestBody']['content']['application/json'];
|
|
9
|
+
export type OrderStatus = NonNullable<ApiOrder['status']>;
|
|
10
|
+
export type OrderOutcome = NonNullable<ApiOrder['outcome']>;
|
|
11
|
+
export type OrderCancelReason = NonNullable<ApiOrder['cancellationReason']>;
|
|
12
|
+
export type OrderRequiredAction = NonNullable<ApiOrder['requiredAction']>;
|
|
13
|
+
export type OrderStepId = NonNullable<ApiOrderStep['id']>;
|
|
14
|
+
export type OrderCheckReason = NonNullable<ApiPriceCheck['reason']>;
|
|
15
|
+
export type OrderCreateErrorCode = NonNullable<OrdersRoute['post']['responses']['400']['content']['application/json']['errorCode']>;
|
|
16
|
+
export type OrderSponsoredFeeComponent = NonNullable<CreateOrderBody['sponsoredFeeComponents']>[number];
|
|
17
|
+
export type OrderAppFee = NonNullable<CreateOrderBody['appFees']>[number];
|
|
18
|
+
export type OrderStep = Required<Omit<ApiOrderStep, 'data' | 'check'>> & {
|
|
46
19
|
data: any;
|
|
47
20
|
check?: {
|
|
48
21
|
endpoint: string;
|
|
49
22
|
method: 'GET' | 'POST';
|
|
50
23
|
};
|
|
51
24
|
};
|
|
52
|
-
export type OrderPriceCheck =
|
|
53
|
-
|
|
54
|
-
allInPrice: string | null;
|
|
55
|
-
reason: OrderCheckReason | null;
|
|
56
|
-
checkedAt: string;
|
|
57
|
-
};
|
|
25
|
+
export type OrderPriceCheck = Required<ApiPriceCheck>;
|
|
26
|
+
type OptionalOrderField = 'appFees' | 'subsidizeFees' | 'sponsoredFeeComponents' | 'maxSubsidizationAmount' | 'subsidizationBps';
|
|
58
27
|
/**
|
|
59
28
|
* An order as the Orders API returns it.
|
|
60
|
-
* @property
|
|
61
|
-
* @property cancellationReason - Who cancelled the order; null unless the outcome is `cancelled`
|
|
62
|
-
* @property requiredAction - What Relay has to do before the order can continue; null unless the status is `requires_action`
|
|
29
|
+
* @property latestPriceCheck - Its `reason` is the first of `insufficient_balance`, `insufficient_allowance`, `no_route` and `price_not_reached` that stopped a fill, or null when nothing did
|
|
63
30
|
*/
|
|
64
|
-
export type Order = Omit<
|
|
65
|
-
id: string;
|
|
66
|
-
clientOrderId: string | null;
|
|
67
|
-
orderHash: string;
|
|
68
|
-
status: OrderStatus;
|
|
69
|
-
outcome: OrderOutcome | null;
|
|
70
|
-
cancellationReason: OrderCancelReason | null;
|
|
71
|
-
requiredAction: OrderRequiredAction | null;
|
|
72
|
-
recipient: string;
|
|
73
|
-
refundTo: string;
|
|
74
|
-
originChainId: number;
|
|
75
|
-
originCurrency: string;
|
|
76
|
-
destinationChainId: number;
|
|
77
|
-
destinationCurrency: string;
|
|
78
|
-
fees: Record<string, unknown>;
|
|
79
|
-
createdAt: string;
|
|
80
|
-
updatedAt: string;
|
|
81
|
-
expiresAt: string;
|
|
82
|
-
closedAt: string | null;
|
|
83
|
-
requestIds: string[];
|
|
84
|
-
filledAmount: string;
|
|
85
|
-
refundedAmount: string;
|
|
86
|
-
withdrawnAmount: string;
|
|
31
|
+
export type Order = Required<Omit<ApiOrder, OptionalOrderField | 'steps' | 'latestPriceCheck' | 'closestPriceCheck'>> & Pick<CreateOrderBody, OptionalOrderField> & {
|
|
87
32
|
steps: OrderStep[];
|
|
88
|
-
|
|
33
|
+
latestPriceCheck: OrderPriceCheck | null;
|
|
34
|
+
closestPriceCheck: OrderPriceCheck | null;
|
|
89
35
|
};
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
* @property status - Only orders in these statuses
|
|
93
|
-
* @property startTimestamp - Unix seconds; filters on the sortBy field
|
|
94
|
-
* @property endTimestamp - Unix seconds; filters on the sortBy field
|
|
95
|
-
*/
|
|
96
|
-
export type GetOrdersQuery = {
|
|
97
|
-
orderId?: string;
|
|
98
|
-
appId?: string;
|
|
99
|
-
user?: string;
|
|
36
|
+
/** Query of `GET /orders`, with `status` as a list instead of a comma-separated string. */
|
|
37
|
+
export type GetOrdersQuery = Omit<NonNullable<OrdersRoute['get']['parameters']['query']>, 'status'> & {
|
|
100
38
|
status?: OrderStatus[];
|
|
101
|
-
originChainId?: number;
|
|
102
|
-
destinationChainId?: number;
|
|
103
|
-
limit?: number;
|
|
104
|
-
continuation?: string;
|
|
105
|
-
startTimestamp?: number;
|
|
106
|
-
endTimestamp?: number;
|
|
107
|
-
sortBy?: 'createdAt' | 'updatedAt';
|
|
108
|
-
sortDirection?: 'asc' | 'desc';
|
|
109
39
|
};
|
|
110
|
-
export type GetOrdersResponse = {
|
|
40
|
+
export type GetOrdersResponse = Omit<ListOrdersResponse, 'orders'> & {
|
|
111
41
|
orders: Order[];
|
|
112
|
-
continuation?: string;
|
|
113
42
|
};
|
|
43
|
+
export {};
|
|
114
44
|
//# sourceMappingURL=Order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../src/types/Order.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../src/types/Order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;AACnC,KAAK,kBAAkB,GACrB,WAAW,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AACvE,KAAK,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,KAAK,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAC1D,KAAK,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAA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