thirdweb 5.52.0-nightly-3a32b11a80cb28f22575219ab8f80e703793ec10-20240906000338 → 5.53.0-nightly-7dd2869e240522a467c73f0017f080ee118c5bf0-20240908000435

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 (151) hide show
  1. package/dist/cjs/exports/react.js +4 -1
  2. package/dist/cjs/exports/react.js.map +1 -1
  3. package/dist/cjs/exports/social.js +6 -0
  4. package/dist/cjs/exports/social.js.map +1 -0
  5. package/dist/cjs/exports/wallets/smart.js +2 -1
  6. package/dist/cjs/exports/wallets/smart.js.map +1 -1
  7. package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  8. package/dist/cjs/react/core/providers/thirdweb-provider.js +2 -0
  9. package/dist/cjs/react/core/providers/thirdweb-provider.js.map +1 -1
  10. package/dist/cjs/react/core/social/useSocialProfiles.js +37 -0
  11. package/dist/cjs/react/core/social/useSocialProfiles.js.map +1 -0
  12. package/dist/cjs/react/core/utils/structuralSharing.js +54 -0
  13. package/dist/cjs/react/core/utils/structuralSharing.js.map +1 -0
  14. package/dist/cjs/react/core/utils/wallet.js +24 -0
  15. package/dist/cjs/react/core/utils/wallet.js.map +1 -1
  16. package/dist/cjs/react/native/ui/components/WalletImage.js +3 -3
  17. package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
  18. package/dist/cjs/react/native/ui/connect/ConnectedButton.js +3 -3
  19. package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
  20. package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -2
  21. package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
  22. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +0 -3
  23. package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  24. package/dist/cjs/react/web/ui/ConnectWallet/Details.js +9 -6
  25. package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +4 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +2 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +4 -4
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
  32. package/dist/cjs/social/profiles.js +38 -0
  33. package/dist/cjs/social/profiles.js.map +1 -0
  34. package/dist/cjs/social/types.js +3 -0
  35. package/dist/cjs/social/types.js.map +1 -0
  36. package/dist/cjs/utils/domains.js +3 -0
  37. package/dist/cjs/utils/domains.js.map +1 -1
  38. package/dist/cjs/utils/function-id.js +3 -5
  39. package/dist/cjs/utils/function-id.js.map +1 -1
  40. package/dist/cjs/utils/ipfs.js +19 -10
  41. package/dist/cjs/utils/ipfs.js.map +1 -1
  42. package/dist/cjs/version.js +1 -1
  43. package/dist/cjs/wallets/smart/lib/userop.js +80 -1
  44. package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
  45. package/dist/esm/exports/react.js +2 -0
  46. package/dist/esm/exports/react.js.map +1 -1
  47. package/dist/esm/exports/social.js +3 -0
  48. package/dist/esm/exports/social.js.map +1 -0
  49. package/dist/esm/exports/wallets/smart.js +1 -1
  50. package/dist/esm/exports/wallets/smart.js.map +1 -1
  51. package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
  52. package/dist/esm/react/core/providers/thirdweb-provider.js +2 -0
  53. package/dist/esm/react/core/providers/thirdweb-provider.js.map +1 -1
  54. package/dist/esm/react/core/social/useSocialProfiles.js +34 -0
  55. package/dist/esm/react/core/social/useSocialProfiles.js.map +1 -0
  56. package/dist/esm/react/core/utils/structuralSharing.js +50 -0
  57. package/dist/esm/react/core/utils/structuralSharing.js.map +1 -0
  58. package/dist/esm/react/core/utils/wallet.js +24 -0
  59. package/dist/esm/react/core/utils/wallet.js.map +1 -1
  60. package/dist/esm/react/native/ui/components/WalletImage.js +3 -3
  61. package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
  62. package/dist/esm/react/native/ui/connect/ConnectedButton.js +3 -3
  63. package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
  64. package/dist/esm/react/native/ui/connect/ConnectedModal.js +2 -2
  65. package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
  66. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +0 -3
  67. package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
  68. package/dist/esm/react/web/ui/ConnectWallet/Details.js +9 -6
  69. package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
  70. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +4 -1
  71. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  72. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +2 -1
  73. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  74. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +4 -4
  75. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
  76. package/dist/esm/social/profiles.js +35 -0
  77. package/dist/esm/social/profiles.js.map +1 -0
  78. package/dist/esm/social/types.js +2 -0
  79. package/dist/esm/social/types.js.map +1 -0
  80. package/dist/esm/utils/domains.js +3 -0
  81. package/dist/esm/utils/domains.js.map +1 -1
  82. package/dist/esm/utils/function-id.js +3 -5
  83. package/dist/esm/utils/function-id.js.map +1 -1
  84. package/dist/esm/utils/ipfs.js +19 -10
  85. package/dist/esm/utils/ipfs.js.map +1 -1
  86. package/dist/esm/version.js +1 -1
  87. package/dist/esm/wallets/smart/lib/userop.js +81 -3
  88. package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
  89. package/dist/types/exports/react.d.ts +1 -0
  90. package/dist/types/exports/react.d.ts.map +1 -1
  91. package/dist/types/exports/social.d.ts +3 -0
  92. package/dist/types/exports/social.d.ts.map +1 -0
  93. package/dist/types/exports/wallets/smart.d.ts +1 -1
  94. package/dist/types/exports/wallets/smart.d.ts.map +1 -1
  95. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +1 -0
  96. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  97. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -1
  98. package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
  99. package/dist/types/react/core/providers/thirdweb-provider.d.ts.map +1 -1
  100. package/dist/types/react/core/social/useSocialProfiles.d.ts +23 -0
  101. package/dist/types/react/core/social/useSocialProfiles.d.ts.map +1 -0
  102. package/dist/types/react/core/utils/structuralSharing.d.ts +4 -0
  103. package/dist/types/react/core/utils/structuralSharing.d.ts.map +1 -0
  104. package/dist/types/react/core/utils/wallet.d.ts +3 -0
  105. package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
  106. package/dist/types/react/native/ui/components/WalletImage.d.ts +1 -1
  107. package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
  108. package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
  109. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +18 -3
  110. package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
  111. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
  112. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
  113. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +2 -2
  114. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
  115. package/dist/types/social/profiles.d.ts +24 -0
  116. package/dist/types/social/profiles.d.ts.map +1 -0
  117. package/dist/types/social/types.d.ts +41 -0
  118. package/dist/types/social/types.d.ts.map +1 -0
  119. package/dist/types/utils/domains.d.ts +6 -0
  120. package/dist/types/utils/domains.d.ts.map +1 -1
  121. package/dist/types/utils/function-id.d.ts.map +1 -1
  122. package/dist/types/utils/ipfs.d.ts.map +1 -1
  123. package/dist/types/version.d.ts +1 -1
  124. package/dist/types/wallets/smart/lib/userop.d.ts +25 -1
  125. package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
  126. package/package.json +1 -1
  127. package/src/exports/react.ts +3 -0
  128. package/src/exports/social.ts +2 -0
  129. package/src/exports/wallets/smart.ts +1 -0
  130. package/src/react/core/hooks/connection/ConnectButtonProps.ts +1 -0
  131. package/src/react/core/hooks/transaction/useSendTransaction.ts +5 -1
  132. package/src/react/core/providers/thirdweb-provider.tsx +2 -0
  133. package/src/react/core/social/useSocialProfiles.ts +40 -0
  134. package/src/react/core/utils/structuralSharing.ts +53 -0
  135. package/src/react/core/utils/wallet.ts +27 -0
  136. package/src/react/native/ui/components/WalletImage.tsx +4 -4
  137. package/src/react/native/ui/connect/ConnectedButton.tsx +8 -14
  138. package/src/react/native/ui/connect/ConnectedModal.tsx +8 -14
  139. package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +0 -3
  140. package/src/react/web/ui/ConnectWallet/Details.tsx +40 -23
  141. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +7 -1
  142. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +2 -1
  143. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +9 -3
  144. package/src/social/profiles.ts +46 -0
  145. package/src/social/types.ts +43 -0
  146. package/src/utils/domains.ts +8 -0
  147. package/src/utils/function-id.ts +3 -5
  148. package/src/utils/ipfs.test.ts +57 -1
  149. package/src/utils/ipfs.ts +22 -14
  150. package/src/version.ts +1 -1
  151. package/src/wallets/smart/lib/userop.ts +98 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/social/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,gBAAgB,GAAG,WAAW,GAAG,UAAU,CAAC;CACxD,EAAE,CAAC"}
