@b3dotfun/sdk 0.0.86 → 0.0.87-alpha.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/dist/cjs/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +59 -49
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +190 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/cjs/anyspend/react/components/QRDeposit.js +146 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/cjs/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/cjs/anyspend/react/components/common/WarningText.js +36 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/CreditCardIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/icons/QrCodeIcon.js +6 -0
- package/dist/cjs/anyspend/react/components/index.d.ts +2 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/cjs/anyspend/react/hooks/useCreateDepositFirstOrder.js +86 -0
- package/dist/cjs/anyspend/types/api.d.ts +65 -3
- package/dist/cjs/anyspend/utils/format.js +28 -5
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +59 -49
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/esm/anyspend/react/components/AnySpendDeposit.js +187 -0
- package/dist/esm/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/esm/anyspend/react/components/QRDeposit.js +143 -0
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -12
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/esm/anyspend/react/components/common/OrderDetailsCollapsible.js +12 -5
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +2 -2
- package/dist/esm/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/esm/anyspend/react/components/common/WarningText.js +32 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/CreditCardIcon.js +2 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/esm/anyspend/react/components/icons/QrCodeIcon.js +2 -0
- package/dist/esm/anyspend/react/components/index.d.ts +2 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +35 -11
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/esm/anyspend/react/hooks/useCreateDepositFirstOrder.js +83 -0
- package/dist/esm/anyspend/types/api.d.ts +65 -3
- package/dist/esm/anyspend/utils/format.js +28 -5
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +4 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +5 -0
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -1
- package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +122 -0
- package/dist/types/anyspend/react/components/QRDeposit.d.ts +43 -0
- package/dist/types/anyspend/react/components/common/OrderDetailsCollapsible.d.ts +2 -0
- package/dist/types/anyspend/react/components/common/WarningText.d.ts +32 -0
- package/dist/types/anyspend/react/components/icons/CreditCardIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/icons/QrCodeIcon.d.ts +6 -0
- package/dist/types/anyspend/react/components/index.d.ts +2 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +2 -2
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +76 -16
- package/dist/types/anyspend/react/hooks/useCreateDepositFirstOrder.d.ts +24 -0
- package/dist/types/anyspend/types/api.d.ts +65 -3
- package/dist/types/global-account/react/stores/useModalStore.d.ts +4 -0
- package/package.json +3 -3
- package/src/anyspend/react/components/AnySpend.tsx +68 -45
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +2 -3
- package/src/anyspend/react/components/AnySpendDeposit.tsx +578 -0
- package/src/anyspend/react/components/QRDeposit.tsx +348 -0
- package/src/anyspend/react/components/common/OrderDetails.tsx +26 -8
- package/src/anyspend/react/components/common/OrderDetailsCollapsible.tsx +20 -8
- package/src/anyspend/react/components/common/OrderStatus.tsx +2 -2
- package/src/anyspend/react/components/common/WarningText.tsx +52 -0
- package/src/anyspend/react/components/icons/CreditCardIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/QrCodeIcon.tsx +25 -0
- package/src/anyspend/react/components/icons/credit-card.svg +5 -0
- package/src/anyspend/react/components/icons/qr-code.svg +5 -0
- package/src/anyspend/react/components/index.ts +2 -0
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +37 -12
- package/src/anyspend/react/hooks/useCreateDepositFirstOrder.ts +110 -0
- package/src/anyspend/types/api.ts +67 -2
- package/src/anyspend/utils/format.ts +33 -5
- package/src/global-account/react/stores/useModalStore.ts +4 -0
- package/src/styles/index.css +2 -0
|
@@ -8,7 +8,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
8
8
|
srcTokenAddress: string;
|
|
9
9
|
dstTokenAddress: string;
|
|
10
10
|
srcAmount: string;
|
|
11
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
11
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
12
12
|
errorDetails: string | null;
|
|
13
13
|
createdAt: number;
|
|
14
14
|
expiredAt: number;
|
|
@@ -38,7 +38,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
38
38
|
srcTokenAddress: string;
|
|
39
39
|
dstTokenAddress: string;
|
|
40
40
|
srcAmount: string;
|
|
41
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
41
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
42
42
|
errorDetails: string | null;
|
|
43
43
|
createdAt: number;
|
|
44
44
|
expiredAt: number;
|
|
@@ -68,7 +68,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
68
68
|
srcTokenAddress: string;
|
|
69
69
|
dstTokenAddress: string;
|
|
70
70
|
srcAmount: string;
|
|
71
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
71
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
72
72
|
errorDetails: string | null;
|
|
73
73
|
createdAt: number;
|
|
74
74
|
expiredAt: number;
|
|
@@ -98,7 +98,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
98
98
|
srcTokenAddress: string;
|
|
99
99
|
dstTokenAddress: string;
|
|
100
100
|
srcAmount: string;
|
|
101
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
101
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
102
102
|
errorDetails: string | null;
|
|
103
103
|
createdAt: number;
|
|
104
104
|
expiredAt: number;
|
|
@@ -128,7 +128,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
128
128
|
srcTokenAddress: string;
|
|
129
129
|
dstTokenAddress: string;
|
|
130
130
|
srcAmount: string;
|
|
131
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
131
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
132
132
|
errorDetails: string | null;
|
|
133
133
|
createdAt: number;
|
|
134
134
|
expiredAt: number;
|
|
@@ -158,7 +158,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
158
158
|
srcTokenAddress: string;
|
|
159
159
|
dstTokenAddress: string;
|
|
160
160
|
srcAmount: string;
|
|
161
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
161
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
162
162
|
errorDetails: string | null;
|
|
163
163
|
createdAt: number;
|
|
164
164
|
expiredAt: number;
|
|
@@ -188,7 +188,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
188
188
|
srcTokenAddress: string;
|
|
189
189
|
dstTokenAddress: string;
|
|
190
190
|
srcAmount: string;
|
|
191
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
191
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
192
192
|
errorDetails: string | null;
|
|
193
193
|
createdAt: number;
|
|
194
194
|
expiredAt: number;
|
|
@@ -218,7 +218,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
218
218
|
srcTokenAddress: string;
|
|
219
219
|
dstTokenAddress: string;
|
|
220
220
|
srcAmount: string;
|
|
221
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
221
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
222
222
|
errorDetails: string | null;
|
|
223
223
|
createdAt: number;
|
|
224
224
|
expiredAt: number;
|
|
@@ -239,6 +239,36 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
239
239
|
type: "fund_tournament";
|
|
240
240
|
payload: import("../..").components["schemas"]["FundTournamentPayload"];
|
|
241
241
|
metadata: import("../..").components["schemas"]["TournamentMetadata"];
|
|
242
|
+
}) | ({
|
|
243
|
+
id: string;
|
|
244
|
+
recipientAddress: string;
|
|
245
|
+
globalAddress: string;
|
|
246
|
+
srcChain: number;
|
|
247
|
+
dstChain: number;
|
|
248
|
+
srcTokenAddress: string;
|
|
249
|
+
dstTokenAddress: string;
|
|
250
|
+
srcAmount: string;
|
|
251
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
252
|
+
errorDetails: string | null;
|
|
253
|
+
createdAt: number;
|
|
254
|
+
expiredAt: number;
|
|
255
|
+
filledAt: number | null;
|
|
256
|
+
receivedDepositAt: number | null;
|
|
257
|
+
creatorAddress: string | null;
|
|
258
|
+
partnerId: string | null;
|
|
259
|
+
clientReferenceId?: string | null;
|
|
260
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
261
|
+
oneClickBuyUrl: string | null;
|
|
262
|
+
stripePaymentIntentId: string | null;
|
|
263
|
+
settlement: {
|
|
264
|
+
actualDstAmount?: string;
|
|
265
|
+
relay?: Record<string, never>;
|
|
266
|
+
} | null;
|
|
267
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
268
|
+
} & {
|
|
269
|
+
type: "deposit_first";
|
|
270
|
+
payload: import("../..").components["schemas"]["DepositFirstPayload"];
|
|
271
|
+
metadata: import("../..").components["schemas"]["DepositFirstMetadata"];
|
|
242
272
|
}))[];
|
|
243
273
|
isLoadingOrderHistory: boolean;
|
|
244
274
|
getOrderHistoryError: Error | null;
|
|
@@ -251,7 +281,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
251
281
|
srcTokenAddress: string;
|
|
252
282
|
dstTokenAddress: string;
|
|
253
283
|
srcAmount: string;
|
|
254
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
284
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
255
285
|
errorDetails: string | null;
|
|
256
286
|
createdAt: number;
|
|
257
287
|
expiredAt: number;
|
|
@@ -281,7 +311,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
281
311
|
srcTokenAddress: string;
|
|
282
312
|
dstTokenAddress: string;
|
|
283
313
|
srcAmount: string;
|
|
284
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
314
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
285
315
|
errorDetails: string | null;
|
|
286
316
|
createdAt: number;
|
|
287
317
|
expiredAt: number;
|
|
@@ -311,7 +341,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
311
341
|
srcTokenAddress: string;
|
|
312
342
|
dstTokenAddress: string;
|
|
313
343
|
srcAmount: string;
|
|
314
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
344
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
315
345
|
errorDetails: string | null;
|
|
316
346
|
createdAt: number;
|
|
317
347
|
expiredAt: number;
|
|
@@ -341,7 +371,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
341
371
|
srcTokenAddress: string;
|
|
342
372
|
dstTokenAddress: string;
|
|
343
373
|
srcAmount: string;
|
|
344
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
374
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
345
375
|
errorDetails: string | null;
|
|
346
376
|
createdAt: number;
|
|
347
377
|
expiredAt: number;
|
|
@@ -371,7 +401,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
371
401
|
srcTokenAddress: string;
|
|
372
402
|
dstTokenAddress: string;
|
|
373
403
|
srcAmount: string;
|
|
374
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
404
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
375
405
|
errorDetails: string | null;
|
|
376
406
|
createdAt: number;
|
|
377
407
|
expiredAt: number;
|
|
@@ -401,7 +431,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
401
431
|
srcTokenAddress: string;
|
|
402
432
|
dstTokenAddress: string;
|
|
403
433
|
srcAmount: string;
|
|
404
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
434
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
405
435
|
errorDetails: string | null;
|
|
406
436
|
createdAt: number;
|
|
407
437
|
expiredAt: number;
|
|
@@ -431,7 +461,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
431
461
|
srcTokenAddress: string;
|
|
432
462
|
dstTokenAddress: string;
|
|
433
463
|
srcAmount: string;
|
|
434
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
464
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
435
465
|
errorDetails: string | null;
|
|
436
466
|
createdAt: number;
|
|
437
467
|
expiredAt: number;
|
|
@@ -461,7 +491,7 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
461
491
|
srcTokenAddress: string;
|
|
462
492
|
dstTokenAddress: string;
|
|
463
493
|
srcAmount: string;
|
|
464
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
494
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
465
495
|
errorDetails: string | null;
|
|
466
496
|
createdAt: number;
|
|
467
497
|
expiredAt: number;
|
|
@@ -482,5 +512,35 @@ export declare function useAnyspendOrderHistory(creatorAddress: string | undefin
|
|
|
482
512
|
type: "fund_tournament";
|
|
483
513
|
payload: import("../..").components["schemas"]["FundTournamentPayload"];
|
|
484
514
|
metadata: import("../..").components["schemas"]["TournamentMetadata"];
|
|
515
|
+
}) | ({
|
|
516
|
+
id: string;
|
|
517
|
+
recipientAddress: string;
|
|
518
|
+
globalAddress: string;
|
|
519
|
+
srcChain: number;
|
|
520
|
+
dstChain: number;
|
|
521
|
+
srcTokenAddress: string;
|
|
522
|
+
dstTokenAddress: string;
|
|
523
|
+
srcAmount: string;
|
|
524
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
525
|
+
errorDetails: string | null;
|
|
526
|
+
createdAt: number;
|
|
527
|
+
expiredAt: number;
|
|
528
|
+
filledAt: number | null;
|
|
529
|
+
receivedDepositAt: number | null;
|
|
530
|
+
creatorAddress: string | null;
|
|
531
|
+
partnerId: string | null;
|
|
532
|
+
clientReferenceId?: string | null;
|
|
533
|
+
onrampMetadata: import("../..").components["schemas"]["OnrampMetadata"] | null;
|
|
534
|
+
oneClickBuyUrl: string | null;
|
|
535
|
+
stripePaymentIntentId: string | null;
|
|
536
|
+
settlement: {
|
|
537
|
+
actualDstAmount?: string;
|
|
538
|
+
relay?: Record<string, never>;
|
|
539
|
+
} | null;
|
|
540
|
+
fee?: Omit<import("../..").components["schemas"]["Fee"], "type"> | null;
|
|
541
|
+
} & {
|
|
542
|
+
type: "deposit_first";
|
|
543
|
+
payload: import("../..").components["schemas"]["DepositFirstPayload"];
|
|
544
|
+
metadata: import("../..").components["schemas"]["DepositFirstMetadata"];
|
|
485
545
|
}))[], Error>>;
|
|
486
546
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { components } from "../../../anyspend/types/api";
|
|
2
|
+
import { DepositContractConfig } from "../components/AnySpendDeposit";
|
|
3
|
+
export type CreateDepositFirstOrderParams = {
|
|
4
|
+
recipientAddress: string;
|
|
5
|
+
srcChain: number;
|
|
6
|
+
dstChain: number;
|
|
7
|
+
srcToken: components["schemas"]["Token"];
|
|
8
|
+
dstToken: components["schemas"]["Token"];
|
|
9
|
+
creatorAddress?: string;
|
|
10
|
+
/** Optional contract config for custom execution after deposit */
|
|
11
|
+
contractConfig?: DepositContractConfig;
|
|
12
|
+
};
|
|
13
|
+
export type UseCreateDepositFirstOrderProps = {
|
|
14
|
+
onSuccess?: (data: any) => void;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
19
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCreateDepositFirstOrder({ onSuccess, onError }?: UseCreateDepositFirstOrderProps): {
|
|
22
|
+
createOrder: import("@tanstack/react-query").UseMutateFunction<any, Error, CreateDepositFirstOrderParams, unknown>;
|
|
23
|
+
isCreatingOrder: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { anyspendService } from "../../../anyspend/services/anyspend.js";
|
|
2
|
+
import { normalizeAddress } from "../../../anyspend/utils/index.js";
|
|
3
|
+
import { useB3 } from "../../../global-account/react/index.js";
|
|
4
|
+
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
5
|
+
import { useMutation } from "@tanstack/react-query";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
/**
|
|
8
|
+
* Hook for creating deposit_first orders in the Anyspend protocol.
|
|
9
|
+
* This order type doesn't require srcAmount - the user deposits tokens after the order is created.
|
|
10
|
+
*/
|
|
11
|
+
export function useCreateDepositFirstOrder({ onSuccess, onError } = {}) {
|
|
12
|
+
const { partnerId } = useB3();
|
|
13
|
+
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
14
|
+
const visitorData = fpData && {
|
|
15
|
+
requestId: fpData.requestId,
|
|
16
|
+
visitorId: fpData.visitorId,
|
|
17
|
+
};
|
|
18
|
+
const { mutate: createOrder, isPending } = useMutation({
|
|
19
|
+
mutationFn: async (params) => {
|
|
20
|
+
const { recipientAddress, srcChain, dstChain, srcToken, dstToken, creatorAddress, contractConfig } = params;
|
|
21
|
+
// Build payload based on whether we have a contract config
|
|
22
|
+
const payload = contractConfig
|
|
23
|
+
? {
|
|
24
|
+
functionAbi: contractConfig.functionAbi,
|
|
25
|
+
functionName: contractConfig.functionName,
|
|
26
|
+
functionArgs: contractConfig.functionArgs,
|
|
27
|
+
to: normalizeAddress(contractConfig.to),
|
|
28
|
+
spenderAddress: contractConfig.spenderAddress ? normalizeAddress(contractConfig.spenderAddress) : undefined,
|
|
29
|
+
action: contractConfig.action,
|
|
30
|
+
}
|
|
31
|
+
: {};
|
|
32
|
+
try {
|
|
33
|
+
return await anyspendService.createOrder({
|
|
34
|
+
recipientAddress: normalizeAddress(recipientAddress),
|
|
35
|
+
type: "deposit_first",
|
|
36
|
+
srcChain,
|
|
37
|
+
dstChain,
|
|
38
|
+
srcTokenAddress: normalizeAddress(srcToken.address),
|
|
39
|
+
dstTokenAddress: normalizeAddress(dstToken.address),
|
|
40
|
+
srcAmount: "", // Not required for deposit_first
|
|
41
|
+
payload,
|
|
42
|
+
metadata: {
|
|
43
|
+
srcToken: {
|
|
44
|
+
chainId: srcToken.chainId,
|
|
45
|
+
address: srcToken.address,
|
|
46
|
+
symbol: srcToken.symbol,
|
|
47
|
+
name: srcToken.name,
|
|
48
|
+
decimals: srcToken.decimals,
|
|
49
|
+
metadata: srcToken.metadata || {},
|
|
50
|
+
},
|
|
51
|
+
dstToken: {
|
|
52
|
+
chainId: dstToken.chainId,
|
|
53
|
+
address: dstToken.address,
|
|
54
|
+
symbol: dstToken.symbol,
|
|
55
|
+
name: dstToken.name,
|
|
56
|
+
decimals: dstToken.decimals,
|
|
57
|
+
metadata: dstToken.metadata || {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
61
|
+
partnerId,
|
|
62
|
+
visitorData,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error?.data) {
|
|
67
|
+
throw error.data;
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onSuccess: (data) => {
|
|
73
|
+
onSuccess?.(data);
|
|
74
|
+
},
|
|
75
|
+
onError: (error) => {
|
|
76
|
+
onError?.(error);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return useMemo(() => ({
|
|
80
|
+
createOrder,
|
|
81
|
+
isCreatingOrder: isPending,
|
|
82
|
+
}), [createOrder, isPending]);
|
|
83
|
+
}
|
|
@@ -1952,6 +1952,15 @@ export interface components {
|
|
|
1952
1952
|
*/
|
|
1953
1953
|
fundAmount: string;
|
|
1954
1954
|
};
|
|
1955
|
+
/** @description DepositFirst payload - empty at creation time, details determined after deposit is detected */
|
|
1956
|
+
DepositFirstPayload: Record<string, never>;
|
|
1957
|
+
/** @description DepositFirst metadata for display purposes */
|
|
1958
|
+
DepositFirstMetadata: {
|
|
1959
|
+
/** @description Token accepted for deposit */
|
|
1960
|
+
srcToken: components["schemas"]["Token"];
|
|
1961
|
+
/** @description Token to swap to after deposit */
|
|
1962
|
+
dstToken: components["schemas"]["Token"];
|
|
1963
|
+
};
|
|
1955
1964
|
/** @description Swap metadata for display purposes */
|
|
1956
1965
|
SwapMetadata: {
|
|
1957
1966
|
srcToken: components["schemas"]["Token"];
|
|
@@ -2037,7 +2046,7 @@ export interface components {
|
|
|
2037
2046
|
* @example executed
|
|
2038
2047
|
* @enum {string}
|
|
2039
2048
|
*/
|
|
2040
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
2049
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "quoting_after_deposit" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
2041
2050
|
/** @description Error details if order failed */
|
|
2042
2051
|
errorDetails: string | null;
|
|
2043
2052
|
/**
|
|
@@ -2167,7 +2176,16 @@ export interface components {
|
|
|
2167
2176
|
payload: components["schemas"]["FundTournamentPayload"];
|
|
2168
2177
|
metadata: components["schemas"]["TournamentMetadata"];
|
|
2169
2178
|
};
|
|
2170
|
-
|
|
2179
|
+
DepositFirstOrder: components["schemas"]["BaseOrder"] & {
|
|
2180
|
+
/**
|
|
2181
|
+
* @description Order type for deposit-first flow where amount is determined after deposit
|
|
2182
|
+
* @enum {string}
|
|
2183
|
+
*/
|
|
2184
|
+
type: "deposit_first";
|
|
2185
|
+
payload: components["schemas"]["DepositFirstPayload"];
|
|
2186
|
+
metadata: components["schemas"]["DepositFirstMetadata"];
|
|
2187
|
+
};
|
|
2188
|
+
Order: components["schemas"]["SwapOrder"] | components["schemas"]["X402SwapOrder"] | components["schemas"]["HypeDuelOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["CustomExactInOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"] | components["schemas"]["DepositFirstOrder"];
|
|
2171
2189
|
/** @description Swap order request */
|
|
2172
2190
|
SwapOrderRequest: {
|
|
2173
2191
|
/**
|
|
@@ -2568,7 +2586,51 @@ export interface components {
|
|
|
2568
2586
|
*/
|
|
2569
2587
|
creatorAddress?: string;
|
|
2570
2588
|
};
|
|
2571
|
-
|
|
2589
|
+
/** @description Deposit-first order request. The srcAmount is determined after deposit is detected, so it is not required at creation time. This flow does not support onramp - users deposit crypto directly. */
|
|
2590
|
+
DepositFirstOrderRequest: {
|
|
2591
|
+
/**
|
|
2592
|
+
* @description Order type for deposit-first flow
|
|
2593
|
+
* @enum {string}
|
|
2594
|
+
*/
|
|
2595
|
+
type: "deposit_first";
|
|
2596
|
+
/**
|
|
2597
|
+
* @description Address to receive the destination tokens after swap
|
|
2598
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
2599
|
+
*/
|
|
2600
|
+
recipientAddress: string;
|
|
2601
|
+
/**
|
|
2602
|
+
* @description Source chain ID where deposit will be made
|
|
2603
|
+
* @example 8453
|
|
2604
|
+
*/
|
|
2605
|
+
srcChain: number;
|
|
2606
|
+
/**
|
|
2607
|
+
* @description Destination chain ID for the swap
|
|
2608
|
+
* @example 8453
|
|
2609
|
+
*/
|
|
2610
|
+
dstChain: number;
|
|
2611
|
+
/**
|
|
2612
|
+
* @description Token contract address that will be deposited
|
|
2613
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
2614
|
+
*/
|
|
2615
|
+
srcTokenAddress: string;
|
|
2616
|
+
/**
|
|
2617
|
+
* @description Token contract address to receive after swap
|
|
2618
|
+
* @example 0x0000000000000000000000000000000000000000
|
|
2619
|
+
*/
|
|
2620
|
+
dstTokenAddress: string;
|
|
2621
|
+
payload: components["schemas"]["DepositFirstPayload"];
|
|
2622
|
+
metadata: components["schemas"]["DepositFirstMetadata"];
|
|
2623
|
+
/** @description Optional partner identifier */
|
|
2624
|
+
partnerId?: string;
|
|
2625
|
+
/** @description Optional client reference identifier for tracking purposes (alphanumeric, hyphens, and underscores only, max 255 chars) */
|
|
2626
|
+
clientReferenceId?: string;
|
|
2627
|
+
/**
|
|
2628
|
+
* @description Optional address of the order creator
|
|
2629
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
2630
|
+
*/
|
|
2631
|
+
creatorAddress?: string;
|
|
2632
|
+
};
|
|
2633
|
+
OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["X402SwapOrderRequest"] | components["schemas"]["HypeDuelOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["CustomExactInOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"] | components["schemas"]["DepositFirstOrderRequest"];
|
|
2572
2634
|
/** @description Deposit transaction (payment from user) */
|
|
2573
2635
|
DepositTx: {
|
|
2574
2636
|
/**
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { formatTokenAmount } from "../../shared/utils/number.js";
|
|
1
2
|
export const getStatusDisplay = (order) => {
|
|
3
|
+
const srcToken = order.metadata?.srcToken;
|
|
4
|
+
const dstToken = order.metadata?.dstToken;
|
|
5
|
+
const formattedSrcAmount = srcToken ? formatTokenAmount(BigInt(order.srcAmount), srcToken.decimals) : undefined;
|
|
6
|
+
const actualDstAmount = order.settlement?.actualDstAmount;
|
|
7
|
+
const formattedActualDstAmount = actualDstAmount && dstToken ? formatTokenAmount(BigInt(actualDstAmount), dstToken.decimals) : undefined;
|
|
2
8
|
switch (order.status) {
|
|
3
|
-
case "scanning_deposit_transaction":
|
|
9
|
+
case "scanning_deposit_transaction": {
|
|
10
|
+
const depositText = formattedSrcAmount && srcToken
|
|
11
|
+
? `Awaiting ${formattedSrcAmount} ${srcToken.symbol}`
|
|
12
|
+
: order.onrampMetadata
|
|
13
|
+
? "Awaiting Payment"
|
|
14
|
+
: "Awaiting Deposit";
|
|
4
15
|
return {
|
|
5
|
-
text:
|
|
16
|
+
text: depositText,
|
|
6
17
|
status: "processing",
|
|
7
18
|
};
|
|
19
|
+
}
|
|
8
20
|
case "waiting_stripe_payment":
|
|
9
21
|
return {
|
|
10
22
|
text: "Awaiting Payment",
|
|
@@ -27,15 +39,16 @@ export const getStatusDisplay = (order) => {
|
|
|
27
39
|
description: "It will take approximately one minute to complete.",
|
|
28
40
|
};
|
|
29
41
|
case "executed": {
|
|
42
|
+
const receivedText = formattedActualDstAmount && dstToken ? `Received ${formattedActualDstAmount} ${dstToken.symbol}` : undefined;
|
|
30
43
|
const { text, description } = order.type === "swap"
|
|
31
|
-
? { text: "Swap Complete", description: "Your swap has been completed successfully." }
|
|
44
|
+
? { text: receivedText || "Swap Complete", description: "Your swap has been completed successfully." }
|
|
32
45
|
: order.type === "mint_nft"
|
|
33
46
|
? { text: "NFT Minted", description: "Your NFT has been minted" }
|
|
34
47
|
: order.type === "join_tournament"
|
|
35
48
|
? { text: "Tournament Joined", description: "You have joined the tournament" }
|
|
36
49
|
: order.type === "fund_tournament"
|
|
37
50
|
? { text: "Tournament Funded", description: "You have funded the tournament" }
|
|
38
|
-
: { text: "Order Complete", description: "Your order has been completed" };
|
|
51
|
+
: { text: receivedText || "Order Complete", description: "Your order has been completed" };
|
|
39
52
|
return { text, status: "success", description };
|
|
40
53
|
}
|
|
41
54
|
case "refunding":
|
|
@@ -48,8 +61,18 @@ export const getStatusDisplay = (order) => {
|
|
|
48
61
|
status: "failure",
|
|
49
62
|
description: "This order has failed. Please try again or contact support.",
|
|
50
63
|
};
|
|
64
|
+
case "quoting_after_deposit": {
|
|
65
|
+
return {
|
|
66
|
+
text: "Quoting After Deposit",
|
|
67
|
+
status: "processing",
|
|
68
|
+
description: "Getting quote for the order",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
51
71
|
default:
|
|
52
|
-
|
|
72
|
+
return {
|
|
73
|
+
text: order.status,
|
|
74
|
+
status: "processing",
|
|
75
|
+
};
|
|
53
76
|
}
|
|
54
77
|
};
|
|
55
78
|
export const getErrorDisplay = (errorDetails) => {
|
|
@@ -144,6 +144,10 @@ export interface AnySpendModalProps extends BaseModalProps {
|
|
|
144
144
|
customUsdInputValues?: string[];
|
|
145
145
|
/** Client-provided reference ID for tracking orders */
|
|
146
146
|
clientReferenceId?: string;
|
|
147
|
+
/** Whether to hide the header */
|
|
148
|
+
hideHeader?: boolean;
|
|
149
|
+
/** When true, disables URL parameter management for swap configuration */
|
|
150
|
+
disableUrlParamManagement?: boolean;
|
|
147
151
|
}
|
|
148
152
|
/**
|
|
149
153
|
* Props for the AnySpend NFT modal
|