@b3dotfun/sdk 0.0.7-alpha.1 → 0.0.7-alpha.11

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.
Files changed (159) hide show
  1. package/dist/cjs/anyspend/constants/index.js +5 -2
  2. package/dist/cjs/anyspend/index.d.ts +1 -0
  3. package/dist/cjs/anyspend/index.js +1 -0
  4. package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +33 -33
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -2
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +89 -49
  7. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -2
  8. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +5 -3
  9. package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +4 -3
  10. package/dist/cjs/anyspend/react/components/AnySpendTournament.js +4 -1
  11. package/dist/cjs/anyspend/react/components/common/OrderDetails.js +2 -2
  12. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +3 -18
  13. package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  14. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +4 -0
  15. package/dist/cjs/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +4 -0
  16. package/dist/cjs/anyspend/services/anyspend.d.ts +3 -1
  17. package/dist/cjs/anyspend/services/anyspend.js +1 -1
  18. package/dist/cjs/anyspend/types/index.d.ts +1 -0
  19. package/dist/cjs/anyspend/types/index.js +1 -0
  20. package/dist/cjs/anyspend/types/metadata.d.ts +26 -0
  21. package/dist/cjs/anyspend/types/metadata.js +16 -0
  22. package/dist/cjs/anyspend/types/nft.d.ts +7 -0
  23. package/dist/cjs/anyspend/types/nft.js +2 -0
  24. package/dist/cjs/anyspend/types/order.d.ts +10 -0
  25. package/dist/cjs/anyspend/types/req-res/createOrder.d.ts +28 -0
  26. package/dist/cjs/anyspend/types/req-res/getOrderAndTransactions.d.ts +18 -0
  27. package/dist/cjs/anyspend/types/req-res/getOrderHistory.d.ts +14 -0
  28. package/dist/cjs/anyspend/types/req-res/getQuote.d.ts +11 -0
  29. package/dist/cjs/anyspend/types/req-res/getQuote.js +4 -1
  30. package/dist/cjs/anyspend/utils/orderPayload.d.ts +3 -3
  31. package/dist/cjs/anyspend/utils/orderPayload.js +18 -4
  32. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  33. package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
  34. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.d.ts +14 -0
  35. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +50 -0
  36. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +1 -2
  37. package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +11 -16
  38. package/dist/cjs/global-account/react/components/StyleRoot.js +0 -1
  39. package/dist/cjs/global-account/react/components/custom/Icon.d.ts +7 -0
  40. package/dist/cjs/global-account/react/components/custom/Icon.js +52 -0
  41. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.d.ts +4 -0
  42. package/dist/cjs/global-account/react/components/custom/ManageAccountButton.js +20 -0
  43. package/dist/cjs/global-account/react/hooks/useB3EnsName.d.ts +1 -4
  44. package/dist/cjs/global-account/react/hooks/useB3EnsName.js +22 -22
  45. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  46. package/dist/cjs/index.d.ts +0 -0
  47. package/dist/cjs/index.js +2 -0
  48. package/dist/cjs/shared/constants/index.d.ts +1 -0
  49. package/dist/cjs/shared/constants/index.js +2 -1
  50. package/dist/cjs/shared/utils/index.d.ts +9 -0
  51. package/dist/cjs/shared/utils/index.js +17 -0
  52. package/dist/esm/anyspend/constants/index.js +5 -2
  53. package/dist/esm/anyspend/index.d.ts +1 -0
  54. package/dist/esm/anyspend/index.js +1 -0
  55. package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +5 -5
  56. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -2
  57. package/dist/esm/anyspend/react/components/AnySpendCustom.js +66 -26
  58. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -2
  59. package/dist/esm/anyspend/react/components/AnySpendNFT.js +5 -3
  60. package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +5 -4
  61. package/dist/esm/anyspend/react/components/AnySpendTournament.js +4 -1
  62. package/dist/esm/anyspend/react/components/common/OrderDetails.js +3 -3
  63. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +3 -18
  64. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  65. package/dist/esm/anyspend/react/hooks/useAnyspendCreateOrder.js +1 -1
  66. package/dist/esm/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +4 -0
  67. package/dist/esm/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +4 -0
  68. package/dist/esm/anyspend/services/anyspend.d.ts +3 -1
  69. package/dist/esm/anyspend/services/anyspend.js +1 -1
  70. package/dist/esm/anyspend/types/index.d.ts +1 -0
  71. package/dist/esm/anyspend/types/index.js +1 -0
  72. package/dist/esm/anyspend/types/metadata.d.ts +26 -0
  73. package/dist/esm/anyspend/types/metadata.js +11 -0
  74. package/dist/esm/anyspend/types/nft.d.ts +7 -0
  75. package/dist/esm/anyspend/types/nft.js +2 -0
  76. package/dist/esm/anyspend/types/order.d.ts +10 -0
  77. package/dist/esm/anyspend/types/req-res/createOrder.d.ts +28 -0
  78. package/dist/esm/anyspend/types/req-res/getOrderAndTransactions.d.ts +18 -0
  79. package/dist/esm/anyspend/types/req-res/getOrderHistory.d.ts +14 -0
  80. package/dist/esm/anyspend/types/req-res/getQuote.d.ts +11 -0
  81. package/dist/esm/anyspend/types/req-res/getQuote.js +4 -1
  82. package/dist/esm/anyspend/utils/orderPayload.d.ts +3 -3
  83. package/dist/esm/anyspend/utils/orderPayload.js +19 -5
  84. package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  85. package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +1 -1
  86. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.d.ts +14 -0
  87. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +44 -0
  88. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +1 -2
  89. package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +7 -12
  90. package/dist/esm/global-account/react/components/StyleRoot.js +0 -1
  91. package/dist/esm/global-account/react/components/custom/Icon.d.ts +7 -0
  92. package/dist/esm/global-account/react/components/custom/Icon.js +50 -0
  93. package/dist/esm/global-account/react/components/custom/ManageAccountButton.d.ts +4 -0
  94. package/dist/esm/global-account/react/components/custom/ManageAccountButton.js +17 -0
  95. package/dist/esm/global-account/react/hooks/useB3EnsName.d.ts +1 -4
  96. package/dist/esm/global-account/react/hooks/useB3EnsName.js +24 -21
  97. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  98. package/dist/esm/index.d.ts +0 -0
  99. package/dist/esm/index.js +2 -0
  100. package/dist/esm/shared/constants/index.d.ts +1 -0
  101. package/dist/esm/shared/constants/index.js +1 -0
  102. package/dist/esm/shared/utils/index.d.ts +9 -0
  103. package/dist/esm/shared/utils/index.js +15 -0
  104. package/dist/styles/index.css +1 -1
  105. package/dist/types/anyspend/index.d.ts +1 -0
  106. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -2
  107. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -2
  108. package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +3 -18
  109. package/dist/types/anyspend/react/hooks/useAnyspendCreateOrder.d.ts +1 -0
  110. package/dist/types/anyspend/react/hooks/useAnyspendOrderAndTransactions.d.ts +4 -0
  111. package/dist/types/anyspend/react/hooks/useAnyspendOrderHistory.d.ts +4 -0
  112. package/dist/types/anyspend/services/anyspend.d.ts +3 -1
  113. package/dist/types/anyspend/types/index.d.ts +1 -0
  114. package/dist/types/anyspend/types/metadata.d.ts +26 -0
  115. package/dist/types/anyspend/types/nft.d.ts +7 -0
  116. package/dist/types/anyspend/types/order.d.ts +10 -0
  117. package/dist/types/anyspend/types/req-res/createOrder.d.ts +28 -0
  118. package/dist/types/anyspend/types/req-res/getOrderAndTransactions.d.ts +18 -0
  119. package/dist/types/anyspend/types/req-res/getOrderHistory.d.ts +14 -0
  120. package/dist/types/anyspend/types/req-res/getQuote.d.ts +11 -0
  121. package/dist/types/anyspend/utils/orderPayload.d.ts +3 -3
  122. package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -1
  123. package/dist/types/global-account/react/components/SignInWithB3/SignIn.d.ts +14 -0
  124. package/dist/types/global-account/react/components/SignInWithB3/SignInWithB3.d.ts +1 -2
  125. package/dist/types/global-account/react/components/custom/Icon.d.ts +7 -0
  126. package/dist/types/global-account/react/components/custom/ManageAccountButton.d.ts +4 -0
  127. package/dist/types/global-account/react/hooks/useB3EnsName.d.ts +1 -4
  128. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  129. package/dist/types/index.d.ts +0 -0
  130. package/dist/types/shared/constants/index.d.ts +1 -0
  131. package/dist/types/shared/utils/index.d.ts +9 -0
  132. package/package.json +22 -3
  133. package/src/anyspend/constants/index.ts +5 -3
  134. package/src/anyspend/index.ts +1 -0
  135. package/src/anyspend/react/components/AnySpendBuySpin.tsx +8 -7
  136. package/src/anyspend/react/components/AnySpendCustom.tsx +83 -30
  137. package/src/anyspend/react/components/AnySpendNFT.tsx +9 -4
  138. package/src/anyspend/react/components/AnySpendStakeB3.tsx +7 -6
  139. package/src/anyspend/react/components/AnySpendTournament.tsx +4 -1
  140. package/src/anyspend/react/components/common/OrderDetails.tsx +6 -6
  141. package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +3 -13
  142. package/src/anyspend/react/hooks/useAnyspendCreateOrder.ts +2 -1
  143. package/src/anyspend/services/anyspend.ts +2 -2
  144. package/src/anyspend/types/index.ts +1 -0
  145. package/src/anyspend/types/metadata.ts +41 -0
  146. package/src/anyspend/types/nft.ts +3 -0
  147. package/src/anyspend/types/req-res/getQuote.ts +4 -1
  148. package/src/anyspend/utils/orderPayload.ts +17 -5
  149. package/src/global-account/react/components/B3Provider/B3Provider.tsx +2 -3
  150. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +190 -0
  151. package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +15 -27
  152. package/src/global-account/react/components/StyleRoot.tsx +0 -1
  153. package/src/global-account/react/components/custom/Icon.tsx +102 -0
  154. package/src/global-account/react/components/custom/ManageAccountButton.tsx +33 -0
  155. package/src/global-account/react/hooks/useB3EnsName.ts +26 -32
  156. package/src/global-account/react/stores/useModalStore.ts +2 -0
  157. package/src/index.ts +1 -0
  158. package/src/shared/constants/index.ts +2 -0
  159. package/src/shared/utils/index.ts +16 -0
