@boostxyz/sdk 0.0.0-alpha.7 → 0.0.0-alpha.9

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 (191) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +1 -1
  3. package/dist/Actions/ContractAction.d.ts +46 -3
  4. package/dist/Actions/ContractAction.d.ts.map +1 -1
  5. package/dist/Actions/ERC721MintAction.d.ts +37 -10
  6. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.cjs +1 -1
  8. package/dist/Actions/EventAction.cjs.map +1 -1
  9. package/dist/Actions/EventAction.d.ts +257 -11
  10. package/dist/Actions/EventAction.d.ts.map +1 -1
  11. package/dist/Actions/EventAction.js +249 -82
  12. package/dist/Actions/EventAction.js.map +1 -1
  13. package/dist/AllowLists/AllowList.cjs +1 -1
  14. package/dist/AllowLists/AllowList.d.ts +2 -2
  15. package/dist/AllowLists/AllowList.js +1 -1
  16. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  17. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.d.ts +33 -4
  19. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  20. package/dist/AllowLists/SimpleAllowList.js +52 -37
  21. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  22. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  23. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
  25. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleDenyList.js +41 -129
  27. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  28. package/dist/Auth/PassthroughAuth.cjs +1 -1
  29. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  30. package/dist/Auth/PassthroughAuth.js +4 -4
  31. package/dist/Auth/PassthroughAuth.js.map +1 -1
  32. package/dist/Boost.cjs +1 -1
  33. package/dist/Boost.cjs.map +1 -1
  34. package/dist/Boost.d.ts +93 -1
  35. package/dist/Boost.d.ts.map +1 -1
  36. package/dist/Boost.js +151 -5
  37. package/dist/Boost.js.map +1 -1
  38. package/dist/BoostCore.cjs +2 -2
  39. package/dist/BoostCore.cjs.map +1 -1
  40. package/dist/BoostCore.d.ts +45 -7
  41. package/dist/BoostCore.d.ts.map +1 -1
  42. package/dist/BoostCore.js +352 -305
  43. package/dist/BoostCore.js.map +1 -1
  44. package/dist/BoostRegistry.cjs +1 -1
  45. package/dist/BoostRegistry.cjs.map +1 -1
  46. package/dist/BoostRegistry.d.ts +18 -4
  47. package/dist/BoostRegistry.d.ts.map +1 -1
  48. package/dist/BoostRegistry.js +36 -25
  49. package/dist/BoostRegistry.js.map +1 -1
  50. package/dist/Budgets/Budget.cjs +1 -1
  51. package/dist/Budgets/Budget.js +1 -1
  52. package/dist/Budgets/ManagedBudget.cjs +1 -1
  53. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  54. package/dist/Budgets/ManagedBudget.d.ts +40 -2
  55. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  56. package/dist/Budgets/ManagedBudget.js +53 -36
  57. package/dist/Budgets/ManagedBudget.js.map +1 -1
  58. package/dist/Budgets/SimpleBudget.d.ts +33 -2
  59. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  60. package/dist/Budgets/VestingBudget.d.ts +54 -2
  61. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  62. package/dist/Deployable/Contract.cjs +1 -1
  63. package/dist/Deployable/Contract.cjs.map +1 -1
  64. package/dist/Deployable/Contract.js +1 -1
  65. package/dist/Deployable/Contract.js.map +1 -1
  66. package/dist/Deployable/Deployable.cjs.map +1 -1
  67. package/dist/Deployable/Deployable.d.ts +8 -2
  68. package/dist/Deployable/Deployable.d.ts.map +1 -1
  69. package/dist/Deployable/Deployable.js +6 -0
  70. package/dist/Deployable/Deployable.js.map +1 -1
  71. package/dist/Deployable/DeployableTarget.cjs +1 -1
  72. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  73. package/dist/Deployable/DeployableTarget.d.ts +4 -3
  74. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  75. package/dist/Deployable/DeployableTarget.js +31 -28
  76. package/dist/Deployable/DeployableTarget.js.map +1 -1
  77. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  78. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  79. package/dist/Incentives/AllowListIncentive.d.ts +35 -5
  80. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  81. package/dist/Incentives/AllowListIncentive.js +33 -21
  82. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  83. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  84. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  85. package/dist/Incentives/CGDAIncentive.d.ts +89 -5
  86. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  87. package/dist/Incentives/CGDAIncentive.js +44 -23
  88. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  89. package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
  90. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  91. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  92. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  93. package/dist/Incentives/ERC20Incentive.d.ts +49 -5
  94. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  95. package/dist/Incentives/ERC20Incentive.js +46 -27
  96. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  97. package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
  98. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  99. package/dist/Incentives/Incentive.cjs +1 -1
  100. package/dist/Incentives/Incentive.cjs.map +1 -1
  101. package/dist/Incentives/Incentive.js +48 -32
  102. package/dist/Incentives/Incentive.js.map +1 -1
  103. package/dist/Incentives/PointsIncentive.cjs +1 -1
  104. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  105. package/dist/Incentives/PointsIncentive.d.ts +49 -5
  106. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  107. package/dist/Incentives/PointsIncentive.js +38 -21
  108. package/dist/Incentives/PointsIncentive.js.map +1 -1
  109. package/dist/Validators/SignerValidator.cjs +1 -1
  110. package/dist/Validators/SignerValidator.cjs.map +1 -1
  111. package/dist/Validators/SignerValidator.d.ts +298 -5
  112. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  113. package/dist/Validators/SignerValidator.js +151 -26
  114. package/dist/Validators/SignerValidator.js.map +1 -1
  115. package/dist/Validators/Validator.cjs +1 -1
  116. package/dist/Validators/Validator.js +1 -1
  117. package/dist/claiming.cjs +2 -0
  118. package/dist/claiming.cjs.map +1 -0
  119. package/dist/claiming.d.ts +43 -0
  120. package/dist/claiming.d.ts.map +1 -0
  121. package/dist/claiming.js +17 -0
  122. package/dist/claiming.js.map +1 -0
  123. package/dist/errors.cjs +1 -1
  124. package/dist/errors.cjs.map +1 -1
  125. package/dist/errors.d.ts +15 -1
  126. package/dist/errors.d.ts.map +1 -1
  127. package/dist/errors.js +30 -21
  128. package/dist/errors.js.map +1 -1
  129. package/dist/{generated-DGpIVcv5.js → generated-57_Kffpz.js} +293 -282
  130. package/dist/generated-57_Kffpz.js.map +1 -0
  131. package/dist/{generated-Cd-Fe7W7.cjs → generated-wKBNvm48.cjs} +3 -3
  132. package/dist/generated-wKBNvm48.cjs.map +1 -0
  133. package/dist/index.cjs +1 -1
  134. package/dist/index.d.ts +4 -4
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +108 -124
  137. package/dist/transfers.cjs +2 -0
  138. package/dist/transfers.cjs.map +1 -0
  139. package/dist/transfers.d.ts +198 -0
  140. package/dist/transfers.d.ts.map +1 -0
  141. package/dist/transfers.js +84 -0
  142. package/dist/transfers.js.map +1 -0
  143. package/dist/utils.cjs +1 -1
  144. package/dist/utils.cjs.map +1 -1
  145. package/dist/utils.d.ts +2 -1371
  146. package/dist/utils.d.ts.map +1 -1
  147. package/dist/utils.js +26 -653
  148. package/dist/utils.js.map +1 -1
  149. package/package.json +17 -3
  150. package/src/Actions/Action.test.ts +5 -4
  151. package/src/Actions/ContractAction.test.ts +4 -6
  152. package/src/Actions/ContractAction.ts +73 -10
  153. package/src/Actions/ERC721MintAction.test.ts +2 -2
  154. package/src/Actions/ERC721MintAction.ts +70 -16
  155. package/src/Actions/EventAction.test.ts +43 -17
  156. package/src/Actions/EventAction.ts +451 -26
  157. package/src/AllowLists/SimpleAllowList.ts +51 -7
  158. package/src/AllowLists/SimpleDenyList.ts +47 -109
  159. package/src/Auth/PassthroughAuth.ts +1 -1
  160. package/src/Boost.ts +136 -1
  161. package/src/BoostCore.test.ts +4 -11
  162. package/src/BoostCore.ts +114 -45
  163. package/src/BoostRegistry.ts +39 -21
  164. package/src/Budgets/ManagedBudget.ts +69 -16
  165. package/src/Budgets/SimpleBudget.ts +57 -14
  166. package/src/Budgets/VestingBudget.ts +79 -9
  167. package/src/Deployable/Contract.ts +1 -1
  168. package/src/Deployable/Deployable.ts +8 -2
  169. package/src/Deployable/DeployableTarget.ts +19 -6
  170. package/src/Incentives/AllowListIncentive.test.ts +2 -5
  171. package/src/Incentives/AllowListIncentive.ts +59 -15
  172. package/src/Incentives/CGDAIncentive.test.ts +3 -7
  173. package/src/Incentives/CGDAIncentive.ts +123 -19
  174. package/src/Incentives/ERC1155Incentive.test.ts +2 -13
  175. package/src/Incentives/ERC1155Incentive.ts +104 -22
  176. package/src/Incentives/ERC20Incentive.test.ts +6 -17
  177. package/src/Incentives/ERC20Incentive.ts +86 -21
  178. package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
  179. package/src/Incentives/ERC20VariableIncentive.ts +71 -19
  180. package/src/Incentives/Incentive.test.ts +1 -1
  181. package/src/Incentives/PointsIncentive.test.ts +3 -6
  182. package/src/Incentives/PointsIncentive.ts +79 -17
  183. package/src/Validators/SignerValidator.test.ts +3 -7
  184. package/src/Validators/SignerValidator.ts +422 -13
  185. package/src/claiming.ts +56 -0
  186. package/src/errors.ts +19 -1
  187. package/src/index.ts +10 -7
  188. package/src/transfers.ts +284 -0
  189. package/src/utils.ts +3 -2052
  190. package/dist/generated-Cd-Fe7W7.cjs.map +0 -1
  191. package/dist/generated-DGpIVcv5.js.map +0 -1
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../node_modules/.pnpm/solady@0.0.208/node_modules/solady/js/solady.js","../src/utils.ts"],"sourcesContent":["/**\n * Accompanying JavaScript library for Solady.\n *\n * To install:\n * \n * ```\n * npm install solady\n * ```\n *\n * Module exports:\n * \n * - `LibZip`\n * - `flzCompress(data)`: Compresses hex encoded data with FastLZ.\n * - `flzDecompress(data)`: Decompresses hex encoded data with FastLZ.\n * - `cdCompress(data)`: Compresses hex encoded calldata.\n * - `cdDecompress(data)`: Decompresses hex encoded calldata.\n * \n * - `ERC1967Factory`\n * - `address`: Canonical address of Solady's ERC1967Factory.\n * - `abi`: ABI of Solady's ERC1967Factory.\n *\n * @module solady\n */\n(function(global, factory) {\n\n \"use strict\";\n\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n module.exports = factory(global, 1);\n if (typeof exports === \"object\") {\n exports.LibZip = module.exports.LibZip;\n exports.ERC1967Factory = module.exports.ERC1967Factory;\n }\n } else {\n factory(global);\n }\n\n})(typeof window !== \"undefined\" ? window : this, function(window, noGlobal) {\n\n \"use strict\";\n\n var solady = {};\n\n /*============================================================*/\n /* LibZip Operations */\n /*============================================================*/\n\n // See: https://github.com/vectorized/solady/blob/main/src/utils/LibZip.sol\n\n /**\n * FastLZ and calldata compression / decompression functions.\n * @namespace\n * @alias module:solady.LibZip\n */\n var LibZip = {};\n\n solady.LibZip = LibZip;\n\n function hexString(data) {\n if (typeof data === \"string\" || data instanceof String) {\n if (data = data.match(/^[\\s\\uFEFF\\xA0]*(0[Xx])?([0-9A-Fa-f]*)[\\s\\uFEFF\\xA0]*$/)) {\n if (data[2].length % 2) {\n throw new Error(\"Hex string length must be a multiple of 2.\");\n }\n return data[2];\n }\n }\n throw new Error(\"Data must be a hex string.\");\n }\n\n function byteToString(b) {\n return (b | 0x100).toString(16).slice(1);\n }\n\n function parseByte(data, i) {\n return parseInt(data.substr(i, 2), 16);\n }\n\n function hexToBytes(data) {\n var a = [], i = 0;\n for (; i < data.length; i += 2) a.push(parseByte(data, i));\n return a;\n }\n\n function bytesToHex(a) {\n var o = \"0x\", i = 0;\n for (; i < a.length; o += byteToString(a[i++])) ;\n return o;\n }\n\n /**\n * Compresses hex encoded data with the FastLZ LZ77 algorithm.\n * @param {string} data A hex encoded string representing the original data.\n * @returns {string} The compressed result as a hex encoded string.\n */\n LibZip.flzCompress = function(data) {\n var ib = hexToBytes(hexString(data)), b = ib.length - 4;\n var ht = [], ob = [], a = 0, i = 2, o = 0, j, s, h, d, c, l, r, p, q, e;\n\n function u24(i) {\n return ib[i] | (ib[++i] << 8) | (ib[++i] << 16);\n }\n\n function hash(x) {\n return ((2654435769 * x) >> 19) & 8191;\n }\n\n function literals(r, s) {\n while (r >= 32) for (ob[o++] = 31, j = 32; j--; r--) ob[o++] = ib[s++];\n if (r) for (ob[o++] = r - 1; r--; ) ob[o++] = ib[s++];\n }\n\n while (i < b - 9) {\n do {\n r = ht[h = hash(s = u24(i))] || 0;\n c = (d = (ht[h] = i) - r) < 8192 ? u24(r) : 0x1000000;\n } while (i < b - 9 && i++ && s != c);\n if (i >= b - 9) break;\n if (--i > a) literals(i - a, a);\n for (l = 0, p = r + 3, q = i + 3, e = b - q; l < e; l++) e *= ib[p + l] === ib[q + l];\n i += l;\n for (--d; l > 262; l -= 262) ob[o++] = 224 + (d >> 8), ob[o++] = 253, ob[o++] = d & 255;\n if (l < 7) ob[o++] = (l << 5) + (d >> 8), ob[o++] = d & 255;\n else ob[o++] = 224 + (d >> 8), ob[o++] = l - 7, ob[o++] = d & 255;\n ht[hash(u24(i))] = i++, ht[hash(u24(i))] = i++, a = i;\n }\n literals(b + 4 - a, a);\n return bytesToHex(ob);\n }\n\n /**\n * Decompresses hex encoded data with the FastLZ LZ77 algorithm.\n * @param {string} data A hex encoded string representing the compressed data.\n * @returns {string} The decompressed result as a hex encoded string.\n */\n LibZip.flzDecompress = function(data) {\n var ib = hexToBytes(hexString(data)), i = 0, o = 0, l, f, t, r, h, ob = [];\n while (i < ib.length) {\n if (!(t = ib[i] >> 5)) {\n for (l = 1 + ib[i++]; l--;) ob[o++] = ib[i++];\n } else {\n f = 256 * (ib[i] & 31) + ib[i + 2 - (t = t < 7)];\n l = t ? 2 + (ib[i] >> 5) : 9 + ib[i + 1];\n i = i + 3 - t;\n r = o - f - 1;\n while (l--) ob[o++] = ob[r++];\n }\n }\n return bytesToHex(ob);\n }\n\n /**\n * Compresses hex encoded calldata.\n * @param {string} data A hex encoded string representing the original data.\n * @returns {string} The compressed result as a hex encoded string.\n */\n LibZip.cdCompress = function(data) {\n data = hexString(data);\n var o = \"0x\", z = 0, y = 0, i = 0, c;\n\n function pushByte(b) {\n o += byteToString(((o.length < 4 * 2 + 2) * 0xff) ^ b);\n }\n\n function rle(v, d) {\n pushByte(0x00);\n pushByte(d - 1 + v * 0x80);\n }\n\n for (; i < data.length; i += 2) {\n c = parseByte(data, i);\n if (!c) {\n if (y) rle(1, y), y = 0;\n if (++z === 0x80) rle(0, 0x80), z = 0;\n continue;\n }\n if (c === 0xff) {\n if (z) rle(0, z), z = 0;\n if (++y === 0x20) rle(1, 0x20), y = 0;\n continue;\n }\n if (y) rle(1, y), y = 0;\n if (z) rle(0, z), z = 0;\n pushByte(c);\n }\n if (y) rle(1, y), y = 0;\n if (z) rle(0, z), z = 0;\n return o;\n }\n\n /**\n * Decompresses hex encoded calldata.\n * @param {string} data A hex encoded string representing the compressed data.\n * @returns {string} The decompressed result as a hex encoded string.\n */\n LibZip.cdDecompress = function(data) {\n data = hexString(data);\n var o = \"0x\", i = 0, j, c, s;\n\n while (i < data.length) {\n c = ((i < 4 * 2) * 0xff) ^ parseByte(data, i);\n i += 2;\n if (!c) {\n c = ((i < 4 * 2) * 0xff) ^ parseByte(data, i);\n s = (c & 0x7f) + 1;\n i += 2;\n for (j = 0; j < s; ++j) o += byteToString((c >> 7 && j < 32) * 0xff);\n continue;\n }\n o += byteToString(c);\n }\n return o;\n }\n\n /*============================================================*/\n /* ERC1967Factory */\n /*============================================================*/\n\n // See: https://github.com/vectorized/solady/blob/main/src/utils/ERC1967Factory.sol\n\n /**\n * ERC1967Factory canonical address and ABI.\n * @namespace\n * @alias module:solady.ERC1967Factory\n */\n var ERC1967Factory = {};\n\n solady.ERC1967Factory = ERC1967Factory;\n\n /**\n * Canonical address of Solady's ERC1967Factory.\n * @type {string}\n */\n ERC1967Factory.address = \"0x0000000000006396FF2a80c067f99B3d2Ab4Df24\";\n\n /**\n * ABI of Solady's ERC1967Factory.\n * @type {Object}\n */\n ERC1967Factory.abi = JSON.parse('[{0:[],1:\"DeploymentFailed\"96\"SaltDoesNotStartWithCaller\"96\"Unauthorized\"96\"UpgradeFailed\",2:3959790,9791],1:\"AdminChanged\",2:10959790,9792,9791],1:\"Deployed\",2:10959790,9792],1:\"Upgraded\",2:10},{0:[{90],1:\"adminOf\",12:[{9199{0:[{90,{91],1:\"changeAdmin\",12:[],13:\"nonpayable\",2:15},{0:[{92,{91],1:\"deploy\",12:[{9098,{0:[{92,{91,{94],1:\"deployAndCall\",12:[{9098,{0:[{92,{91,{93],1:\"deployDeterministic\",12:[{9098,{0:[{92,{91,{93,{94],1:\"deployDeterministicAndCall\",12:[{9098,{0:[],1:\"initCodeHash\",12:[{6:19,1:\"result\",2:19}99{0:[{93],1:\"predictDeterministicAddress\",12:[{6:7,1:\"predicted\",2:7}99{0:[{90,{92],1:\"upgrade\",12:[98,{0:[{90,{92,{94],1:\"upgradeAndCall\",12:[98]'.replace(/9\\d/g, function (m) { return [\"6:7,1:8,2:7}\",\"6:7,1:9,2:7}\",\"6:7,1:11,2:7}\",\"6:19,1:20,2:19}\",\"6:17,1:18,2:17}\",\"},{4:false,0:[\",\",2:3},{0:[],1:\",\"{5:true,\",\"],13:16,2:15}\",\"],13:14,2:15},\"][m-90] }).replace(/\\d+/g, function (m) { return '\"' + (\"inputs,name,type,error,anonymous,indexed,internalType,address,proxy,admin,event,implementation,outputs,stateMutability,view,function,payable,bytes,data,bytes32,salt\".split(\",\")[m]) + '\"' }));\n\n /*--------------------------- END ----------------------------*/\n\n if (typeof define === \"function\" && define.amd) {\n define(\"solady\", [], function() {\n return solady\n });\n }\n\n if (!noGlobal) {\n window.solady = solady;\n }\n\n return solady;\n});\n","import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport { LibZip } from 'solady';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n PrivateKeyAccount,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport {\n encodeAbiParameters,\n isHex,\n keccak256,\n parseAbiParameters,\n slice,\n toHex,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { signTypedData } from 'viem/accounts';\nimport { ContractAction } from './Actions/ContractAction';\nimport { ERC721MintAction } from './Actions/ERC721MintAction';\nimport {\n LIST_MANAGER_ROLE,\n SimpleAllowList,\n} from './AllowLists/SimpleAllowList';\nimport { SimpleDenyList } from './AllowLists/SimpleDenyList';\nimport { VestingBudget } from './Budgets/VestingBudget';\nimport type { ERC1155Incentive } from './Incentives/ERC1155Incentive';\nimport { SignerValidator } from './Validators/SignerValidator';\nimport { NoContractAddressUponReceiptError } from './errors';\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Enum representing incentive disbursement strategies.\n *\n * @export\n * @enum {number}\n */\nexport enum StrategyType {\n POOL = 0,\n MINT = 1,\n RAFFLE = 2,\n}\n\n/**\n * Enum representing inventive disbursement strategies for {@link ERC1155Incentive}\n *\n * @export\n * @enum {number}\n */\nexport enum ERC1155StrategyType {\n POOL = 0,\n MINT = 1,\n}\n\n/**\n * Object representation of `BoostLib.Target` struct. Used for low level Boost creation operations.\n * This is used to pass the base contract and its initialization parameters in an efficient manner\n *\n * @export\n * @typedef {Target}\n */\nexport type Target = {\n isBase: boolean;\n instance: Address;\n parameters: Hex;\n};\n\n/*\n * Action Event Payloads\n */\n\n/**\n * Filter types used to determine how criteria are evaluated.\n *\n * @export\n * @enum {number}\n */\nexport enum FilterType {\n EQUAL = 0,\n NOT_EQUAL = 1,\n GREATER_THAN = 2,\n LESS_THAN = 3,\n CONTAINS = 4,\n}\n\n/**\n * The primitive types supported for filtering.\n *\n * @export\n * @enum {number}\n */\nexport enum PrimitiveType {\n UINT = 0,\n ADDRESS = 1,\n BYTES = 2,\n STRING = 3,\n}\n\n/**\n * Object representation of a `Criteria` struct used in event actions.\n *\n * @export\n * @interface Criteria\n * @typedef {Criteria}\n */\nexport interface Criteria {\n /**\n * The filter type used in this criteria.\n *\n * @type {FilterType}\n */\n filterType: FilterType;\n /**\n * The primitive type of the field being filtered.\n *\n * @type {PrimitiveType}\n */\n fieldType: PrimitiveType;\n /**\n * The index in the logs argument array where the field is located.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The filter data used for complex filtering.\n *\n * @type {Hex}\n */\n filterData: Hex;\n}\n\n/**\n * Whether a given signature is an event or function\n *\n * @export\n * @enum {number}\n */\nexport enum SignatureType {\n EVENT = 0,\n FUNC = 1,\n}\n\n/**\n * The payload describing how claimants are identified\n *\n * @export\n * @interface ActionClaimant\n * @typedef {ActionClaimant}\n */\nexport interface ActionClaimant {\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The 4 byte signature of the event or function\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index corresponding to claimant.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the target contract\n *\n * @type {Address}\n */\n targetContract: Address;\n}\n\n/**\n * Object representation of an `ActionStep` struct used in event actions.\n *\n * @export\n * @interface ActionStep\n * @typedef {ActionStep}\n */\nexport interface ActionStep {\n /**\n * The signature of the event.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * Whether claimaint is inferred from event or function\n *\n * @type {SignatureType}\n */\n signatureType: SignatureType;\n /**\n * The type of action being performed.\n *\n * @type {number}\n */\n actionType: number;\n /**\n * The address of the target contract.\n *\n * @type {Address}\n */\n targetContract: Address;\n /**\n * The criteria used for this action step.\n *\n * @type {Criteria}\n */\n actionParameter: Criteria;\n}\n\n/**\n * You can either supply a simplified version of the payload, or one that explicitly declares action steps.\n *\n * @export\n * @typedef {EventActionPayload}\n */\nexport type EventActionPayload =\n | EventActionPayloadSimple\n | EventActionPayloadRaw;\n\nexport interface EventActionPayloadSimple {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n\n /**\n * Up to 4 action steps.\n * If you supply less than 4, then the last step will be reused to satisfy the EventAction.InitPayload\n * Any more than 4 will throw an error.\n *\n * @type {ActionStep[]}\n */\n actionSteps: ActionStep[];\n}\n\n/**\n * Typeguard to determine if a user is supplying a simple or raw EventActionPayload\n *\n * @param {*} opts\n * @returns {opts is EventActionPayloadSimple}\n */\nexport function isEventActionPayloadSimple(\n opts: EventActionPayload,\n): opts is EventActionPayloadSimple {\n return Array.isArray((opts as EventActionPayloadSimple).actionSteps);\n}\n\n/**\n * Object representation of an `InitPayload` struct used to initialize event actions.\n *\n * @export\n * @interface EventActionPayloadRaw\n * @typedef {EventActionPayloadRaw}\n */\nexport interface EventActionPayloadRaw {\n /**\n * The payload describing how claimants are identified\n *\n * @type {ActionClaimant}\n */\n actionClaimant: ActionClaimant;\n /**\n * The first action step.\n *\n * @type {ActionStep}\n */\n actionStepOne: ActionStep;\n /**\n * The second action step.\n *\n * @type {ActionStep}\n */\n actionStepTwo: ActionStep;\n /**\n * The third action step.\n *\n * @type {ActionStep}\n */\n actionStepThree: ActionStep;\n /**\n * The fourth action step.\n *\n * @type {ActionStep}\n */\n actionStepFour: ActionStep;\n}\n\n/**\n * Function to properly encode an event action payload.\n *\n * @param {InitPayload} param0\n * @param {ActionStep} param0.actionStepOne - The first action step to initialize.\n * @param {ActionStep} param0.actionStepTwo - The second action step to initialize.\n * @param {ActionStep} param0.actionStepThree - The third action step to initialize.\n * @param {ActionStep} param0.actionStepFour - The fourth action step to initialize.\n * @returns {Hex}\n */\nexport const prepareEventActionPayload = ({\n actionClaimant,\n actionStepOne,\n actionStepTwo,\n actionStepThree,\n actionStepFour,\n}: EventActionPayloadRaw) => {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayload',\n components: [\n {\n type: 'tuple',\n name: 'actionClaimant',\n components: [\n { type: 'uint8', name: 'signatureType' },\n { type: 'bytes4', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepOne',\n components: [\n { type: 'bytes4', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepTwo',\n components: [\n { type: 'bytes4', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepThree',\n components: [\n { type: 'bytes4', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n {\n type: 'tuple',\n name: 'actionStepFour',\n components: [\n { type: 'bytes4', name: 'signature' },\n { type: 'uint8', name: 'signatureType' },\n { type: 'uint8', name: 'actionType' },\n { type: 'address', name: 'targetContract' },\n {\n type: 'tuple',\n name: 'actionParameter',\n components: [\n { type: 'uint8', name: 'filterType' },\n { type: 'uint8', name: 'fieldType' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'bytes', name: 'filterData' },\n ],\n },\n ],\n },\n ],\n },\n ],\n [\n {\n actionClaimant,\n actionStepOne,\n actionStepTwo,\n actionStepThree,\n actionStepFour,\n },\n ],\n );\n};\n\n/**\n * Object representation of the `ERC20Incentive.InitPayload`.\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed.\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * Object representing the payload for signing before validaton.\n *\n * @export\n * @interface SignerValidatorSignaturePayload\n * @typedef {SignerValidatorSignaturePayload}\n */\nexport interface SignerValidatorSignaturePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n}\n\n// /**\n// * Function to properly encode a validation payload.\n// *\n// * @param {SignerValidatorValidatePayload} param0\n// * @param {Address} param0.signer - The address of the signer with which to validate.\n// * @param {Hex} param0.hash - The transaction 558 to associate with the validation.\n// * @param {Hex} param0.signature - The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer\n// * @param {Address} param0.validator - Address of the validator module.\n// * @returns {*}\n// */\n// export const prepareSignerValidatorSignaturePayload = ({\n// boostId,\n// incentiveId,\n// claimant,\n// claimData,\n// validator,\n// chainId,\n// }: SignerValidatorSignaturePayload) => {\n// const domain = {\n// name: 'SignerValidator',\n// version: '1',\n// chainId: chainId,\n// verifyingContract: validator,\n// };\n// return hashTypedData({\n// domain,\n// types: {\n// SignerValidatorData: [\n// { name: 'incentiveId', type: 'uint256' },\n// { name: 'claimant', type: 'address' },\n// { name: 'boostId', type: 'uint256' },\n// { name: 'claimData', type: 'bytes32' },\n// ],\n// },\n// primaryType: 'SignerValidatorData',\n// message: {\n// incentiveId,\n// claimant,\n// boostId,\n// claimData,\n// },\n// });\n// };\n\n/**\n * Object reprentation of a {@link SignerValidator} initialization payload\n *\n * @export\n * @interface SignerValidatorPayload\n * @typedef {SignerValidatorPayload}\n */\nexport interface SignerValidatorPayload {\n /**\n * The list of authorized signers. The first address in the list will be the initial owner of the contract.\n *\n * @type {Address[]}\n */\n signers: Address[];\n /**\n * The authorized caller of the {@link prepareSignerValidator} function\n * @type {Address}\n */\n validatorCaller: Address;\n}\n\n/**\n * Description placeholder\n *\n * @export\n * @interface SignerValidatorValidatePayload\n * @typedef {SignerValidatorValidatePayload}\n */\nexport interface SignerValidatorValidatePayload {\n /**\n * The ID of the boost.\n *\n * @type {bigint}\n */\n boostId: bigint;\n /**\n * The ID of the incentive.\n *\n * @type {bigint}\n */\n incentiveId: bigint;\n /**\n * The address of the claimant.\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The claim data.\n *\n * @type {Hex}\n */\n claimData: Hex;\n}\n\n/**\n * Given a {@link SignerValidatorPayload}, properly encode the initialization payload.\n *\n * @param {SignerValidatorPayload} param0\n * @param {Address[]} param0.signers\n * @param {Address} param0.validatorCaller\n * @returns {Hex}\n */\nexport const prepareSignerValidatorPayload = ({\n signers,\n validatorCaller,\n}: SignerValidatorPayload) => {\n return encodeAbiParameters(\n [\n { type: 'address[]', name: 'signers' },\n { type: 'address', name: 'validatorCaller' },\n ],\n [signers, validatorCaller],\n );\n};\n\n/**\n * Object representation of a {@link BoostClaimData} initialization payload\n *\n * @export\n * @interface BoostClaimData\n * @typedef {BoostClaimData}\n */\nexport interface BoostClaimData {\n /**\n * The validator data.\n *\n * @type {Hex}\n */\n validatorData: Hex;\n\n /**\n * The incentive data.\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n}\n\n/**\n * Given a {@link BoostClaimData}, properly encode the initialization payload.\n *\n * @param {BoostClaimData} param0\n * @param {Hex} param0.validatorData\n * @param {Hex} param0.incentiveData\n * @returns {Hex}\n */\nexport const prepareBoostClaimData = ({\n validatorData,\n incentiveData,\n}: BoostClaimData) => {\n return encodeAbiParameters(\n [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n [validatorData, incentiveData],\n );\n};\n\n/**\n * Object representation of a {@link SignerValidatorInputParams} initialization payload\n *\n * @export\n * @interface SignerValidatorInputParams\n * @typedef {SignerValidatorInputParams}\n */\nexport interface SignerValidatorInputParams {\n /**\n * The signer address.\n *\n * @type {Address}\n */\n signer: Address;\n\n /**\n * The signature data.\n *\n * @type {string}\n */\n signature: Hex;\n\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n}\n\n/**\n * Given a {@link SignerValidatorInputParams}, properly encode the initialization payload.\n *\n * @param {SignerValidatorInputParams} param0\n * @param {Address} param0.signer\n * @param {Hex} param0.signature\n * @param {number} param0.incentiveQuantity\n * @returns {Hex}\n */\nexport const prepareSignerValidatorInputParams = ({\n signer,\n signature,\n incentiveQuantity,\n}: SignerValidatorInputParams) => {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'SignerValidatorInputParams',\n components: [\n { type: 'address', name: 'signer' },\n { type: 'bytes', name: 'signature' },\n { type: 'uint8', name: 'incentiveQuantity' },\n ],\n },\n ],\n [{ signer, signature, incentiveQuantity }],\n );\n};\n\n/**\n * Signer Validator Claim Data Payload\n *\n * @export\n * @interface SignerValidatorClaimDataParams\n * @typedef {SignerValidatorClaimDataParams}\n */\nexport interface SignerValidatorClaimDataParams {\n /**\n * The signer with which to sign the input\n *\n * @type {{\n * account: Address;\n * key: Hex;\n * privateKey: PrivateKeyAccount;\n * }}\n */\n signer: {\n account: Address;\n key: Hex;\n privateKey: PrivateKeyAccount;\n };\n /**\n * The encoded data to provide the underlying incentive. You can use {@link prepareAllowListIncentivePayload}, {@link prepareCGDAIncentivePayload}, {@link prepareERC20IncentivePayload}, {@link prepareERC1155IncentivePayload}, or {@link preparePointsIncentivePayload}\n *\n * @type {Hex}\n */\n incentiveData: Hex;\n /**\n * The chain id to target\n *\n * @type {number}\n */\n chainId: number;\n /**\n * The address of the validator\n *\n * @type {Address}\n */\n validator: Address;\n /**\n * The incentive quantity.\n *\n * @type {number}\n */\n incentiveQuantity: number;\n /**\n * The address of the claimant\n *\n * @type {Address}\n */\n claimant: Address;\n /**\n * The ID of the boost\n *\n * @type {bigint}\n */\n boostId: bigint;\n}\n\n/**\n * Signer Validator Claim Data Payload Preparation\n *\n * @export\n * @async\n * @param {SignerValidatorClaimDataParams} param0\n * @param {{ account: Address; key: Hex; privateKey: PrivateKeyAccount; }} param0.signer\n * @param {Hex} param0.incentiveData\n * @param {number} param0.chainId\n * @param {Address} param0.validator\n * @param {number} param0.incentiveQuantity\n * @param {Address} param0.claimant\n * @param {bigint} param0.boostId\n * @returns {Promise<Hex>}\n */\nexport async function prepareSignerValidatorClaimDataPayload({\n signer,\n incentiveData,\n chainId,\n validator,\n incentiveQuantity,\n claimant,\n boostId,\n}: SignerValidatorClaimDataParams): Promise<Hex> {\n const domain = {\n name: 'SignerValidator',\n version: '1',\n chainId: chainId,\n verifyingContract: validator,\n };\n const typedData = {\n domain,\n types: {\n SignerValidatorData: [\n { name: 'boostId', type: 'uint256' },\n { name: 'incentiveQuantity', type: 'uint8' },\n { name: 'claimant', type: 'address' },\n { name: 'incentiveData', type: 'bytes' },\n ],\n },\n primaryType: 'SignerValidatorData' as const,\n message: {\n boostId,\n incentiveQuantity,\n claimant,\n incentiveData: incentiveData,\n },\n };\n\n const trustedSignature = await signTypedData({\n ...typedData,\n privateKey: signer.key,\n });\n\n // Prepare the claim data payload using the new helper\n const validatorData = prepareSignerValidatorInputParams({\n signer: signer.account,\n signature: trustedSignature,\n incentiveQuantity, // Adjust incentive quantity as necessary\n });\n\n const boostClaimDataPayload = encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n [{ validatorData, incentiveData }],\n );\n\n return boostClaimDataPayload;\n}\n\n/**\n * Object representation of a {@link SimpleAllowList} initialization payload.\n *\n * @export\n * @interface SimpleAllowListPayload\n * @typedef {SimpleAllowListPayload}\n */\nexport interface SimpleAllowListPayload {\n /**\n * The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of allowed addresses.\n *\n * @type {Address[]}\n */\n allowed: Address[];\n}\n\n/**\n * Given a {@link SimpleAllowListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleAllowListPayload} param0\n * @param {Address} param0.owner - The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.\n * @param {Address[]} param0.allowed - List of allowed addresses.\n * @returns {Hex}\n */\nexport const prepareSimpleAllowListPayload = ({\n owner,\n allowed,\n}: SimpleAllowListPayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'allowed' },\n ],\n [owner, allowed],\n );\n};\n\n/**\n * Object representation of a {@link SimpleDenyList} initialization payload.\n *\n * @export\n * @interface SimpleDenyListPayload\n * @typedef {SimpleDenyListPayload}\n */\nexport interface SimpleDenyListPayload {\n /**\n * The allow list's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of denied addresses.\n *\n * @type {Address[]}\n */\n denied: Address[];\n}\n\n/**\n * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleDenyListPayload} param0\n * @param {Address} param0.owner - The allow list's owner\n * @param {Address[]} param0.denied - List of denied addresses.\n * @returns {Hex}\n */\nexport const prepareSimpleDenyListPayload = ({\n owner,\n denied,\n}: SimpleDenyListPayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'denied' },\n ],\n [owner, denied],\n );\n};\n\n/**\n * Object representation of `BoostCore.InitPayload` struct.\n *\n * @export\n * @interface BoostPayload\n * @typedef {BoostPayload}\n */\nexport interface BoostPayload {\n /**\n * Address to valid budget.\n *\n * @type {Address}\n */\n budget: Address;\n /**\n * Target for existing action, or base with initialization payload.\n *\n * @type {Target}\n */\n action: Target;\n /**\n * Target for existing validator, or base with initialization payload.\n *\n * @type {Target}\n */\n validator: Target;\n /**\n * Target for existing allowList, or base with initialization payload.\n *\n * @type {Target}\n */\n allowList: Target;\n /**\n * Targets for new incentives, with initialization payloads.\n *\n * @type {Target[]}\n */\n incentives: Target[];\n /**\n * The base protocol fee (in bps)\n *\n * @type {?bigint}\n */\n protocolFee?: bigint;\n /**\n * The base referral fee (in bps)\n *\n * @type {?bigint}\n */\n referralFee?: bigint;\n /**\n * Optional maximum amount of participants in the Boost.\n *\n * @type {?bigint}\n */\n maxParticipants?: bigint;\n /**\n * The owner of the Boost.\n *\n * @type {Address}\n */\n owner: Address;\n}\n\n/**\n * Given a valid {@link BoostPayload}, properly encode and compress the payload for use with `createBoost`\n *\n * @export\n * @param {BoostPayload} param0\n * @param {Address} param0.budget - Address to valid budget.\n * @param {Target} param0.action - Target for existing action, or base with initialization payload.\n * @param {Target} param0.validator - Target for existing validator, or base with initialization payload.\n * @param {Target} param0.allowList - Target for existing allowList, or base with initialization payload.\n * @param {Target[]} param0.incentives - Targets for new incentives, with initialization payloads.\n * @param {bigint} [param0.protocolFee=0n] - The base protocol fee (in bps)\n * @param {bigint} [param0.referralFee=0n] - The base referral fee (in bps)\n * @param {bigint} [param0.maxParticipants=0n] - Optional maximum amount of participants in the Boost.\n * @param {Address} param0.owner - The owner of the Boost.\n * @returns {Hex}\n */\nexport function prepareBoostPayload({\n budget,\n action,\n validator,\n allowList,\n incentives,\n protocolFee = 0n,\n referralFee = 0n,\n maxParticipants = 0n,\n owner,\n}: BoostPayload): Hex {\n return LibZip.cdCompress(\n encodeAbiParameters(\n parseAbiParameters([\n 'BoostPayload payload',\n 'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint64 referralFee; uint256 maxParticipants; address owner; }',\n 'struct Target { bool isBase; address instance; bytes parameters; }',\n ]),\n [\n {\n budget,\n action,\n validator,\n allowList,\n incentives,\n protocolFee,\n referralFee,\n maxParticipants,\n owner,\n },\n ],\n ),\n ) as Hex;\n}\n\n/**\n * Object representation of\n *\n * @export\n * @interface ERC1155Payload\n * @typedef {ERC1155Payload}\n */\nexport interface ERC1155Payload {\n /**\n * The ERC1155 token ID for the incentive\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Given a token ID and amount, properly encode a `ERC1155Incentive.ERC1155Payload` for use with {@link ERC1155Incentive} initialization.\n *\n * @export\n * @param {ERC1155Payload} param0\n * @param {bigint} param0.tokenId - The ERC1155 token ID for the incentive\n * @param {bigint} param0.amount - The amount to transfer\n * @returns {Hex}\n */\nexport function prepareERC1155Payload({ tokenId, amount }: ERC1155Payload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ERC1155Payload payload',\n 'struct ERC1155Payload { uint256 tokenId; uint256 amount; bytes data; }',\n ]),\n [{ tokenId, amount, data: '0x' }],\n );\n}\n\n/**\n * The object representation of a `PointsIncentive.InitPayload`\n *\n * @export\n * @interface PointsIncentivePayload\n * @typedef {PointsIncentivePayload}\n */\nexport interface PointsIncentivePayload {\n /**\n * The address of the points contract\n *\n * @type {Address}\n */\n venue: Address;\n /**\n * The selector for the issuance function on the points contract\n *\n * @type {Hex}\n */\n selector: Hex;\n /**\n * The reward amount issued for each claim\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * Given a {@link PointsIncentivePayload}, properly encode a `PointsIncentive.InitPayload` for use with {@link PointsIncentive} initialization.\n *\n * @param {PointsIncentivePayload} param0\n * @param {Address} param0.venue - The address of the points contract\n * @param {Hex} param0.selector - The selector for the issuance function on the points contract\n * @param {bigint} param0.reward - The reward amount issued for each claim\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {*}\n */\nexport const preparePointsIncentivePayload = ({\n venue,\n selector,\n reward,\n limit,\n}: PointsIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'venue' },\n { type: 'bytes4', name: 'selector' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [venue, selector, reward, limit],\n );\n};\n\n/**\n * The configuration parameters for the CGDAIncentive\n *\n * @export\n * @interface CGDAParameters\n * @typedef {CGDAParameters}\n */\nexport interface CGDAParameters {\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The timestamp of the last claim\n *\n * @type {bigint}\n */\n lastClaimTime: bigint;\n /**\n * The current reward amount\n *\n * @type {bigint}\n */\n currentReward: bigint;\n}\n\n/**\n * The object representation of a `CGDAIncentive.InitPayload`\n *\n * @export\n * @interface CGDAIncentivePayload\n * @typedef {CGDAIncentivePayload}\n */\nexport interface CGDAIncentivePayload {\n /**\n * The address of the ERC20-like token\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The initial reward amount\n *\n * @type {bigint}\n */\n initialReward: bigint;\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The total budget for the incentive\n *\n * @type {bigint}\n */\n totalBudget: bigint;\n}\n\n/**\n * Given a {@link CGDAIncentivePayload}, properly encode a `CGDAIncentive.InitPayload` for use with {@link CGDAIncentive} initialization.\n *\n * @param {CGDAIncentivePayload} param0\n * @param {Address} param0.asset - The address of the ERC20-like token\n * @param {bigint} param0.initialReward - The initial reward amount\n * @param {bigint} param0.rewardDecay - The amount to subtract from the current reward after each claim\n * @param {bigint} param0.rewardBoost - The amount by which the reward increases for each hour without a claim (continuous linear increase)\n * @param {bigint} param0.totalBudget - The total budget for the incentive\n * @returns {Hex}\n */\nexport const prepareCGDAIncentivePayload = ({\n asset,\n initialReward,\n rewardDecay,\n rewardBoost,\n totalBudget,\n}: CGDAIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n ],\n [asset, initialReward, rewardDecay, rewardBoost, totalBudget],\n );\n};\n\n/**\n * The object representation of a `ERC1155Incentive.InitPayload`\n *\n * @export\n * @interface ERC1155IncentivePayload\n * @typedef {ERC1155IncentivePayload}\n */\nexport interface ERC1155IncentivePayload {\n /**\n * The address of the `ERC1155` asset\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * Should be `Strategy.POOL`\n *\n * @type {ERC1155StrategyType}\n */\n strategy: ERC1155StrategyType;\n /**\n * The token ID to target\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * Any extra data to accompany the claim, if applicable.\n *\n * @type {Hex}\n */\n extraData: Hex;\n}\n\n/**\n * Given a {@link ERC1155IncentivePayload}, properly encode a `ERC1155Incentive.InitPayload` for use with {@link ERC1155Incentive} initialization.\n *\n * @param {ERC1155IncentivePayload} param0\n * @param {Address} param0.asset - The address of the `ERC1155` asset\n * @param {ERC1155StrategyType} param0.strategy - Should be `Strategy.POOL`\n * @param {bigint} param0.tokenId - The token ID to target\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @param {Hex} param0.extraData - Any extra data to accompany the claim, if applicable.\n * @returns {Hex}\n */\nexport const prepareERC1155IncentivePayload = ({\n asset,\n strategy,\n tokenId,\n limit,\n extraData,\n}: ERC1155IncentivePayload) => {\n return encodeAbiParameters(\n parseAbiParameters([\n 'InitPayload payload',\n 'struct InitPayload { address asset; uint8 strategy; uint256 tokenId; uint256 limit; bytes extraData; }',\n ]),\n [{ asset, strategy, tokenId, limit, extraData }],\n );\n // return encodeAbiParameters(\n // [\n // { type: 'address', name: 'asset' },\n // { type: 'uint8', name: 'strategy' },\n // { type: 'uint256', name: 'tokenId' },\n // { type: 'uint256', name: 'limit' },\n // { type: 'bytes', name: 'extraData' },\n // ],\n // [asset, strategy, tokenId, limit, extraData],\n // );\n};\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n\n/**\n * The object representation of a `ERC20Incentive.InitPayload`\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed.\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * Given a {@link ERC20IncentivePayload}, properly encode a `ERC20Incentive.InitPayload` for use with {@link ERC20Incentive} initialization.\n *\n * @param {ERC20IncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @returns {*}\n */\nexport const prepareERC20IncentivePayload = ({\n asset,\n strategy,\n reward,\n limit,\n}: ERC20IncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint8', name: 'strategy' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [asset, strategy, reward, limit],\n );\n};\n\n/**\n * The object representation of a `ERC20VariableIncentivePayload.InitPayload`\n *\n * @export\n * @interface ERC20VariableIncentivePayload\n * @typedef {ERC20VariableIncentivePayload}\n */\nexport interface ERC20VariableIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed.\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * Given a {@link ERC20VariableIncentivePayload}, properly encode a ` ERC20VariableIncentive.InitPayload` for use with {@link ERC20VariableIncentive} initialization.\n *\n * @param {ERC20VariableIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @returns {*}\n */\nexport const prepareERC20VariableIncentivePayload = ({\n asset,\n reward,\n limit,\n}: ERC20VariableIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [asset, reward, limit],\n );\n};\n\n/**\n * The object representation of a `ContractAction.InitPayload`\n *\n * @export\n * @interface ContractActionPayload\n * @typedef {ContractActionPayload}\n */\nexport interface ContractActionPayload {\n /**\n * The chain ID on which the target exists\n *\n * @type {bigint}\n */\n chainId: bigint;\n /**\n * The target contract address\n *\n * @type {Address}\n */\n target: Address;\n /**\n * The selector for the function to be called\n *\n * @type {Hex}\n */\n selector: Hex;\n /**\n * The native token value to send with the function call\n *\n * @type {bigint}\n */\n value: bigint;\n}\n\n/**\n * `ERC721MintActionPayload` is a re-exported `ContractActionPayload`\n *\n * @export\n * @typedef {ERC721MintActionPayload}\n */\nexport type ERC721MintActionPayload = ContractActionPayload;\n\n/**\n * The object representation of a `SimpleBudgetPayload.InitPayload`\n *\n * @export\n * @interface SimpleBudgetPayload\n * @typedef {SimpleBudgetPayload}\n */\nexport interface SimpleBudgetPayload {\n /**\n * The budget's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n *\n * @type {Address[]}\n */\n authorized: Address[];\n}\n\n/**\n * Given a {@link SimpleBudgetPayload}, properly encode a `SimpleBudget.InitPayload` for use with {@link SimpleBudget} initialization.\n *\n * @param {SimpleBudgetPayload} param0\n * @param {Address} param0.owner - The budget's owner\n * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n * @returns {*}\n */\nexport const prepareSimpleBudgetPayload = ({\n owner,\n authorized,\n}: SimpleBudgetPayload) => {\n return encodeAbiParameters(\n parseAbiParameters([\n 'SimpleBudgetPayload payload',\n 'struct SimpleBudgetPayload { address owner; address[] authorized; }',\n ]),\n [{ owner, authorized }],\n );\n};\n\n/**\n * The object representation of a `ManagedBudgetPayload.InitPayload`\n *\n * @export\n * @interface ManagedBudgetPayload\n * @typedef {ManagedBudgetPayload}\n */\nexport interface ManagedBudgetPayload {\n /**\n * The budget's owner\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n *\n * @type {Address[]}\n */\n authorized: Address[];\n /**\n * List of roles to assign to the corresponding account by index.\n *\n * @type {bigint[]}\n */\n roles: bigint[];\n}\n\n/**\n * Given a {@link ManagedBudgetPayload}, properly encode a `ManagedBudget.InitPayload` for use with {@link ManagedBudget} initialization.\n *\n * @param {ManagedBudgetPayload} param0\n * @param {Address} param0.owner - The budget's owner\n * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n * @param {{}} param0.roles - List of roles to assign to the corresponding account by index.\n * @returns {*}\n */\nexport const prepareManagedBudgetPayload = ({\n owner,\n authorized,\n roles,\n}: ManagedBudgetPayload) => {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ManagedBudgetPayload payload',\n 'struct ManagedBudgetPayload { address owner; address[] authorized; uint256[] roles; }',\n ]),\n [{ owner, authorized, roles }],\n );\n};\n\n/**\n * The object representation of a `VestingBudget.InitPayload`\n *\n * @export\n * @interface VestingBudgetPayload\n * @typedef {VestingBudgetPayload}\n */\nexport interface VestingBudgetPayload {\n /**\n * The budget's owner.\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n *\n * @type {Address[]}\n */\n authorized: Address[];\n /**\n * The timestamp at which the vesting schedule begins\n *\n * @type {bigint}\n */\n start: bigint;\n /**\n * The duration of the vesting schedule (in seconds)\n *\n * @type {bigint}\n */\n duration: bigint;\n /**\n * The duration of the cliff period (in seconds)\n *\n * @type {bigint}\n */\n cliff: bigint;\n}\n\n/**\n * Given a {@link VestingBudgetPayload}, properly encode a `VestingBudget.InitPayload` for use with {@link VestingBudget} initialization.\n *\n * @param {VestingBudgetPayload} param0\n * @param {Address} param0.owner - The budget's owner.\n * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.\n * @param {bigint} param0.start - The timestamp at which the vesting schedule begins\n * @param {bigint} param0.duration - The duration of the vesting schedule (in seconds)\n * @param {bigint} param0.cliff - The duration of the cliff period (in seconds)\n * @returns {Hex}\n */\nexport const prepareVestingBudgetPayload = ({\n owner,\n authorized,\n start,\n duration,\n cliff,\n}: VestingBudgetPayload) => {\n return encodeAbiParameters(\n parseAbiParameters([\n 'VestingBudgetPayload payload',\n 'struct VestingBudgetPayload { address owner; address[] authorized; uint64 start; uint64 duration; uint64 cliff; }',\n ]),\n [{ owner, authorized, start, duration, cliff }],\n );\n};\n\n/**\n * Given a {@link ContractActionPayload}, properly encode a `ContractAction.InitPayload` for use with {@link ContractAction} initialization.\n *\n * @param {ContractActionPayload} param0\n * @param {bigint} param0.chainId - The chain ID on which the target exists\n * @param {Address} param0.target - The target contract address\n * @param {Hex} param0.selector - The selector for the function to be called\n * @param {bigint} param0.value - The native token value to send with the function call\n * @returns {Hex}\n */\nexport const prepareContractActionPayload = ({\n chainId,\n target,\n selector,\n value,\n}: ContractActionPayload) => {\n return encodeAbiParameters(\n parseAbiParameters([\n 'ContractActionPayload payload',\n 'struct ContractActionPayload { uint256 chainId; address target; bytes4 selector; uint256 value; }',\n ]),\n [{ chainId, target, selector, value }],\n );\n};\n\n/**\n * Given a {@link ContractActionPayload}, properly encode a `ContractAction.InitPayload` for use with {@link ERC721MintAction} initialization.\n *\n * @param {ContractActionPayload} param0\n * @param {bigint} param0.chainId - The chain ID on which the target exists\n * @param {Address} param0.target - The target contract address\n * @param {Hex} param0.selector - The selector for the function to be called\n * @param {bigint} param0.value - The native token value to send with the function call\n * @returns {*}\n */\nexport const prepareERC721MintActionPayload = ({\n chainId,\n target,\n selector,\n value,\n}: ContractActionPayload) => {\n return prepareContractActionPayload({ chainId, target, selector, value });\n};\n\n/**\n * The object representation of an `Incentive.ClaimPayload`\n *\n * @export\n * @interface ClaimPayload\n * @typedef {ClaimPayload}\n */\nexport interface ClaimPayload {\n /**\n * The address of the recipient\n *\n * @type {Address}\n */\n target: Address;\n /**\n * The implementation-specific data for the claim, if needed\n *\n * @type {?Hex}\n */\n data?: Hex;\n}\n\n/**\n * Given a valid {@link ClaimPayload}, encode the payload for use with Incentive operations.\n *\n * @param {ClaimPayload} param0\n * @param {Address} param0.target - The address of the recipient\n * @param {Hex} [param0.data=zeroHash] - The implementation-specific data for the claim, if needed\n * @returns {*}\n */\nexport const prepareClaimPayload = ({\n target,\n data = zeroHash,\n}: ClaimPayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [target, data],\n );\n};\n\n/*\n * Transfer Payloads\n */\n\n/**\n * The various types of assets supported in Budgets and Incentives.\n *\n * @export\n * @enum {number}\n */\nexport enum AssetType {\n ETH,\n ERC20,\n ERC1155,\n}\n\n/**\n * Object representation of a generic `Transfer` struct.\n *\n * @export\n * @interface TransferPayload\n * @typedef {TransferPayload}\n */\nexport interface TransferPayload {\n /**\n * The type of the asset being transferred.\n *\n * @type {AssetType}\n */\n assetType: AssetType;\n /**\n * The address of the asset to transfer, zero address for ETH.\n *\n * @type {Address}\n */\n address: Address;\n /**\n * The account from which to transfer the assets.\n *\n * @type {Address}\n */\n target: Address;\n /**\n * An encoded {@link FungiblePayload}, use {@link prepareFungiblePayload} to construct.\n *\n * @type {Hex}\n */\n data: Hex;\n}\n\n/**\n * Encodes parameters for transferring the transfer of Fungible and ERC1155 assets, used for {@link Budget} operations.\n * Typically you'd use {@link prepareFungibleTransfer} or {@link prepareERC1155Transfer}\n *\n * @param {TransferPayload} param0\n * @param {AssetType} param0.assetType - The asset type being transferred.\n * @param {Address} param0.address - The address of the asset, use zero address for ETH transfers.\n * @param {Address} param0.target - The address of the account being transferred from\n * @param {Hex} param0.data - Use {@link prepareFungiblePayload} to properly encode an amount to transfer\n * @returns {Hex}\n */\nexport const prepareTransferPayload = ({\n assetType,\n address,\n target,\n data,\n}: TransferPayload) => {\n return encodeAbiParameters(\n [\n { type: 'uint8', name: 'assetType' },\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'target' },\n { type: 'bytes', name: 'data' },\n ],\n [assetType, address, target, data],\n );\n};\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of ERC1155 assets.\n *\n * @export\n * @interface ERC1155TransferPayload\n * @typedef {ERC1155TransferPayload}\n */\nexport interface ERC1155TransferPayload {\n /**\n * The token ID to transfer\n *\n * @type {bigint}\n */\n tokenId: bigint;\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset to target\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for transferring the transfer of ERC1155 assets, used for {@link Budget} operations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {ERC1155TransferPayload} param0\n * @param {bigint} param0.tokenId - The token ID to transfer\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset to target\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareERC1155Transfer({\n tokenId,\n amount,\n asset,\n target,\n}: ERC1155TransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: AssetType.ERC1155,\n asset,\n data: prepareERC1155Payload({ tokenId, amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * An object representation of the `FungiblePayload` struct\n *\n * @export\n * @interface FungiblePayload\n * @typedef {FungiblePayload}\n */\nexport interface FungiblePayload {\n /**\n * The amount being transferred\n *\n * @type {bigint}\n */\n amount: bigint;\n}\n\n/**\n * Encodes an amount for the `FungiblePayload` struct\n *\n * @export\n * @param {FungiblePayload} param0\n * @param {bigint} param0.amount - The amount being transferred\n * @returns {*}\n */\nexport function prepareFungiblePayload({ amount }: FungiblePayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'FungiblePayload payload',\n 'struct FungiblePayload { uint256 amount; }',\n ]),\n [{ amount }],\n );\n}\n\n/**\n * An object representation of the `Budget.Transfer` contract struct for transfers of fungible assets.\n *\n * @export\n * @interface FungibleTransferPayload\n * @typedef {FungibleTransferPayload}\n */\nexport interface FungibleTransferPayload {\n /**\n * The amount to transfer\n *\n * @type {bigint}\n */\n amount: bigint;\n /**\n * The address of the asset. Use zero address for ETH transfers.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The account to transfer from\n *\n * @type {Address}\n */\n target: Address;\n}\n\n/**\n * Encodes parameters for a Fungible transfer, used for Budget allocations.\n * The caller must have already approved the contract to transfer the asset.\n *\n * @export\n * @param {FungibleTransferPayload} param0\n * @param {bigint} param0.amount - The amount to transfer\n * @param {Address} param0.asset - The address of the asset. Use zero address for ETH transfers.\n * @param {Address} param0.target - The account to transfer from\n * @returns {Hex}\n */\nexport function prepareFungibleTransfer({\n amount,\n asset,\n target,\n}: FungibleTransferPayload) {\n return encodeAbiParameters(\n parseAbiParameters([\n 'Transfer request',\n 'struct Transfer { uint8 assetType; address asset; address target; bytes data; }',\n ]),\n [\n {\n assetType: asset == zeroAddress ? AssetType.ETH : AssetType.ERC20,\n asset,\n data: prepareFungiblePayload({ amount }),\n target,\n },\n ],\n );\n}\n\n/**\n * Encodes a payload to validate that an action has been completed successfully.\n *\n *\n * @export\n * @param {Address} holder - The holder address\n * @param {bigint} payload - The token ID\n * @returns {Hex} - The first 20 bytes of the payload will be the holder address and the remaining bytes must be an encoded token ID (uint256)\n */\nexport function prepareERC721MintActionValidate(\n holder: Address,\n payload: bigint,\n) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'holder' },\n { type: 'bytes', name: 'payload' },\n ],\n [holder, toHex(payload)],\n );\n}\n\nexport function dedupeActionSteps(_steps: ActionStep[]): ActionStep[] {\n const steps: ActionStep[] = [],\n signatures: Record<string, boolean> = {};\n for (let step of _steps) {\n const signature = JSON.stringify(step);\n if (signatures[signature]) continue;\n steps.push(step);\n signatures[signature] = true;\n }\n return steps;\n}\n"],"names":["global","factory","module","exports","this","window","noGlobal","solady","LibZip","hexString","data","byteToString","b","parseByte","hexToBytes","a","i","bytesToHex","o","ib","ht","ob","j","s","h","d","c","l","r","p","q","e","u24","hash","x","literals","f","t","z","y","pushByte","rle","v","ERC1967Factory","m","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType","StrategyType","ERC1155StrategyType","FilterType","PrimitiveType","SignatureType","isEventActionPayloadSimple","opts","prepareEventActionPayload","actionClaimant","actionStepOne","actionStepTwo","actionStepThree","actionStepFour","encodeAbiParameters","prepareSignerValidatorPayload","signers","validatorCaller","prepareBoostClaimData","validatorData","incentiveData","prepareSignerValidatorInputParams","signer","signature","incentiveQuantity","prepareSignerValidatorClaimDataPayload","chainId","validator","claimant","boostId","trustedSignature","signTypedData","prepareSimpleAllowListPayload","owner","allowed","prepareSimpleDenyListPayload","denied","prepareBoostPayload","budget","action","allowList","incentives","protocolFee","referralFee","maxParticipants","parseAbiParameters","prepareERC1155Payload","tokenId","amount","preparePointsIncentivePayload","venue","selector","reward","limit","prepareCGDAIncentivePayload","asset","initialReward","rewardDecay","rewardBoost","totalBudget","prepareERC1155IncentivePayload","strategy","extraData","prepareAllowListIncentivePayload","prepareERC20IncentivePayload","prepareERC20VariableIncentivePayload","prepareSimpleBudgetPayload","authorized","prepareManagedBudgetPayload","roles","prepareVestingBudgetPayload","start","duration","cliff","prepareContractActionPayload","target","value","prepareERC721MintActionPayload","prepareClaimPayload","zeroHash","AssetType","AssetType2","prepareTransferPayload","assetType","address","prepareERC1155Transfer","prepareFungiblePayload","prepareFungibleTransfer","zeroAddress","prepareERC721MintActionValidate","holder","payload","dedupeActionSteps","_steps","steps","signatures","step"],"mappings":";;;;;;AAuBA,GAAC,SAAS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AEJ;AA0BgB,SAAAW,GAAuB,EAAE,QAAAtC,KAA2B;AAC3D,SAAAlC;AAAA,IACL+B,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD,CAAC,EAAE,QAAAG,EAAA,CAAQ;AAAA,EAAA;AAEf;AAyCO,SAASuC,GAAwB;AAAA,EACtC,QAAAvC;AAAA,EACA,OAAAO;AAAA,EACA,QAAAoB;AACF,GAA4B;AACnB,SAAA7D;AAAA,IACL+B,EAAmB;AAAA,MACjB;AAAA,MACA;AAAA,IAAA,CACD;AAAA,IACD;AAAA,MACE;AAAA,QACE,WAAWU,KAASiC,IAAc,IAAgB;AAAA,QAClD,OAAAjC;AAAA,QACA,MAAM+B,GAAuB,EAAE,QAAAtC,GAAQ;AAAA,QACvC,QAAA2B;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AAWgB,SAAAc,GACdC,GACAC,GACA;AACO,SAAA7E;AAAA,IACL;AAAA,MACE,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,MAClC,EAAE,MAAM,SAAS,MAAM,UAAU;AAAA,IACnC;AAAA,IACA,CAAC4E,GAAQpG,EAAMqG,CAAO,CAAC;AAAA,EAAA;AAE3B;AAEO,SAASC,GAAkBC,GAAoC;AACpE,QAAMC,IAAsB,CAAA,GAC1BC,IAAsC;AACxC,WAASC,KAAQH,GAAQ;AACjB,UAAAtE,IAAY,KAAK,UAAUyE,CAAI;AACrC,IAAID,EAAWxE,CAAS,MACxBuE,EAAM,KAAKE,CAAI,GACfD,EAAWxE,CAAS,IAAI;AAAA,EAC1B;AACO,SAAAuE;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":";;;AA2HO,SAASA,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAQY,IAAAC,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boostxyz/sdk",
3
- "version": "0.0.0-alpha.7",
3
+ "version": "0.0.0-alpha.9",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
@@ -42,6 +42,18 @@
42
42
  "node": "./dist/utils.js",
43
43
  "types": "./dist/utils.d.ts"
44
44
  },
