@p2pdotme/sdk 1.0.5 → 1.1.1
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/README.md +103 -41
- package/dist/country.cjs +9 -2
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +35 -10
- package/dist/country.d.ts +35 -10
- package/dist/country.mjs +6 -2
- package/dist/country.mjs.map +1 -1
- package/dist/fraud-engine.cjs +52 -48
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +46 -42
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -36
- package/dist/index.d.ts +41 -36
- package/dist/index.mjs +4 -12
- package/dist/index.mjs.map +1 -1
- package/dist/orders.cjs +5961 -0
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +620 -0
- package/dist/orders.d.ts +620 -0
- package/dist/orders.mjs +5911 -0
- package/dist/orders.mjs.map +1 -0
- package/dist/prices.cjs +1432 -0
- package/dist/prices.cjs.map +1 -0
- package/dist/prices.d.cts +109 -0
- package/dist/prices.d.ts +109 -0
- package/dist/prices.mjs +1404 -0
- package/dist/prices.mjs.map +1 -0
- package/dist/profile.cjs +899 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +39 -27
- package/dist/profile.d.ts +39 -27
- package/dist/profile.mjs +892 -62
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +88 -7
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +38 -16
- package/dist/qr-parsers.d.ts +38 -16
- package/dist/qr-parsers.mjs +88 -7
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +2955 -1105
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +384 -104
- package/dist/react.d.ts +384 -104
- package/dist/react.mjs +2841 -992
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +405 -24
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.d.cts +14 -9
- package/dist/zkkyc.d.ts +14 -9
- package/dist/zkkyc.mjs +405 -24
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/order-routing.cjs +0 -888
- package/dist/order-routing.cjs.map +0 -1
- package/dist/order-routing.d.cts +0 -68
- package/dist/order-routing.d.ts +0 -68
- package/dist/order-routing.mjs +0 -860
- package/dist/order-routing.mjs.map +0 -1
- package/dist/payload.cjs +0 -3168
- package/dist/payload.cjs.map +0 -1
- package/dist/payload.d.cts +0 -147
- package/dist/payload.d.ts +0 -147
- package/dist/payload.mjs +0 -3124
- package/dist/payload.mjs.map +0 -1
package/dist/orders.d.ts
ADDED
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import { ResultAsync } from 'neverthrow';
|
|
2
|
+
import { Address, WalletClient, TransactionReceipt } from 'viem';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Minimal viem PublicClient interface — consumers pass their own client.
|
|
7
|
+
* The SDK uses `readContract` for single reads and `multicall` where available
|
|
8
|
+
* to batch multiple reads into one RPC round-trip.
|
|
9
|
+
*/
|
|
10
|
+
interface PublicClientLike {
|
|
11
|
+
readContract(args: {
|
|
12
|
+
address: Address;
|
|
13
|
+
abi: readonly unknown[];
|
|
14
|
+
functionName: string;
|
|
15
|
+
args: readonly unknown[];
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
multicall?(args: {
|
|
18
|
+
contracts: readonly {
|
|
19
|
+
address: Address;
|
|
20
|
+
abi: readonly unknown[];
|
|
21
|
+
functionName: string;
|
|
22
|
+
args?: readonly unknown[];
|
|
23
|
+
}[];
|
|
24
|
+
allowFailure?: boolean;
|
|
25
|
+
}): Promise<readonly unknown[]>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class SdkError<TCode extends string = string> extends Error {
|
|
29
|
+
readonly code: TCode;
|
|
30
|
+
readonly cause?: unknown;
|
|
31
|
+
readonly context?: Record<string, unknown>;
|
|
32
|
+
constructor(message: string, options: {
|
|
33
|
+
code: TCode;
|
|
34
|
+
cause?: unknown;
|
|
35
|
+
context?: Record<string, unknown>;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type OrdersErrorCode = "VALIDATION_ERROR" | "INVALID_ORDER_ID" | "INVALID_GET_ORDERS_PARAMS" | "INVALID_FEE_CONFIG_PARAMS" | "ORDER_NOT_FOUND" | "CONTRACT_READ_FAILED" | "SUBGRAPH_REQUEST_FAILED" | "SUBGRAPH_VALIDATION_FAILED" | "MALFORMED_ORDER" | "CIRCLE_SELECTION_FAILED" | "ENCRYPTION_FAILED" | "RELAY_IDENTITY_CORRUPT" | "RELAY_IDENTITY_STORE_FAILED" | "TX_SUBMISSION_FAILED" | "RECEIPT_TIMEOUT" | "TX_REVERTED" | "EVENT_WATCH_FAILED";
|
|
40
|
+
declare class OrdersError extends SdkError<OrdersErrorCode> {
|
|
41
|
+
constructor(message: string, options: {
|
|
42
|
+
code: OrdersErrorCode;
|
|
43
|
+
cause?: unknown;
|
|
44
|
+
context?: Record<string, unknown>;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Logger {
|
|
49
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
50
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
51
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
52
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface RelayIdentity {
|
|
56
|
+
readonly address: `0x${string}`;
|
|
57
|
+
readonly publicKey: string;
|
|
58
|
+
readonly privateKey: `0x${string}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Generates a fresh relay identity keypair. Pure — no side effects.
|
|
62
|
+
* Consumers decide how to persist the result via a `RelayIdentityStore`.
|
|
63
|
+
*/
|
|
64
|
+
declare function createRelayIdentity(): RelayIdentity;
|
|
65
|
+
|
|
66
|
+
interface RelayIdentityStore {
|
|
67
|
+
get(): Promise<RelayIdentity | null>;
|
|
68
|
+
set(identity: RelayIdentity): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Ephemeral in-process store. Lost on process restart. Used as the default
|
|
72
|
+
* when the consumer doesn't supply one.
|
|
73
|
+
*/
|
|
74
|
+
declare function createInMemoryRelayStore(): RelayIdentityStore;
|
|
75
|
+
/**
|
|
76
|
+
* Browser-only adapter that persists the identity as JSON in `localStorage`.
|
|
77
|
+
* Throws at call time if `localStorage` is unavailable — do not use in SSR/RN.
|
|
78
|
+
*/
|
|
79
|
+
declare function createLocalStorageRelayStore(options?: {
|
|
80
|
+
key?: string;
|
|
81
|
+
}): RelayIdentityStore;
|
|
82
|
+
|
|
83
|
+
declare const ZodGetOrderParamsSchema: z.ZodObject<{
|
|
84
|
+
orderId: z.ZodBigInt;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
type GetOrderParams = z.infer<typeof ZodGetOrderParamsSchema>;
|
|
87
|
+
declare const ZodGetFeeConfigParamsSchema: z.ZodObject<{
|
|
88
|
+
currency: z.ZodEnum<{
|
|
89
|
+
IDR: "IDR";
|
|
90
|
+
INR: "INR";
|
|
91
|
+
BRL: "BRL";
|
|
92
|
+
ARS: "ARS";
|
|
93
|
+
MEX: "MEX";
|
|
94
|
+
VEN: "VEN";
|
|
95
|
+
EUR: "EUR";
|
|
96
|
+
NGN: "NGN";
|
|
97
|
+
USD: "USD";
|
|
98
|
+
COP: "COP";
|
|
99
|
+
}>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
type GetFeeConfigParams = z.infer<typeof ZodGetFeeConfigParamsSchema>;
|
|
102
|
+
declare const ZodGetOrdersParamsSchema: z.ZodObject<{
|
|
103
|
+
userAddress: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
104
|
+
skip: z.ZodDefault<z.ZodNumber>;
|
|
105
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
type GetOrdersParams = z.input<typeof ZodGetOrdersParamsSchema>;
|
|
108
|
+
declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
|
|
109
|
+
orderType: z.ZodNumber;
|
|
110
|
+
currency: z.ZodEnum<{
|
|
111
|
+
IDR: "IDR";
|
|
112
|
+
INR: "INR";
|
|
113
|
+
BRL: "BRL";
|
|
114
|
+
ARS: "ARS";
|
|
115
|
+
MEX: "MEX";
|
|
116
|
+
VEN: "VEN";
|
|
117
|
+
EUR: "EUR";
|
|
118
|
+
NGN: "NGN";
|
|
119
|
+
USD: "USD";
|
|
120
|
+
COP: "COP";
|
|
121
|
+
}>;
|
|
122
|
+
user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
123
|
+
amount: z.ZodBigInt;
|
|
124
|
+
fiatAmount: z.ZodBigInt;
|
|
125
|
+
fiatAmountLimit: z.ZodDefault<z.ZodOptional<z.ZodBigInt>>;
|
|
126
|
+
recipientAddr: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
127
|
+
preferredPaymentChannelConfigId: z.ZodOptional<z.ZodBigInt>;
|
|
128
|
+
pubKey: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
type PlaceOrderParams = z.input<typeof ZodPlaceOrderParamsSchema>;
|
|
131
|
+
declare const ZodCancelOrderParamsSchema: z.ZodObject<{
|
|
132
|
+
orderId: z.ZodBigInt;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
type CancelOrderParams = z.infer<typeof ZodCancelOrderParamsSchema>;
|
|
135
|
+
declare const ZodSetSellOrderUpiParamsSchema: z.ZodObject<{
|
|
136
|
+
orderId: z.ZodBigInt;
|
|
137
|
+
paymentAddress: z.ZodString;
|
|
138
|
+
merchantPublicKey: z.ZodString;
|
|
139
|
+
updatedAmount: z.ZodBigInt;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
type SetSellOrderUpiParams = z.infer<typeof ZodSetSellOrderUpiParamsSchema>;
|
|
142
|
+
declare const ZodRaiseDisputeParamsSchema: z.ZodObject<{
|
|
143
|
+
orderId: z.ZodBigInt;
|
|
144
|
+
redactTransId: z.ZodBigInt;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
type RaiseDisputeParams = z.infer<typeof ZodRaiseDisputeParamsSchema>;
|
|
147
|
+
declare const ZodApproveUsdcParamsSchema: z.ZodObject<{
|
|
148
|
+
amount: z.ZodBigInt;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
type ApproveUsdcParams = z.infer<typeof ZodApproveUsdcParamsSchema>;
|
|
151
|
+
declare const ZodPaidBuyOrderParamsSchema: z.ZodObject<{
|
|
152
|
+
orderId: z.ZodBigInt;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
type PaidBuyOrderParams = z.infer<typeof ZodPaidBuyOrderParamsSchema>;
|
|
155
|
+
|
|
156
|
+
type OrderType = "buy" | "sell" | "pay";
|
|
157
|
+
type OrderStatus = "placed" | "accepted" | "paid" | "completed" | "cancelled";
|
|
158
|
+
type DisputeStatus = "none" | "open" | "resolved";
|
|
159
|
+
/**
|
|
160
|
+
* Normalized order record returned by both `getOrder` and `getOrders`.
|
|
161
|
+
* Amounts are 6-decimal bigints; timestamps are unix seconds.
|
|
162
|
+
*/
|
|
163
|
+
interface Order {
|
|
164
|
+
orderId: bigint;
|
|
165
|
+
type: OrderType;
|
|
166
|
+
status: OrderStatus;
|
|
167
|
+
usdcAmount: bigint;
|
|
168
|
+
fiatAmount: bigint;
|
|
169
|
+
actualUsdcAmount: bigint;
|
|
170
|
+
actualFiatAmount: bigint;
|
|
171
|
+
currency: string;
|
|
172
|
+
user: Address;
|
|
173
|
+
recipient: Address;
|
|
174
|
+
acceptedMerchant: Address;
|
|
175
|
+
placedAt: bigint;
|
|
176
|
+
acceptedAt: bigint;
|
|
177
|
+
paidAt: bigint;
|
|
178
|
+
completedAt: bigint;
|
|
179
|
+
circleId: bigint;
|
|
180
|
+
fixedFeePaid: bigint;
|
|
181
|
+
tipsPaid: bigint;
|
|
182
|
+
disputeStatus: DisputeStatus;
|
|
183
|
+
/**
|
|
184
|
+
* Encrypted UPI / payment address that the merchant published for this order
|
|
185
|
+
* (set when the merchant accepts a buy order). Empty string until set.
|
|
186
|
+
* Decrypt with `decryptPaymentAddress`.
|
|
187
|
+
*/
|
|
188
|
+
encUpi: string;
|
|
189
|
+
/**
|
|
190
|
+
* Encrypted merchant UPI for the seller-side flow (set by `setSellOrderUpi`).
|
|
191
|
+
* Empty string until set.
|
|
192
|
+
*/
|
|
193
|
+
encMerchantUpi: string;
|
|
194
|
+
/** Public key associated with the order, used for ECIES encryption setup. */
|
|
195
|
+
pubkey: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Per-currency small-order fee config read from the Diamond.
|
|
199
|
+
* Amounts are 6-decimal bigints.
|
|
200
|
+
*/
|
|
201
|
+
interface FeeConfig {
|
|
202
|
+
/** Order amounts at or below this threshold are billed the fixed fee. */
|
|
203
|
+
smallOrderThreshold: bigint;
|
|
204
|
+
/** Fixed fee applied to small orders (6 decimals). */
|
|
205
|
+
smallOrderFixedFee: bigint;
|
|
206
|
+
}
|
|
207
|
+
interface OrdersConfig {
|
|
208
|
+
readonly publicClient: PublicClientLike;
|
|
209
|
+
readonly diamondAddress: Address;
|
|
210
|
+
readonly usdcAddress: Address;
|
|
211
|
+
readonly subgraphUrl: string;
|
|
212
|
+
readonly relayIdentityStore?: RelayIdentityStore;
|
|
213
|
+
readonly relayIdentity?: RelayIdentity;
|
|
214
|
+
readonly logger?: Logger;
|
|
215
|
+
}
|
|
216
|
+
interface PreparedTxMeta {
|
|
217
|
+
readonly circleId?: bigint;
|
|
218
|
+
readonly relayIdentity?: RelayIdentity;
|
|
219
|
+
}
|
|
220
|
+
interface PreparedTx {
|
|
221
|
+
readonly to: `0x${string}`;
|
|
222
|
+
readonly data: `0x${string}`;
|
|
223
|
+
readonly value: bigint;
|
|
224
|
+
readonly meta?: PreparedTxMeta;
|
|
225
|
+
}
|
|
226
|
+
interface TxResultMeta extends PreparedTxMeta {
|
|
227
|
+
/**
|
|
228
|
+
* Populated on `placeOrder.execute({ waitForReceipt: true })` — the orderId
|
|
229
|
+
* parsed from the `OrderPlaced` event in the receipt's logs. Undefined when
|
|
230
|
+
* `waitForReceipt` is not set (no receipt means no logs to parse).
|
|
231
|
+
*/
|
|
232
|
+
readonly orderId?: bigint;
|
|
233
|
+
}
|
|
234
|
+
interface TxResult {
|
|
235
|
+
readonly hash: `0x${string}`;
|
|
236
|
+
readonly receipt?: TransactionReceipt;
|
|
237
|
+
readonly meta?: TxResultMeta;
|
|
238
|
+
}
|
|
239
|
+
interface ExecuteBase {
|
|
240
|
+
readonly walletClient: WalletClient;
|
|
241
|
+
readonly waitForReceipt?: boolean;
|
|
242
|
+
}
|
|
243
|
+
type OrderEvent = {
|
|
244
|
+
readonly type: "placed";
|
|
245
|
+
readonly orderId: bigint;
|
|
246
|
+
readonly user: Address;
|
|
247
|
+
readonly orderType: 0 | 1 | 2;
|
|
248
|
+
readonly blockNumber: bigint;
|
|
249
|
+
readonly txHash: `0x${string}`;
|
|
250
|
+
} | {
|
|
251
|
+
readonly type: "accepted";
|
|
252
|
+
readonly orderId: bigint;
|
|
253
|
+
readonly merchant: Address;
|
|
254
|
+
readonly blockNumber: bigint;
|
|
255
|
+
readonly txHash: `0x${string}`;
|
|
256
|
+
} | {
|
|
257
|
+
readonly type: "paid";
|
|
258
|
+
readonly orderId: bigint;
|
|
259
|
+
readonly blockNumber: bigint;
|
|
260
|
+
readonly txHash: `0x${string}`;
|
|
261
|
+
} | {
|
|
262
|
+
readonly type: "completed";
|
|
263
|
+
readonly orderId: bigint;
|
|
264
|
+
readonly blockNumber: bigint;
|
|
265
|
+
readonly txHash: `0x${string}`;
|
|
266
|
+
} | {
|
|
267
|
+
readonly type: "cancelled";
|
|
268
|
+
readonly orderId: bigint;
|
|
269
|
+
readonly blockNumber: bigint;
|
|
270
|
+
readonly txHash: `0x${string}`;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
interface ApproveUsdcAction {
|
|
274
|
+
prepare(params: ApproveUsdcParams): ResultAsync<PreparedTx, OrdersError>;
|
|
275
|
+
execute(params: ApproveUsdcParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface CancelOrderAction {
|
|
279
|
+
prepare(params: CancelOrderParams): ResultAsync<PreparedTx, OrdersError>;
|
|
280
|
+
execute(params: CancelOrderParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface PaidBuyOrderAction {
|
|
284
|
+
prepare(params: PaidBuyOrderParams): ResultAsync<PreparedTx, OrdersError>;
|
|
285
|
+
execute(params: PaidBuyOrderParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface PlaceOrderAction {
|
|
289
|
+
prepare(params: PlaceOrderParams): ResultAsync<PreparedTx, OrdersError>;
|
|
290
|
+
execute(params: PlaceOrderParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
interface RaiseDisputeAction {
|
|
294
|
+
prepare(params: RaiseDisputeParams): ResultAsync<PreparedTx, OrdersError>;
|
|
295
|
+
execute(params: RaiseDisputeParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
interface SetSellOrderUpiAction {
|
|
299
|
+
prepare(params: SetSellOrderUpiParams): ResultAsync<PreparedTx, OrdersError>;
|
|
300
|
+
execute(params: SetSellOrderUpiParams & ExecuteBase): ResultAsync<TxResult, OrdersError>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
interface WatchEventsParams {
|
|
304
|
+
readonly user?: Address;
|
|
305
|
+
readonly onEvent: (event: OrderEvent) => void;
|
|
306
|
+
readonly onError?: (error: OrdersError) => void;
|
|
307
|
+
}
|
|
308
|
+
type WatchEvents = (params: WatchEventsParams) => () => void;
|
|
309
|
+
|
|
310
|
+
interface OrdersClient {
|
|
311
|
+
/** Reads a single order by id from the Diamond contract. */
|
|
312
|
+
getOrder(params: GetOrderParams): ResultAsync<Order, OrdersError>;
|
|
313
|
+
/**
|
|
314
|
+
* Lists orders created by `userAddress` from the subgraph, newest first.
|
|
315
|
+
* Defaults: `skip = 0`, `limit = 20`. Max `limit` is 100.
|
|
316
|
+
*/
|
|
317
|
+
getOrders(params: GetOrdersParams): ResultAsync<Order[], OrdersError>;
|
|
318
|
+
/**
|
|
319
|
+
* Reads the per-currency small-order fee config from the Diamond via
|
|
320
|
+
* multicall: threshold (below which the fixed fee applies) and the fixed
|
|
321
|
+
* fee itself. Both are 6-decimal bigints.
|
|
322
|
+
*/
|
|
323
|
+
getFeeConfig(params: GetFeeConfigParams): ResultAsync<FeeConfig, OrdersError>;
|
|
324
|
+
readonly placeOrder: PlaceOrderAction;
|
|
325
|
+
readonly cancelOrder: CancelOrderAction;
|
|
326
|
+
readonly setSellOrderUpi: SetSellOrderUpiAction;
|
|
327
|
+
readonly raiseDispute: RaiseDisputeAction;
|
|
328
|
+
readonly approveUsdc: ApproveUsdcAction;
|
|
329
|
+
readonly paidBuyOrder: PaidBuyOrderAction;
|
|
330
|
+
watchEvents: WatchEvents;
|
|
331
|
+
/**
|
|
332
|
+
* Decrypts an `encUpi` / `encMerchantUpi` ciphertext from an order using the
|
|
333
|
+
* relay identity resolved from the configured store. Returns the plaintext
|
|
334
|
+
* payment address.
|
|
335
|
+
*/
|
|
336
|
+
decryptPaymentAddress(params: {
|
|
337
|
+
encrypted: string;
|
|
338
|
+
}): ResultAsync<string, OrdersError>;
|
|
339
|
+
/**
|
|
340
|
+
* Signs `paymentAddress` with the resolved relay identity and ECIES-encrypts
|
|
341
|
+
* the payload for `recipientPublicKey`. Returns the hex-stringified ciphertext
|
|
342
|
+
* suitable for on-chain storage (e.g. as the merchant's encUpi when calling
|
|
343
|
+
* `setSellOrderUpi`).
|
|
344
|
+
*/
|
|
345
|
+
encryptPaymentAddress(params: {
|
|
346
|
+
paymentAddress: string;
|
|
347
|
+
recipientPublicKey: string;
|
|
348
|
+
}): ResultAsync<string, OrdersError>;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Creates the unified orders client — reads (getOrder, getOrders, getFeeConfig)
|
|
352
|
+
* and circle-routing-backed writes (placeOrder, cancelOrder, setSellOrderUpi,
|
|
353
|
+
* raiseDispute, approveUsdc). The relay identity store defaults to in-memory
|
|
354
|
+
* when none is supplied.
|
|
355
|
+
*
|
|
356
|
+
* For USDC balance / allowance reads use `@p2pdotme/sdk/profile` (those are
|
|
357
|
+
* user-scoped and live there).
|
|
358
|
+
*/
|
|
359
|
+
declare function createOrders(config: OrdersConfig): OrdersClient;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Centralized contract error definitions mirroring `contracts/libraries/Errors.sol`.
|
|
363
|
+
* Maps Solidity custom error names and their 4-byte selectors to human-readable codes.
|
|
364
|
+
*/
|
|
365
|
+
declare const contractErrors: {
|
|
366
|
+
readonly NotAdmin: "NOT_ADMIN";
|
|
367
|
+
readonly NotSuperAdmin: "NOT_SUPER_ADMIN";
|
|
368
|
+
readonly NotAuthorized: "NOT_AUTHORIZED";
|
|
369
|
+
readonly NotSelf: "NOT_SELF";
|
|
370
|
+
readonly NotWhitelisted: "NOT_WHITELISTED";
|
|
371
|
+
readonly NotCircleAdmin: "NOT_CIRCLE_ADMIN";
|
|
372
|
+
readonly InvalidName: "INVALID_NAME";
|
|
373
|
+
readonly InvalidCommunityUrl: "INVALID_COMMUNITY_URL";
|
|
374
|
+
readonly InvalidAdminCommunityUrl: "INVALID_ADMIN_COMMUNITY_URL";
|
|
375
|
+
readonly AdminAlreadyHasCircle: "ADMIN_ALREADY_HAS_CIRCLE";
|
|
376
|
+
readonly CircleNameAlreadyTaken: "CIRCLE_NAME_ALREADY_TAKEN";
|
|
377
|
+
readonly P2PStakeConfigNotSet: "P2P_STAKE_CONFIG_NOT_SET";
|
|
378
|
+
readonly InsufficientP2PStake: "INSUFFICIENT_P2P_STAKE";
|
|
379
|
+
readonly P2PTokenNotSet: "P2P_TOKEN_NOT_SET";
|
|
380
|
+
readonly P2PUnstakeRequestPending: "P2P_UNSTAKE_REQUEST_PENDING";
|
|
381
|
+
readonly NoP2PUnstakeRequest: "NO_P2P_UNSTAKE_REQUEST";
|
|
382
|
+
readonly P2PUnstakeCooldownNotPassed: "P2P_UNSTAKE_COOLDOWN_NOT_PASSED";
|
|
383
|
+
readonly SlashAmountExceedsStake: "SLASH_AMOUNT_EXCEEDS_STAKE";
|
|
384
|
+
readonly CircleNotActive: "CIRCLE_NOT_ACTIVE";
|
|
385
|
+
readonly InvalidCircleId: "INVALID_CIRCLE_ID";
|
|
386
|
+
readonly CurrencyMismatch: "CURRENCY_MISMATCH";
|
|
387
|
+
readonly CircleFull: "CIRCLE_FULL";
|
|
388
|
+
readonly CircleIdMismatch: "CIRCLE_ID_MISMATCH";
|
|
389
|
+
readonly DuplicateAccountName: "DUPLICATE_ACCOUNT_NAME";
|
|
390
|
+
readonly EmptyName: "EMPTY_NAME";
|
|
391
|
+
readonly AccountBoundToAnotherCircle: "ACCOUNT_BOUND_TO_ANOTHER_CIRCLE";
|
|
392
|
+
readonly ExitAmountExceededCircleBalance: "EXIT_AMOUNT_EXCEEDED_CIRCLE_BALANCE";
|
|
393
|
+
readonly UndelegationAmountTooHigh: "UNDELEGATION_AMOUNT_TOO_HIGH";
|
|
394
|
+
readonly ExchangeNotOperational: "EXCHANGE_NOT_OPERATIONAL";
|
|
395
|
+
readonly OrderNotPlaced: "ORDER_NOT_PLACED";
|
|
396
|
+
readonly OrderNotPaid: "ORDER_NOT_PAID";
|
|
397
|
+
readonly OrderStatusInvalid: "ORDER_STATUS_INVALID";
|
|
398
|
+
readonly OrderExpired: "ORDER_EXPIRED";
|
|
399
|
+
readonly OrderAlreadyPaid: "ORDER_ALREADY_PAID";
|
|
400
|
+
readonly OrderAlreadyCompleted: "ORDER_ALREADY_COMPLETED";
|
|
401
|
+
readonly InvalidOrderType: "INVALID_ORDER_TYPE";
|
|
402
|
+
readonly OrderTypeIncorrect: "ORDER_TYPE_INCORRECT";
|
|
403
|
+
readonly OrderNotAccepted: "ORDER_NOT_ACCEPTED";
|
|
404
|
+
readonly OrderNotAssigned: "ORDER_NOT_ASSIGNED";
|
|
405
|
+
readonly OrderAmountExceedsLimit: "ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
406
|
+
readonly InvalidOrderAmount: "INVALID_ORDER_AMOUNT";
|
|
407
|
+
readonly InvalidOrderAmountToCoverFee: "INVALID_ORDER_AMOUNT_TO_COVER_FEE";
|
|
408
|
+
readonly InvalidOrderId: "INVALID_ORDER_ID";
|
|
409
|
+
readonly OrderTooEarlyForReassignment: "ORDER_TOO_EARLY_FOR_REASSIGNMENT";
|
|
410
|
+
readonly OrderTooLateForReassignment: "ORDER_TOO_LATE_FOR_REASSIGNMENT";
|
|
411
|
+
readonly ReAssignmentNotRequired: "REASSIGNMENT_NOT_REQUIRED";
|
|
412
|
+
readonly TipAlreadyGiven: "TIP_ALREADY_GIVEN";
|
|
413
|
+
readonly CashbackTransferFailed: "CASHBACK_TRANSFER_FAILED";
|
|
414
|
+
readonly DailyBuyOrderLimitExceeded: "DAILY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
415
|
+
readonly MonthlyBuyOrderLimitExceeded: "MONTHLY_BUY_ORDER_LIMIT_EXCEEDED";
|
|
416
|
+
readonly SellOrderAmountLimitExceeded: "SELL_ORDER_AMOUNT_LIMIT_EXCEEDED";
|
|
417
|
+
readonly BuyOrderAmountExceedsLimit: "BUY_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
418
|
+
readonly SellOrderAmountExceedsLimit: "SELL_ORDER_AMOUNT_EXCEEDS_LIMIT";
|
|
419
|
+
readonly BuyAmountExceedsUsdcLimit: "BUY_AMOUNT_EXCEEDS_USDC_LIMIT";
|
|
420
|
+
readonly SellAmountExceedsFiatLimit: "SELL_AMOUNT_EXCEEDS_FIAT_LIMIT";
|
|
421
|
+
readonly DailyVolumeLimitExceeded: "DAILY_VOLUME_LIMIT_EXCEEDED";
|
|
422
|
+
readonly MonthlyVolumeLimitExceeded: "MONTHLY_VOLUME_LIMIT_EXCEEDED";
|
|
423
|
+
readonly UserYearlyVolumeLimitExceeded: "USER_YEARLY_VOLUME_LIMIT_EXCEEDED";
|
|
424
|
+
readonly DisputeTimeNotReached: "DISPUTE_TIME_NOT_REACHED";
|
|
425
|
+
readonly DisputeTimeExpired: "DISPUTE_TIME_EXPIRED";
|
|
426
|
+
readonly InvalidOrderStatusToRaiseDispute: "INVALID_ORDER_STATUS_TO_RAISE_DISPUTE";
|
|
427
|
+
readonly DisputeNotRaised: "DISPUTE_NOT_RAISED";
|
|
428
|
+
readonly CannotRaiseDisputeTwice: "CANNOT_RAISE_DISPUTE_TWICE";
|
|
429
|
+
readonly DisputeAlreadySettled: "DISPUTE_ALREADY_SETTLED";
|
|
430
|
+
readonly TransactionIdMismatch: "TRANSACTION_ID_MISMATCH";
|
|
431
|
+
readonly AccountNumberMismatch: "ACCOUNT_NUMBER_MISMATCH";
|
|
432
|
+
readonly NotPaidBuyOrder: "NOT_PAID_BUY_ORDER";
|
|
433
|
+
readonly PaymentChannelNotFound: "PAYMENT_CHANNEL_NOT_FOUND";
|
|
434
|
+
readonly PaymentChannelNotActive: "PAYMENT_CHANNEL_NOT_ACTIVE";
|
|
435
|
+
readonly PaymentChannelNotApproved: "PAYMENT_CHANNEL_NOT_APPROVED";
|
|
436
|
+
readonly PaymentChannelNotRejected: "PAYMENT_CHANNEL_NOT_REJECTED";
|
|
437
|
+
readonly InvalidPaymentChannelId: "INVALID_PAYMENT_CHANNEL_ID";
|
|
438
|
+
readonly DuplicatePaymentChannel: "DUPLICATE_PAYMENT_CHANNEL";
|
|
439
|
+
readonly OldPaymentChannelNotFound: "OLD_PAYMENT_CHANNEL_NOT_FOUND";
|
|
440
|
+
readonly NewPaymentChannelNotFound: "NEW_PAYMENT_CHANNEL_NOT_FOUND";
|
|
441
|
+
readonly SamePaymentChannel: "SAME_PAYMENT_CHANNEL";
|
|
442
|
+
readonly OldPaymentChannelShouldBeInactive: "OLD_PAYMENT_CHANNEL_SHOULD_BE_INACTIVE";
|
|
443
|
+
readonly NewPaymentChannelShouldBeActive: "NEW_PAYMENT_CHANNEL_SHOULD_BE_ACTIVE";
|
|
444
|
+
readonly OngoingOrderOnPaymentChannel: "ONGOING_ORDER_ON_PAYMENT_CHANNEL";
|
|
445
|
+
readonly UpiAlreadySent: "UPI_ALREADY_SENT";
|
|
446
|
+
readonly InvalidOrderUpi: "INVALID_ORDER_UPI";
|
|
447
|
+
readonly NoFiatLiquidity: "NO_FIAT_LIQUIDITY";
|
|
448
|
+
readonly NotEnoughEligibleMerchants: "NOT_ENOUGH_ELIGIBLE_MERCHANTS";
|
|
449
|
+
readonly MerchantNotRegistered: "MERCHANT_NOT_REGISTERED";
|
|
450
|
+
readonly MerchantNotApproved: "MERCHANT_NOT_APPROVED";
|
|
451
|
+
readonly MerchantAlreadyRegistered: "MERCHANT_ALREADY_REGISTERED";
|
|
452
|
+
readonly MerchantAlreadyRejected: "MERCHANT_ALREADY_REJECTED";
|
|
453
|
+
readonly MerchantBlacklisted: "MERCHANT_BLACKLISTED";
|
|
454
|
+
readonly MerchantNotBlacklisted: "MERCHANT_NOT_BLACKLISTED";
|
|
455
|
+
readonly MerchantAlreadyBlacklisted: "MERCHANT_ALREADY_BLACKLISTED";
|
|
456
|
+
readonly MerchantHasOngoingOrders: "MERCHANT_HAS_ONGOING_ORDERS";
|
|
457
|
+
readonly MerchantNotFullfilledEligibilityThreshold: "MERCHANT_NOT_FULLFILLED_ELIGIBILITY_THRESHOLD";
|
|
458
|
+
readonly InvalidMerchant: "INVALID_MERCHANT";
|
|
459
|
+
readonly StakeAmountTooLow: "STAKE_AMOUNT_TOO_LOW";
|
|
460
|
+
readonly AdditionalStakeNotAllowed: "ADDITIONAL_STAKE_NOT_ALLOWED";
|
|
461
|
+
readonly UnstakeRequestPending: "UNSTAKE_REQUEST_PENDING";
|
|
462
|
+
readonly UnstakeRequestNotPending: "UNSTAKE_REQUEST_NOT_PENDING";
|
|
463
|
+
readonly UnstakeAmountExceeded: "UNSTAKE_AMOUNT_EXCEEDED";
|
|
464
|
+
readonly ZeroUnstakeAmount: "ZERO_UNSTAKE_AMOUNT";
|
|
465
|
+
readonly NoWithdrawableAmount: "NO_WITHDRAWABLE_AMOUNT";
|
|
466
|
+
readonly NoStake: "NO_STAKE";
|
|
467
|
+
readonly NoStakers: "NO_STAKERS";
|
|
468
|
+
readonly InsufficientStakedAmount: "INSUFFICIENT_STAKED_AMOUNT";
|
|
469
|
+
readonly CooldownNotPassed: "COOLDOWN_NOT_PASSED";
|
|
470
|
+
readonly ClaimableRewardsNotAvailable: "CLAIMABLE_REWARDS_NOT_AVAILABLE";
|
|
471
|
+
readonly ExitWouldBreachDelegationInvariant: "EXIT_WOULD_BREACH_DELEGATION_INVARIANT";
|
|
472
|
+
readonly AggregateDelegationExceedsTotalStaked: "AGGREGATE_DELEGATION_EXCEEDS_TOTAL_STAKED";
|
|
473
|
+
readonly InsufficientMerchantRewards: "INSUFFICIENT_MERCHANT_REWARDS";
|
|
474
|
+
readonly InvalidMigrationStatus: "INVALID_MIGRATION_STATUS";
|
|
475
|
+
readonly MigrationRequestNotPending: "MIGRATION_REQUEST_NOT_PENDING";
|
|
476
|
+
readonly MigrationAlreadyRequested: "MIGRATION_ALREADY_REQUESTED";
|
|
477
|
+
readonly TokenAlreadyExists: "TOKEN_ALREADY_EXISTS";
|
|
478
|
+
readonly TokenNotFound: "TOKEN_NOT_FOUND";
|
|
479
|
+
readonly TokenEmpty: "TOKEN_EMPTY";
|
|
480
|
+
readonly CurrencyNotSupported: "CURRENCY_NOT_SUPPORTED";
|
|
481
|
+
readonly InvalidCurrency: "INVALID_CURRENCY";
|
|
482
|
+
readonly UsdtTransferFailed: "USDC_TRANSFER_FAILED";
|
|
483
|
+
readonly UsdtTransferFailedWithErrorMessage: "USDC_TRANSFER_FAILED_WITH_ERROR_MESSAGE";
|
|
484
|
+
readonly UsdtTransferFailedWithPanic: "USDC_TRANSFER_FAILED_WITH_PANIC";
|
|
485
|
+
readonly InsufficientAllowance: "INSUFFICIENT_ALLOWANCE";
|
|
486
|
+
readonly ZKPassportVerifierNotSet: "ZK_PASSPORT_VERIFIER_NOT_SET";
|
|
487
|
+
readonly ZKPassportDomainEmpty: "ZK_PASSPORT_DOMAIN_EMPTY";
|
|
488
|
+
readonly ZKPassportScopeEmpty: "ZK_PASSPORT_SCOPE_EMPTY";
|
|
489
|
+
readonly PassportAlreadyVerified: "PASSPORT_ALREADY_VERIFIED";
|
|
490
|
+
readonly ZKPassportProofInvalid: "ZK_PASSPORT_PROOF_INVALID";
|
|
491
|
+
readonly ZKPassportIdentifierAlreadyVerified: "ZK_PASSPORT_IDENTIFIER_ALREADY_VERIFIED";
|
|
492
|
+
readonly ZKPassportInvalidScope: "ZK_PASSPORT_INVALID_SCOPE";
|
|
493
|
+
readonly ZKPassportUnexpectedSender: "ZK_PASSPORT_UNEXPECTED_SENDER";
|
|
494
|
+
readonly ZKPassportAgeBelowMinimum: "ZK_PASSPORT_AGE_BELOW_MINIMUM";
|
|
495
|
+
readonly ZKPassportMinAgeTooHigh: "ZK_PASSPORT_MIN_AGE_TOO_HIGH";
|
|
496
|
+
readonly UnexpectedRequestId: "UNEXPECTED_REQUEST_ID";
|
|
497
|
+
readonly OnlyRouterCanFulfill: "ONLY_ROUTER_CAN_FULFILL";
|
|
498
|
+
readonly RequestFailed: "REQUEST_FAILED";
|
|
499
|
+
readonly SourceCodeMismatch: "SOURCE_CODE_MISMATCH";
|
|
500
|
+
readonly ZeroMarketPrice: "ZERO_MARKET_PRICE";
|
|
501
|
+
readonly InvalidComputedPrices: "INVALID_COMPUTED_PRICES";
|
|
502
|
+
readonly NotPriceUpdaterForCurrency: "NOT_PRICE_UPDATER_FOR_CURRENCY";
|
|
503
|
+
readonly ThresholdNotConfigured: "THRESHOLD_NOT_CONFIGURED";
|
|
504
|
+
readonly SlippageExceeded: "SLIPPAGE_EXCEEDED";
|
|
505
|
+
readonly UserHasNoReputation: "USER_HAS_NO_REPUTATION";
|
|
506
|
+
readonly ZeroReputationPoints: "ZERO_REPUTATION_POINTS";
|
|
507
|
+
readonly NoReputation: "NO_REPUTATION";
|
|
508
|
+
readonly InsufficientRP: "INSUFFICIENT_RP";
|
|
509
|
+
readonly NullifierAlreadyVerified: "NULLIFIER_ALREADY_VERIFIED";
|
|
510
|
+
readonly VerificationFailed: "VERIFICATION_FAILED";
|
|
511
|
+
readonly InvalidSocialPlatform: "INVALID_SOCIAL_PLATFORM";
|
|
512
|
+
readonly SocialAlreadyVerified: "SOCIAL_ALREADY_VERIFIED";
|
|
513
|
+
readonly YearFieldNotInProof: "YEAR_FIELD_NOT_IN_PROOF";
|
|
514
|
+
readonly UserIdFieldNotInProof: "USER_ID_FIELD_NOT_IN_PROOF";
|
|
515
|
+
readonly UserIdAlreadyVerified: "USER_ID_ALREADY_VERIFIED";
|
|
516
|
+
readonly UsernameAlreadyVerified: "USERNAME_ALREADY_VERIFIED";
|
|
517
|
+
readonly UsernameNotInProof: "USERNAME_NOT_IN_PROOF";
|
|
518
|
+
readonly LinkedInOnlyRpUpdates: "LINKEDIN_ONLY_RP_UPDATES";
|
|
519
|
+
readonly FacebookOnlyRpUpdates: "FACEBOOK_ONLY_RP_UPDATES";
|
|
520
|
+
readonly AlreadyReferred: "ALREADY_REFERRED";
|
|
521
|
+
readonly SelfReferralNotAllowed: "SELF_REFERRAL_NOT_ALLOWED";
|
|
522
|
+
readonly NotEligibleToRefer: "NOT_ELIGIBLE_TO_REFER";
|
|
523
|
+
readonly MerchantMonthlyReferralLimitReached: "MERCHANT_MONTHLY_REFERRAL_LIMIT_REACHED";
|
|
524
|
+
readonly NoRecommender: "NO_RECOMMENDER";
|
|
525
|
+
readonly RecommendationAlreadyClaimed: "RECOMMENDATION_ALREADY_CLAIMED";
|
|
526
|
+
readonly CannotVoteYourself: "CANNOT_VOTE_YOURSELF";
|
|
527
|
+
readonly VotesPerEpochExceeded: "VOTES_PER_EPOCH_EXCEEDED";
|
|
528
|
+
readonly AlreadyVoted: "ALREADY_VOTED";
|
|
529
|
+
readonly FunctionNotFound: "FUNCTION_NOT_FOUND";
|
|
530
|
+
readonly CampaignNotActive: "CAMPAIGN_NOT_ACTIVE";
|
|
531
|
+
readonly InvalidManagerDetails: "INVALID_MANAGER_DETAILS";
|
|
532
|
+
readonly UnclaimedRewardsExist: "UNCLAIMED_REWARDS_EXIST";
|
|
533
|
+
readonly RewardAlreadyClaimed: "REWARD_ALREADY_CLAIMED";
|
|
534
|
+
readonly OnlyNewUsersAllowed: "ONLY_NEW_USERS_ALLOWED";
|
|
535
|
+
readonly ManagerNotFound: "MANAGER_NOT_FOUND";
|
|
536
|
+
readonly ManagerInactive: "MANAGER_INACTIVE";
|
|
537
|
+
readonly NoRewards: "NO_REWARDS";
|
|
538
|
+
readonly InvalidCampaignId: "INVALID_CAMPAIGN_ID";
|
|
539
|
+
readonly CannotClaimRevenueForCurrentMonth: "CANNOT_CLAIM_REVENUE_FOR_CURRENT_MONTH";
|
|
540
|
+
readonly RewardPercentageTooHigh: "REWARD_PERCENTAGE_TOO_HIGH";
|
|
541
|
+
readonly NonceAlreadyUsed: "NONCE_ALREADY_USED";
|
|
542
|
+
readonly SignatureValidationFailed: "SIGNATURE_VALIDATION_FAILED";
|
|
543
|
+
readonly InvalidAddress: "INVALID_ADDRESS";
|
|
544
|
+
readonly InvalidBlockAmount: "INVALID_BLOCK_AMOUNT";
|
|
545
|
+
readonly InvalidAmount: "INVALID_AMOUNT";
|
|
546
|
+
readonly InvalidInput: "INVALID_INPUT";
|
|
547
|
+
readonly InvalidStatusTransition: "INVALID_STATUS_TRANSITION";
|
|
548
|
+
readonly ArrayLengthMismatch: "ARRAY_LENGTH_MISMATCH";
|
|
549
|
+
readonly UserIsBlacklisted: "USER_IS_BLACKLISTED";
|
|
550
|
+
readonly ZeroAddress: "ZERO_ADDRESS";
|
|
551
|
+
readonly ReentrancyGuard: "REENTRANCY_GUARD";
|
|
552
|
+
readonly BatchTooLarge: "BATCH_TOO_LARGE";
|
|
553
|
+
readonly UnderflowSubtraction: "UNDERFLOW_SUBTRACTION";
|
|
554
|
+
readonly TargetLongerThanData: "TARGET_LONGER_THAN_DATA";
|
|
555
|
+
};
|
|
556
|
+
type ContractErrorCode = (typeof contractErrors)[keyof typeof contractErrors];
|
|
557
|
+
/** Maps 4-byte Solidity custom error selectors to their error codes. */
|
|
558
|
+
declare const hexContractErrors: Record<string, ContractErrorCode>;
|
|
559
|
+
/**
|
|
560
|
+
* Parses an unknown contract revert into a `ContractErrorCode` string.
|
|
561
|
+
* Inspects hex selectors in `data`, `message`, and nested `cause` fields.
|
|
562
|
+
* Returns `null` if no known error is matched.
|
|
563
|
+
*/
|
|
564
|
+
declare function parseContractError(error: unknown): ContractErrorCode | null;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* English UI strings for every contract error code.
|
|
568
|
+
* Pass a `ContractErrorCode` to `getContractErrorMessage` to get a
|
|
569
|
+
* human-readable string safe to display directly in the UI.
|
|
570
|
+
*/
|
|
571
|
+
declare const contractErrorMessages: Record<ContractErrorCode, string>;
|
|
572
|
+
/**
|
|
573
|
+
* Returns a human-readable English string for the given `ContractErrorCode`,
|
|
574
|
+
* or a generic fallback message if the code is not recognised.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* const msg = getContractErrorMessage("USERNAME_ALREADY_VERIFIED");
|
|
578
|
+
* // "The social media account's username is already verified"
|
|
579
|
+
*/
|
|
580
|
+
declare function getContractErrorMessage(code: ContractErrorCode | string | null | undefined, fallback?: string): string;
|
|
581
|
+
|
|
582
|
+
interface Encrypted {
|
|
583
|
+
readonly iv: string;
|
|
584
|
+
readonly ephemPublicKey: string;
|
|
585
|
+
readonly ciphertext: string;
|
|
586
|
+
readonly mac: string;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Serializes an Encrypted object to a compact hex string.
|
|
590
|
+
* Format: IV (16 bytes) || compressed ephemPublicKey (33 bytes) || MAC (32 bytes) || ciphertext.
|
|
591
|
+
*/
|
|
592
|
+
declare function cipherStringify(encrypted: Encrypted): string;
|
|
593
|
+
/**
|
|
594
|
+
* Parses a compact hex string back into an Encrypted object.
|
|
595
|
+
* Inverse of cipherStringify.
|
|
596
|
+
*/
|
|
597
|
+
declare function cipherParse(str: string): Encrypted;
|
|
598
|
+
|
|
599
|
+
interface EncryptPaymentAddressInput {
|
|
600
|
+
readonly paymentAddress: string;
|
|
601
|
+
readonly recipientPublicKey: string;
|
|
602
|
+
readonly senderIdentity: RelayIdentity;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Signs `paymentAddress` with the sender relay identity's private key, then
|
|
606
|
+
* ECIES-encrypts the `{ message, signature }` payload for the recipient. Returns
|
|
607
|
+
* the hex-stringified ciphertext suitable for on-chain storage.
|
|
608
|
+
*/
|
|
609
|
+
declare function encryptPaymentAddress(input: EncryptPaymentAddressInput): ResultAsync<string, OrdersError>;
|
|
610
|
+
interface DecryptPaymentAddressInput {
|
|
611
|
+
readonly encrypted: string;
|
|
612
|
+
readonly recipientIdentity: RelayIdentity;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Decrypts a ciphertext produced by `encryptPaymentAddress` using the recipient
|
|
616
|
+
* relay identity's private key. Returns the plaintext payment address.
|
|
617
|
+
*/
|
|
618
|
+
declare function decryptPaymentAddress(input: DecryptPaymentAddressInput): ResultAsync<string, OrdersError>;
|
|
619
|
+
|
|
620
|
+
export { type ApproveUsdcParams, type CancelOrderParams, type ContractErrorCode, type DisputeStatus, type ExecuteBase, type FeeConfig, type GetFeeConfigParams, type GetOrderParams, type GetOrdersParams, type Order, type OrderEvent, type OrderStatus, type OrderType, type OrdersClient, type OrdersConfig, OrdersError, type OrdersErrorCode, type PaidBuyOrderAction, type PaidBuyOrderParams, type PlaceOrderParams, type PreparedTx, type PreparedTxMeta, type RaiseDisputeParams, type RelayIdentity, type RelayIdentityStore, type SetSellOrderUpiParams, type TxResult, type TxResultMeta, type WatchEventsParams, cipherParse, cipherStringify, contractErrorMessages, contractErrors, createInMemoryRelayStore, createLocalStorageRelayStore, createOrders, createRelayIdentity, decryptPaymentAddress, encryptPaymentAddress, getContractErrorMessage, hexContractErrors, parseContractError };
|