@@ -1,9 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { eqci, getDefaultToken, NftType, OrderStatus, OrderType, RELAY_ETH_ADDRESS, USDC_BASE, useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useGeoOnrampOptions } from "../../../anyspend/index.js";
3
- import { useB3, StyleRoot } from "../../../global-account/react/index.js";
4
- import { Badge, Button, ShinyButton, Skeleton, Tabs, TabsContent, TabsList, TabTrigger, useAccountWallet, useBsmntProfile, useHasMounted, useRouter, useTokenBalancesByChain, useModalStore, useSearchParamsSSR } from "../../../global-account/react/index.js";
5
- import { TextShimmer } from "../../../global-account/react/index.js";
6
- import { TransitionPanel } from "../../../global-account/react/index.js";
2
+ import { eqci, getDefaultToken, isCustomTxMetadata, isNftMetadata, isTournamentMetadata, NftType, OrderStatus, OrderType, RELAY_ETH_ADDRESS, USDC_BASE, useAnyspendCreateOnrampOrder, useAnyspendCreateOrder, useAnyspendOrderAndTransactions, useAnyspendQuote, useAnyspendTokenList, useGeoOnrampOptions } from "../../../anyspend/index.js";
3
+ import { Badge, Button, ShinyButton, Skeleton, StyleRoot, Tabs, TabsContent, TabsList, TabTrigger, TextShimmer, TransitionPanel, useAccountWallet, useB3, useBsmntProfile, useHasMounted, useModalStore, useRouter, useSearchParamsSSR, useTokenBalancesByChain } from "../../../global-account/react/index.js";
7
4
  import { cn } from "../../../shared/utils/index.js";
8
5
  import centerTruncate from "../../../shared/utils/centerTruncate.js";
9
6
  import { formatTokenAmount } from "../../../shared/utils/number.js";
@@ -26,7 +23,7 @@ var PanelView;
26
23
  PanelView[PanelView["ORDER_DETAILS"] = 2] = "ORDER_DETAILS";
27
24
  PanelView[PanelView["LOADING"] = 3] = "LOADING";
28
25
  })(PanelView || (PanelView = {}));