45
+ "./claiming": {
46
+ "require": "./dist/claiming.cjs",
47
+ "import": "./dist/claiming.js",
48
+ "node": "./dist/claiming.js",
49
+ "types": "./dist/claiming.d.ts"
50
+ },
51
+ "./transfers": {
52
+ "require": "./dist/transfers.cjs",
53
+ "import": "./dist/transfers.js",
54
+ "node": "./dist/transfers.js",
55
+ "types": "./dist/transfers.d.ts"
56
+ },
45
57
  "./Boost": {
46
58
  "require": "./dist/Boost.cjs",
47
59
  "import": "./dist/Boost.js",
@@ -176,7 +188,7 @@
176
188
  }
177
189
  },
178
190
  "dependencies": {
179
- "@boostxyz/signatures": "0.0.0-alpha.0"
191
+ "@boostxyz/signatures": "0.0.0-alpha.1"
180
192
  },
181
193
  "optionalDependencies": {
182
194
  "@boostxyz/evm": "0.0.0-alpha.1"
@@ -188,12 +200,14 @@
188
200
  },
189
201
  "scripts": {
190
202
  "build": "vite build && tsc --build --emitDeclarationOnly --declaration --declarationMap --force",
203
+ "lint:ci": "npx biome ci",
204
+ "lint": "npx biome check",
191
205
  "bench": "vitest bench",
192
206
  "bench:ci": "CI=true vitest bench",
193
207
  "clean": "rm -rf dist",
194
208
  "dev": "vite build --watch",
195
209
  "test": "vitest dev",
196
210
  "test:ci": "CI=true vitest --coverage",
197
- "typedoc": "npx typedoc"
211
+ "typedoc": "npx typedoc --sort required-first --sort visibility --sort kind"
198
212
  }
