thirdweb 5.121.1 → 5.121.3

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 (78) hide show
  1. package/dist/cjs/react/core/hooks/x402/useFetchWithPaymentCore.js +1 -0
  2. package/dist/cjs/react/core/hooks/x402/useFetchWithPaymentCore.js.map +1 -1
  3. package/dist/cjs/react/native/hooks/x402/useFetchWithPayment.js +1 -1
  4. package/dist/cjs/react/web/hooks/x402/useFetchWithPayment.js +2 -2
  5. package/dist/cjs/react/web/hooks/x402/useFetchWithPayment.js.map +1 -1
  6. package/dist/cjs/react/web/ui/Bridge/common/token-query.js +4 -1
  7. package/dist/cjs/react/web/ui/Bridge/common/token-query.js.map +1 -1
  8. package/dist/cjs/react/web/ui/x402/PaymentErrorModal.js +4 -4
  9. package/dist/cjs/react/web/ui/x402/PaymentErrorModal.js.map +1 -1
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/cjs/x402/encode.js +41 -2
  12. package/dist/cjs/x402/encode.js.map +1 -1
  13. package/dist/cjs/x402/fetchWithPayment.js +56 -33
  14. package/dist/cjs/x402/fetchWithPayment.js.map +1 -1
  15. package/dist/cjs/x402/schemas.js +134 -2
  16. package/dist/cjs/x402/schemas.js.map +1 -1
  17. package/dist/cjs/x402/sign.js +56 -15
  18. package/dist/cjs/x402/sign.js.map +1 -1
  19. package/dist/esm/react/core/hooks/x402/useFetchWithPaymentCore.js +2 -1
  20. package/dist/esm/react/core/hooks/x402/useFetchWithPaymentCore.js.map +1 -1
  21. package/dist/esm/react/native/hooks/x402/useFetchWithPayment.js +1 -1
  22. package/dist/esm/react/web/hooks/x402/useFetchWithPayment.js +2 -2
  23. package/dist/esm/react/web/hooks/x402/useFetchWithPayment.js.map +1 -1
  24. package/dist/esm/react/web/ui/Bridge/common/token-query.js +4 -1
  25. package/dist/esm/react/web/ui/Bridge/common/token-query.js.map +1 -1
  26. package/dist/esm/react/web/ui/x402/PaymentErrorModal.js +5 -5
  27. package/dist/esm/react/web/ui/x402/PaymentErrorModal.js.map +1 -1
  28. package/dist/esm/version.js +1 -1
  29. package/dist/esm/x402/encode.js +40 -2
  30. package/dist/esm/x402/encode.js.map +1 -1
  31. package/dist/esm/x402/fetchWithPayment.js +57 -35
  32. package/dist/esm/x402/fetchWithPayment.js.map +1 -1
  33. package/dist/esm/x402/schemas.js +129 -1
  34. package/dist/esm/x402/schemas.js.map +1 -1
  35. package/dist/esm/x402/sign.js +57 -16
  36. package/dist/esm/x402/sign.js.map +1 -1
  37. package/dist/scripts/bridge-widget.js +3 -3
  38. package/dist/types/react/core/hooks/x402/useFetchWithPaymentCore.d.ts +1 -0
  39. package/dist/types/react/core/hooks/x402/useFetchWithPaymentCore.d.ts.map +1 -1
  40. package/dist/types/react/native/hooks/x402/useFetchWithPayment.d.ts +1 -1
  41. package/dist/types/react/web/hooks/x402/useFetchWithPayment.d.ts +1 -1
  42. package/dist/types/react/web/hooks/x402/useFetchWithPayment.d.ts.map +1 -1
  43. package/dist/types/react/web/ui/Bridge/common/token-query.d.ts.map +1 -1
  44. package/dist/types/react/web/ui/x402/PaymentErrorModal.d.ts +1 -0
  45. package/dist/types/react/web/ui/x402/PaymentErrorModal.d.ts.map +1 -1
  46. package/dist/types/version.d.ts +1 -1
  47. package/dist/types/x402/encode.d.ts +7 -0
  48. package/dist/types/x402/encode.d.ts.map +1 -1
  49. package/dist/types/x402/fetchWithPayment.d.ts +10 -1
  50. package/dist/types/x402/fetchWithPayment.d.ts.map +1 -1
  51. package/dist/types/x402/schemas.d.ts +60 -2
  52. package/dist/types/x402/schemas.d.ts.map +1 -1
  53. package/dist/types/x402/sign.d.ts +13 -1
  54. package/dist/types/x402/sign.d.ts.map +1 -1
  55. package/package.json +3 -3
  56. package/src/contract/actions/resolve-abi.test.ts +3 -5
  57. package/src/extensions/airdrop/write/airdropERC721WithSignature.test.ts +4 -5
  58. package/src/extensions/erc1155/drop1155.test.ts +1 -1
  59. package/src/extensions/erc1155/write/sigMint1155.test.ts +189 -187
  60. package/src/extensions/erc20/drop20.test.ts +1 -1
  61. package/src/extensions/erc721/write/sigMint721.test.ts +4 -6
  62. package/src/extensions/modules/ClaimableERC1155/claimableERC1155.test.ts +180 -178
  63. package/src/extensions/modules/ClaimableERC20/claimableERC20.test.ts +1 -1
  64. package/src/extensions/modules/ClaimableERC721/claimableERC721.test.ts +1 -1
  65. package/src/extensions/prebuilts/process-ref-deployments.test.ts +1 -1
  66. package/src/react/core/hooks/x402/useFetchWithPaymentCore.ts +6 -1
  67. package/src/react/native/hooks/x402/useFetchWithPayment.ts +1 -1
  68. package/src/react/web/hooks/x402/useFetchWithPayment.tsx +3 -1
  69. package/src/react/web/ui/Bridge/common/token-query.test.tsx +117 -0
  70. package/src/react/web/ui/Bridge/common/token-query.ts +4 -1
  71. package/src/react/web/ui/x402/PaymentErrorModal.tsx +9 -4
  72. package/src/version.ts +1 -1
  73. package/src/x402/encode.ts +46 -2
  74. package/src/x402/fetchWithPayment.test.ts +1173 -104
  75. package/src/x402/fetchWithPayment.ts +72 -54
  76. package/src/x402/schemas.test.ts +123 -0
  77. package/src/x402/schemas.ts +199 -6
  78. package/src/x402/sign.ts +86 -10