29
- function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress, encodedData, spenderAddress }) {
26
+ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChainId, dstToken, dstAmount, contractAddress, tokenId, contractType, encodedData, spenderAddress }) {
30
27
  switch (orderType) {
31
28
  case OrderType.MintNFT: {
32
29
  return {
@@ -36,7 +33,9 @@ function generateGetRelayQuoteRequest({ orderType, srcChainId, srcToken, dstChai
36
33
  dstChain: dstChainId,
37
34
  dstTokenAddress: dstToken.address,
38
35
  price: dstAmount,
39
- contractAddress: contractAddress
36
+ contractAddress: contractAddress,
37
+ tokenId: tokenId,
38
+ contractType: contractType
40
39
  };
41
40
  }
42
41
  case OrderType.JoinTournament: {
@@ -160,6 +159,8 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
160
159
  dstToken: dstToken,
161
160
  dstAmount: dstAmount,
162
161
  contractAddress: contractAddress,
162
+ tokenId: isNftMetadata(metadata) ? metadata.nftContract.tokenId : undefined,
163
+ contractType: isNftMetadata(metadata) ? metadata.nftContract.type : undefined,
163
164
  encodedData: encodedData,
164
165
  spenderAddress: spenderAddress
165
166
  });
@@ -239,22 +240,44 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
239
240
  srcAmount: srcAmount.toString(),
240
241
  recipientAddress,
241
242
  creatorAddress: currentWallet?.wallet?.address,
242
- nft: {
243
- ...metadata.nftContract,
244
- type: NftType.ERC721
245
- },
246
- tournament: {
247
- ...metadata.tournament,
248
- contractAddress: contractAddress,
249
- entryPriceOrFundAmount: dstAmount
250
- },
251
- payload: {
252
- amount: dstAmount,
253
- data: encodedData,
254
- spenderAddress: spenderAddress,
255
- to: contractAddress,
256
- action: metadata.action
257
- }
243
+ nft: isNftMetadata(metadata)
244
+ ? metadata.nftContract.type === NftType.ERC1155
245
+ ? {
246
+ type: NftType.ERC1155,
247
+ contractAddress: metadata.nftContract.contractAddress,
248
+ tokenId: metadata.nftContract.tokenId,
249
+ name: metadata.nftContract.name,
250
+ description: metadata.nftContract.description,
251
+ imageUrl: metadata.nftContract.imageUrl,
252
+ price: dstAmount
253
+ }
254
+ : {
255
+ type: NftType.ERC721,
256
+ contractAddress: metadata.nftContract.contractAddress,
257
+ contractType: metadata.nftContract.type,
258
+ price: dstAmount,
259
+ name: metadata.nftContract.name,
260
+ description: metadata.nftContract.description,
261
+ imageUrl: metadata.nftContract.imageUrl
262
+ }
263
+ : undefined,
264
+ tournament: isTournamentMetadata(metadata)
265
+ ? {
266
+ ...metadata.tournament,
267
+ contractAddress: contractAddress,
268
+ entryPriceOrFundAmount: dstAmount
269
+ }
270
+ : undefined,
271
+ // only populate payload for custom tx
272
+ payload: isCustomTxMetadata(metadata)
273
+ ? {
274
+ amount: dstAmount,
275
+ data: encodedData,
276
+ spenderAddress: spenderAddress,
277
+ to: contractAddress,
278
+ action: metadata.action
279
+ }
280
+ : undefined
258
281
  };
259
282
  if (onramp) {
260
283
  invariant(srcToken.address === USDC_BASE.address, "Selected src token is not USDC");
@@ -350,9 +373,26 @@ export function AnySpendCustom({ isMainnet = true, loadOrder, mode = "modal", re
350
373
  opacity: hasMounted ? 1 : 0,
351
374
  y: hasMounted ? 0 : 20,
352
375
  filter: hasMounted ? "blur(0px)" : "blur(10px)"
353
- }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: metadata.nftContract ? { ...metadata.nftContract, price: dstAmount } : undefined, tournament: metadata.tournament
354
- ? { ...metadata.tournament, contractAddress: contractAddress, entryPriceOrFundAmount: dstAmount }
355
- : undefined, payload: metadata.action
376
+ }, transition: { duration: 0.3, delay: 0.3, ease: "easeInOut" }, className: "flex w-full flex-col gap-2", children: _jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", disabled: isCreatingOrder || isLoadingAnyspendQuote || !anyspendQuote, onClick: () => handleConfirmOrder(), className: "relative w-full", children: !isAuthenticated ? ("Sign in with B3") : isCreatingOrder ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Creating order..." })] })) : isLoadingAnyspendQuote ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { children: "Loading quote..." })] })) : anyspendQuote ? (_jsxs(_Fragment, { children: [_jsx("span", { children: "Checkout" }), _jsx(ChevronRightCircle, { className: "absolute right-0 top-1/2 size-6 -translate-y-1/2 opacity-70" })] })) : ("No quote found") }) }) })] }) }), _jsx(TabsContent, { value: "fiat", children: _jsx("div", { className: "mt-6 flex w-full flex-col gap-6", children: _jsx(PanelOnrampPayment, { srcAmountOnRamp: anyspendQuote?.data?.currencyIn?.amountUsd || "0", recipientName: recipientEnsName, recipientAddress: recipientAddress, isMainnet: isMainnet, isBuyMode: false, selectedDstChainId: dstChainId, selectedDstToken: dstToken, anyspendQuote: anyspendQuote, globalAddress: currentWallet?.wallet?.address, onOrderCreated: (orderId) => setOrderId(orderId), onBack: () => setActiveTab("crypto"), orderType: orderType, nft: isNftMetadata(metadata)
377
+ ? metadata.nftContract.type === NftType.ERC1155
378
+ ? {
379
+ type: NftType.ERC1155,
380
+ contractAddress: metadata.nftContract.contractAddress,
381
+ tokenId: metadata.nftContract.tokenId,
382
+ imageUrl: metadata.nftContract.imageUrl,
383
+ name: metadata.nftContract.name,
384
+ description: metadata.nftContract.description,
385
+ price: dstAmount
386
+ }
387
+ : {
388
+ type: NftType.ERC721,
389
+ contractAddress: metadata.nftContract.contractAddress,
390
+ name: metadata.nftContract.name,
391
+ description: metadata.nftContract.description,
392
+ imageUrl: metadata.nftContract.imageUrl,
393
+ price: dstAmount
394
+ }
395
+ : undefined, payload: isCustomTxMetadata(metadata)
356
396
  ? {
357
397
  ...metadata,
358
398
  amount: dstAmount,
@@ -1,8 +1,9 @@
1
1
  import { NftContract } from "../../../anyspend/types";
2
- export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract }: {
2
+ export declare function AnySpendNFT({ isMainnet, loadOrder, mode, recipientAddress, nftContract, onSuccess }: {
3
3
  isMainnet?: boolean;
4
4
  loadOrder?: string;
5
5
  mode?: "modal" | "page";
6
6
  recipientAddress?: string;
7
- nftContract?: NftContract;
7
+ nftContract: NftContract;
8
+ onSuccess?: (txHash?: string) => void;
8
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { ALL_CHAINS, getChainName, getExplorerAddressUrl, OrderType } from "../../../anyspend/index.js";
3
- import { DEFAULT_NFT_CONTRACT } from "../../../anyspend/constants/index.js";
4
3
  import { GlareCard, Popover, PopoverContent, PopoverTrigger } from "../../../global-account/react/index.js";
5
4
  import { cn } from "../../../shared/utils/index.js";
6
5
  import { getIpfsUrl } from "../../../shared/utils/ipfs.js";
@@ -10,11 +9,14 @@ import { MoreVertical } from "lucide-react";
10
9
  import { useState } from "react";
11
10
  import { b3 } from "viem/chains";
12
11
  import { AnySpendCustom } from "./AnySpendCustom.js";
13
- export function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract = DEFAULT_NFT_CONTRACT }) {
12
+ export function AnySpendNFT({ isMainnet = true, loadOrder, mode = "modal", recipientAddress, nftContract, onSuccess }) {
14
13
  const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative size-[200px]", children: [_jsx("div", { className: "absolute inset-0 scale-95 bg-black/30 blur-md" }), _jsxs(GlareCard, { className: "overflow-hidden", children: [_jsx("img", { src: getIpfsUrl(nftContract.imageUrl), alt: nftContract.name, className: "size-full object-cover" }), _jsx("div", { className: "absolute inset-0 rounded-xl border border-white/10" })] }), _jsx(DropdownMenu, { nftContract: nftContract })] }), _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[100px] w-full" }), _jsxs("div", { className: "mb-1 flex w-full flex-col items-center gap-2 p-5", children: [_jsx("span", { className: "font-sf-rounded text-2xl font-semibold", children: nftContract.name }), _jsx("div", { className: "flex w-fit items-center gap-1", children: anyspendPrice ? (_jsx(AnimatePresence, { mode: "wait", children: _jsx("div", { className: cn("text-as-primary group flex items-center text-3xl font-semibold transition-all", {
15
14
  "opacity-0": isLoadingAnyspendPrice
16
15
  }), children: formatDisplayNumber(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }) }) })) : (_jsx("div", { className: "h-[36px] w-full" })) })] })] })] }));
