@b3dotfun/sdk 0.0.33-alpha.6 → 0.0.33-alpha.8
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.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +5 -36
- package/dist/cjs/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +17 -25
- package/dist/cjs/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/cjs/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/cjs/anyspend/types/api.d.ts +130 -14
- package/dist/cjs/anyspend/utils/chain.js +1 -1
- package/dist/cjs/anyspend/utils/format.js +1 -0
- package/dist/cjs/anyspend/utils/orderPayload.js +7 -0
- package/dist/cjs/global-account/react/index.native.d.ts +2 -1
- package/dist/cjs/global-account/react/index.native.js +5 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +6 -37
- package/dist/esm/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +17 -25
- package/dist/esm/anyspend/react/components/common/OrderStatus.js +1 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/esm/anyspend/react/hooks/useAnyspendQuote.js +1 -1
- package/dist/esm/anyspend/types/api.d.ts +130 -14
- package/dist/esm/anyspend/utils/chain.js +1 -1
- package/dist/esm/anyspend/utils/format.js +1 -0
- package/dist/esm/anyspend/utils/orderPayload.js +7 -0
- package/dist/esm/global-account/react/index.native.d.ts +2 -1
- package/dist/esm/global-account/react/index.native.js +2 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +0 -1
- package/dist/types/anyspend/react/components/common/OrderDetails.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendFlow.d.ts +3 -3
- package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +6 -6
- package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +54 -10
- package/dist/types/anyspend/types/api.d.ts +130 -14
- package/dist/types/global-account/react/index.native.d.ts +2 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +0 -2
- package/package.json +2 -2
- package/src/anyspend/react/components/AnySpend.tsx +1 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +5 -43
- package/src/anyspend/react/components/common/OrderDetails.tsx +45 -53
- package/src/anyspend/react/components/common/OrderStatus.tsx +1 -1
- package/src/anyspend/react/hooks/useAnyspendQuote.ts +1 -1
- package/src/anyspend/types/api.ts +131 -11
- package/src/anyspend/utils/chain.ts +1 -1
- package/src/anyspend/utils/format.ts +1 -0
- package/src/anyspend/utils/orderPayload.ts +7 -0
- package/src/global-account/react/index.native.ts +2 -1
- package/src/global-account/react/stores/useModalStore.ts +0 -2
|
@@ -417,18 +417,23 @@ export interface paths {
|
|
|
417
417
|
* }
|
|
418
418
|
* ]
|
|
419
419
|
*/
|
|
420
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
421
|
-
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
|
|
420
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
421
|
+
/**
|
|
422
|
+
* @description Cross-chain relay transactions
|
|
423
|
+
* @example [
|
|
424
|
+
* {
|
|
425
|
+
* "orderId": "5392f7a7-d472-4d6b-9848-bd07117fb82d",
|
|
426
|
+
* "chain": 8453,
|
|
427
|
+
* "txHash": "0x9df917e14bb089f74763d1d2662761d75c97a5a068b8a9e411c3d384c9c40d19",
|
|
428
|
+
* "status": "success",
|
|
429
|
+
* "createdAt": 1752505817654
|
|
430
|
+
* }
|
|
431
|
+
* ]
|
|
432
|
+
*/
|
|
433
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
429
434
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
430
435
|
/** @description Refund transactions if order failed */
|
|
431
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
436
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
432
437
|
};
|
|
433
438
|
/** @example 200 */
|
|
434
439
|
statusCode: number;
|
|
@@ -467,7 +472,7 @@ export interface paths {
|
|
|
467
472
|
"/orders/quote": {
|
|
468
473
|
/**
|
|
469
474
|
* Get anyspend quote
|
|
470
|
-
* @description Retrieves a quote to swap or
|
|
475
|
+
* @description Retrieves a quote to swap, execute contract, or participate in HypeDuel
|
|
471
476
|
*/
|
|
472
477
|
post: {
|
|
473
478
|
requestBody: {
|
|
@@ -591,6 +596,42 @@ export interface paths {
|
|
|
591
596
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
592
597
|
contractAddress: string;
|
|
593
598
|
fundAmount: string;
|
|
599
|
+
} | {
|
|
600
|
+
/**
|
|
601
|
+
* @description Order type for HypeDuel
|
|
602
|
+
* @enum {string}
|
|
603
|
+
*/
|
|
604
|
+
type: "hype_duel";
|
|
605
|
+
/**
|
|
606
|
+
* @description Source chain ID
|
|
607
|
+
* @example 1
|
|
608
|
+
*/
|
|
609
|
+
srcChain: number;
|
|
610
|
+
/**
|
|
611
|
+
* @description Destination chain ID
|
|
612
|
+
* @example 8453
|
|
613
|
+
*/
|
|
614
|
+
dstChain: number;
|
|
615
|
+
/**
|
|
616
|
+
* @description Source token contract address
|
|
617
|
+
* @example 0x0000000000000000000000000000000000000000
|
|
618
|
+
*/
|
|
619
|
+
srcTokenAddress: string;
|
|
620
|
+
/**
|
|
621
|
+
* @description Destination token contract address
|
|
622
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
623
|
+
*/
|
|
624
|
+
dstTokenAddress: string;
|
|
625
|
+
/**
|
|
626
|
+
* @description Amount to quote
|
|
627
|
+
* @example 1000000000000000000
|
|
628
|
+
*/
|
|
629
|
+
amount: string;
|
|
630
|
+
/**
|
|
631
|
+
* @description Optional onramp vendor
|
|
632
|
+
* @enum {string}
|
|
633
|
+
*/
|
|
634
|
+
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
594
635
|
};
|
|
595
636
|
};
|
|
596
637
|
};
|
|
@@ -1037,6 +1078,19 @@ export interface components {
|
|
|
1037
1078
|
*/
|
|
1038
1079
|
actualDstAmount: string | null;
|
|
1039
1080
|
};
|
|
1081
|
+
/** @description HypeDuel-specific payload */
|
|
1082
|
+
HypeDuelPayload: {
|
|
1083
|
+
/**
|
|
1084
|
+
* @description Expected amount of destination tokens
|
|
1085
|
+
* @example 990000
|
|
1086
|
+
*/
|
|
1087
|
+
expectedDstAmount: string;
|
|
1088
|
+
/**
|
|
1089
|
+
* @description Actual received amount (null for new orders)
|
|
1090
|
+
* @example 990000
|
|
1091
|
+
*/
|
|
1092
|
+
actualDstAmount: string | null;
|
|
1093
|
+
};
|
|
1040
1094
|
/** @description Custom execution payload */
|
|
1041
1095
|
CustomPayload: {
|
|
1042
1096
|
/**
|
|
@@ -1115,6 +1169,11 @@ export interface components {
|
|
|
1115
1169
|
srcToken: components["schemas"]["Token"];
|
|
1116
1170
|
dstToken: components["schemas"]["Token"];
|
|
1117
1171
|
};
|
|
1172
|
+
/** @description HypeDuel metadata for display purposes */
|
|
1173
|
+
HypeDuelMetadata: {
|
|
1174
|
+
srcToken: components["schemas"]["Token"];
|
|
1175
|
+
dstToken: components["schemas"]["Token"];
|
|
1176
|
+
};
|
|
1118
1177
|
/** @description Custom metadata for display purposes */
|
|
1119
1178
|
CustomMetadata: {
|
|
1120
1179
|
srcToken: components["schemas"]["Token"];
|
|
@@ -1185,7 +1244,7 @@ export interface components {
|
|
|
1185
1244
|
* @example executed
|
|
1186
1245
|
* @enum {string}
|
|
1187
1246
|
*/
|
|
1188
|
-
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executed" | "refunding" | "refunded" | "failure";
|
|
1247
|
+
status: "scanning_deposit_transaction" | "waiting_stripe_payment" | "expired" | "sending_token_from_vault" | "relay" | "executing" | "executed" | "refunding" | "refunded" | "failure";
|
|
1189
1248
|
/** @description Error details if order failed */
|
|
1190
1249
|
errorDetails: string | null;
|
|
1191
1250
|
/**
|
|
@@ -1224,6 +1283,15 @@ export interface components {
|
|
|
1224
1283
|
payload: components["schemas"]["SwapPayload"];
|
|
1225
1284
|
metadata: components["schemas"]["SwapMetadata"];
|
|
1226
1285
|
};
|
|
1286
|
+
HypeDuelOrder: components["schemas"]["BaseOrder"] & {
|
|
1287
|
+
/**
|
|
1288
|
+
* @description Order type
|
|
1289
|
+
* @enum {string}
|
|
1290
|
+
*/
|
|
1291
|
+
type: "hype_duel";
|
|
1292
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1293
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1294
|
+
};
|
|
1227
1295
|
CustomOrder: components["schemas"]["BaseOrder"] & {
|
|
1228
1296
|
/**
|
|
1229
1297
|
* @description Order type
|
|
@@ -1260,7 +1328,7 @@ export interface components {
|
|
|
1260
1328
|
payload: components["schemas"]["FundTournamentPayload"];
|
|
1261
1329
|
metadata: components["schemas"]["TournamentMetadata"];
|
|
1262
1330
|
};
|
|
1263
|
-
Order: components["schemas"]["SwapOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
|
|
1331
|
+
Order: components["schemas"]["SwapOrder"] | components["schemas"]["HypeDuelOrder"] | components["schemas"]["CustomOrder"] | components["schemas"]["MintNftOrder"] | components["schemas"]["JoinTournamentOrder"] | components["schemas"]["FundTournamentOrder"];
|
|
1264
1332
|
/** @description Swap order request */
|
|
1265
1333
|
SwapOrderRequest: {
|
|
1266
1334
|
/**
|
|
@@ -1309,6 +1377,54 @@ export interface components {
|
|
|
1309
1377
|
*/
|
|
1310
1378
|
creatorAddress?: string;
|
|
1311
1379
|
};
|
|
1380
|
+
/** @description HypeDuel order request */
|
|
1381
|
+
HypeDuelOrderRequest: {
|
|
1382
|
+
/**
|
|
1383
|
+
* @description Order type
|
|
1384
|
+
* @enum {string}
|
|
1385
|
+
*/
|
|
1386
|
+
type: "hype_duel";
|
|
1387
|
+
/**
|
|
1388
|
+
* @description Address to receive the destination tokens
|
|
1389
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1390
|
+
*/
|
|
1391
|
+
recipientAddress: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* @description Source chain ID
|
|
1394
|
+
* @example 1
|
|
1395
|
+
*/
|
|
1396
|
+
srcChain: number;
|
|
1397
|
+
/**
|
|
1398
|
+
* @description Destination chain ID
|
|
1399
|
+
* @example 8453
|
|
1400
|
+
*/
|
|
1401
|
+
dstChain: number;
|
|
1402
|
+
/**
|
|
1403
|
+
* @description Source token contract address
|
|
1404
|
+
* @example 0xA0b86a33E6441E8A91DEF8f5663ACb4C9B4a1234
|
|
1405
|
+
*/
|
|
1406
|
+
srcTokenAddress: string;
|
|
1407
|
+
/**
|
|
1408
|
+
* @description Destination token contract address
|
|
1409
|
+
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
1410
|
+
*/
|
|
1411
|
+
dstTokenAddress: string;
|
|
1412
|
+
/**
|
|
1413
|
+
* @description Amount of source tokens for HypeDuel
|
|
1414
|
+
* @example 1000000
|
|
1415
|
+
*/
|
|
1416
|
+
srcAmount: string;
|
|
1417
|
+
payload: components["schemas"]["HypeDuelPayload"];
|
|
1418
|
+
metadata: components["schemas"]["HypeDuelMetadata"];
|
|
1419
|
+
/** @description Optional partner identifier */
|
|
1420
|
+
partnerId?: string;
|
|
1421
|
+
onramp?: components["schemas"]["Onramp"];
|
|
1422
|
+
/**
|
|
1423
|
+
* @description Optional address of the order creator
|
|
1424
|
+
* @example 0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1
|
|
1425
|
+
*/
|
|
1426
|
+
creatorAddress?: string;
|
|
1427
|
+
};
|
|
1312
1428
|
/** @description Custom order request */
|
|
1313
1429
|
CustomOrderRequest: {
|
|
1314
1430
|
/**
|
|
@@ -1501,7 +1617,7 @@ export interface components {
|
|
|
1501
1617
|
*/
|
|
1502
1618
|
creatorAddress?: string;
|
|
1503
1619
|
};
|
|
1504
|
-
OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
|
|
1620
|
+
OrderRequest: components["schemas"]["SwapOrderRequest"] | components["schemas"]["HypeDuelOrderRequest"] | components["schemas"]["CustomOrderRequest"] | components["schemas"]["MintNftOrderRequest"] | components["schemas"]["JoinTournamentOrderRequest"] | components["schemas"]["FundTournamentOrderRequest"];
|
|
1505
1621
|
/** @description Deposit transaction (payment from user) */
|
|
1506
1622
|
DepositTx: {
|
|
1507
1623
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { B3Provider } from "./components/B3Provider/B3Provider.native";
|
|
2
|
-
export { useB3 } from "./components/B3Provider/useB3";
|
|
3
2
|
export { B3Context, type B3ContextType } from "./components/B3Provider/types";
|
|
3
|
+
export { useB3 } from "./components/B3Provider/useB3";
|
|
4
4
|
export { useAccountWallet } from "./hooks/useAccountWallet";
|
|
5
5
|
export { useAuthentication } from "./hooks/useAuthentication";
|
|
6
|
+
export { useProfile } from "./hooks/useProfile";
|
|
6
7
|
export { useSiwe } from "./hooks/useSiwe";
|
|
7
8
|
export { useAuthStore } from "./stores/useAuthStore";
|
|
@@ -280,8 +280,6 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
|
|
|
280
280
|
sourceTokenChainId?: number;
|
|
281
281
|
/** Payment type - crypto or fiat */
|
|
282
282
|
paymentType?: "crypto" | "fiat";
|
|
283
|
-
/** Deposit contract address */
|
|
284
|
-
depositContractAddress: string;
|
|
285
283
|
/** Main footer */
|
|
286
284
|
mainFooter?: React.ReactNode;
|
|
287
285
|
/** Callback function called when the deposit is successful */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.33-alpha.
|
|
3
|
+
"version": "0.0.33-alpha.8",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
"constants"
|
|
238
238
|
],
|
|
239
239
|
"dependencies": {
|
|
240
|
-
"@b3dotfun/b3-api": "0.0.
|
|
240
|
+
"@b3dotfun/b3-api": "0.0.48",
|
|
241
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
242
242
|
"@feathersjs/authentication-client": "5.0.33",
|
|
243
243
|
"@feathersjs/feathers": "5.0.33",
|
|
@@ -809,7 +809,7 @@ function AnySpendInner({
|
|
|
809
809
|
mode={mode}
|
|
810
810
|
order={oat.data.order}
|
|
811
811
|
depositTxs={oat.data.depositTxs}
|
|
812
|
-
|
|
812
|
+
relayTxs={oat.data.relayTxs}
|
|
813
813
|
executeTx={oat.data.executeTx}
|
|
814
814
|
refundTxs={oat.data.refundTxs}
|
|
815
815
|
onBack={() => {
|
|
@@ -654,7 +654,7 @@ function AnySpendCustomInner({
|
|
|
654
654
|
mode={mode}
|
|
655
655
|
order={oat.data.order}
|
|
656
656
|
depositTxs={oat.data.depositTxs}
|
|
657
|
-
|
|
657
|
+
relayTxs={oat.data.relayTxs}
|
|
658
658
|
executeTx={oat.data.executeTx}
|
|
659
659
|
refundTxs={oat.data.refundTxs}
|
|
660
660
|
cryptoPaymentMethod={activeTab === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { B3_TOKEN
|
|
1
|
+
import { B3_TOKEN } from "@b3dotfun/sdk/anyspend";
|
|
2
2
|
import { Button, ShinyButton, StyleRoot, TransitionPanel } from "@b3dotfun/sdk/global-account/react";
|
|
3
3
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
4
4
|
import invariant from "invariant";
|
|
5
5
|
import { motion } from "motion/react";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { toast } from "sonner";
|
|
8
|
-
import { encodeFunctionData } from "viem";
|
|
9
8
|
import { base } from "viem/chains";
|
|
10
9
|
import { PanelView, useAnyspendFlow } from "../hooks/useAnyspendFlow";
|
|
11
10
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
@@ -18,7 +17,6 @@ import { OrderStatus } from "./common/OrderStatus";
|
|
|
18
17
|
import { PaySection } from "./common/PaySection";
|
|
19
18
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
20
19
|
|
|
21
|
-
import { ESCROW_ABI } from "@b3dotfun/sdk/anyspend/abis/escrow";
|
|
22
20
|
import { ArrowDown } from "lucide-react";
|
|
23
21
|
import { PanelOnramp } from "./common/PanelOnramp";
|
|
24
22
|
|
|
@@ -29,16 +27,6 @@ export const HYPE_TOKEN_DETAILS = {
|
|
|
29
27
|
LOGO_URI: "https://cdn.hypeduel.com/hypes-coin.svg",
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
function generateEncodedDataForDepositHype(amount: string, beneficiary: string): string {
|
|
33
|
-
invariant(BigInt(amount) > 0, "Amount must be greater than zero");
|
|
34
|
-
const encodedData = encodeFunctionData({
|
|
35
|
-
abi: ESCROW_ABI,
|
|
36
|
-
functionName: "depositFor",
|
|
37
|
-
args: [beneficiary as `0x${string}`, B3_TOKEN.address as `0x${string}`, BigInt(amount)],
|
|
38
|
-
});
|
|
39
|
-
return encodedData;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
30
|
export interface AnySpendDepositHypeProps {
|
|
43
31
|
loadOrder?: string;
|
|
44
32
|
mode?: "modal" | "page";
|
|
@@ -47,7 +35,6 @@ export interface AnySpendDepositHypeProps {
|
|
|
47
35
|
sourceTokenAddress?: string;
|
|
48
36
|
sourceTokenChainId?: number;
|
|
49
37
|
onSuccess?: () => void;
|
|
50
|
-
depositContractAddress?: string;
|
|
51
38
|
mainFooter?: React.ReactNode;
|
|
52
39
|
}
|
|
53
40
|
|
|
@@ -69,7 +56,6 @@ function AnySpendDepositHypeInner({
|
|
|
69
56
|
sourceTokenAddress,
|
|
70
57
|
sourceTokenChainId,
|
|
71
58
|
onSuccess,
|
|
72
|
-
depositContractAddress,
|
|
73
59
|
mainFooter,
|
|
74
60
|
}: AnySpendDepositHypeProps) {
|
|
75
61
|
// Use shared flow hook
|
|
@@ -319,32 +305,18 @@ function AnySpendDepositHypeInner({
|
|
|
319
305
|
try {
|
|
320
306
|
invariant(anyspendQuote, "Relay price is not found");
|
|
321
307
|
invariant(selectedRecipientAddress, "Recipient address is not found");
|
|
322
|
-
invariant(depositContractAddress, "Deposit contract address is not found");
|
|
323
308
|
|
|
324
309
|
const srcAmountBigInt = BigInt(activeInputAmountInWei);
|
|
325
|
-
// TODO: temp subtract 3% for slippage
|
|
326
|
-
const originalDepositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
327
|
-
const depositAmountWei = (
|
|
328
|
-
(BigInt(originalDepositAmountWei) * BigInt(100 - SLIPPAGE_PERCENT)) /
|
|
329
|
-
BigInt(100)
|
|
330
|
-
).toString();
|
|
331
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
332
|
-
|
|
333
310
|
createOrder({
|
|
334
311
|
recipientAddress: selectedRecipientAddress,
|
|
335
|
-
orderType: "
|
|
312
|
+
orderType: "hype_duel",
|
|
336
313
|
srcChain: selectedSrcChainId,
|
|
337
314
|
dstChain: base.id,
|
|
338
315
|
srcToken: selectedSrcToken,
|
|
339
316
|
dstToken: B3_TOKEN,
|
|
340
317
|
srcAmount: srcAmountBigInt.toString(),
|
|
318
|
+
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
341
319
|
creatorAddress: globalAddress,
|
|
342
|
-
payload: {
|
|
343
|
-
amount: depositAmountWei,
|
|
344
|
-
data: encodedData,
|
|
345
|
-
to: depositContractAddress,
|
|
346
|
-
action: DEPOSIT_HYPE_ACTION,
|
|
347
|
-
},
|
|
348
320
|
});
|
|
349
321
|
} catch (err: any) {
|
|
350
322
|
console.error(err);
|
|
@@ -357,7 +329,6 @@ function AnySpendDepositHypeInner({
|
|
|
357
329
|
try {
|
|
358
330
|
invariant(anyspendQuote, "Relay price is not found");
|
|
359
331
|
invariant(selectedRecipientAddress, "Recipient address is not found");
|
|
360
|
-
invariant(depositContractAddress, "Deposit contract address is not found");
|
|
361
332
|
|
|
362
333
|
if (!srcAmount || parseFloat(srcAmount) <= 0) {
|
|
363
334
|
toast.error("Please enter a valid amount");
|
|
@@ -387,12 +358,9 @@ function AnySpendDepositHypeInner({
|
|
|
387
358
|
return;
|
|
388
359
|
}
|
|
389
360
|
|
|
390
|
-
const depositAmountWei = anyspendQuote.data?.currencyOut?.amount || "0";
|
|
391
|
-
const encodedData = generateEncodedDataForDepositHype(depositAmountWei, selectedRecipientAddress);
|
|
392
|
-
|
|
393
361
|
createOnrampOrder({
|
|
394
362
|
recipientAddress: selectedRecipientAddress,
|
|
395
|
-
orderType: "
|
|
363
|
+
orderType: "hype_duel",
|
|
396
364
|
dstChain: base.id,
|
|
397
365
|
dstToken: B3_TOKEN,
|
|
398
366
|
srcFiatAmount: srcAmount,
|
|
@@ -404,12 +372,6 @@ function AnySpendDepositHypeInner({
|
|
|
404
372
|
},
|
|
405
373
|
expectedDstAmount: anyspendQuote?.data?.currencyOut?.amount?.toString() || "0",
|
|
406
374
|
creatorAddress: globalAddress,
|
|
407
|
-
payload: {
|
|
408
|
-
amount: depositAmountWei,
|
|
409
|
-
data: encodedData,
|
|
410
|
-
to: depositContractAddress,
|
|
411
|
-
action: DEPOSIT_HYPE_ACTION,
|
|
412
|
-
},
|
|
413
375
|
});
|
|
414
376
|
} catch (err: any) {
|
|
415
377
|
console.error(err);
|
|
@@ -428,7 +390,7 @@ function AnySpendDepositHypeInner({
|
|
|
428
390
|
mode={mode}
|
|
429
391
|
order={oat.data.order}
|
|
430
392
|
depositTxs={oat.data.depositTxs}
|
|
431
|
-
|
|
393
|
+
relayTxs={oat.data.relayTxs}
|
|
432
394
|
executeTx={oat.data.executeTx}
|
|
433
395
|
refundTxs={oat.data.refundTxs}
|
|
434
396
|
cryptoPaymentMethod={paymentType === "fiat" ? CryptoPaymentMethodType.NONE : selectedCryptoPaymentMethod}
|
|
@@ -59,10 +59,10 @@ import { TransferCryptoDetails } from "./TransferCryptoDetails";
|
|
|
59
59
|
interface OrderDetailsProps {
|
|
60
60
|
mode?: "modal" | "page";
|
|
61
61
|
order: components["schemas"]["Order"];
|
|
62
|
-
depositTxs: components["schemas"]["DepositTx"][]
|
|
63
|
-
|
|
62
|
+
depositTxs: components["schemas"]["DepositTx"][];
|
|
63
|
+
relayTxs: components["schemas"]["RelayTx"][];
|
|
64
64
|
executeTx: components["schemas"]["ExecuteTx"] | null;
|
|
65
|
-
refundTxs: components["schemas"]["RefundTx"][]
|
|
65
|
+
refundTxs: components["schemas"]["RefundTx"][];
|
|
66
66
|
cryptoPaymentMethod?: CryptoPaymentMethodType; // Now optional since we read from URL
|
|
67
67
|
onBack?: () => void;
|
|
68
68
|
disableUrlParamManagement?: boolean; // When true, will not modify URL parameters
|
|
@@ -106,6 +106,9 @@ function getOrderSuccessText({
|
|
|
106
106
|
}
|
|
107
107
|
actionText = order.metadata.action || `executed contract`;
|
|
108
108
|
return `Successfully ${actionText}`;
|
|
109
|
+
case "hype_duel":
|
|
110
|
+
actionText = `deposited ${formattedActualDstAmount || "--"} HYPE`;
|
|
111
|
+
return `Successfully ${actionText} to ${recipient}`;
|
|
109
112
|
default:
|
|
110
113
|
throw new Error("Invalid order type");
|
|
111
114
|
}
|
|
@@ -200,7 +203,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
200
203
|
mode = "modal",
|
|
201
204
|
order,
|
|
202
205
|
depositTxs,
|
|
203
|
-
|
|
206
|
+
relayTxs,
|
|
204
207
|
executeTx,
|
|
205
208
|
refundTxs,
|
|
206
209
|
cryptoPaymentMethod,
|
|
@@ -556,7 +559,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
556
559
|
}
|
|
557
560
|
};
|
|
558
561
|
|
|
559
|
-
if (refundTxs) {
|
|
562
|
+
if (refundTxs.length > 0) {
|
|
560
563
|
return (
|
|
561
564
|
<>
|
|
562
565
|
<OrderDetailsCollapsible
|
|
@@ -672,13 +675,19 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
672
675
|
/>
|
|
673
676
|
))
|
|
674
677
|
: null}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
678
|
+
{relayTxs
|
|
679
|
+
? relayTxs.map(relayTx => (
|
|
680
|
+
<TransactionDetails
|
|
681
|
+
key={relayTx.txHash}
|
|
682
|
+
title="Processed Transaction"
|
|
683
|
+
chainId={relayTx.chain}
|
|
684
|
+
tx={relayTx}
|
|
685
|
+
delay={0.5}
|
|
686
|
+
isProcessing={false}
|
|
687
|
+
/>
|
|
688
|
+
))
|
|
689
|
+
: null}
|
|
690
|
+
|
|
682
691
|
<TransactionDetails
|
|
683
692
|
title={
|
|
684
693
|
order.type === "swap"
|
|
@@ -752,7 +761,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
752
761
|
);
|
|
753
762
|
}
|
|
754
763
|
|
|
755
|
-
if (
|
|
764
|
+
if (relayTxs.length > 0 && relayTxs.every(tx => tx.status === "success")) {
|
|
756
765
|
return (
|
|
757
766
|
<>
|
|
758
767
|
<OrderDetailsCollapsible
|
|
@@ -791,59 +800,42 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
791
800
|
/>
|
|
792
801
|
))
|
|
793
802
|
: null}
|
|
794
|
-
{
|
|
795
|
-
|
|
803
|
+
{relayTxs.map(relayTx => (
|
|
804
|
+
<TransactionDetails
|
|
805
|
+
title="Processed Transaction"
|
|
806
|
+
chainId={relayTx.chain}
|
|
807
|
+
isProcessing={false}
|
|
808
|
+
tx={relayTx}
|
|
809
|
+
delay={0.5}
|
|
810
|
+
/>
|
|
811
|
+
))}
|
|
812
|
+
{order.status === "executing" && (
|
|
796
813
|
<TransactionDetails
|
|
797
814
|
title={
|
|
798
815
|
order.type === "swap"
|
|
799
|
-
? "
|
|
816
|
+
? "Processing Swap"
|
|
800
817
|
: order.type === "mint_nft"
|
|
801
|
-
? "
|
|
818
|
+
? "Minting NFT"
|
|
802
819
|
: order.type === "join_tournament"
|
|
803
|
-
? "
|
|
820
|
+
? "Joining Tournament"
|
|
804
821
|
: order.type === "fund_tournament"
|
|
805
|
-
? "
|
|
806
|
-
:
|
|
822
|
+
? "Funding Tournament"
|
|
823
|
+
: order.type === "hype_duel"
|
|
824
|
+
? "Depositing Hype Duel"
|
|
825
|
+
: "Processing Bridge"
|
|
807
826
|
}
|
|
808
|
-
chainId={order.
|
|
809
|
-
isProcessing={
|
|
810
|
-
tx={
|
|
811
|
-
delay={
|
|
827
|
+
chainId={order.dstChain}
|
|
828
|
+
isProcessing={true}
|
|
829
|
+
tx={null}
|
|
830
|
+
delay={1}
|
|
812
831
|
/>
|
|
813
|
-
) : (
|
|
814
|
-
<>
|
|
815
|
-
<TransactionDetails
|
|
816
|
-
title="Processed Transaction"
|
|
817
|
-
chainId={order.srcChain}
|
|
818
|
-
isProcessing={false}
|
|
819
|
-
tx={relayTx}
|
|
820
|
-
delay={0.5}
|
|
821
|
-
/>
|
|
822
|
-
<TransactionDetails
|
|
823
|
-
title={
|
|
824
|
-
order.type === "swap"
|
|
825
|
-
? "Processing Swap"
|
|
826
|
-
: order.type === "mint_nft"
|
|
827
|
-
? "Minting NFT"
|
|
828
|
-
: order.type === "join_tournament"
|
|
829
|
-
? "Joining Tournament"
|
|
830
|
-
: order.type === "fund_tournament"
|
|
831
|
-
? "Funding Tournament"
|
|
832
|
-
: "Processing Bridge"
|
|
833
|
-
}
|
|
834
|
-
chainId={order.dstChain}
|
|
835
|
-
isProcessing={true}
|
|
836
|
-
tx={executeTx}
|
|
837
|
-
delay={1}
|
|
838
|
-
/>
|
|
839
|
-
</>
|
|
840
832
|
)}
|
|
841
833
|
</div>
|
|
842
834
|
</AccordionContent>
|
|
843
835
|
</AccordionItem>
|
|
844
836
|
</Accordion>
|
|
845
837
|
|
|
846
|
-
<div className="flex w-full flex-col gap-8">
|
|
838
|
+
{/* <div className="flex w-full flex-col gap-8">
|
|
847
839
|
<Button variant="link" asChild>
|
|
848
840
|
<a
|
|
849
841
|
href={getExplorerTxUrl(order.dstChain, relayTx.txHash)}
|
|
@@ -862,7 +854,7 @@ export const OrderDetails = memo(function OrderDetails({
|
|
|
862
854
|
<ExternalLink className="ml-2 h-4 w-4" />
|
|
863
855
|
</a>
|
|
864
856
|
</Button>
|
|
865
|
-
</div>
|
|
857
|
+
</div> */}
|
|
866
858
|
|
|
867
859
|
{order.type === "join_tournament" && order.status === "executed" && (
|
|
868
860
|
<ShinyButton
|
|
@@ -41,7 +41,7 @@ export const OrderStatus = memo(function OrderStatus({
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (["relay", "sending_token_from_vault"].includes(order.status)) {
|
|
44
|
+
if (["relay", "executing", "sending_token_from_vault"].includes(order.status)) {
|
|
45
45
|
return <StepProgress steps={paymentSteps} currentStepIndex={1} />;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -27,7 +27,7 @@ export function useAnyspendQuote(req: GetQuoteRequest): UseAnyspendQuoteResult {
|
|
|
27
27
|
req.srcTokenAddress &&
|
|
28
28
|
req.dstTokenAddress &&
|
|
29
29
|
BigInt(
|
|
30
|
-
req.type === "swap"
|
|
30
|
+
req.type === "swap" || req.type === "hype_duel"
|
|
31
31
|
? req.amount
|
|
32
32
|
: req.type === "mint_nft"
|
|
33
33
|
? req.price
|