@@ -15,6 +15,7 @@ export type UseFetchWithPaymentOptions = {
15
15
  };
16
16
  type ShowErrorModalCallback = (data: {
17
17
  errorData: PaymentRequiredResult["responseBody"];
18
+ requestUrl?: string;
18
19
  onRetry: () => void;
19
20
  onCancel: () => void;
20
21
  }) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchWithPaymentCore.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/x402/useFetchWithPaymentCore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,KAAK,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AAW;;;;;eApGtD,WAAW;eACX,WAAW;;;;;;;;eADX,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;8BAmGY,WAAW,SAAS,WAAW;EAKlE"}
1
+ {"version":3,"file":"useFetchWithPaymentCore.d.ts","sourceRoot":"","sources":["../../../../../../src/react/core/hooks/x402/useFetchWithPaymentCore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAKvE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,CAC5B,mBAAmB,EAAE,4BAA4B,EAAE,KAChD,4BAA4B,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,KAAK,sBAAsB,GAAG,CAAC,IAAI,EAAE;IACnC,SAAS,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,KAAK,IAAI,CAAC;AAEX,KAAK,wBAAwB,GAAG,CAAC,IAAI,EAAE;IACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,KAAK,IAAI,CAAC;AAEX;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,0BAA0B,EACpC,cAAc,CAAC,EAAE,sBAAsB,EACvC,gBAAgB,CAAC,EAAE,wBAAwB;;;;;;;;;;eAShC,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;8BAoGY,WAAW,SAAS,WAAW;;;;eArGtD,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;8BAoGY,WAAW,SAAS,WAAW;;;;;eArGtD,WAAW;eACX,WAAW;;;;;;;;eADX,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;8BAoGY,WAAW,SAAS,WAAW;;;;;eArGtD,WAAW;eACX,WAAW;;;;;;;;eADX,WAAW;eACX,WAAW;;;;;;;;;eADX,WAAW;eACX,WAAW;;8BAoGY,WAAW,SAAS,WAAW;EAKlE"}
@@ -19,7 +19,7 @@ export type { UseFetchWithPaymentOptions };
19
19
  *
20
20
  * @param client - The thirdweb client used to access RPC infrastructure
21
21
  * @param options - Optional configuration for payment handling
22
- * @param options.maxValue - The maximum allowed payment amount in base units
22
+ * @param options.maxValue - The maximum allowed payment amount in base units. `0n` only allows zero-amount payments
23
23
  * @param options.paymentRequirementsSelector - Custom function to select payment requirements from available options
24
24
  * @param options.parseAs - How to parse the response: "json" (default), "text", or "raw"
25
25
  * @param options.storage - Storage for caching permit signatures (for "upto" scheme). Provide your own AsyncStorage implementation for React Native.
@@ -56,7 +56,7 @@ type UseFetchWithPaymentConfig = UseFetchWithPaymentOptions & {
56
56
  *
57
57
  * @param client - The thirdweb client used to access RPC infrastructure
58
58
  * @param options - Optional configuration for payment handling
59
- * @param options.maxValue - The maximum allowed payment amount in base units
59
+ * @param options.maxValue - The maximum allowed payment amount in base units. `0n` only allows zero-amount payments
60
60
  * @param options.paymentRequirementsSelector - Custom function to select payment requirements from available options
61
61
  * @param options.parseAs - How to parse the response: "json" (default), "text", or "raw"
62
62
  * @param options.uiEnabled - Whether to show the UI for connection, funding or payment retries (defaults to true). Set to false to handle errors yourself
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchWithPayment.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/x402/useFetchWithPayment.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,2CAA2C,CAAC;AAInD,YAAY,EAAE,0BAA0B,EAAE,CAAC;AAE3C,KAAK,yBAAyB,GAAG,0BAA0B,GAAG;IAC5D;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CACzB,IAAI,CACF,cAAc,EACd,QAAQ,GAAG,OAAO,GAAG,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CACzE,CACF,CAAC;IACF;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC;IAClE;;OAEG;IACH,mBAAmB,CAAC,EAAE;QACpB,wCAAwC;QACxC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,8BAA8B;QAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,0CAA0C;QAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFpC"}
1
+ {"version":3,"file":"useFetchWithPayment.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/x402/useFetchWithPayment.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,qDAAqD,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,2CAA2C,CAAC;AAInD,YAAY,EAAE,0BAA0B,EAAE,CAAC;AAE3C,KAAK,yBAAyB,GAAG,0BAA0B,GAAG;IAC5D;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CACzB,IAAI,CACF,cAAc,EACd,QAAQ,GAAG,OAAO,GAAG,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CACzE,CACF,CAAC;IACF;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC;IAClE;;OAEG;IACH,mBAAmB,CAAC,EAAE;QACpB,wCAAwC;QACxC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,8BAA8B;QAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,0CAA0C;QAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2HG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuFpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"token-query.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/common/token-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,KAAK,gBAAgB,GACjB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GAC3C;IACE,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEN,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;CACxB,2EAgCA"}
1
+ {"version":3,"file":"token-query.d.ts","sourceRoot":"","sources":["../../../../../../../src/react/web/ui/Bridge/common/token-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,KAAK,gBAAgB,GACjB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GAC3C;IACE,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEN,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;CACxB,2EAmCA"}
@@ -6,6 +6,7 @@ import { type BuyWidgetProps } from "../Bridge/BuyWidget.js";
6
6
  type PaymentErrorModalProps = {
7
7
  client: ThirdwebClient;
8
8
  errorData: PaymentRequiredResult["responseBody"];
9
+ requestUrl?: string;
9
10
  onRetry: () => void;
10
11
  onCancel: () => void;
11
12
  theme: Theme | "light" | "dark";
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentErrorModal.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/ui/x402/PaymentErrorModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAGlE,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAUxE,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CACzB,IAAI,CACF,cAAc,EACZ,QAAQ,GACR,OAAO,GACP,cAAc,GACd,QAAQ,GACR,WAAW,GACX,UAAU,GACV,OAAO,CACV,CACF,CAAC;IACF,2BAA2B,CAAC,EAAE,CAC5B,mBAAmB,EAAE,4BAA4B,EAAE,KAChD,4BAA4B,GAAG,SAAS,CAAC;CAC/C,CAAC;AAIF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAiL9D"}
1
+ {"version":3,"file":"PaymentErrorModal.d.ts","sourceRoot":"","sources":["../../../../../../src/react/web/ui/x402/PaymentErrorModal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAIL,KAAK,4BAA4B,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAGlE,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAUxE,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CACzB,IAAI,CACF,cAAc,EACZ,QAAQ,GACR,OAAO,GACP,cAAc,GACd,QAAQ,GACR,WAAW,GACX,UAAU,GACV,OAAO,CACV,CACF,CAAC;IACF,2BAA2B,CAAC,EAAE,CAC5B,mBAAmB,EAAE,4BAA4B,EAAE,KAChD,4BAA4B,GAAG,SAAS,CAAC;CAC/C,CAAC;AAIF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAoL9D"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.121.1";
1
+ export declare const version = "5.121.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -43,4 +43,11 @@ export declare function safeBase64Encode(data: string): string;
43
43
  * @returns The decoded string in UTF-8 format
44
44
  */
45
45
  export declare function safeBase64Decode(data: string): string;
46
+ /**
47
+ * Decodes a base64 string and interprets the bytes as UTF-8
48
+ *
49
+ * @param data - The base64 encoded string
50
+ * @returns The decoded string
51
+ */
52
+ export declare function base64DecodeUtf8(data: string): string;
46
53
  //# sourceMappingURL=encode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/x402/encode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAkBtE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE,GAAG,MAAM,CAET;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQrD"}
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/x402/encode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAkBtE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAStE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE,GAAG,MAAM,CAET;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQrD;AAuBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAarD"}
@@ -16,7 +16,7 @@ import { type RequestedPaymentRequirements } from "./schemas.js";
16
16
  * @param fetch - The fetch function to wrap (typically globalThis.fetch)
17
17
  * @param client - The thirdweb client used to access RPC infrastructure
18
18
  * @param wallet - The wallet used to sign payment messages
19
- * @param maxValue - The maximum allowed payment amount in base units
19
+ * @param maxValue - The maximum allowed payment amount in base units. `0n` only allows zero-amount payments
20
20
  * @returns A wrapped fetch function that handles 402 responses automatically
21
21
  *
22
22
  * @example
@@ -43,6 +43,10 @@ import { type RequestedPaymentRequirements } from "./schemas.js";
43
43
  */
44
44
  export declare function wrapFetchWithPayment(fetch: typeof globalThis.fetch, client: ThirdwebClient, wallet: Wallet, options?: {
45
45
  maxValue?: bigint;
46
+ /**
47
+ * Selects the payment requirement to pay. Return one of the provided requirements;
48
+ * the returned requirement is validated again before payment.
49
+ */
46
50
  paymentRequirementsSelector?: (paymentRequirements: RequestedPaymentRequirements[]) => RequestedPaymentRequirements | undefined;
47
51
  /**
48
52
  * Storage for caching permit signatures (for "upto" scheme).
@@ -50,4 +54,9 @@ export declare function wrapFetchWithPayment(fetch: typeof globalThis.fetch, cli
50
54
  */
51
55
  storage?: AsyncStorage;
52
56
  }): (input: RequestInfo, init?: RequestInit) => Promise<Response>;
57
+ /**
58
+ * Resolves the absolute URL of a fetch input, if it can be determined.
59
+ * @internal
60
+ */
61
+ export declare function getRequestUrl(input: RequestInfo | URL): string | undefined;
53
62
  //# sourceMappingURL=fetchWithPayment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchWithPayment.d.ts","sourceRoot":"","sources":["../../../src/x402/fetchWithPayment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAO9D,OAAO,EAGL,KAAK,4BAA4B,EAElC,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,EAC9B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,CAC5B,mBAAmB,EAAE,4BAA4B,EAAE,KAChD,4BAA4B,GAAG,SAAS,CAAC;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,IAEa,OAAO,WAAW,EAAE,OAAO,WAAW,uBA+IrD"}
1
+ {"version":3,"file":"fetchWithPayment.d.ts","sourceRoot":"","sources":["../../../src/x402/fetchWithPayment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAO9D,OAAO,EAKL,KAAK,4BAA4B,EAClC,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,UAAU,CAAC,KAAK,EAC9B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,2BAA2B,CAAC,EAAE,CAC5B,mBAAmB,EAAE,4BAA4B,EAAE,KAChD,4BAA4B,GAAG,SAAS,CAAC;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,IAEa,OAAO,WAAW,EAAE,OAAO,WAAW,uBAmIrD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,GAAG,MAAM,GAAG,SAAS,CAmB1E"}
@@ -94,13 +94,18 @@ declare const RequestedPaymentPayloadSchema: z.ZodObject<{
94
94
  network: string;
95
95
  x402Version: number;
96
96
  }>;
97
- export type RequestedPaymentPayload = z.infer<typeof RequestedPaymentPayloadSchema>;
97
+ export type RequestedPaymentPayload = z.infer<typeof RequestedPaymentPayloadSchema> & {
98
+ /** x402 v2: the payment requirement accepted by the client, as sent by the server */
99
+ accepted?: Record<string, unknown>;
100
+ /** x402 v2: the resource being paid for */
101
+ resource?: Record<string, unknown>;
102
+ };
98
103
  export type UnsignedPaymentPayload = Omit<RequestedPaymentPayload, "payload"> & {
99
104
  payload: Omit<ExactEvmPayload, "signature"> & {
100
105
  signature: undefined;
101
106
  };
102
107
  };
103
- export declare const RequestedPaymentRequirementsSchema: z.ZodObject<{
108
+ declare const RequestedPaymentRequirementsSchema: z.ZodObject<{
104
109
  maxAmountRequired: z.ZodEffects<z.ZodString, string, string>;
105
110
  resource: z.ZodString;
106
111
  description: z.ZodString;
@@ -139,6 +144,59 @@ export declare const RequestedPaymentRequirementsSchema: z.ZodObject<{
139
144
  extra?: Record<string, any> | undefined;
140
145
  }>;
141
146
  export type RequestedPaymentRequirements = z.infer<typeof RequestedPaymentRequirementsSchema>;
147
+ /**
148
+ * Returns true if the value is a base-10 integer string that fits in a uint256.
149
+ * @internal
150
+ */
151
+ export declare function isAtomicAmount(value: unknown): value is string;
152
+ /**
153
+ * Payment requirements normalised from a server 402 response.
154
+ * @internal
155
+ */
156
+ type NormalizedPaymentRequirements = {
157
+ /** The normalised requirement */
158
+ requirements: RequestedPaymentRequirements;
159
+ /** The requirement exactly as sent by the server */
160
+ raw: Record<string, unknown>;
161
+ };
162
+ /**
163
+ * Normalises a payment requirement from a 402 response (x402 v1, v2, or v2 envelopes with v1 requirements).
164
+ *
165
+ * @param requirement - The raw payment requirement
166
+ * @param context - Fallback values for fields that v2 moves out of the requirement
167
+ * @returns The normalised requirement and the raw requirement
168
+ * @throws If the amount is missing, malformed, or ambiguous, or the requirement is otherwise invalid
169
+ * @internal
170
+ */
171
+ export declare function normalizePaymentRequirements(requirement: unknown, context?: {
172
+ resourceUrl?: string;
173
+ }): NormalizedPaymentRequirements;
174
+ /**
175
+ * Parses a decoded 402 payment required object (PAYMENT-REQUIRED header or JSON body).
176
+ * Every entry of `accepts` is normalised with {@link normalizePaymentRequirements}.
177
+ *
178
+ * @param paymentRequired - The decoded payment required object
179
+ * @param requestUrl - The URL of the request, used when the response carries no resource URL
180
+ * @returns The x402 version, error, top-level resource, resolved resource URL and normalised requirements
181
+ * @throws If the object has no accepts array or any requirement is invalid
182
+ * @internal
183
+ */
184
+ export declare function parsePaymentRequired(paymentRequired: unknown, requestUrl?: string): {
185
+ x402Version: number | undefined;
186
+ error: string | undefined;
187
+ resource: Record<string, unknown> | undefined;
188
+ resourceUrl: string | undefined;
189
+ accepts: NormalizedPaymentRequirements[];
190
+ };
191
+ /**
192
+ * Parses the payment requirements of a 402 response for display only, skipping invalid entries.
193
+ *
194
+ * @param paymentRequired - The decoded payment required object
195
+ * @param requestUrl - The URL of the request, used when the response carries no resource URL
196
+ * @returns The normalised requirements that passed validation
197
+ * @internal
198
+ */
199
+ export declare function parsePaymentRequirementsForDisplay(paymentRequired: unknown, requestUrl?: string): RequestedPaymentRequirements[];
142
200
  declare const FacilitatorSettleResponseSchema: z.ZodObject<{
143
201
  success: z.ZodBoolean;
144
202
  errorReason: z.ZodOptional<z.ZodEnum<["insufficient_funds", "invalid_exact_evm_payload_authorization_valid_after", "invalid_exact_evm_payload_authorization_valid_before", "invalid_exact_evm_payload_authorization_value", "invalid_exact_evm_payload_signature", "invalid_exact_evm_payload_recipient_mismatch", "invalid_exact_svm_payload_transaction", "invalid_exact_svm_payload_transaction_amount_mismatch", "invalid_exact_svm_payload_transaction_create_ata_instruction", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee", "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset", "invalid_exact_svm_payload_transaction_instructions", "invalid_exact_svm_payload_transaction_instructions_length", "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction", "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high", "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked", "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked", "invalid_exact_svm_payload_transaction_not_a_transfer_instruction", "invalid_exact_svm_payload_transaction_receiver_ata_not_found", "invalid_exact_svm_payload_transaction_sender_ata_not_found", "invalid_exact_svm_payload_transaction_simulation_failed", "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata", "invalid_network", "invalid_payload", "invalid_payment_requirements", "invalid_scheme", "invalid_payment", "payment_expired", "unsupported_scheme", "invalid_x402_version", "invalid_transaction_state", "invalid_x402_version", "settle_exact_svm_block_height_exceeded", "settle_exact_svm_transaction_confirmation_timed_out", "unsupported_scheme", "unexpected_settle_error", "unexpected_verify_error"]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/x402/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAOrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,QAAA,MAAM,wBAAwB,aAAa,CAAC;AAE5C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,uBAAuB,EACvB,SAAS,CACV,GAAG;IACF,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG;QAAE,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC;CACxE,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3C,CAAC;AAEL,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,K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;;;;;;;;;;;;;;;;;;;;;;EAiBqB,CAAC;AAE9D,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,kCAAkC,CAC1C,CAAC;AAMF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAO3E;AAED;;;GAGG;AACH,QAAA,MAAM,kBAAkB,8FA8DrB,CAAC;AAEJ,KAAK,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,YAAY,CAK3E"}
@@ -2,6 +2,15 @@ import type { ThirdwebClient } from "../client/client.js";
2
2
  import type { AsyncStorage } from "../utils/storage/AsyncStorage.js";
3
3
  import type { Account } from "../wallets/interfaces/wallet.js";
4
4
  import { type RequestedPaymentRequirements } from "./schemas.js";
5
+ /**
6
+ * x402 v2 payload fields echoed back to the server.
7
+ */
8
+ type PaymentPayloadV2Context = {
9
+ /** The selected payment requirement exactly as sent by the server */
10
+ accepted: Record<string, unknown>;
11
+ /** The resource being paid for */
12
+ resource?: Record<string, unknown>;
13
+ };
5
14
  /**
6
15
  * Creates and encodes a payment header for the given client and payment requirements.
7
16
  *
@@ -9,7 +18,10 @@ import { type RequestedPaymentRequirements } from "./schemas.js";
9
18
  * @param x402Version - The version of the X402 protocol to use
10
19
  * @param paymentRequirements - The payment requirements containing scheme and network information
11
20
  * @param storage - Optional storage for caching permit signatures (for "upto" scheme)
21
+ * @param v2Context - The x402 v2 fields to include in the payload
22
+ * @param maxValue - The maximum allowed payment amount
12
23
  * @returns A promise that resolves to the encoded payment header string
13
24
  */
14
- export declare function createPaymentHeader(client: ThirdwebClient, account: Account, paymentRequirements: RequestedPaymentRequirements, x402Version: number, storage?: AsyncStorage): Promise<string>;
25
+ export declare function createPaymentHeader(client: ThirdwebClient, account: Account, paymentRequirements: RequestedPaymentRequirements, x402Version: number, storage?: AsyncStorage, v2Context?: PaymentPayloadV2Context, maxValue?: bigint): Promise<string>;
26
+ export {};
15
27
  //# sourceMappingURL=sign.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/x402/sign.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAM1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAQ/D,OAAO,EAIL,KAAK,4BAA4B,EAElC,MAAM,cAAc,CAAC;AAqMtB;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,4BAA4B,EACjD,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,CAAC,CASjB"}
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/x402/sign.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAM1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAQ/D,OAAO,EAKL,KAAK,4BAA4B,EAElC,MAAM,cAAc,CAAC;AAGtB;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC7B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAyPF;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,4BAA4B,EACjD,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,uBAAuB,EACnC,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
package/package.json CHANGED
@@ -40,8 +40,8 @@
40
40
  "viem": "2.39.0",
41
41
  "x402": "0.7.0",
42
42
  "zod": "3.25.75",
43
- "@thirdweb-dev/engine": "3.4.0",
44
- "@thirdweb-dev/insight": "1.1.1"
43
+ "@thirdweb-dev/insight": "1.1.1",
44
+ "@thirdweb-dev/engine": "3.4.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@aws-sdk/client-kms": "3.592.0",
@@ -400,7 +400,7 @@
400
400
  }
401
401
  },
402
402
  "typings": "./dist/types/exports/thirdweb.d.ts",
403
- "version": "5.121.1",
403
+ "version": "5.121.3",
404
404
  "scripts": {
405
405
  "bench": "vitest -c ./test/vitest.config.ts bench",
406
406
  "bench:compare": "bun run ./benchmarks/run.ts",
@@ -43,15 +43,13 @@ it("should resolve abi from contract api", async () => {
43
43
  expect(abi).toMatchObject(DOODLES_ABI);
44
44
  });
45
45
 
46
- it.runIf(process.env.TW_SECRET_KEY)(
47
- "should resolve abi from bytecode",
48
- async () => {
46
+ it.runIf(process.env.TW_SECRET_KEY)
47
+ .skip("should resolve abi from bytecode", async () => {
49
48
  // we do this so we don't hit any PRIOR cache
50
49
  const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT };
51
50
  const abi = await resolveAbiFromBytecode(DOODLES_CONTRACT_CLONE);
52
51
  expect(abi).toMatchObject(DOODLES_ABI);
53
- },
54
- );
52
+ });
55
53
 
56
54
  it("should throw error if contract bytecode is 0x", async () => {
57
55
  const wrongContract = getContract({
@@ -26,9 +26,9 @@ import {
26
26
 
27
27
  // skip this test suite if there is no secret key available to test with
28
28
  // TODO: remove reliance on secret key during unit tests entirely
29
- describe.runIf(process.env.TW_SECRET_KEY)(
30
- "generateAirdropSignatureERC721",
31
- () => {
29
+ describe
30
+ .runIf(process.env.TW_SECRET_KEY)
31
+ .skip("generateAirdropSignatureERC721", () => {
32
32
  let airdropContract: ThirdwebContract;
33
33
  let erc721TokenContract: ThirdwebContract;
34
34
 
@@ -158,5 +158,4 @@ describe.runIf(process.env.TW_SECRET_KEY)(
158
158
 
159
159
  expect(transactionHash.length).toBe(66);
160
160
  });
161
- },
162
- );
161
+ });
@@ -31,7 +31,7 @@ import { getNFT } from "./read/getNFT.js";
31
31
  import { isGetNFTsSupported } from "./read/getNFTs.js";
32
32
  import { lazyMint } from "./write/lazyMint.js";
33
33
 
34
- describe.runIf(process.env.TW_SECRET_KEY)(
34
+ describe.runIf(process.env.TW_SECRET_KEY).skip(
35
35
  "DropERC1155",
36
36
  {
37
37
  retry: 0,