17
- return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: { nftContract }, header: header }));
16
+ return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.MintNFT, dstChainId: nftContract.chainId, dstToken: nftContract.currency, dstAmount: nftContract.price, contractAddress: nftContract.contractAddress, encodedData: "0x", metadata: {
17
+ type: OrderType.MintNFT,
18
+ nftContract: nftContract
19
+ }, header: header, onSuccess: onSuccess }));
18
20
  }
19
21
  function DropdownMenu({ nftContract }) {
20
22
  const [open, setOpen] = useState(false);
@@ -1,9 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { ABI_ERC20_STAKING, B3_TOKEN, OrderType } from "../../../anyspend/index.js";
3
- import { EthIcon } from "./icons/EthIcon.js";
4
- import { SolIcon } from "./icons/SolIcon.js";
5
- import { UsdcIcon } from "./icons/USDCIcon.js";
6
- import { Button, GlareCardRounded, Input, TextLoop, useHasMounted, useModalStore, useChainSwitchWithAction, useTokenBalance, StyleRoot } from "../../../global-account/react/index.js";
3
+ import { Button, GlareCardRounded, Input, StyleRoot, TextLoop, useChainSwitchWithAction, useHasMounted, useModalStore, useTokenBalance } from "../../../global-account/react/index.js";
7
4
  import { formatTokenAmount } from "../../../shared/utils/number.js";
8
5
  import { motion } from "framer-motion";
9
6
  import invariant from "invariant";
@@ -14,6 +11,9 @@ import { createPublicClient, encodeFunctionData, erc20Abi, http } from "viem";
14
11
  import { base } from "viem/chains";
15
12
  import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
16
13
  import { AnySpendCustom } from "./AnySpendCustom.js";
14
+ import { EthIcon } from "./icons/EthIcon.js";
15
+ import { SolIcon } from "./icons/SolIcon.js";
16
+ import { UsdcIcon } from "./icons/USDCIcon.js";
17
17
  const basePublicClient = createPublicClient({
18
18
  chain: base,
19
19
  transport: http()
@@ -250,6 +250,7 @@ export function AnySpendStakeB3({ isMainnet = true, loadOrder, mode = "modal", r
250
250
  }
251
251
  const encodedData = generateEncodedDataForStakingB3(userStakeAmount, recipientAddress);
252
252
  return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, orderType: OrderType.Custom, dstChainId: base.id, dstToken: B3_TOKEN, dstAmount: userStakeAmount, contractAddress: ERC20Staking, encodedData: encodedData, metadata: {
253
+ type: OrderType.Custom,
253
254
  action: "stake B3"
254
255
  }, header: header, onSuccess: onSuccess, showRecipient: true }));
255
256
  }
