@b3dotfun/sdk 0.0.70-alpha.1 → 0.0.70-alpha.2
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 +0 -6
- package/dist/cjs/anyspend/react/components/AnySpend.js +1 -13
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +82 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/cjs/anyspend/react/components/AnySpendTournament.js +1 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -2
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/cjs/anyspend/react/hooks/useValidatedClientReferenceId.js +35 -0
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +23 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -13
- package/dist/esm/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +79 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -3
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +1 -3
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendDepositUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3ExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/esm/anyspend/react/components/AnySpendTournament.js +1 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +2 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -2
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +5 -2
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/esm/anyspend/react/hooks/useValidatedClientReferenceId.js +32 -0
- package/dist/esm/global-account/react/components/B3DynamicModal.js +3 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +4 -3
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/types.js +1 -0
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +23 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +0 -6
- package/dist/types/anyspend/react/components/AnySpendBondKit.d.ts +1 -3
- package/dist/types/anyspend/react/components/AnySpendBuySpin.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +57 -0
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +0 -1
- package/dist/types/anyspend/react/components/AnySpendDepositUpside.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeB3.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeB3ExactIn.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnySpendTournament.d.ts +0 -2
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +1 -2
- package/dist/types/anyspend/react/components/AnyspendSignatureMint.d.ts +1 -2
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +0 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/anyspend/react/hooks/useValidatedClientReferenceId.d.ts +5 -0
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +4 -2
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +23 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +0 -23
- package/src/anyspend/react/components/AnySpendBondKit.tsx +1 -3
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -3
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +178 -0
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -5
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +0 -4
- package/src/anyspend/react/components/AnySpendDepositUpside.tsx +0 -3
- package/src/anyspend/react/components/AnySpendNFT.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeB3ExactIn.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeUpside.tsx +0 -3
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +0 -3
- package/src/anyspend/react/components/AnySpendTournament.tsx +0 -3
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +0 -3
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +0 -3
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +5 -2
- package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +6 -13
- package/src/anyspend/react/hooks/useValidatedClientReferenceId.ts +40 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +3 -0
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
- package/src/global-account/react/components/B3Provider/types.ts +2 -0
- package/src/global-account/react/stores/useModalStore.ts +25 -1
|
@@ -57,7 +57,6 @@ export interface AnySpendCustomExactInProps {
|
|
|
57
57
|
anyspendPrice: GetQuoteResponse | undefined;
|
|
58
58
|
isLoadingAnyspendPrice: boolean;
|
|
59
59
|
}) => React.JSX.Element;
|
|
60
|
-
clientReferenceId?: string;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export function AnySpendCustomExactIn(props: AnySpendCustomExactInProps) {
|
|
@@ -88,7 +87,6 @@ function AnySpendCustomExactInInner({
|
|
|
88
87
|
orderType = "custom_exact_in",
|
|
89
88
|
minDestinationAmount,
|
|
90
89
|
header,
|
|
91
|
-
clientReferenceId,
|
|
92
90
|
}: AnySpendCustomExactInProps) {
|
|
93
91
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
94
92
|
|
|
@@ -435,7 +433,6 @@ function AnySpendCustomExactInInner({
|
|
|
435
433
|
expectedDstAmount: expectedDstAmountRaw,
|
|
436
434
|
creatorAddress: globalAddress,
|
|
437
435
|
payload,
|
|
438
|
-
clientReferenceId: clientReferenceId,
|
|
439
436
|
});
|
|
440
437
|
} catch (err: any) {
|
|
441
438
|
console.error(err);
|
|
@@ -491,7 +488,6 @@ function AnySpendCustomExactInInner({
|
|
|
491
488
|
expectedDstAmount: expectedDstAmountRaw,
|
|
492
489
|
creatorAddress: globalAddress,
|
|
493
490
|
payload,
|
|
494
|
-
clientReferenceId: clientReferenceId,
|
|
495
491
|
});
|
|
496
492
|
} catch (err: any) {
|
|
497
493
|
console.error(err);
|
|
@@ -33,7 +33,6 @@ export function AnySpendDepositUpside({
|
|
|
33
33
|
depositContractAddress,
|
|
34
34
|
token,
|
|
35
35
|
onSuccess,
|
|
36
|
-
clientReferenceId,
|
|
37
36
|
}: {
|
|
38
37
|
loadOrder?: string;
|
|
39
38
|
mode?: "modal" | "page";
|
|
@@ -43,7 +42,6 @@ export function AnySpendDepositUpside({
|
|
|
43
42
|
depositContractAddress: string;
|
|
44
43
|
token: components["schemas"]["Token"];
|
|
45
44
|
onSuccess?: (amount: string) => void;
|
|
46
|
-
clientReferenceId?: string;
|
|
47
45
|
}) {
|
|
48
46
|
if (!recipientAddress) return null;
|
|
49
47
|
|
|
@@ -78,7 +76,6 @@ export function AnySpendDepositUpside({
|
|
|
78
76
|
customExactInConfig={customExactInConfig}
|
|
79
77
|
header={header}
|
|
80
78
|
onSuccess={onSuccess}
|
|
81
|
-
clientReferenceId={clientReferenceId}
|
|
82
79
|
/>
|
|
83
80
|
);
|
|
84
81
|
}
|
|
@@ -37,7 +37,6 @@ export function AnySpendNFT({
|
|
|
37
37
|
nftContract,
|
|
38
38
|
onSuccess,
|
|
39
39
|
onShowPointsDetail,
|
|
40
|
-
clientReferenceId,
|
|
41
40
|
}: {
|
|
42
41
|
loadOrder?: string;
|
|
43
42
|
mode?: "modal" | "page";
|
|
@@ -45,7 +44,6 @@ export function AnySpendNFT({
|
|
|
45
44
|
nftContract: components["schemas"]["NftContract"];
|
|
46
45
|
onSuccess?: (txHash?: string) => void;
|
|
47
46
|
onShowPointsDetail?: () => void;
|
|
48
|
-
clientReferenceId?: string;
|
|
49
47
|
}) {
|
|
50
48
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
|
|
51
49
|
const [isLoadingFallback, setIsLoadingFallback] = useState(false);
|
|
@@ -169,7 +167,6 @@ export function AnySpendNFT({
|
|
|
169
167
|
header={header}
|
|
170
168
|
onSuccess={onSuccess}
|
|
171
169
|
onShowPointsDetail={onShowPointsDetail}
|
|
172
|
-
clientReferenceId={clientReferenceId}
|
|
173
170
|
/>
|
|
174
171
|
);
|
|
175
172
|
}
|
|
@@ -48,14 +48,12 @@ export function AnySpendStakeB3({
|
|
|
48
48
|
recipientAddress,
|
|
49
49
|
stakeAmount,
|
|
50
50
|
onSuccess,
|
|
51
|
-
clientReferenceId,
|
|
52
51
|
}: {
|
|
53
52
|
loadOrder?: string;
|
|
54
53
|
mode?: "modal" | "page";
|
|
55
54
|
recipientAddress: string;
|
|
56
55
|
stakeAmount?: string;
|
|
57
56
|
onSuccess?: () => void;
|
|
58
|
-
clientReferenceId?: string;
|
|
59
57
|
}) {
|
|
60
58
|
const hasMounted = useHasMounted();
|
|
61
59
|
const { setB3ModalOpen } = useModalStore();
|
|
@@ -508,7 +506,6 @@ export function AnySpendStakeB3({
|
|
|
508
506
|
header={header}
|
|
509
507
|
onSuccess={onSuccess}
|
|
510
508
|
showRecipient={true}
|
|
511
|
-
clientReferenceId={clientReferenceId}
|
|
512
509
|
/>
|
|
513
510
|
);
|
|
514
511
|
}
|
|
@@ -53,7 +53,6 @@ export function AnySpendStakeB3ExactIn({
|
|
|
53
53
|
recipientAddress,
|
|
54
54
|
stakeAmount,
|
|
55
55
|
onSuccess,
|
|
56
|
-
clientReferenceId,
|
|
57
56
|
}: {
|
|
58
57
|
loadOrder?: string;
|
|
59
58
|
mode?: "modal" | "page";
|
|
@@ -62,7 +61,6 @@ export function AnySpendStakeB3ExactIn({
|
|
|
62
61
|
recipientAddress: string;
|
|
63
62
|
stakeAmount?: string;
|
|
64
63
|
onSuccess?: (amount: string) => void;
|
|
65
|
-
clientReferenceId?: string;
|
|
66
64
|
}) {
|
|
67
65
|
const hasMounted = useHasMounted();
|
|
68
66
|
const { setB3ModalOpen } = useModalStore();
|
|
@@ -519,7 +517,6 @@ export function AnySpendStakeB3ExactIn({
|
|
|
519
517
|
customExactInConfig={customExactInConfig}
|
|
520
518
|
header={header}
|
|
521
519
|
onSuccess={onSuccess}
|
|
522
|
-
clientReferenceId={clientReferenceId}
|
|
523
520
|
/>
|
|
524
521
|
);
|
|
525
522
|
}
|
|
@@ -25,7 +25,6 @@ export function AnySpendStakeUpside({
|
|
|
25
25
|
token,
|
|
26
26
|
onSuccess,
|
|
27
27
|
activeTab,
|
|
28
|
-
clientReferenceId,
|
|
29
28
|
}: {
|
|
30
29
|
loadOrder?: string;
|
|
31
30
|
mode?: "modal" | "page";
|
|
@@ -35,7 +34,6 @@ export function AnySpendStakeUpside({
|
|
|
35
34
|
token: components["schemas"]["Token"];
|
|
36
35
|
onSuccess?: () => void;
|
|
37
36
|
activeTab?: "crypto" | "fiat";
|
|
38
|
-
clientReferenceId?: string;
|
|
39
37
|
}) {
|
|
40
38
|
const header = () => (
|
|
41
39
|
<>
|
|
@@ -82,7 +80,6 @@ export function AnySpendStakeUpside({
|
|
|
82
80
|
onSuccess={onSuccess}
|
|
83
81
|
showRecipient={true}
|
|
84
82
|
activeTab={activeTab}
|
|
85
|
-
clientReferenceId={clientReferenceId}
|
|
86
83
|
/>
|
|
87
84
|
);
|
|
88
85
|
}
|
|
@@ -25,7 +25,6 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
25
25
|
stakingContractAddress,
|
|
26
26
|
token,
|
|
27
27
|
onSuccess,
|
|
28
|
-
clientReferenceId,
|
|
29
28
|
}: {
|
|
30
29
|
loadOrder?: string;
|
|
31
30
|
mode?: "modal" | "page";
|
|
@@ -35,7 +34,6 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
35
34
|
stakingContractAddress: string;
|
|
36
35
|
token: components["schemas"]["Token"];
|
|
37
36
|
onSuccess?: (amount: string) => void;
|
|
38
|
-
clientReferenceId?: string;
|
|
39
37
|
}) {
|
|
40
38
|
if (!recipientAddress) return null;
|
|
41
39
|
|
|
@@ -70,7 +68,6 @@ export function AnySpendStakeUpsideExactIn({
|
|
|
70
68
|
customExactInConfig={customExactInConfig}
|
|
71
69
|
header={header}
|
|
72
70
|
onSuccess={onSuccess}
|
|
73
|
-
clientReferenceId={clientReferenceId}
|
|
74
71
|
/>
|
|
75
72
|
);
|
|
76
73
|
}
|
|
@@ -17,7 +17,6 @@ type AnySpendTournamentProps =
|
|
|
17
17
|
tournamentEntryToken: components["schemas"]["Token"];
|
|
18
18
|
tournamentEntryFee: string;
|
|
19
19
|
onSuccess?: () => void;
|
|
20
|
-
clientReferenceId?: string;
|
|
21
20
|
}
|
|
22
21
|
| {
|
|
23
22
|
mode?: "modal" | "page";
|
|
@@ -29,7 +28,6 @@ type AnySpendTournamentProps =
|
|
|
29
28
|
tournamentFundToken: components["schemas"]["Token"];
|
|
30
29
|
tournamentFundAmount: string;
|
|
31
30
|
onSuccess?: () => void;
|
|
32
|
-
clientReferenceId?: string;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
@@ -106,7 +104,6 @@ export function AnySpendTournament(props: AnySpendTournamentProps) {
|
|
|
106
104
|
header={header}
|
|
107
105
|
onSuccess={onSuccess}
|
|
108
106
|
showRecipient={action === "join"}
|
|
109
|
-
clientReferenceId={props.clientReferenceId}
|
|
110
107
|
/>
|
|
111
108
|
);
|
|
112
109
|
}
|
|
@@ -24,7 +24,6 @@ export interface AnySpendDepositHypeProps {
|
|
|
24
24
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
25
25
|
customUsdInputValues?: string[];
|
|
26
26
|
preferEoa?: boolean;
|
|
27
|
-
clientReferenceId?: string;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export function AnySpendDepositHype({
|
|
@@ -39,7 +38,6 @@ export function AnySpendDepositHype({
|
|
|
39
38
|
onTokenSelect,
|
|
40
39
|
customUsdInputValues,
|
|
41
40
|
preferEoa,
|
|
42
|
-
clientReferenceId,
|
|
43
41
|
}: AnySpendDepositHypeProps) {
|
|
44
42
|
if (!recipientAddress) return null;
|
|
45
43
|
|
|
@@ -81,7 +79,6 @@ export function AnySpendDepositHype({
|
|
|
81
79
|
onTokenSelect={onTokenSelect}
|
|
82
80
|
customUsdInputValues={customUsdInputValues}
|
|
83
81
|
preferEoa={preferEoa}
|
|
84
|
-
clientReferenceId={clientReferenceId}
|
|
85
82
|
/>
|
|
86
83
|
);
|
|
87
84
|
}
|
|
@@ -47,14 +47,12 @@ export function AnyspendSignatureMint({
|
|
|
47
47
|
signatureData,
|
|
48
48
|
imageUrl,
|
|
49
49
|
onSuccess,
|
|
50
|
-
clientReferenceId,
|
|
51
50
|
}: {
|
|
52
51
|
loadOrder?: string;
|
|
53
52
|
mode?: "modal" | "page";
|
|
54
53
|
signatureData: GenerateSigMintResponse;
|
|
55
54
|
imageUrl?: string;
|
|
56
55
|
onSuccess?: (txHash?: string) => void;
|
|
57
|
-
clientReferenceId?: string;
|
|
58
56
|
}) {
|
|
59
57
|
// Get token data
|
|
60
58
|
const {
|
|
@@ -151,7 +149,6 @@ export function AnyspendSignatureMint({
|
|
|
151
149
|
header={header}
|
|
152
150
|
onSuccess={onSuccess}
|
|
153
151
|
showRecipient={true}
|
|
154
|
-
clientReferenceId={clientReferenceId}
|
|
155
152
|
/>
|
|
156
153
|
);
|
|
157
154
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { AnySpend } from "./AnySpend";
|
|
3
3
|
export { AnySpendBondKit } from "./AnySpendBondKit";
|
|
4
4
|
export { AnySpendBuySpin } from "./AnySpendBuySpin";
|
|
5
|
+
export { AnySpendCollectorClubPurchase } from "./AnySpendCollectorClubPurchase";
|
|
5
6
|
export { AnySpendCustom } from "./AnySpendCustom";
|
|
6
7
|
export { AnySpendCustomExactIn } from "./AnySpendCustomExactIn";
|
|
7
8
|
export { AnySpendDepositHype, HYPE_TOKEN_DETAILS } from "./AnyspendDepositHype";
|
|
@@ -10,6 +10,7 @@ import { useMemo } from "react";
|
|
|
10
10
|
import { parseUnits } from "viem";
|
|
11
11
|
import { base } from "viem/chains";
|
|
12
12
|
import { CreateOrderParams } from "./useAnyspendCreateOrder";
|
|
13
|
+
import { useValidatedClientReferenceId } from "./useValidatedClientReferenceId";
|
|
13
14
|
|
|
14
15
|
export type OnrampOptions = {
|
|
15
16
|
vendor: components["schemas"]["OnrampMetadata"]["vendor"];
|
|
@@ -33,6 +34,9 @@ export type UseAnyspendCreateOnrampOrderProps = {
|
|
|
33
34
|
* Specifically handles orders that involve fiat-to-crypto onramp functionality
|
|
34
35
|
*/
|
|
35
36
|
export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspendCreateOnrampOrderProps = {}) {
|
|
37
|
+
// Get validated client reference ID from B3 context
|
|
38
|
+
const validatedClientReferenceId = useValidatedClientReferenceId();
|
|
39
|
+
|
|
36
40
|
// Get fingerprint data
|
|
37
41
|
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
38
42
|
const visitorData: VisitorData | undefined = fpData && {
|
|
@@ -55,7 +59,6 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspend
|
|
|
55
59
|
tournament,
|
|
56
60
|
payload,
|
|
57
61
|
partnerId,
|
|
58
|
-
clientReferenceId,
|
|
59
62
|
} = params;
|
|
60
63
|
|
|
61
64
|
try {
|
|
@@ -103,7 +106,7 @@ export function useAnyspendCreateOnrampOrder({ onSuccess, onError }: UseAnyspend
|
|
|
103
106
|
}),
|
|
104
107
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
105
108
|
partnerId,
|
|
106
|
-
clientReferenceId,
|
|
109
|
+
clientReferenceId: validatedClientReferenceId,
|
|
107
110
|
visitorData,
|
|
108
111
|
});
|
|
109
112
|
} catch (error: any) {
|
|
@@ -5,6 +5,7 @@ import { buildMetadata, buildPayload, normalizeAddress } from "@b3dotfun/sdk/any
|
|
|
5
5
|
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react";
|
|
6
6
|
import { useMutation } from "@tanstack/react-query";
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
+
import { useValidatedClientReferenceId } from "./useValidatedClientReferenceId";
|
|
8
9
|
|
|
9
10
|
export type CreateOrderParams = {
|
|
10
11
|
recipientAddress: string;
|
|
@@ -20,7 +21,6 @@ export type CreateOrderParams = {
|
|
|
20
21
|
creatorAddress?: string;
|
|
21
22
|
payload?: any;
|
|
22
23
|
partnerId?: string;
|
|
23
|
-
clientReferenceId?: string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type UseAnyspendCreateOrderProps = {
|
|
@@ -34,6 +34,9 @@ export type UseAnyspendCreateOrderProps = {
|
|
|
34
34
|
* For onramp orders, use useAnyspendCreateOnrampOrder instead.
|
|
35
35
|
*/
|
|
36
36
|
export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreateOrderProps = {}) {
|
|
37
|
+
// Get validated client reference ID from B3 context
|
|
38
|
+
const validatedClientReferenceId = useValidatedClientReferenceId();
|
|
39
|
+
|
|
37
40
|
// Get fingerprint data
|
|
38
41
|
const { data: fpData } = useVisitorData({ extendedResult: true }, { immediate: true });
|
|
39
42
|
const visitorData: VisitorData | undefined = fpData && {
|
|
@@ -42,17 +45,7 @@ export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreate
|
|
|
42
45
|
};
|
|
43
46
|
const { mutate: createOrder, isPending } = useMutation({
|
|
44
47
|
mutationFn: async (params: CreateOrderParams) => {
|
|
45
|
-
const {
|
|
46
|
-
recipientAddress,
|
|
47
|
-
orderType,
|
|
48
|
-
srcChain,
|
|
49
|
-
dstChain,
|
|
50
|
-
srcToken,
|
|
51
|
-
dstToken,
|
|
52
|
-
srcAmount,
|
|
53
|
-
creatorAddress,
|
|
54
|
-
clientReferenceId,
|
|
55
|
-
} = params;
|
|
48
|
+
const { recipientAddress, orderType, srcChain, dstChain, srcToken, dstToken, srcAmount, creatorAddress } = params;
|
|
56
49
|
|
|
57
50
|
try {
|
|
58
51
|
return await anyspendService.createOrder({
|
|
@@ -86,7 +79,7 @@ export function useAnyspendCreateOrder({ onSuccess, onError }: UseAnyspendCreate
|
|
|
86
79
|
},
|
|
87
80
|
}),
|
|
88
81
|
creatorAddress: creatorAddress ? normalizeAddress(creatorAddress) : undefined,
|
|
89
|
-
clientReferenceId,
|
|
82
|
+
clientReferenceId: validatedClientReferenceId,
|
|
90
83
|
visitorData,
|
|
91
84
|
});
|
|
92
85
|
} catch (error: any) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Validators } from "@b3dotfun/sdk/anyspend/utils/validation";
|
|
2
|
+
import { useB3 } from "@b3dotfun/sdk/global-account/react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook that provides a validated client reference ID
|
|
7
|
+
* Gets the createClientReferenceId function from B3 context and validates the result
|
|
8
|
+
*/
|
|
9
|
+
export function useValidatedClientReferenceId() {
|
|
10
|
+
const { createClientReferenceId } = useB3();
|
|
11
|
+
|
|
12
|
+
const validatedClientReferenceId = useMemo(() => {
|
|
13
|
+
// If no function provided, return undefined
|
|
14
|
+
if (!createClientReferenceId) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// Call the function to generate the ID
|
|
20
|
+
const generatedId = createClientReferenceId();
|
|
21
|
+
|
|
22
|
+
// Validate the generated ID
|
|
23
|
+
const validation = Validators.clientReferenceId(generatedId);
|
|
24
|
+
|
|
25
|
+
if (!validation.isValid) {
|
|
26
|
+
console.error(
|
|
27
|
+
`[AnySpend] Invalid clientReferenceId generated: ${validation.error || "Validation failed"}. Will be set to undefined.`,
|
|
28
|
+
);
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return validation.cleaned;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("[AnySpend] Error generating clientReferenceId:", error);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}, [createClientReferenceId]);
|
|
38
|
+
|
|
39
|
+
return validatedClientReferenceId;
|
|
40
|
+
}
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
AnySpend,
|
|
3
3
|
AnySpendBondKit,
|
|
4
4
|
AnySpendBuySpin,
|
|
5
|
+
AnySpendCollectorClubPurchase,
|
|
5
6
|
AnySpendNFT,
|
|
6
7
|
AnyspendSignatureMint,
|
|
7
8
|
AnySpendStakeB3,
|
|
@@ -143,6 +144,8 @@ export function B3DynamicModal() {
|
|
|
143
144
|
return <LinkAccount {...contentType} />;
|
|
144
145
|
case "anySpendDepositHype":
|
|
145
146
|
return <AnySpendDepositHype {...contentType} mode="modal" />;
|
|
147
|
+
case "anySpendCollectorClubPurchase":
|
|
148
|
+
return <AnySpendCollectorClubPurchase {...contentType} mode="modal" />;
|
|
146
149
|
case "avatarEditor":
|
|
147
150
|
return <AvatarEditor onSetAvatar={contentType.onSuccess} />;
|
|
148
151
|
case "profileEditor":
|
|
@@ -58,6 +58,7 @@ export function B3Provider({
|
|
|
58
58
|
onConnect,
|
|
59
59
|
connectors,
|
|
60
60
|
overrideDefaultConnectors = false,
|
|
61
|
+
createClientReferenceId,
|
|
61
62
|
}: {
|
|
62
63
|
theme: "light" | "dark";
|
|
63
64
|
children: React.ReactNode;
|
|
@@ -75,6 +76,7 @@ export function B3Provider({
|
|
|
75
76
|
onConnect?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
76
77
|
connectors?: CreateConnectorFn[];
|
|
77
78
|
overrideDefaultConnectors?: boolean;
|
|
79
|
+
createClientReferenceId?: () => string;
|
|
78
80
|
}) {
|
|
79
81
|
// Initialize Google Analytics on mount
|
|
80
82
|
useEffect(() => {
|
|
@@ -100,6 +102,7 @@ export function B3Provider({
|
|
|
100
102
|
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
101
103
|
clientType={clientType}
|
|
102
104
|
partnerId={partnerId}
|
|
105
|
+
createClientReferenceId={createClientReferenceId}
|
|
103
106
|
>
|
|
104
107
|
<RelayKitProviderWrapper simDuneApiKey={simDuneApiKey}>
|
|
105
108
|
{children}
|
|
@@ -128,6 +131,7 @@ export function InnerProvider({
|
|
|
128
131
|
theme = "light",
|
|
129
132
|
clientType = "socket",
|
|
130
133
|
partnerId,
|
|
134
|
+
createClientReferenceId,
|
|
131
135
|
}: {
|
|
132
136
|
children: React.ReactNode;
|
|
133
137
|
accountOverride?: Account;
|
|
@@ -137,6 +141,7 @@ export function InnerProvider({
|
|
|
137
141
|
theme: "light" | "dark";
|
|
138
142
|
clientType?: ClientType;
|
|
139
143
|
partnerId: string;
|
|
144
|
+
createClientReferenceId?: () => string;
|
|
140
145
|
}) {
|
|
141
146
|
const activeAccount = useActiveAccount();
|
|
142
147
|
const [manuallySelectedWallet, setManuallySelectedWallet] = useState<Wallet | undefined>(undefined);
|
|
@@ -204,6 +209,7 @@ export function InnerProvider({
|
|
|
204
209
|
theme,
|
|
205
210
|
clientType,
|
|
206
211
|
partnerId: partnerId,
|
|
212
|
+
createClientReferenceId,
|
|
207
213
|
}}
|
|
208
214
|
>
|
|
209
215
|
<InnerProvider2>{children}</InnerProvider2>
|
|
@@ -22,6 +22,7 @@ export interface B3ContextType {
|
|
|
22
22
|
theme: "light" | "dark";
|
|
23
23
|
clientType: ClientType;
|
|
24
24
|
partnerId: string;
|
|
25
|
+
createClientReferenceId?: () => string;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -41,4 +42,5 @@ export const B3Context = createContext<B3ContextType>({
|
|
|
41
42
|
theme: "light",
|
|
42
43
|
clientType: "rest",
|
|
43
44
|
partnerId: "",
|
|
45
|
+
createClientReferenceId: undefined,
|
|
44
46
|
});
|
|
@@ -405,6 +405,29 @@ export interface ProfileEditorModalProps extends BaseModalProps {
|
|
|
405
405
|
onSuccess?: () => void;
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Props for the AnySpend Collector Club Purchase modal
|
|
410
|
+
* Handles Collector Club pack purchases
|
|
411
|
+
*/
|
|
412
|
+
export interface AnySpendCollectorClubPurchaseProps extends BaseModalProps {
|
|
413
|
+
/** Modal type identifier */
|
|
414
|
+
type: "anySpendCollectorClubPurchase";
|
|
415
|
+
/** The pack ID to purchase */
|
|
416
|
+
packId: number;
|
|
417
|
+
/** The number of packs to purchase */
|
|
418
|
+
packAmount: number;
|
|
419
|
+
/** Price per pack in wei (e.g., "10000" for 0.01 USDC with 6 decimals) */
|
|
420
|
+
pricePerPack: string;
|
|
421
|
+
/** Recipient address to receive the packs */
|
|
422
|
+
recipientAddress: string;
|
|
423
|
+
/** Payment type - crypto or fiat */
|
|
424
|
+
paymentType?: "crypto" | "fiat";
|
|
425
|
+
/** Callback function called when the purchase is successful */
|
|
426
|
+
onSuccess?: (txHash?: string) => void;
|
|
427
|
+
/** Client-provided reference ID for tracking orders */
|
|
428
|
+
clientReferenceId?: string;
|
|
429
|
+
}
|
|
430
|
+
|
|
408
431
|
/**
|
|
409
432
|
* Union type of all possible modal content types
|
|
410
433
|
*/
|
|
@@ -429,7 +452,8 @@ export type ModalContentType =
|
|
|
429
452
|
| LinkAccountModalProps
|
|
430
453
|
| AnySpendDepositHypeProps
|
|
431
454
|
| AvatarEditorModalProps
|
|
432
|
-
| ProfileEditorModalProps
|
|
455
|
+
| ProfileEditorModalProps
|
|
456
|
+
| AnySpendCollectorClubPurchaseProps;
|
|
433
457
|
// Add other modal types here like: | OtherModalProps | AnotherModalProps
|
|
434
458
|
|
|
435
459
|
/**
|