@@ -4,6 +4,11 @@ type DomainOverrides = {
4
4
  * @default "rpc.thirdweb.com"
5
5
  */
6
6
  rpc?: string;
7
+ /**
8
+ * The base URL for the social service.
9
+ * @default "social.thirdweb.com"
10
+ */
11
+ social?: string;
7
12
  /**
8
13
  * The base URL for the in-app wallet service
9
14
  * @default "embedded-wallet.thirdweb.com"
@@ -35,6 +40,7 @@ export declare const setThirdwebDomains: (DomainOverrides: DomainOverrides) => v
35
40
  */
36
41
  export declare const getThirdwebDomains: () => {
37
42
  rpc: string;
43
+ social: string;
38
44
  inAppWallet: string;
39
45
  pay: string;
40
46
  storage: string;
@@ -1 +1 @@
1
- {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/utils/domains.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAclD;;GAEG;AACH,eAAO,MAAM,kBAAkB,oBAAqB,eAAe,SAQlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;SArDvB,MAAM;iBAKE,MAAM;SAKd,MAAM;aAKF,MAAM;aAKN,MAAM;CAmCjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAa,MAAM,eAAe,WAMhE,CAAC"}
1
+ {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/utils/domains.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAgBlD;;GAEG;AACH,eAAO,MAAM,kBAAkB,oBAAqB,eAAe,SASlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;SA7DvB,MAAM;YAKH,MAAM;iBAKD,MAAM;SAKd,MAAM;aAKF,MAAM;aAKN,MAAM;CAsCjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAa,MAAM,eAAe,WAMhE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"function-id.d.ts","sourceRoot":"","sources":["../../../src/utils/function-id.ts"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAK3C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,UAQ5C"}
1
+ {"version":3,"file":"function-id.d.ts","sourceRoot":"","sources":["../../../src/utils/function-id.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAI3C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,UAQ5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ipfs.d.ts","sourceRoot":"","sources":["../../../src/utils/ipfs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAIF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,UAwB1D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,UAU7C;AACD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,CAAC,SAAS,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxD,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkB7E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAkB1D"}
1
+ {"version":3,"file":"ipfs.d.ts","sourceRoot":"","sources":["../../../src/utils/ipfs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAIF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,UAwB1D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,UAU7C;AACD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,CAAC,SAAS,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxD,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkB7E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CA2B1D"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.52.0-nightly-3a32b11a80cb28f22575219ab8f80e703793ec10-20240906000338";
1
+ export declare const version = "5.53.0-nightly-7dd2869e240522a467c73f0017f080ee118c5bf0-20240908000435";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -65,9 +65,10 @@ export declare function createUnsignedUserOp(args: {
65
65
  * ```ts
66
66
  * import { signUserOp } from "thirdweb/wallets/smart";
67
67
  *
68
- * const userOp = createUnsignedUserOp(...);
68
+ * const userOp = await createUnsignedUserOp(...);
69
69
  *
70
70
  * const signedUserOp = await signUserOp({
71
+ * client,
71
72
  * userOp,
72
73
  * chain,
73
74
  * adminAccount,
@@ -82,4 +83,27 @@ export declare function signUserOp(args: {
82
83
  entrypointAddress?: string;
83
84
  adminAccount: Account;
84
85
  }): Promise<UserOperationV06 | UserOperationV07>;
86
+ /**
87
+ * Create and sign a user operation.
88
+ * @param options - The options for creating and signing the user operation
89
+ * @returns - The signed user operation
90
+ * @example
91
+ * ```ts
92
+ * import { createAndSignUserOp } from "thirdweb/wallets/smart";
93
+ *
94
+ * const userOp = await createAndSignUserOp({
95
+ * client,
96
+ * adminAccount,
97
+ * smartWalletOptions,
98
+ * transactions,
99
+ * });
100
+ * ```
101
+ * @walletUtils
102
+ */
103
+ export declare function createAndSignUserOp(options: {
104
+ transactions: PreparedTransaction[];
105
+ adminAccount: Account;
106
+ client: ThirdwebClient;
107
+ smartWalletOptions: SmartWalletOptions;
108
+ }): Promise<UserOperationV06 | UserOperationV07>;
85
109
  //# sourceMappingURL=userop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAkBrB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,GAAG;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,kBAAkB,CAAC,CAY7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,mBAAmB,CAAC;IACjC,eAAe,EAAE,gBAAgB,CAAC;IAClC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;CAC7C,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAwE/C;AA2SD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CA0C/C"}
1
+ {"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EAEd,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAwBrB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,cAAc,GAAG;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,kBAAkB,CAAC,CAY7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,mBAAmB,CAAC;IACjC,eAAe,EAAE,gBAAgB,CAAC;IAClC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;CAC7C,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAwE/C;AA2SD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CA0C/C;AAiDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IACjD,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,gDAgEA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thirdweb",
3
- "version": "5.52.0-nightly-3a32b11a80cb28f22575219ab8f80e703793ec10-20240906000338",
3
+ "version": "5.53.0-nightly-7dd2869e240522a467c73f0017f080ee118c5bf0-20240908000435",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -184,3 +184,6 @@ export { useConnectionManager } from "../react/core/providers/connection-manager
184
184
  export { Blobbie } from "../react/web/ui/ConnectWallet/Blobbie.js";
185
185
 
186
186
  export { useSiweAuth } from "../react/core/hooks/auth/useSiweAuth.js";
187
+
188
+ // Social
189
+ export { useSocialProfiles } from "../react/core/social/useSocialProfiles.js";
@@ -0,0 +1,2 @@
1
+ export { getSocialProfiles } from "../social/profiles.js";
2
+ export { type SocialProfiles } from "../social/types.js";
@@ -4,6 +4,7 @@ export {
4
4
  waitForUserOpReceipt,
5
5
  createUnsignedUserOp,
6
6
  signUserOp,
7
+ createAndSignUserOp,
7
8
  } from "../../wallets/smart/lib/userop.js";
8
9
 
9
10
  export {
@@ -64,6 +64,7 @@ export type PayUIOptions = Prettify<
64
64
  buyWithCrypto?:
65
65
  | false
66
66
  | {
67
+ testMode?: boolean;
67
68
  prefillSource?: {
68
69
  chain: Chain;
69
70
  token?: TokenInfo;
@@ -45,7 +45,11 @@ export type SendTransactionPayModalConfig =
45
45
  locale?: LocaleId;
46
46
  supportedTokens?: SupportedTokens;
47
47
  theme?: Theme | "light" | "dark";
48
- buyWithCrypto?: false;
48
+ buyWithCrypto?:
49
+ | false
50
+ | {
51
+ testMode?: boolean;
52
+ };
49
53
  buyWithFiat?:
50
54
  | false
51
55
  | {
@@ -6,6 +6,7 @@ import { isBaseTransactionOptions } from "../../../transaction/types.js";
6
6
  import type { Hex } from "../../../utils/encoding/hex.js";
7
7
  import { isObjectWithKeys } from "../../../utils/type-guards.js";
8
8
  import type { ConnectionManager } from "../../../wallets/manager/index.js";
9
+ import { structuralSharing } from "../utils/structuralSharing.js";
9
10
  import { SetRootElementContext } from "./RootElementContext.js";
10
11
  import { ConnectionManagerCtx } from "./connection-manager.js";
11
12
  import { invalidateWalletBalance } from "./invalidateWalletBalance.js";
@@ -63,6 +64,7 @@ export function ThirdwebProviderCore(props: {
63
64
  // With SSR, we usually want to set some default staleTime
64
65
  // above 0 to avoid refetching immediately on the client
65
66
  staleTime: 60 * 1000,
67
+ structuralSharing,
66
68
  },
67
69
  },
68
70
  }),
@@ -0,0 +1,40 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import type { ThirdwebClient } from "../../../client/client.js";
3
+ import { getSocialProfiles } from "../../../social/profiles.js";
4
+
5
+ /**
6
+ * Fetches the wallet's available social profiles.
7
+ * @param options - The options to use when fetching the social profiles.
8
+ * @param options.client - The Thirdweb client.
9
+ * @param options.address - The wallet address to fetch the social profiles for.
10
+ * @returns A React Query result containing the social profiles.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { useSocialProfiles } from "thirdweb/react";
15
+ * const { data: profiles } = useSocialProfiles({
16
+ * client,
17
+ * address: "0x...",
18
+ * });
19
+ * ```
20
+ * @beta
21
+ */
22
+ export function useSocialProfiles(options: {
23
+ client: ThirdwebClient;
24
+ address: string | undefined;
25
+ }) {
26
+ const { client, address } = options;
27
+ return useQuery({
28
+ queryKey: ["social-profiles", address],
29
+ enabled: !!address,
30
+ retry: 3,
31
+ queryFn: async () => {
32
+ if (!address) {
33
+ throw new Error(
34
+ "Address is required, should not have reached this point.",
35
+ );
36
+ }
37
+ return await getSocialProfiles({ address, client });
38
+ },
39
+ });
40
+ }
@@ -0,0 +1,53 @@
1
+ import { replaceEqualDeep } from "@tanstack/react-query";
2
+
3
+ /** Forked from https://github.com/epoberezkin/fast-deep-equal */
4
+ // biome-ignore lint/suspicious/noExplicitAny: This function by nature takes any object
5
+ export function deepEqual(a: any, b: any) {
6
+ if (a === b) return true;
7
+
8
+ if (a && b && typeof a === "object" && typeof b === "object") {
9
+ if (a.constructor !== b.constructor) return false;
10
+
11
+ let length: number;
12
+ let i: number;
13
+
14
+ if (Array.isArray(a) && Array.isArray(b)) {
15
+ length = a.length;
16
+ if (length !== b.length) return false;
17
+ for (i = length; i-- !== 0; ) if (!deepEqual(a[i], b[i])) return false;
18
+ return true;
19
+ }
20
+
21
+ if (a.valueOf !== Object.prototype.valueOf)
22
+ return a.valueOf() === b.valueOf();
23
+ if (a.toString !== Object.prototype.toString)
24
+ return a.toString() === b.toString();
25
+
26
+ const keys = Object.keys(a);
27
+ length = keys.length;
28
+ if (length !== Object.keys(b).length) return false;
29
+
30
+ for (i = length; i-- !== 0; )
31
+ // biome-ignore lint/style/noNonNullAssertion: We know its there
32
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]!)) return false;
33
+
34
+ for (i = length; i-- !== 0; ) {
35
+ const key = keys[i];
36
+
37
+ if (key && !deepEqual(a[key], b[key])) return false;
38
+ }
39
+
40
+ return true;
41
+ }
42
+
43
+ // true if both NaN, false otherwise
44
+ // biome-ignore lint/suspicious/noSelfCompare: <explanation>
45
+ return a !== a && b !== b;
46
+ }
47
+
48
+ export function structuralSharing<T>(oldData: T | undefined, newData: T) {
49
+ if (deepEqual(oldData, newData)) {
50
+ return oldData as T;
51
+ }
52
+ return replaceEqualDeep(oldData, newData) as T;
53
+ }
@@ -5,11 +5,13 @@ import type { ThirdwebClient } from "../../../client/client.js";
5
5
  import { resolveAvatar } from "../../../extensions/ens/resolve-avatar.js";
6
6
  import { resolveName } from "../../../extensions/ens/resolve-name.js";
7
7
  import { shortenAddress } from "../../../utils/address.js";
8
+ import { parseAvatarRecord } from "../../../utils/ens/avatar.js";
8
9
  import { getWalletInfo } from "../../../wallets/__generated__/getWalletInfo.js";
9
10
  import type { Account, Wallet } from "../../../wallets/interfaces/wallet.js";
10
11
  import type { WalletInfo } from "../../../wallets/wallet-info.js";
11
12
  import type { WalletId } from "../../../wallets/wallet-types.js";
12
13
  import { useWalletBalance } from "../hooks/others/useWalletBalance.js";
14
+ import { useSocialProfiles } from "../social/useSocialProfiles.js";
13
15
 
14
16
  /**
15
17
  * Get the ENS name and avatar for an address
@@ -98,6 +100,11 @@ export function useConnectedWalletDetails(
98
100
  ensName: ensNameQuery.data,
99
101
  });
100
102
 
103
+ const socialProfileQuery = useSocialProfiles({
104
+ client,
105
+ address: activeAccount?.address,
106
+ });
107
+
101
108
  const shortAddress = activeAccount?.address
102
109
  ? shortenAddress(activeAccount.address, 4)
103
110
  : "";
@@ -110,11 +117,31 @@ export function useConnectedWalletDetails(
110
117
  });
111
118
 
112
119
  const addressOrENS = ensNameQuery.data || shortAddress;
120
+ const pfpUnresolved = socialProfileQuery.data?.filter((p) => p.avatar)[0]
121
+ ?.avatar;
122
+
123
+ const { data: pfp } = useQuery({
124
+ queryKey: ["ens-avatar", pfpUnresolved],
125
+ queryFn: async () => {
126
+ if (!pfpUnresolved) {
127
+ return undefined;
128
+ }
129
+ return parseAvatarRecord({ client, uri: pfpUnresolved });
130
+ },
131
+ enabled: !!pfpUnresolved,
132
+ refetchOnWindowFocus: false,
133
+ refetchOnMount: false,
134
+ });
135
+ const name =
136
+ socialProfileQuery.data?.filter((p) => p.name)[0]?.name || addressOrENS;
113
137
 
114
138
  return {
139
+ socialProfileQuery,
115
140
  ensNameQuery,
116
141
  ensAvatarQuery,
117
142
  addressOrENS,
143
+ pfp,
144
+ name,
118
145
  shortAddress,
119
146
  balanceQuery,
120
147
  };
@@ -21,9 +21,9 @@ export const WalletImage = (props: {
21
21
  theme: Theme;
22
22
  wallet: Wallet;
23
23
  size: number;
24
- ensAvatar?: string | null;
24
+ avatar?: string | null;
25
25
  }) => {
26
- const { wallet, ensAvatar, size } = props;
26
+ const { wallet, avatar, size } = props;
27
27
 
28
28
  const { data: imageData } = useQuery({
29
29
  queryKey: ["wallet-image", wallet.id, wallet.getAccount()?.address],
@@ -56,10 +56,10 @@ export const WalletImage = (props: {
56
56
 
57
57
  return WALLET_ICON;
58
58
  },
59
- enabled: !ensAvatar,
59
+ enabled: !avatar,
60
60
  });
61
61
 
62
- const data = ensAvatar || imageData || WALLET_ICON;
62
+ const data = avatar || imageData || WALLET_ICON;
63
63
  return <RNImage theme={props.theme} data={data} size={size} />;
64
64
  };
65
65
 
@@ -22,13 +22,12 @@ export function ConnectedButton(
22
22
  const theme = parseTheme(props.theme);
23
23
  const { account, wallet } = props;
24
24
  const walletChain = useActiveWalletChain();
25
- const { ensAvatarQuery, addressOrENS, balanceQuery } =
26
- useConnectedWalletDetails(
27
- props.client,
28
- walletChain,
29
- account,
30
- props.detailsButton?.displayBalanceToken,
31
- );
25
+ const { pfp, name, balanceQuery } = useConnectedWalletDetails(
26
+ props.client,
27
+ walletChain,
28
+ account,
29
+ props.detailsButton?.displayBalanceToken,
30
+ );
32
31
  return (
33
32
  <ThemedButton
34
33
  theme={theme}
@@ -41,12 +40,7 @@ export function ConnectedButton(
41
40
  }}
42
41
  >
43
42
  <View style={styles.row}>
44
- <WalletImage
45
- theme={theme}
46
- size={40}
47
- wallet={wallet}
48
- ensAvatar={ensAvatarQuery.data}
49
- />
43
+ <WalletImage theme={theme} size={40} wallet={wallet} avatar={pfp} />
50
44
  <View style={styles.col}>
51
45
  <ThemedText
52
46
  theme={theme}
@@ -55,7 +49,7 @@ export function ConnectedButton(
55
49
  color: theme.colors.primaryButtonText,
56
50
  }}
57
51
  >
58
- {addressOrENS}
52
+ {name}
59
53
  </ThemedText>
60
54
  {balanceQuery.data ? (
61
55
  <ThemedText
@@ -163,24 +163,18 @@ export function ConnectedModal(props: ConnectedModalProps) {
163
163
  const AccountHeader = (props: ConnectedModalProps) => {
164
164
  const { account, wallet, theme } = props;
165
165
  const walletChain = useActiveWalletChain();
166
- const { ensAvatarQuery, addressOrENS, balanceQuery } =
167
- useConnectedWalletDetails(
168
- props.client,
169
- walletChain,
170
- account,
171
- props.detailsButton?.displayBalanceToken,
172
- );
166
+ const { pfp, name, balanceQuery } = useConnectedWalletDetails(
167
+ props.client,
168
+ walletChain,
169
+ account,
170
+ props.detailsButton?.displayBalanceToken,
171
+ );
173
172
  return (
174
173
  <View style={styles.accountHeaderContainer}>
175
- <WalletImage
176
- theme={theme}
177
- size={70}
178
- wallet={wallet}
179
- ensAvatar={ensAvatarQuery.data}
180
- />
174
+ <WalletImage theme={theme} size={70} wallet={wallet} avatar={pfp} />
181
175
  <SmartAccountBadge client={props.client} theme={theme} />
182
176
  <Spacer size="smd" />
183
- <Address account={account} theme={theme} addressOrENS={addressOrENS} />
177
+ <Address account={account} theme={theme} addressOrENS={name} />
184
178
  <Spacer size="xxs" />
185
179
  {balanceQuery.data ? (
186
180
  <ThemedText
@@ -544,9 +544,6 @@ function ConnectButtonInner(
544
544
  showAllWallets: props.showAllWallets,
545
545
  walletConnect: props.walletConnect,
546
546
  wallets: props.wallets,
547
- hideReceiveFunds: props.detailsModal?.hideReceiveFunds,
548
- hideSendFunds: props.detailsModal?.hideSendFunds,
549
- hideBuyFunds: props.detailsModal?.hideBuyFunds,
550
547
  }}
551
548
  />
552
549
  );
@@ -131,13 +131,12 @@ export const ConnectedWalletDetails: React.FC<{
131
131
  const activeAccount = useActiveAccount();
132
132
  const walletChain = useActiveWalletChain();
133
133
 
134
- const { ensAvatarQuery, addressOrENS, balanceQuery } =
135
- useConnectedWalletDetails(
136
- client,
137
- walletChain,
138
- activeAccount,
139
- props.detailsButton?.displayBalanceToken,
140
- );
134
+ const { pfp, name, balanceQuery } = useConnectedWalletDetails(
135
+ client,
136
+ walletChain,
137
+ activeAccount,
138
+ props.detailsButton?.displayBalanceToken,
139
+ );
141
140
 
142
141
  function closeModal() {
143
142
  setRootEl(null);
@@ -185,8 +184,7 @@ export const ConnectedWalletDetails: React.FC<{
185
184
  );
186
185
  }
187
186
 
188
- const avatarSrc =
189
- props.detailsButton?.connectedAccountAvatarUrl ?? ensAvatarQuery.data;
187
+ const avatarSrc = props.detailsButton?.connectedAccountAvatarUrl || pfp;
190
188
 
191
189
  return (
192
190
  <WalletInfoButton
@@ -235,7 +233,7 @@ export const ConnectedWalletDetails: React.FC<{
235
233
  weight={500}
236
234
  className={`${TW_CONNECTED_WALLET}__address`}
237
235
  >
238
- {props.detailsButton?.connectedAccountName ?? addressOrENS}
236
+ {props.detailsButton?.connectedAccountName ?? name}
239
237
  </Text>
240
238
 
241
239
  {/* Balance */}
@@ -280,13 +278,12 @@ function DetailsModal(props: {
280
278
  const { client, locale } = props;
281
279
  const walletChain = useActiveWalletChain();
282
280
  const activeAccount = useActiveAccount();
283
- const { ensAvatarQuery, addressOrENS, balanceQuery } =
284
- useConnectedWalletDetails(
285
- client,
286
- walletChain,
287
- activeAccount,
288
- props.displayBalanceToken,
289
- );
281
+ const { pfp, name, balanceQuery } = useConnectedWalletDetails(
282
+ client,
283
+ walletChain,
284
+ activeAccount,
285
+ props.displayBalanceToken,
286
+ );
290
287
  const theme = parseTheme(props.theme);
291
288
 
292
289
  const activeWallet = useActiveWallet();
@@ -370,8 +367,7 @@ function DetailsModal(props: {
370
367
  </MenuButton>
371
368
  );
372
369
 
373
- const avatarSrc =
374
- props.detailsModal?.connectedAccountAvatarUrl ?? ensAvatarQuery.data;
370
+ const avatarSrc = props.detailsModal?.connectedAccountAvatarUrl ?? pfp;
375
371
 
376
372
  const { hideSendFunds, hideReceiveFunds, hideBuyFunds } =
377
373
  props.detailsModal || {};
@@ -483,7 +479,7 @@ function DetailsModal(props: {
483
479
  }}
484
480
  >
485
481
  <Text color="primaryText" weight={500} size="md">
486
- {props.detailsModal?.connectedAccountName ?? addressOrENS}
482
+ {props.detailsModal?.connectedAccountName ?? name}
487
483
  </Text>
488
484
  <IconButton>
489
485
  <CopyIcon
@@ -1154,9 +1150,6 @@ export type DetailsModalConnectOptions = {
1154
1150
  chains?: Chain[];
1155
1151
  recommendedWallets?: Wallet[];
1156
1152
  showAllWallets?: boolean;
1157
- hideSendFunds?: boolean;
1158
- hideReceiveFunds?: boolean;
1159
- hideBuyFunds?: boolean;
1160
1153
  };
1161
1154
 
1162
1155
  export type UseWalletDetailsModalOptions = {
@@ -1380,6 +1373,27 @@ export type UseWalletDetailsModalOptions = {
1380
1373
  * Use custom avatar URL for the connected wallet image in the `ConnectButton` Details Modal, overriding ENS avatar or Blobbie icon.
1381
1374
  */
1382
1375
  connectedAccountAvatarUrl?: string;
1376
+
1377
+ /**
1378
+ * Hide the "Send Funds" button in the Details Modal.
1379
+ *
1380
+ * By default the "Send Funds" button is shown.
1381
+ */
1382
+ hideSendFunds?: boolean;
1383
+
1384
+ /**
1385
+ * Hide the "Receive Funds" button in the Details Modal.
1386
+ *
1387
+ * By default the "Receive Funds" button is shown.
1388
+ */
1389
+ hideReceiveFunds?: boolean;
1390
+
1391
+ /**
1392
+ * Hide the "Buy Funds" button in the Details Modal.
1393
+ *
1394
+ * By default the "Buy Funds" button is shown.
1395
+ */
1396
+ hideBuyFunds?: boolean;
1383
1397
  };
1384
1398
 
1385
1399
  /**
@@ -1434,6 +1448,9 @@ export function useWalletDetailsModal() {
1434
1448
  showTestnetFaucet: props.showTestnetFaucet,
1435
1449
  connectedAccountName: props.connectedAccountName,
1436
1450
  connectedAccountAvatarUrl: props.connectedAccountAvatarUrl,
1451
+ hideBuyFunds: props.hideBuyFunds,
1452
+ hideReceiveFunds: props.hideReceiveFunds,
1453
+ hideSendFunds: props.hideSendFunds,
1437
1454
  }}
1438
1455
  displayBalanceToken={props.displayBalanceToken}
1439
1456
  theme={props.theme || "dark"}
@@ -97,7 +97,13 @@ export type BuyScreenProps = {
97
97
  * @internal
98
98
  */
99
99
  export default function BuyScreen(props: BuyScreenProps) {
100
- const supportedDestinationsQuery = useBuySupportedDestinations(props.client);
100
+ const isTestMode = props.payOptions.buyWithCrypto
101
+ ? props.payOptions.buyWithCrypto.testMode
102
+ : undefined;
103
+ const supportedDestinationsQuery = useBuySupportedDestinations(
104
+ props.client,
105
+ isTestMode,
106
+ );
101
107
 
102
108
  if (!supportedDestinationsQuery.data) {
103
109
  return <LoadingScreen />;
@@ -50,7 +50,8 @@ export function useToTokenSelectionStates(options: {
50
50
  // use active chain if its supported as destination
51
51
  supportedDestinations.find((x) => x.chain.id === activeChain?.id)
52
52
  ?.chain ||
53
- // default to polygon
53
+ // default to the first chain in supportedDestinations, or polygon if nothing is found at all
54
+ supportedDestinations[0]?.chain ||
54
55
  polygon,
55
56
  );
56
57
 
@@ -36,11 +36,14 @@ export type SupportedChainAndTokens = Array<{
36
36
 
37
37
  export async function fetchBuySupportedDestinations(
38
38
  client: ThirdwebClient,
39
+ isTestMode?: boolean,
39
40
  ): Promise<SupportedChainAndTokens> {
40
41
  return withCache(
41
42
  async () => {
42
43
  const fetchWithHeaders = getClientFetch(client);
43
- const res = await fetchWithHeaders(getPaySupportedDestinations());
44
+ const res = await fetchWithHeaders(
45
+ `${getPaySupportedDestinations()}?isTestMode=${isTestMode}`,
46
+ );
44
47
  const data = (await res.json()) as Response;
45
48
  return data.result.map((item) => ({
46
49
  chain: defineChain({
@@ -59,11 +62,14 @@ export async function fetchBuySupportedDestinations(
59
62
  /**
60
63
  * @internal
61
64
  */
62
- export function useBuySupportedDestinations(client: ThirdwebClient) {
65
+ export function useBuySupportedDestinations(
66
+ client: ThirdwebClient,
67
+ isTestMode?: boolean,
68
+ ) {
63
69
  return useQuery({
64
70
  queryKey: ["destination-tokens", client],
65
71
  queryFn: async () => {
66
- return fetchBuySupportedDestinations(client);
72
+ return fetchBuySupportedDestinations(client, isTestMode);
67
73
  },
68
74
  });
69
75
  }