@@ -11,5 +11,8 @@ export function AnySpendTournament(props) {
11
11
  const header = ({ anyspendPrice, isLoadingAnyspendPrice }) => (_jsxs(_Fragment, { children: [_jsx("div", { className: "z-10 mt-[-100px] flex h-[270px] w-full items-end justify-center", children: _jsx("img", { src: "https://cdn.b3.fun/tournament-play.svg", alt: "Tournament Play", className: "h-[200px] w-[360px] object-cover object-center" }) }), _jsxs("div", { className: "from-b3-react-background to-as-on-surface-1 mt-[-100px] w-full rounded-t-lg bg-gradient-to-t", children: [_jsx("div", { className: "h-[100px] w-full" }), _jsxs("div", { className: "flex w-full flex-col items-center gap-1 p-6 pt-0", children: [_jsxs("span", { className: "font-sf-rounded text-center text-lg font-semibold", children: [action === "join" ? "Pay entry fee to join " : "Pay to fund ", " ", tournamentMetadata.name] }), _jsx("div", { className: "mt-2 flex w-fit items-center gap-1", children: anyspendPrice ? (_jsx(AnimatePresence, { mode: "wait", children: _jsxs("div", { className: cn("text-as-primary group flex items-center text-2xl font-semibold transition-all", {
12
12
  "opacity-0": isLoadingAnyspendPrice
13
13
  }), children: [formatDisplayNumber(anyspendPrice?.data?.currencyIn?.amountUsd, { style: "currency" }), " (", formatTokenAmount(BigInt(dstAmount), dstToken.decimals, 6, true), " ", dstToken.symbol, ")"] }) })) : (_jsx("div", { className: "h-[32px] w-full" })) })] })] })] }));
14
- return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: { tournament: tournamentMetadata }, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
14
+ return (_jsx(AnySpendCustom, { isMainnet: isMainnet, loadOrder: loadOrder, mode: mode, recipientAddress: action === "join" ? props.joinFor : undefined, orderType: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament, dstChainId: tournamentChainId, dstToken: dstToken, dstAmount: dstAmount, contractAddress: tournamentContractAddress, encodedData: "0x", metadata: {
15
+ type: action === "join" ? OrderType.JoinTournament : OrderType.FundTournament,
16
+ tournament: tournamentMetadata
17
+ }, header: header, onSuccess: onSuccess, showRecipient: action === "join" }));
15
18
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { ALL_CHAINS, capitalizeFirstLetter, EVM_CHAINS, getChainName, getErrorDisplay, getExplorerTxUrl, getPaymentUrl, getStatusDisplay, isNativeToken, OrderStatus, OrderType, RELAY_ETH_ADDRESS, zNft, zToken, zTournament } from "../../../../anyspend/index.js";
4
- import { CopyToClipboard, Badge, ShinyButton, Skeleton, TextLoop, TextShimmer, Button, useAccountWallet, useChainSwitchWithAction, useOnchainName, useModalStore } from "../../../../global-account/react/index.js";
4
+ import { Badge, Button, CopyToClipboard, ShinyButton, Skeleton, TextLoop, TextShimmer, useAccountWallet, useChainSwitchWithAction, useModalStore, useOnchainName } from "../../../../global-account/react/index.js";
5
5
  import { cn } from "../../../../shared/utils/index.js";
6
6
  import centerTruncate from "../../../../shared/utils/centerTruncate.js";
7
7
  import { formatTokenAmount } from "../../../../shared/utils/number.js";
@@ -217,7 +217,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
217
217
  };
218
218
  // When waitingForDeposit is true, we show a message to the user to wait for the deposit to be processed.
219
219
  const setWaitingForDeposit = useCallback(() => {
220
- const params = new URLSearchParams(searchParams);
220
+ const params = new URLSearchParams(searchParams.toString());
221
221
  params.set("waitingForDeposit", "true");
222
222
  router.push(`?${params}`);
223
223
  }, [router, searchParams]);