199
213
  }
@@ -10,13 +10,13 @@ import {
10
10
  deployFixtures,
11
11
  fundErc721,
12
12
  } from '../../test/helpers';
13
+ import { EventAction, actionFromAddress } from './Action';
13
14
  import {
14
15
  type EventActionPayloadSimple,
15
16
  FilterType,
16
17
  PrimitiveType,
17
18
  SignatureType,
18
- } from '../utils';
19
- import { EventAction, actionFromAddress } from './Action';
19
+ } from './EventAction';
20
20
 
21
21
  let fixtures: Fixtures, erc721: MockERC721;
22
22
 
@@ -25,6 +25,7 @@ export function basicErc721TransferAction(
25
25
  ): EventActionPayloadSimple {
26
26
  return {
27
27
  actionClaimant: {
28
+ chainid: 31337,
28
29
  signatureType: SignatureType.EVENT,
29
30
  signature: selectors['Transfer(address,address,uint256)'] as Hex,
30
31
  fieldIndex: 2,
@@ -32,15 +33,15 @@ export function basicErc721TransferAction(
32
33
  },
33
34
  actionSteps: [
34
35
  {
36
+ chainid: 31337,
35
37
  signature: selectors['Transfer(address,address,uint256)'] as Hex,
36
38
  signatureType: SignatureType.EVENT,
37
- actionType: 0,
38
39
  targetContract: erc721.assertValidAddress(),
39
40
  actionParameter: {
40
41
  filterType: FilterType.EQUAL,
41
42
  fieldType: PrimitiveType.ADDRESS,
42
43
  fieldIndex: 2,
43
- filterData: accounts.at(1)!.account,
44
+ filterData: accounts[1].account,
44
45
  },
45
46
  },
46
47
  ],
@@ -1,6 +1,5 @@
1
1
  import { mockErc20Abi, readMockErc20BalanceOf } from '@boostxyz/evm';
2
2
  import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
3
- import { getClient } from '@wagmi/core';
4
3
  import {
5
4
  ContractFunctionExecutionError,
6
5
  encodeAbiParameters,
@@ -10,7 +9,6 @@ import {
10
9
  toFunctionSelector,
11
10
  zeroAddress,
12
11
  } from 'viem';
13
- import { call } from 'viem/actions';
14
12
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
15
13
  import type { MockERC20 } from '../../test/MockERC20';
16
14
  import { accounts } from '../../test/accounts';
@@ -118,7 +116,7 @@ describe.skip('ContractAction', () => {
118
116
 
119
117
  test('prepare will properly encode execution payload', async () => {
120
118
  const action = await loadFixture(payableContractAction(fixtures, erc20));
121
- const { account } = accounts.at(1)!;
119
+ const { account } = accounts[1];
122
120
  const payload = await action.prepare(
123
121
  encodeAbiParameters(
124
122
  [
@@ -139,7 +137,7 @@ describe.skip('ContractAction', () => {
139
137
 
140
138
  test('payable execute', async () => {
141
139
  const action = await loadFixture(payableContractAction(fixtures, erc20));
142
- const { account } = accounts.at(1)!;
140
+ const { account } = accounts[1];
143
141
  await action.execute(
144
142
  encodeAbiParameters(
145
143
  [
@@ -160,7 +158,7 @@ describe.skip('ContractAction', () => {
160
158
 
161
159
  test('nonpayable execute', async () => {
162
160
  const action = await loadFixture(nonPayableAction(fixtures, erc20));
163
- const { account } = accounts.at(1)!;
161
+ const { account } = accounts[1];
164
162
  const [success] = await action.execute(
165
163
  encodeAbiParameters(
166
164
  [
@@ -181,7 +179,7 @@ describe.skip('ContractAction', () => {
181
179
 
182
180
  test('different chain id should throw', async () => {
183
181
  const action = await loadFixture(otherAction(fixtures, erc20));
184
- const { account } = accounts.at(1)!;
182
+ const { account } = accounts[1];
185
183
  try {
186
184
  await action.execute(
187
185
  encodeAbiParameters(
@@ -9,23 +9,61 @@ import {
9
9
  writeContractActionExecute,
10
10
  } from '@boostxyz/evm';
11
11
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/ContractAction.sol/ContractAction.json';
12
- import type { Abi, Address, ContractEventName, Hex } from 'viem';
12
+ import {
13
+ type Abi,
14
+ type Address,
15
+ type ContractEventName,
16
+ type Hex,
17
+ encodeAbiParameters,
18
+ parseAbiParameters,
19
+ } from 'viem';
13
20
  import type {
14
21
  DeployableOptions,
15
22
  GenericDeployableParams,
16
23
  } from '../Deployable/Deployable';
17
24
  import { DeployableTarget } from '../Deployable/DeployableTarget';
18
25
  import {
19
- type ContractActionPayload,
20
26
  type GenericLog,
21
27
  type ReadParams,
22
28
  RegistryType,
23
29
  type WriteParams,
24
- prepareContractActionPayload,
25
30
  } from '../utils';
26
31
 
27
32
  export { contractActionAbi };
28
- export type { ContractActionPayload };
33
+
34
+ /**
35
+ * The object representation of a `ContractAction.InitPayload`
36
+ *
37
+ * @export
38
+ * @interface ContractActionPayload
39
+ * @typedef {ContractActionPayload}
40
+ */
41
+ export interface ContractActionPayload {
42
+ /**
43
+ * The chain ID on which the target exists
44
+ *
45
+ * @type {bigint}
46
+ */
47
+ chainId: bigint;
48
+ /**
49
+ * The target contract address
50
+ *
51
+ * @type {Address}
52
+ */
53
+ target: Address;
54
+ /**
55
+ * The selector for the function to be called
56
+ *
57
+ * @type {Hex}
58
+ */
59
+ selector: Hex;
60
+ /**
61
+ * The native token value to send with the function call
62
+ *
63
+ * @type {bigint}
64
+ */
65
+ value: bigint;
66
+ }
29
67
 
30
68
  /**
31
69
  * A generic `viem.Log` event with support for `ContractAction` event types.
@@ -85,7 +123,7 @@ export class ContractAction<
85
123
  public async chainId(
86
124
  params?: ReadParams<typeof contractActionAbi, 'chainId'>,
87
125
  ) {
88
- return readContractActionChainId(this._config, {
126
+ return await readContractActionChainId(this._config, {
89
127
  address: this.assertValidAddress(),
90
128
  ...this.optionallyAttachAccount(),
91
129
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -102,7 +140,7 @@ export class ContractAction<
102
140
  * @returns {Promise<`0x${string}`>}
103
141
  */
104
142
  public async target(params?: ReadParams<typeof contractActionAbi, 'target'>) {
105
- return readContractActionTarget(this._config, {
143
+ return await readContractActionTarget(this._config, {
106
144
  address: this.assertValidAddress(),
107
145
  ...this.optionallyAttachAccount(),
108
146
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -122,7 +160,7 @@ export class ContractAction<
122
160
  public async selector(
123
161
  params?: ReadParams<typeof contractActionAbi, 'selector'>,
124
162
  ) {
125
- return readContractActionSelector(this._config, {
163
+ return await readContractActionSelector(this._config, {
126
164
  address: this.assertValidAddress(),
127
165
  ...this.optionallyAttachAccount(),
128
166
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -139,7 +177,7 @@ export class ContractAction<
139
177
  * @returns {Promise<bigint>}
140
178
  */
141
179
  public async value(params?: ReadParams<typeof contractActionAbi, 'value'>) {
142
- return readContractActionValue(this._config, {
180
+ return await readContractActionValue(this._config, {
143
181
  address: this.assertValidAddress(),
144
182
  ...this.optionallyAttachAccount(),
145
183
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -160,7 +198,7 @@ export class ContractAction<
160
198
  data: Hex,
161
199
  params?: WriteParams<typeof contractActionAbi, 'execute'>,
162
200
  ) {
163
- return this.awaitResult(this.executeRaw(data, params));
201
+ return await this.awaitResult(this.executeRaw(data, params));
164
202
  }
165
203
 
166
204
  /**
@@ -203,7 +241,7 @@ export class ContractAction<
203
241
  calldata: Hex,
204
242
  params?: ReadParams<typeof contractActionAbi, 'prepare'>,
205
243
  ) {
206
- return readContractActionPrepare(this._config, {
244
+ return await readContractActionPrepare(this._config, {
207
245
  address: this.assertValidAddress(),
208
246
  args: [calldata],
209
247
  ...this.optionallyAttachAccount(),
@@ -236,3 +274,28 @@ export class ContractAction<
236
274
  };
237
275
  }
238
276
  }
277
+
278
+ /**
279
+ * Given a {@link ContractActionPayload}, properly encode a `ContractAction.InitPayload` for use with {@link ContractAction} initialization.
280
+ *
281
+ * @param {ContractActionPayload} param0
282
+ * @param {bigint} param0.chainId - The chain ID on which the target exists
283
+ * @param {Address} param0.target - The target contract address
284
+ * @param {Hex} param0.selector - The selector for the function to be called
285
+ * @param {bigint} param0.value - The native token value to send with the function call
286
+ * @returns {Hex}
287
+ */
288
+ export function prepareContractActionPayload({
289
+ chainId,
290
+ target,
291
+ selector,
292
+ value,
293
+ }: ContractActionPayload) {
294
+ return encodeAbiParameters(
295
+ parseAbiParameters([
296
+ 'ContractActionPayload payload',
297
+ 'struct ContractActionPayload { uint256 chainId; address target; bytes4 selector; uint256 value; }',
298
+ ]),
299
+ [{ chainId, target, selector, value }],
300
+ );
301
+ }
@@ -81,7 +81,7 @@ describe.skip('ERC721MintAction', () => {
81
81
 
82
82
  test('prepare will properly encode execution payload', async () => {
83
83
  const action = await loadFixture(nonPayableAction(fixtures, erc721));
84
- const { account } = accounts.at(1)!;
84
+ const { account } = accounts[1];
85
85
  const payload = await action.prepare(
86
86
  encodeAbiParameters([{ type: 'address', name: 'address' }], [account]),
87
87
  );
@@ -97,7 +97,7 @@ describe.skip('ERC721MintAction', () => {
97
97
  // TODO implement execute
98
98
  test.skip('nonpayable execute', async () => {
99
99
  const action = await loadFixture(nonPayableAction(fixtures, erc721));
100
- const { account } = accounts.at(1)!;
100
+ const { account } = accounts[1];
101
101
  const [success] = await action.execute(
102
102
  encodeAbiParameters(
103
103
  [