@@ -338,7 +338,7 @@ export const OrderDetails = memo(function OrderDetails({ isMainnet, mode = "moda
338
338
  toast.success("Copied to clipboard");
339
339
  }, children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("strong", { className: "border-as-brand text-as-primary border-b-2 pb-1 text-2xl font-semibold sm:text-xl", children: [roundedUpSrcAmount, " ", srcToken.symbol] }), _jsx(Copy, { className: "text-as-primary/50 hover:text-as-primary h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), _jsxs(Badge, { variant: "outline", className: "flex h-10 items-center gap-2 px-3 py-1 pr-2 text-sm", children: ["on ", getChainName(order.srcChain), _jsx("img", { src: ALL_CHAINS[order.srcChain].logoUrl, alt: getChainName(order.srcChain), className: cn("h-6 rounded-full", order.srcChain === b3.id && "h-5 rounded-none") })] })] }), _jsx("span", { className: "text-as-primary/50 mb-1 mt-2", children: " to the address:" })] }), _jsx(CopyToClipboard, { text: order.globalAddress, onCopy: () => {
340
340
  toast.success("Copied to clipboard");
341
- }, children: _jsxs("div", { className: "bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), account?.address && !showQRCode ? (_jsxs("div", { className: "mb-4 mt-8 flex w-full flex-col items-center gap-4", children: [_jsxs("div", { className: "relative flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: handlePayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to: ", centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] })) : (_jsxs(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: [_jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), size: 200 }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [account && (_jsxs(Button, { variant: "ghost", className: "text-as-primary w-full", onClick: handlePayment, children: ["Send Transaction ", _jsx(ChevronRight, { className: "ml-2 h-4 w-4" })] })), EVM_CHAINS[order.srcChain] ? (_jsxs(Button, { variant: "outline", className: "w-full", onClick: handlePayment, children: ["Open Metamask", _jsx(WalletMetamask, { className: "ml-2 h-5 w-5", variant: "branded" })] })) : null, _jsx("a", { href: handleCoinbaseRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Coinbase", _jsx(WalletCoinbase, { className: "ml-2 h-5 w-5", variant: "branded" })] }) }), _jsx("a", { href: handlePhantomRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Phantom", _jsx(WalletPhantom, { className: "ml-2 h-5 w-5", variant: "branded" })] }) })] })] }))] })), _jsxs("div", { className: "bg-as-light-brand/30 w-full rounded-lg p-4 sm:p-2 sm:px-4", children: [_jsx("p", { className: "text-as-secondary mb-3 text-sm", children: "Continue on another device?" }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(CopyToClipboard, { text: permalink, onCopy: () => {
341
+ }, children: _jsxs("div", { className: "bg-b3-react-background border-b3-react-border hover:border-as-brand group flex cursor-pointer items-center justify-between gap-4 rounded-lg border p-3 px-4 shadow-md transition-all duration-200", children: [_jsx("div", { className: "text-as-primary overflow-hidden text-ellipsis whitespace-nowrap text-sm", children: order.globalAddress }), _jsx(Copy, { className: "group-hover:text-as-brand text-as-primary/50 h-5 w-5 cursor-pointer transition-all duration-200" })] }) }), account?.address && !showQRCode ? (_jsxs("div", { className: "mb-4 mt-8 flex w-full flex-col items-center gap-4", children: [_jsxs("div", { className: "relative flex w-full flex-col items-center gap-2", children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", textColor: "text-white", className: "flex w-5/6 items-center gap-2 sm:px-0", disabled: txLoading || isSwitchingOrExecuting, onClick: handlePayment, children: txLoading ? (_jsxs(_Fragment, { children: ["Transaction Pending", _jsx(Loader2, { className: "ml-2 h-5 w-5 animate-spin" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from Connected Wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] })) }), _jsxs("span", { className: "label-style text-as-primary/50 text-xs", children: ["Connected to: ", centerTruncate(account?.address || "", 6)] })] }), _jsxs("div", { className: "flex w-full flex-col items-center gap-2", children: [_jsxs(ShinyButton, { accentColor: colorMode === "dark" ? "#ffffff" : "#000000", className: "flex w-5/6 items-center gap-2 sm:px-0", onClick: () => setShowQRCode(true), children: [_jsx("span", { className: "pl-4 text-lg md:text-sm", children: "Pay from a different wallet" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" }), _jsx("span", { className: "label-style text-as-primary/30 text-xs", children: "& more" })] })] })] })) : (_jsxs(motion.div, { initial: { opacity: 0, filter: "blur(10px)" }, animate: { opacity: 1, filter: "blur(0px)" }, transition: { duration: 0.5, ease: "easeInOut" }, className: "flex w-full items-center justify-evenly gap-4", children: [_jsxs("div", { className: "mt-8 flex flex-col items-center rounded-lg bg-white p-6 pb-3", children: [_jsx(QRCodeSVG, { value: getPaymentUrl(order.globalAddress, BigInt(order.srcAmount), order.srcTokenAddress === RELAY_ETH_ADDRESS ? "ETH" : order.srcTokenAddress), className: "max-w-[200px]" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2 text-sm", children: [_jsx("span", { className: "label-style text-as-brand/70 text-sm", children: "Scan with" }), _jsxs(TextLoop, { interval: 3, children: [_jsx(WalletMetamask, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletCoinbase, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletPhantom, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletTrust, { className: "h-5 w-5", variant: "branded" }), _jsx(WalletWalletConnect, { className: "h-5 w-5", variant: "branded" })] })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [account && (_jsxs(Button, { variant: "ghost", className: "text-as-primary w-full", onClick: handlePayment, children: ["Send Transaction ", _jsx(ChevronRight, { className: "ml-2 h-4 w-4" })] })), EVM_CHAINS[order.srcChain] ? (_jsxs(Button, { variant: "outline", className: "w-full", onClick: handlePayment, children: ["Open Metamask", _jsx(WalletMetamask, { className: "ml-2 h-5 w-5", variant: "branded" })] })) : null, _jsx("a", { href: handleCoinbaseRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Coinbase", _jsx(WalletCoinbase, { className: "ml-2 h-5 w-5", variant: "branded" })] }) }), _jsx("a", { href: handlePhantomRedirect(), children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Open Phantom", _jsx(WalletPhantom, { className: "ml-2 h-5 w-5", variant: "branded" })] }) })] })] }))] })), _jsxs("div", { className: "bg-as-light-brand/30 w-full rounded-lg p-4 sm:p-2 sm:px-4", children: [_jsx("p", { className: "text-as-secondary mb-3 text-sm", children: "Continue on another device?" }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(CopyToClipboard, { text: permalink, onCopy: () => {
342
342
  toast.success("Copied to clipboard");
343
343
  }, children: _jsxs(Button, { variant: "outline", className: "w-full", children: ["Copy Link", _jsx(Copy, { className: "ml-2 h-3 w-3" })] }) }), _jsxs(Button, { variant: "outline", className: "w-full", onClick: () => {
344
344
  if (navigator.share) {
@@ -1,4 +1,5 @@
1
- import { Nft, OnrampVendor, OrderType, Token, Tournament } from "../../../anyspend/types";
1
+ import { OnrampVendor } from "../../../anyspend/types";
2
+ import { CreateOrderParams } from "./useAnyspendCreateOrder";
2
3
  export type OnrampOptions = {
3
4
  vendor: OnrampVendor;
4
5
  paymentMethod: string;
@@ -6,25 +7,9 @@ export type OnrampOptions = {
6
7
  redirectUrl: string;
7
8
  ipAddress?: string;
8
9
  };
9
- export type CreateOnrampOrderParams = {
10
- isMainnet: boolean;
11
- recipientAddress: string;
12
- orderType: OrderType;
13
- dstChain: number;
14
- dstToken: Token;
10
+ export type CreateOnrampOrderParams = Omit<CreateOrderParams, "srcChain" | "srcToken" | "srcAmount"> & {
15
11
  srcFiatAmount: string;
16
12
  onramp: OnrampOptions;
17
- partnerId?: string;
18
- expectedDstAmount: string;
19
- creatorAddress?: string;
20
- nft?: Nft & {
21
- price: string;
22
- };
23
- tournament?: Tournament & {
24
- contractAddress: string;
25
- entryPriceOrFundAmount: string;
26
- };
27
- payload?: any;
28
13
  };
29
14
  export type UseAnyspendCreateOnrampOrderProps = {
30
15
  onSuccess?: (data: any) => void;
@@ -18,6 +18,7 @@ export type CreateOrderParams = {
18
18
  };
19
19
  creatorAddress?: string;
20
20
  payload?: any;
21
+ partnerId?: string;
21
22
  };
22
23
  export type UseAnyspendCreateOrderProps = {
23
24
  onSuccess?: (data: any) => void;
@@ -1,5 +1,5 @@
1
1
  import { anyspendService } from "../../../anyspend/services/anyspend.js";
2
- import { normalizeAddress, buildMetadata, buildPayload } from "../../../anyspend/utils/index.js";
2
+ import { buildMetadata, buildPayload, normalizeAddress } from "../../../anyspend/utils/index.js";
3
3
  import { useMutation } from "@tanstack/react-query";
4
4
  import { useMemo } from "react";
5
5
  /**
@@ -130,6 +130,8 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
130
130
  } | null;
131
131
  payload: {
132
132
  contractAddress: string;
133
+ tokenId: number | null;
134
+ contractType: import("../../../anyspend/types").NftType;
133
135
  nftPrice: string;
134
136
  };
135
137
  } | {
@@ -488,6 +490,8 @@ export declare function useAnyspendOrderAndTransactions(isMainnet: boolean, orde
488
490
  } | null;
489
491
  payload: {
490
492
  contractAddress: string;
493
+ tokenId: number | null;
494
+ contractType: import("../../../anyspend/types").NftType;
491
495
  nftPrice: string;
492
496
  };
493
497
  } | {
@@ -127,6 +127,8 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
127
127
  } | null;
128
128
  payload: {
129
129
  contractAddress: string;
130
+ tokenId: number | null;
131
+ contractType: import("../..").NftType;
130
132
  nftPrice: string;
131
133
  };
132
134
  } | {
@@ -449,6 +451,8 @@ export declare function useAnyspendOrderHistory(isMainnet: boolean, creatorAddre
449
451
  } | null;
450
452
  payload: {
451
453
  contractAddress: string;
454
+ tokenId: number | null;
455
+ contractType: import("../..").NftType;
452
456
  nftPrice: string;
453
457
  };
454
458
  } | {
@@ -1,5 +1,5 @@
1
- import { GetOrderAndTxsResponse, GetQuoteRequest, GetQuoteResponse, SendPermitDataRequestBody, Token } from "../../anyspend/types";
2
1
  import { OnrampOptions } from "../../anyspend/react";
2
+ import { GetOrderAndTxsResponse, GetQuoteRequest, GetQuoteResponse, SendPermitDataRequestBody, Token } from "../../anyspend/types";
3
3
  export declare const anyspendService: {
4
4
  getTokenList: (isMainnet: boolean, chainId: number, query: string) => Promise<Token[]>;
5
5
  getToken: (isMainnet: boolean, chainId: number, tokenAddress: string) => Promise<Token>;
@@ -150,6 +150,8 @@ export declare const anyspendService: {
150
150
  } | null;
151
151
  payload: {
152
152
  contractAddress: string;
153
+ tokenId: number | null;
154
+ contractType: import("../../anyspend/types").NftType;
153
155
  nftPrice: string;
154
156
  };
155
157
  } | {
@@ -1,7 +1,7 @@
1
+ import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants/index.js";
1
2
  import { zGetCoinbaseOnrampOptionsResponse, zGetOrderAndTxsResponse, zGetOrderHistoryResponse, zGetTokenListResponse } from "../../anyspend/types/index.js";
2
3
  import { getNativeToken, isNativeToken } from "../../anyspend/utils/index.js";
3
4
  import invariant from "invariant";
4
- import { ANYSPEND_MAINNET_BASE_URL, ANYSPEND_TESTNET_BASE_URL } from "../../anyspend/constants/index.js";
5
5
  // Service functions
6
6
  export const anyspendService = {
7
7
  getTokenList: async (isMainnet, chainId, query) => {
@@ -2,6 +2,7 @@ export * from "./req-res";
2
2
  export * from "./chain";
3
3
  export * from "./custom";
4
4
  export * from "./globalWallet";
5
+ export * from "./metadata";
5
6
  export * from "./nft";
6
7
  export * from "./onramp";
7
8
  export * from "./order";
@@ -2,6 +2,7 @@ export * from "./req-res/index.js";
2
2
  export * from "./chain.js";
3
3
  export * from "./custom.js";
4
4
  export * from "./globalWallet.js";
5
+ export * from "./metadata.js";
5
6
  export * from "./nft.js";
6
7
  export * from "./onramp.js";
7
8
  export * from "./order.js";
@@ -0,0 +1,26 @@
1
+ import { NftContract } from "./nft";
2
+ import { OrderType } from "./order";
3
+ export type BaseMetadata = {
4
+ type: OrderType;
5
+ };
6
+ export type NftMetadata = BaseMetadata & {
7
+ type: OrderType.MintNFT;
8
+ nftContract: NftContract;
9
+ };
10
+ export type TournamentMetadata = BaseMetadata & {
11
+ type: OrderType.JoinTournament | OrderType.FundTournament;
12
+ tournament: {
13
+ slug: string;
14
+ name: string;
15
+ description: string;
16
+ imageUrl: string;
17
+ };
18
+ };
19
+ export type CustomTxMetadata = BaseMetadata & {
20
+ type: OrderType.Custom;
21
+ action: string;
22
+ };
23
+ export type AnySpendMetadata = NftMetadata | TournamentMetadata | CustomTxMetadata;
24
+ export declare function isNftMetadata(metadata: AnySpendMetadata): metadata is NftMetadata;
25
+ export declare function isTournamentMetadata(metadata: AnySpendMetadata): metadata is TournamentMetadata;
26
+ export declare function isCustomTxMetadata(metadata: AnySpendMetadata): metadata is CustomTxMetadata;
@@ -0,0 +1,11 @@
1
+ import { OrderType } from "./order.js";
2
+ // Type guard functions
3
+ export function isNftMetadata(metadata) {
4
+ return metadata.type === OrderType.MintNFT;
5
+ }
6
+ export function isTournamentMetadata(metadata) {
7
+ return metadata.type === OrderType.JoinTournament || metadata.type === OrderType.FundTournament;
8
+ }
9
+ export function isCustomTxMetadata(metadata) {
10
+ return metadata.type === OrderType.Custom;
11
+ }
@@ -68,12 +68,18 @@ export declare const zNft: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
68
68
  export type Nft = z.infer<typeof zNft>;
69
69
  export declare const zMintNftPayload: z.ZodObject<{
70
70
  contractAddress: z.ZodString;
71
+ tokenId: z.ZodNullable<z.ZodNumber>;
72
+ contractType: z.ZodNativeEnum<typeof NftType>;
71
73
  nftPrice: z.ZodString;
72
74
  }, "strip", z.ZodTypeAny, {
73
75
  contractAddress: string;
76
+ tokenId: number | null;
77
+ contractType: NftType;
74
78
  nftPrice: string;
75
79
  }, {
76
80
  contractAddress: string;
81
+ tokenId: number | null;
82
+ contractType: NftType;
77
83
  nftPrice: string;
78
84
  }>;
79
85
  export declare const zMintNftMetadata: z.ZodObject<{
@@ -264,4 +270,5 @@ export interface NftContract {
264
270
  name: string;
265
271
  description: string;
266
272
  tokenId: number | null;
273
+ type: NftType;
267
274
  }
@@ -24,6 +24,8 @@ export const zNft = z.discriminatedUnion("type", [
24
24
  ]);
25
25
  export const zMintNftPayload = z.object({
26
26
  contractAddress: z.string(),
27
+ tokenId: z.number().nullable(),
28
+ contractType: z.nativeEnum(NftType),
27
29
  nftPrice: z.string()
28
30
  });
29
31
  export const zMintNftMetadata = z.object({
@@ -487,12 +487,18 @@ export declare const zOrder: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
487
487
  type: z.ZodLiteral<OrderType.MintNFT>;
488
488
  payload: z.ZodObject<{
489
489
  contractAddress: z.ZodString;
490
+ tokenId: z.ZodNullable<z.ZodNumber>;
491
+ contractType: z.ZodNativeEnum<typeof import("./nft").NftType>;
490
492
  nftPrice: z.ZodString;
491
493
  }, "strip", z.ZodTypeAny, {
492
494
  contractAddress: string;
495
+ tokenId: number | null;
496
+ contractType: import("./nft").NftType;
493
497
  nftPrice: string;
494
498
  }, {
495
499
  contractAddress: string;
500
+ tokenId: number | null;
501
+ contractType: import("./nft").NftType;
496
502
  nftPrice: string;
497
503
  }>;
498
504
  metadata: z.ZodObject<{
@@ -743,6 +749,8 @@ export declare const zOrder: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
743
749
  } | null;
744
750
  payload: {
745
751
  contractAddress: string;
752
+ tokenId: number | null;
753
+ contractType: import("./nft").NftType;
746
754
  nftPrice: string;
747
755
  };
748
756
  }, {
@@ -815,6 +823,8 @@ export declare const zOrder: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
815
823
  } | null;
816
824
  payload: {
817
825
  contractAddress: string;
826
+ tokenId: number | null;
827
+ contractType: import("./nft").NftType;
818
828
  nftPrice: string;
819
829
  };
820
830
  }>, z.ZodObject<{
@@ -267,12 +267,18 @@ export declare const zCreateOrderRequest: z.ZodObject<{
267
267
  type: z.ZodLiteral<OrderType.MintNFT>;
268
268
  payload: z.ZodObject<{
269
269
  contractAddress: z.ZodString;
270
+ tokenId: z.ZodNullable<z.ZodNumber>;
271
+ contractType: z.ZodNativeEnum<typeof import("../nft").NftType>;
270
272
  nftPrice: z.ZodString;
271
273
  }, "strip", z.ZodTypeAny, {
272
274
  contractAddress: string;
275
+ tokenId: number | null;
276
+ contractType: import("../nft").NftType;
273
277
  nftPrice: string;
274
278
  }, {
275
279
  contractAddress: string;
280
+ tokenId: number | null;
281
+ contractType: import("../nft").NftType;
276
282
  nftPrice: string;
277
283
  }>;
278
284
  metadata: z.ZodObject<{
@@ -499,6 +505,8 @@ export declare const zCreateOrderRequest: z.ZodObject<{
499
505
  srcAmount: string;
500
506
  payload: {
501
507
  contractAddress: string;
508
+ tokenId: number | null;
509
+ contractType: import("../nft").NftType;
502
510
  nftPrice: string;
503
511
  };
504
512
  creatorAddress?: string | undefined;
@@ -556,6 +564,8 @@ export declare const zCreateOrderRequest: z.ZodObject<{
556
564
  srcAmount: string;
557
565
  payload: {
558
566
  contractAddress: string;
567
+ tokenId: number | null;
568
+ contractType: import("../nft").NftType;
559
569
  nftPrice: string;
560
570
  };
561
571
  creatorAddress?: string | undefined;
@@ -1455,6 +1465,8 @@ export declare const zCreateOrderRequest: z.ZodObject<{
1455
1465
  srcAmount: string;
1456
1466
  payload: {
1457
1467
  contractAddress: string;
1468
+ tokenId: number | null;
1469
+ contractType: import("../nft").NftType;
1458
1470
  nftPrice: string;
1459
1471
  };
1460
1472
  creatorAddress?: string | undefined;
@@ -1701,6 +1713,8 @@ export declare const zCreateOrderRequest: z.ZodObject<{
1701
1713
  srcAmount: string;
1702
1714
  payload: {
1703
1715
  contractAddress: string;
1716
+ tokenId: number | null;
1717
+ contractType: import("../nft").NftType;
1704
1718
  nftPrice: string;
1705
1719
  };
1706
1720
  creatorAddress?: string | undefined;
@@ -2212,12 +2226,18 @@ export declare const zCreateOrderResponse: z.ZodObject<{
2212
2226
  type: z.ZodLiteral<OrderType.MintNFT>;
2213
2227
  payload: z.ZodObject<{
2214
2228
  contractAddress: z.ZodString;
2229
+ tokenId: z.ZodNullable<z.ZodNumber>;
2230
+ contractType: z.ZodNativeEnum<typeof import("../nft").NftType>;
2215
2231
  nftPrice: z.ZodString;
2216
2232
  }, "strip", z.ZodTypeAny, {
2217
2233
  contractAddress: string;
2234
+ tokenId: number | null;
2235
+ contractType: import("../nft").NftType;
2218
2236
  nftPrice: string;
2219
2237
  }, {
2220
2238
  contractAddress: string;
2239
+ tokenId: number | null;
2240
+ contractType: import("../nft").NftType;
2221
2241
  nftPrice: string;
2222
2242
  }>;
2223
2243
  metadata: z.ZodObject<{
@@ -2468,6 +2488,8 @@ export declare const zCreateOrderResponse: z.ZodObject<{
2468
2488
  } | null;
2469
2489
  payload: {
2470
2490
  contractAddress: string;
2491
+ tokenId: number | null;
2492
+ contractType: import("../nft").NftType;
2471
2493
  nftPrice: string;
2472
2494
  };
2473
2495
  }, {
@@ -2540,6 +2562,8 @@ export declare const zCreateOrderResponse: z.ZodObject<{
2540
2562
  } | null;
2541
2563
  payload: {
2542
2564
  contractAddress: string;
2565
+ tokenId: number | null;
2566
+ contractType: import("../nft").NftType;
2543
2567
  nftPrice: string;
2544
2568
  };
2545
2569
  }>, z.ZodObject<{
@@ -3642,6 +3666,8 @@ export declare const zCreateOrderResponse: z.ZodObject<{
3642
3666
  } | null;
3643
3667
  payload: {
3644
3668
  contractAddress: string;
3669
+ tokenId: number | null;
3670
+ contractType: import("../nft").NftType;
3645
3671
  nftPrice: string;
3646
3672
  };
3647
3673
  } | {
@@ -3966,6 +3992,8 @@ export declare const zCreateOrderResponse: z.ZodObject<{
3966
3992
  } | null;
3967
3993
  payload: {
3968
3994
  contractAddress: string;
3995
+ tokenId: number | null;
3996
+ contractType: import("../nft").NftType;
3969
3997
  nftPrice: string;
3970
3998
  };
3971
3999
  } | {