@boostxyz/sdk 2.0.0-alpha.34 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +18 -0
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +46 -20
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +18 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +55 -24
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +18 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +46 -20
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +28 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +45 -8
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +18 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +41 -15
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +12 -1
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +37 -20
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +80 -78
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +64 -35
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/Incentives/AllowListIncentive.test.ts +52 -4
- package/src/Incentives/AllowListIncentive.ts +28 -0
- package/src/Incentives/CGDAIncentive.test.ts +48 -3
- package/src/Incentives/CGDAIncentive.ts +34 -0
- package/src/Incentives/ERC20Incentive.test.ts +42 -0
- package/src/Incentives/ERC20Incentive.ts +28 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +74 -0
- package/src/Incentives/ERC20VariableIncentive.ts +41 -0
- package/src/Incentives/PointsIncentive.test.ts +47 -3
- package/src/Incentives/PointsIncentive.ts +28 -0
- package/src/Validators/SignerValidator.ts +0 -1
- package/src/Validators/Validator.ts +24 -1
- package/src/utils.ts +46 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignerValidator.js","sources":["../../src/Validators/SignerValidator.ts"],"sourcesContent":["import {\n readSignerValidatorHashSignerData,\n readSignerValidatorSigners,\n signerValidatorAbi,\n simulateSignerValidatorSetAuthorized,\n simulateSignerValidatorSetValidatorCaller,\n simulateSignerValidatorValidate,\n writeSignerValidatorSetAuthorized,\n writeSignerValidatorSetValidatorCaller,\n writeSignerValidatorValidate,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/SignerValidator.sol/SignerValidator.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n type PrivateKeyAccount,\n encodeAbiParameters,\n} from 'viem';\nimport { signTypedData } from 'viem/accounts';\nimport { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { signerValidatorAbi };\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 * 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 * 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 total number of incentives on the Boost\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 * 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 total number of incentives on the Boost\n *\n * @type {number}\n */\n incentiveQuantity: number;\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 * A generic `viem.Log` event with support for `BoostCore` event types.\n *\n * @export\n * @typedef {SignerValidatorLog}\n * @template {ContractEventName<\n * typeof signerValidatorAbi\n * >} [event=ContractEventName<typeof signerValidatorAbi>]\n */\nexport type SignerValidatorLog<\n event extends ContractEventName<\n typeof signerValidatorAbi\n > = ContractEventName<typeof signerValidatorAbi>,\n> = GenericLog<typeof signerValidatorAbi, event>;\n\n/**\n * A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers\n *\n * @export\n * @class SignerValidator\n * @typedef {SignerValidator}\n * @extends {DeployableTarget<SignerValidatorPayload>}\n */\nexport class SignerValidator extends DeployableTarget<\n SignerValidatorPayload,\n typeof signerValidatorAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = signerValidatorAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_SIGNER_VALIDATOR_BASE,\n ...(SignerValidatorBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.VALIDATOR;\n\n /**\n * The set of authorized signers\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async signers(address: Address, params?: ReadParams) {\n return await readSignerValidatorSigners(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Retrieve the hash and signer data for a given hash\n *\n * @public\n * @async\n * @param {SignerValidatorSignaturePayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async hashSignerData(\n payload: SignerValidatorSignaturePayload,\n params?: ReadParams,\n ) {\n return await readSignerValidatorHashSignerData(this._config, {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveQuantity,\n payload.claimant,\n payload.incentiveData,\n ],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validate(\n payload: SignerValidatorValidatePayload,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.validateRaw(payload, params));\n }\n\n /**\n * Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validateRaw(\n payload: SignerValidatorValidatePayload,\n params?: ReadParams,\n ) {\n const { request, result } = await simulateSignerValidatorValidate(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveId,\n payload.claimant,\n payload.claimData,\n ],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorValidate(this._config, request);\n return { hash, result };\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateSignerValidatorSetAuthorized(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setValidatorCallerRaw(address: Address, params?: WriteParams) {\n const { request, result } = await simulateSignerValidatorSetValidatorCaller(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [address],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetValidatorCaller(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setValidatorCaller(address: Address, params?: WriteParams) {\n return await this.awaitResult(this.setValidatorCallerRaw(address, params));\n }\n\n /**\n * Properly encodes the data needed to claim\n *\n * @public\n * @async\n * @param {SignerValidatorClaimDataParams} params\n * @returns {Promise<Hex>}\n */\n public async encodeClaimData(\n params: Omit<SignerValidatorClaimDataParams, 'validator'>,\n ): Promise<Hex> {\n return await prepareSignerValidatorClaimDataPayload({\n ...params,\n validator: this.assertValidAddress(),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SignerValidatorPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: SignerValidatorPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: signerValidatorAbi,\n bytecode: bytecode as Hex,\n args: [prepareSignerValidatorPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\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 trustedSignature = await signer.privateKey.signTypedData({\n domain: {\n name: 'SignerValidator',\n version: '1',\n chainId: chainId,\n verifyingContract: validator,\n },\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 // 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 * 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 function 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 * 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 function 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"],"names":["_SignerValidator","DeployableTarget","signerValidatorAbi","address","params","readSignerValidatorSigners","payload","readSignerValidatorHashSignerData","request","result","simulateSignerValidatorValidate","writeSignerValidatorValidate","addresses","allowed","simulateSignerValidatorSetAuthorized","writeSignerValidatorSetAuthorized","simulateSignerValidatorSetValidatorCaller","writeSignerValidatorSetValidatorCaller","prepareSignerValidatorClaimDataPayload","_payload","_options","options","bytecode","prepareSignerValidatorPayload","SignerValidatorBases","RegistryType","SignerValidator","signer","incentiveData","chainId","validator","incentiveQuantity","claimant","boostId","trustedSignature","validatorData","prepareSignerValidatorInputParams","encodeAbiParameters","signature","signers","validatorCaller"],"mappings":";;;;;kshBAoSaA,IAAN,MAAMA,UAAwBC,EAGnC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAWL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/B,MAAa,QAAQC,GAAkBC,GAAqB;AACnD,WAAA,MAAMC,EAA2B,KAAK,SAAS;AAAA,MACpD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACF,CAAO;AAAA;AAAA,MAEd,GAAIC;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,eACXE,GACAF,GACA;AACO,WAAA,MAAMG,EAAkC,KAAK,SAAS;AAAA,MAC3D,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM;AAAA,QACJD,EAAQ;AAAA,QACRA,EAAQ;AAAA,QACRA,EAAQ;AAAA,QACRA,EAAQ;AAAA,MACV;AAAA;AAAA,MAEA,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAgB,SACdE,GACAF,GACA;AACA,WAAO,MAAM,KAAK,YAAY,KAAK,YAAYE,GAASF,CAAM,CAAC;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAgB,YACdE,GACAF,GACA;AACA,UAAM,EAAE,SAAAI,GAAS,QAAAC,EAAO,IAAI,MAAMC;AAAAA,MAChC,KAAK;AAAA,MACL;AAAA,QACE,SAAS,KAAK,mBAAmB;AAAA,QACjC,MAAM;AAAA,UACJJ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M,aAAa,MAAM,UAAU;AAAA,MACrC,EAAE,MAAM,WAAW,MAAM,kBAAkB;AAAA,IAC7C;AAAA,IACA,CAACE,GAASC,CAAe;AAAA,EAAA;AAE7B;"}
|
|
1
|
+
{"version":3,"file":"SignerValidator.js","sources":["../../src/Validators/SignerValidator.ts"],"sourcesContent":["import {\n readSignerValidatorHashSignerData,\n readSignerValidatorSigners,\n signerValidatorAbi,\n simulateSignerValidatorSetAuthorized,\n simulateSignerValidatorSetValidatorCaller,\n simulateSignerValidatorValidate,\n writeSignerValidatorSetAuthorized,\n writeSignerValidatorSetValidatorCaller,\n writeSignerValidatorValidate,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/SignerValidator.sol/SignerValidator.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n type PrivateKeyAccount,\n encodeAbiParameters,\n} from 'viem';\nimport { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { signerValidatorAbi };\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 * 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 * 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 total number of incentives on the Boost\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 * 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 total number of incentives on the Boost\n *\n * @type {number}\n */\n incentiveQuantity: number;\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 * A generic `viem.Log` event with support for `BoostCore` event types.\n *\n * @export\n * @typedef {SignerValidatorLog}\n * @template {ContractEventName<\n * typeof signerValidatorAbi\n * >} [event=ContractEventName<typeof signerValidatorAbi>]\n */\nexport type SignerValidatorLog<\n event extends ContractEventName<\n typeof signerValidatorAbi\n > = ContractEventName<typeof signerValidatorAbi>,\n> = GenericLog<typeof signerValidatorAbi, event>;\n\n/**\n * A simple implementation of a Validator that verifies a given signature and checks the recovered address against a set of authorized signers\n *\n * @export\n * @class SignerValidator\n * @typedef {SignerValidator}\n * @extends {DeployableTarget<SignerValidatorPayload>}\n */\nexport class SignerValidator extends DeployableTarget<\n SignerValidatorPayload,\n typeof signerValidatorAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = signerValidatorAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_SIGNER_VALIDATOR_BASE,\n ...(SignerValidatorBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.VALIDATOR;\n\n /**\n * The set of authorized signers\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async signers(address: Address, params?: ReadParams) {\n return await readSignerValidatorSigners(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Retrieve the hash and signer data for a given hash\n *\n * @public\n * @async\n * @param {SignerValidatorSignaturePayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async hashSignerData(\n payload: SignerValidatorSignaturePayload,\n params?: ReadParams,\n ) {\n return await readSignerValidatorHashSignerData(this._config, {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveQuantity,\n payload.claimant,\n payload.incentiveData,\n ],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validate(\n payload: SignerValidatorValidatePayload,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.validateRaw(payload, params));\n }\n\n /**\n * Validate that the action has been completed successfully. The data payload is expected to be a tuple of (address signer, bytes32 hash, bytes signature). The signature is expected to be a valid ECDSA or EIP-1271 signature of a unique hash by an authorized signer.\n *\n * @public\n * @async\n * @param {SignerValidatorValidatePayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the action has been validated based on the data payload\n */\n protected async validateRaw(\n payload: SignerValidatorValidatePayload,\n params?: ReadParams,\n ) {\n const { request, result } = await simulateSignerValidatorValidate(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [\n payload.boostId,\n payload.incentiveId,\n payload.claimant,\n payload.claimData,\n ],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorValidate(this._config, request);\n return { hash, result };\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of a signer\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of signers to update\n * @param {boolean[]} allowed - The authorized status of each signer\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateSignerValidatorSetAuthorized(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async setValidatorCallerRaw(address: Address, params?: WriteParams) {\n const { request, result } = await simulateSignerValidatorSetValidatorCaller(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [address],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSignerValidatorSetValidatorCaller(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Update the authorized caller of the validator function\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setValidatorCaller(address: Address, params?: WriteParams) {\n return await this.awaitResult(this.setValidatorCallerRaw(address, params));\n }\n\n /**\n * Properly encodes the data needed to claim\n *\n * @public\n * @async\n * @param {SignerValidatorClaimDataParams} params\n * @returns {Promise<Hex>}\n */\n public async encodeClaimData(\n params: Omit<SignerValidatorClaimDataParams, 'validator'>,\n ): Promise<Hex> {\n return await prepareSignerValidatorClaimDataPayload({\n ...params,\n validator: this.assertValidAddress(),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SignerValidatorPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: SignerValidatorPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: signerValidatorAbi,\n bytecode: bytecode as Hex,\n args: [prepareSignerValidatorPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\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 trustedSignature = await signer.privateKey.signTypedData({\n domain: {\n name: 'SignerValidator',\n version: '1',\n chainId: chainId,\n verifyingContract: validator,\n },\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 // 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 * 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 function 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 * 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 function 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"],"names":["_SignerValidator","DeployableTarget","signerValidatorAbi","address","params","readSignerValidatorSigners","payload","readSignerValidatorHashSignerData","request","result","simulateSignerValidatorValidate","writeSignerValidatorValidate","addresses","allowed","simulateSignerValidatorSetAuthorized","writeSignerValidatorSetAuthorized","simulateSignerValidatorSetValidatorCaller","writeSignerValidatorSetValidatorCaller","prepareSignerValidatorClaimDataPayload","_payload","_options","options","bytecode","prepareSignerValidatorPayload","SignerValidatorBases","RegistryType","SignerValidator","signer","incentiveData","chainId","validator","incentiveQuantity","claimant","boostId","trustedSignature","validatorData","prepareSignerValidatorInputParams","encodeAbiParameters","signature","signers","validatorCaller"],"mappings":";;;;;kshBAmSaA,IAAN,MAAMA,UAAwBC,EAGnC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAWL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/B,MAAa,QAAQC,GAAkBC,GAAqB;AACnD,WAAA,MAAMC,EAA2B,KAAK,SAAS;AAAA,MACpD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACF,CAAO;AAAA;AAAA,MAEd,GAAIC;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,eACXE,GACAF,GACA;AACO,WAAA,MAAMG,EAAkC,KAAK,SAAS;AAAA,MAC3D,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM;AAAA,QACJD,EAAQ;AAAA,QACRA,EAAQ;AAAA,QACRA,EAAQ;AAAA,QACRA,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mBAAAP;AACF,GAA+B;AACtB,SAAAM;AAAA,IACL;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,UACV,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,UAClC,EAAE,MAAM,SAAS,MAAM,YAAY;AAAA,UACnC,EAAE,MAAM,SAAS,MAAM,oBAAoB;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,EAAE,QAAAV,GAAQ,WAAAW,GAAW,mBAAAP,GAAmB;AAAA,EAAA;AAE7C;AAUO,SAASR,EAA8B;AAAA,EAC5C,SAAAgB;AAAA,EACA,iBAAAC;AACF,GAA2B;AAClB,SAAAH;AAAA,IACL;AAAA,MACE,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,MACrC,EAAE,MAAM,WAAW,MAAM,kBAAkB;AAAA,IAC7C;AAAA,IACA,CAACE,GAASC,CAAe;AAAA,EAAA;AAE7B;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../generated-D3DE5TfH.cjs"),d=require("../componentInterfaces-BQw7DH-m.cjs"),c=require("@wagmi/core"),s=require("../errors.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../generated-D3DE5TfH.cjs"),d=require("../componentInterfaces-BQw7DH-m.cjs"),c=require("@wagmi/core"),s=require("viem"),l=require("../errors.cjs"),m=require("./LimitedSignerValidator.cjs"),n=require("./SignerValidator.cjs"),t={[d.ASignerValidator]:n.SignerValidator};async function u(e,r){const a=await c.readContract(e.config,{abi:i.ye,functionName:"getComponentInterface",address:r}),o=t[a];if(!o)throw new l.InvalidComponentInterfaceError(Object.keys(t),a);return new o(e,r)}const f={MAINNET:"",TESTNET:"0xd63167e9db11B108940b2E8236581F961f33f396"};function g(e){return s.decodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],e)[0]}exports.LimitedSignerValidator=m.LimitedSignerValidator;exports.SignerValidator=n.SignerValidator;exports.BoostValidatorEOA=f;exports.ValidatorByComponentInterface=t;exports.decodeClaimData=g;exports.validatorFromAddress=u;
|
|
2
2
|
//# sourceMappingURL=Validator.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.cjs","sources":["../../src/Validators/Validator.ts"],"sourcesContent":["import { aValidatorAbi } from '@boostxyz/evm';\nimport {\n ASignerValidator,\n // TODO: bring this back in\n // ALimitedSignerValidator,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type
|
|
1
|
+
{"version":3,"file":"Validator.cjs","sources":["../../src/Validators/Validator.ts"],"sourcesContent":["import { aValidatorAbi } from '@boostxyz/evm';\nimport {\n ASignerValidator,\n // TODO: bring this back in\n // ALimitedSignerValidator,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport { type Address, type Hex, decodeAbiParameters } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { LimitedSignerValidator } from './LimitedSignerValidator';\nimport { SignerValidator } from './SignerValidator';\n\nexport { SignerValidator, LimitedSignerValidator };\n\n/**\n * A union type representing all valid protocol Validator implementations\n *\n * @export\n * @typedef {Validator}\n */\nexport type Validator = SignerValidator | LimitedSignerValidator;\n\n/**\n * A map of Validator component interfaces to their constructors.\n *\n * @type {{ \"0xd8725ea2\": typeof SignerValidator; }}\n */\nexport const ValidatorByComponentInterface = {\n [ASignerValidator as Hex]: SignerValidator,\n // TODO bring this back in\n // [ALimitedSignerValidator as Hex]: LimitedSignerValidator,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Promise<Validator>}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function validatorFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aValidatorAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof ValidatorByComponentInterface;\n const Ctor = ValidatorByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(ValidatorByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n\n/**\n * An enum of verified Boost Validator EOA (Externally Owned Account) addresses used by the Boost protocol\n * for validating transactions on mainnet and testnet environments.\n *\n * @example\n * ```typescript\n * // Initialize a SignerValidator using the pre-configured EOA address of a verified Boost validator.\n * // If no validator is provided to core.createBoost(...), then this is what will be used by default.\n * const validator = core.SignerValidator({\n * signers: [BoostValidatorEOA.[TESTNET | MAINNET]],\n * validatorCaller: core.assertValidAddress()\n * })\n * ```\n * @enum {Address}\n */\nexport const BoostValidatorEOA = {\n MAINNET: import.meta.env.VITE_BOOST_MAINNET_SIGNER_EOA as Address,\n TESTNET: import.meta.env.VITE_BOOST_TESTNET_SIGNER_EOA as Address,\n};\n\n/**\n * Decodes a claim data hex string into its validator data and incentive data components.\n *\n * @export\n * @param {Hex} data - The hex-encoded claim data to decode\n * @returns {{ validatorData: Hex; incentiveData: Hex }} The decoded claim data components\n */\nexport function decodeClaimData(data: Hex) {\n return decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n data,\n )[0];\n}\n"],"names":["ValidatorByComponentInterface","ASignerValidator","SignerValidator","validatorFromAddress","options","address","interfaceId","readContract","aValidatorAbi","Ctor","InvalidComponentInterfaceError","BoostValidatorEOA","decodeClaimData","data","decodeAbiParameters"],"mappings":"iUA4BaA,EAAgC,CAC3C,CAACC,EAAuB,gBAAA,EAAGC,EAAA,eAG7B,EAYsB,eAAAC,EACpBC,EACAC,EACA,CACA,MAAMC,EAAe,MAAMC,eAAaH,EAAQ,OAAQ,CACtD,IAAKI,EAAA,GACL,aAAc,wBACd,QAAAH,CAAA,CACD,EACKI,EAAOT,EAA8BM,CAAW,EACtD,GAAI,CAACG,EACH,MAAM,IAAIC,EAAA,+BACR,OAAO,KAAKV,CAA6B,EACzCM,CAAA,EAGG,OAAA,IAAIG,EAAKL,EAASC,CAAO,CAClC,CAiBO,MAAMM,EAAoB,CAC/B,QAAS,GACT,QAAS,4CACX,EASO,SAASC,EAAgBC,EAAW,CAClC,OAAAC,EAAA,oBACL,CACE,CACE,KAAM,QACN,KAAM,iBACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,eAAgB,EACvC,CAAE,KAAM,QAAS,KAAM,eAAgB,CACzC,CACF,CACF,EACAD,GACA,CAAC,CACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, type Hex } from 'viem';
|
|
2
2
|
import type { DeployableOptions } from '../Deployable/Deployable';
|
|
3
3
|
import { LimitedSignerValidator } from './LimitedSignerValidator';
|
|
4
4
|
import { SignerValidator } from './SignerValidator';
|
|
@@ -48,4 +48,15 @@ export declare const BoostValidatorEOA: {
|
|
|
48
48
|
MAINNET: Address;
|
|
49
49
|
TESTNET: Address;
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Decodes a claim data hex string into its validator data and incentive data components.
|
|
53
|
+
*
|
|
54
|
+
* @export
|
|
55
|
+
* @param {Hex} data - The hex-encoded claim data to decode
|
|
56
|
+
* @returns {{ validatorData: Hex; incentiveData: Hex }} The decoded claim data components
|
|
57
|
+
*/
|
|
58
|
+
export declare function decodeClaimData(data: Hex): {
|
|
59
|
+
validatorData: `0x${string}`;
|
|
60
|
+
incentiveData: `0x${string}`;
|
|
61
|
+
};
|
|
51
62
|
//# sourceMappingURL=Validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../src/Validators/Validator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../src/Validators/Validator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAuB,MAAM,MAAM,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,sBAAsB,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,OAAO,4BAejB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;aAC8B,OAAO;aACP,OAAO;CAClE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG;;;EAcxC"}
|
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
import { p as
|
|
1
|
+
import { p as n } from "../generated-CDEDSOGZ.js";
|
|
2
2
|
import { h as i } from "../componentInterfaces-C0vuWQlh.js";
|
|
3
3
|
import { readContract as m } from "@wagmi/core";
|
|
4
|
+
import { decodeAbiParameters as c } from "viem";
|
|
4
5
|
import { InvalidComponentInterfaceError as f } from "../errors.js";
|
|
5
|
-
import { LimitedSignerValidator as
|
|
6
|
-
import { SignerValidator as
|
|
7
|
-
const
|
|
8
|
-
[i]:
|
|
6
|
+
import { LimitedSignerValidator as V } from "./LimitedSignerValidator.js";
|
|
7
|
+
import { SignerValidator as d } from "./SignerValidator.js";
|
|
8
|
+
const a = {
|
|
9
|
+
[i]: d
|
|
9
10
|
// TODO bring this back in
|
|
10
11
|
// [ALimitedSignerValidator as Hex]: LimitedSignerValidator,
|
|
11
12
|
};
|
|
12
|
-
async function
|
|
13
|
-
const
|
|
14
|
-
abi:
|
|
13
|
+
async function u(t, o) {
|
|
14
|
+
const e = await m(t.config, {
|
|
15
|
+
abi: n,
|
|
15
16
|
functionName: "getComponentInterface",
|
|
16
|
-
address:
|
|
17
|
-
}),
|
|
18
|
-
if (!
|
|
17
|
+
address: o
|
|
18
|
+
}), r = a[e];
|
|
19
|
+
if (!r)
|
|
19
20
|
throw new f(
|
|
20
|
-
Object.keys(
|
|
21
|
-
|
|
21
|
+
Object.keys(a),
|
|
22
|
+
e
|
|
22
23
|
);
|
|
23
|
-
return new
|
|
24
|
+
return new r(t, o);
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
+
const E = {
|
|
26
27
|
MAINNET: "",
|
|
27
28
|
TESTNET: "0xd63167e9db11B108940b2E8236581F961f33f396"
|
|
28
29
|
};
|
|
30
|
+
function I(t) {
|
|
31
|
+
return c(
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
type: "tuple",
|
|
35
|
+
name: "BoostClaimData",
|
|
36
|
+
components: [
|
|
37
|
+
{ type: "bytes", name: "validatorData" },
|
|
38
|
+
{ type: "bytes", name: "incentiveData" }
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
t
|
|
43
|
+
)[0];
|
|
44
|
+
}
|
|
29
45
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
I as
|
|
46
|
+
E as BoostValidatorEOA,
|
|
47
|
+
V as LimitedSignerValidator,
|
|
48
|
+
d as SignerValidator,
|
|
49
|
+
a as ValidatorByComponentInterface,
|
|
50
|
+
I as decodeClaimData,
|
|
51
|
+
u as validatorFromAddress
|
|
35
52
|
};
|
|
36
53
|
//# sourceMappingURL=Validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sources":["../../src/Validators/Validator.ts"],"sourcesContent":["import { aValidatorAbi } from '@boostxyz/evm';\nimport {\n ASignerValidator,\n // TODO: bring this back in\n // ALimitedSignerValidator,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type
|
|
1
|
+
{"version":3,"file":"Validator.js","sources":["../../src/Validators/Validator.ts"],"sourcesContent":["import { aValidatorAbi } from '@boostxyz/evm';\nimport {\n ASignerValidator,\n // TODO: bring this back in\n // ALimitedSignerValidator,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport { type Address, type Hex, decodeAbiParameters } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { LimitedSignerValidator } from './LimitedSignerValidator';\nimport { SignerValidator } from './SignerValidator';\n\nexport { SignerValidator, LimitedSignerValidator };\n\n/**\n * A union type representing all valid protocol Validator implementations\n *\n * @export\n * @typedef {Validator}\n */\nexport type Validator = SignerValidator | LimitedSignerValidator;\n\n/**\n * A map of Validator component interfaces to their constructors.\n *\n * @type {{ \"0xd8725ea2\": typeof SignerValidator; }}\n */\nexport const ValidatorByComponentInterface = {\n [ASignerValidator as Hex]: SignerValidator,\n // TODO bring this back in\n // [ALimitedSignerValidator as Hex]: LimitedSignerValidator,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Promise<Validator>}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function validatorFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aValidatorAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof ValidatorByComponentInterface;\n const Ctor = ValidatorByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(ValidatorByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n\n/**\n * An enum of verified Boost Validator EOA (Externally Owned Account) addresses used by the Boost protocol\n * for validating transactions on mainnet and testnet environments.\n *\n * @example\n * ```typescript\n * // Initialize a SignerValidator using the pre-configured EOA address of a verified Boost validator.\n * // If no validator is provided to core.createBoost(...), then this is what will be used by default.\n * const validator = core.SignerValidator({\n * signers: [BoostValidatorEOA.[TESTNET | MAINNET]],\n * validatorCaller: core.assertValidAddress()\n * })\n * ```\n * @enum {Address}\n */\nexport const BoostValidatorEOA = {\n MAINNET: import.meta.env.VITE_BOOST_MAINNET_SIGNER_EOA as Address,\n TESTNET: import.meta.env.VITE_BOOST_TESTNET_SIGNER_EOA as Address,\n};\n\n/**\n * Decodes a claim data hex string into its validator data and incentive data components.\n *\n * @export\n * @param {Hex} data - The hex-encoded claim data to decode\n * @returns {{ validatorData: Hex; incentiveData: Hex }} The decoded claim data components\n */\nexport function decodeClaimData(data: Hex) {\n return decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n data,\n )[0];\n}\n"],"names":["ValidatorByComponentInterface","ASignerValidator","SignerValidator","validatorFromAddress","options","address","interfaceId","readContract","aValidatorAbi","Ctor","InvalidComponentInterfaceError","BoostValidatorEOA","decodeClaimData","data","decodeAbiParameters"],"mappings":";;;;;;;AA4BO,MAAMA,IAAgC;AAAA,EAC3C,CAACC,CAAuB,GAAGC;AAAA;AAAA;AAG7B;AAYsB,eAAAC,EACpBC,GACAC,GACA;AACA,QAAMC,IAAe,MAAMC,EAAaH,EAAQ,QAAQ;AAAA,IACtD,KAAKI;AAAAA,IACL,cAAc;AAAA,IACd,SAAAH;AAAA,EAAA,CACD,GACKI,IAAOT,EAA8BM,CAAW;AACtD,MAAI,CAACG;AACH,UAAM,IAAIC;AAAA,MACR,OAAO,KAAKV,CAA6B;AAAA,MACzCM;AAAA,IAAA;AAGG,SAAA,IAAIG,EAAKL,GAASC,CAAO;AAClC;AAiBO,MAAMM,IAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,SAAS;AACX;AASO,SAASC,EAAgBC,GAAW;AAClC,SAAAC;AAAA,IACL;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,UACV,EAAE,MAAM,SAAS,MAAM,gBAAgB;AAAA,UACvC,EAAE,MAAM,SAAS,MAAM,gBAAgB;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAAA,IACAD;AAAA,IACA,CAAC;AACL;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./BoostRegistry.cjs"),n=require("./BoostCore.cjs"),A=require("./Boost.cjs"),C=require("./Actions/Action.cjs"),a=require("./Actions/EventAction.cjs"),c=require("./AllowLists/AllowList.cjs"),E=require("./AllowLists/SimpleAllowList.cjs"),g=require("./SimpleDenyList-wDvsNIuY.cjs"),u=require("./Budgets/Budget.cjs"),i=require("./Budgets/ManagedBudget.cjs"),B=require("./Deployable/Deployable.cjs"),T=require("./Deployable/Contract.cjs"),V=require("./Deployable/DeployableTarget.cjs"),I=require("./Deployable/DeployableTargetWithRBAC.cjs"),m=require("./Incentives/AllowListIncentive.cjs"),S=require("./Incentives/CGDAIncentive.cjs"),v=require("./Incentives/ERC20Incentive.cjs"),P=require("./Incentives/ERC20VariableIncentive.cjs"),y=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),b=require("./Incentives/Incentive.cjs"),R=require("./Incentives/PointsIncentive.cjs"),l=require("./Validators/SignerValidator.cjs"),d=require("./Validators/LimitedSignerValidator.cjs"),s=require("./Validators/Validator.cjs"),e=require("./errors.cjs"),o=require("./utils.cjs"),D=require("./claiming.cjs"),t=require("./transfers.cjs"),L=require("./Auth/PassthroughAuth.cjs"),r=require("./generated-D3DE5TfH.cjs");exports.BOOST_REGISTRY_ADDRESS=p.BOOST_REGISTRY_ADDRESS;exports.BOOST_REGISTRY_ADDRESSES=p.BOOST_REGISTRY_ADDRESSES;exports.BoostRegistry=p.BoostRegistry;exports.BOOST_CORE_ADDRESS=n.BOOST_CORE_ADDRESS;exports.BOOST_CORE_ADDRESSES=n.BOOST_CORE_ADDRESSES;exports.BoostCore=n.BoostCore;exports.FEE_DENOMINATOR=n.FEE_DENOMINATOR;exports.Boost=A.Boost;exports.prepareBoostPayload=A.prepareBoostPayload;exports.ActionByComponentInterface=C.ActionByComponentInterface;exports.actionFromAddress=C.actionFromAddress;exports.EventAction=a.EventAction;exports.FilterType=a.FilterType;exports.PrimitiveType=a.PrimitiveType;exports.SignatureType=a.SignatureType;exports.anyActionParameter=a.anyActionParameter;exports.isEventActionPayloadSimple=a.isEventActionPayloadSimple;exports.prepareEventActionPayload=a.prepareEventActionPayload;exports.transactionSenderClaimant=a.transactionSenderClaimant;exports.AllowListByComponentInterface=c.AllowListByComponentInterface;exports.OpenAllowList=c.OpenAllowList;exports.allowListFromAddress=c.allowListFromAddress;exports.LIST_MANAGER_ROLE=E.LIST_MANAGER_ROLE;exports.SimpleAllowList=E.SimpleAllowList;exports.prepareSimpleAllowListPayload=E.prepareSimpleAllowListPayload;exports.SimpleDenyList=g.SimpleDenyList;exports.prepareSimpleDenyListPayload=g.prepareSimpleDenyListPayload;exports.BudgetByComponentInterface=u.BudgetByComponentInterface;exports.budgetFromAddress=u.budgetFromAddress;exports.ManagedBudget=i.ManagedBudget;exports.ManagedBudgetRoles=i.ManagedBudgetRoles;exports.isERC1155TransferPayload=i.isERC1155TransferPayload;exports.isFungibleTransfer=i.isFungibleTransfer;exports.prepareManagedBudgetPayload=i.prepareManagedBudgetPayload;exports.prepareTransfer=i.prepareTransfer;exports.Deployable=B.Deployable;exports.Contract=T.Contract;exports.DeployableTarget=V.DeployableTarget;exports.DeployableTargetWithRBAC=I.DeployableTargetWithRBAC;exports.Roles=I.Roles;exports.AllowListIncentive=m.AllowListIncentive;exports.prepareAllowListIncentivePayload=m.prepareAllowListIncentivePayload;exports.CGDAIncentive=S.CGDAIncentive;exports.prepareCGDAIncentivePayload=S.prepareCGDAIncentivePayload;exports.ERC20Incentive=v.ERC20Incentive;exports.prepareERC20IncentivePayload=v.prepareERC20IncentivePayload;exports.ERC20VariableIncentive=P.ERC20VariableIncentive;exports.prepareERC20VariableIncentivePayload=P.prepareERC20VariableIncentivePayload;exports.ERC20VariableCriteriaIncentive=y.ERC20VariableCriteriaIncentive;exports.gasRebateIncentiveCriteria=y.gasRebateIncentiveCriteria;exports.prepareERC20VariableCriteriaIncentivePayload=y.prepareERC20VariableCriteriaIncentivePayload;exports.IncentiveByComponentInterface=b.IncentiveByComponentInterface;exports.incentiveFromAddress=b.incentiveFromAddress;exports.PointsIncentive=R.PointsIncentive;exports.preparePointsIncentivePayload=R.preparePointsIncentivePayload;exports.SignerValidator=l.SignerValidator;exports.prepareSignerValidatorClaimDataPayload=l.prepareSignerValidatorClaimDataPayload;exports.prepareSignerValidatorInputParams=l.prepareSignerValidatorInputParams;exports.prepareSignerValidatorPayload=l.prepareSignerValidatorPayload;exports.LimitedSignerValidator=d.LimitedSignerValidator;exports.prepareLimitedSignerValidatorClaimDataPayload=d.prepareLimitedSignerValidatorClaimDataPayload;exports.prepareLimitedSignerValidatorInputParams=d.prepareLimitedSignerValidatorInputParams;exports.prepareLimitedSignerValidatorPayload=d.prepareLimitedSignerValidatorPayload;exports.BoostValidatorEOA=s.BoostValidatorEOA;exports.ValidatorByComponentInterface=s.ValidatorByComponentInterface;exports.decodeClaimData=s.decodeClaimData;exports.validatorFromAddress=s.validatorFromAddress;exports.BoostCoreNoIdentifierEmitted=e.BoostCoreNoIdentifierEmitted;exports.BoostNotFoundError=e.BoostNotFoundError;exports.BudgetMustAuthorizeBoostCore=e.BudgetMustAuthorizeBoostCore;exports.ContractAddressRequiredError=e.ContractAddressRequiredError;exports.DecodedArgsError=e.DecodedArgsError;exports.DecodedArgsMalformedError=e.DecodedArgsMalformedError;exports.DeployableAlreadyDeployedError=e.DeployableAlreadyDeployedError;exports.DeployableBuildParametersUnspecifiedError=e.DeployableBuildParametersUnspecifiedError;exports.DeployableMissingPayloadError=e.DeployableMissingPayloadError;exports.DeployableUnknownOwnerProvidedError=e.DeployableUnknownOwnerProvidedError;exports.DeployableWagmiConfigurationRequiredError=e.DeployableWagmiConfigurationRequiredError;exports.FieldActionValidationError=e.FieldActionValidationError;exports.FieldValueNotComparableError=e.FieldValueNotComparableError;exports.FieldValueUndefinedError=e.FieldValueUndefinedError;exports.FunctionDataDecodeError=e.FunctionDataDecodeError;exports.IncentiveCriteriaNotFoundError=e.IncentiveCriteriaNotFoundError;exports.IncentiveNotCloneableError=e.IncentiveNotCloneableError;exports.InvalidComponentInterfaceError=e.InvalidComponentInterfaceError;exports.InvalidCriteriaTypeError=e.InvalidCriteriaTypeError;exports.InvalidNumericalCriteriaError=e.InvalidNumericalCriteriaError;exports.InvalidProtocolChainIdError=e.InvalidProtocolChainIdError;exports.MustInitializeBudgetError=e.MustInitializeBudgetError;exports.NoConnectedChainIdError=e.NoConnectedChainIdError;exports.NoContractAddressUponReceiptError=e.NoContractAddressUponReceiptError;exports.NoEventActionStepsProvidedError=e.NoEventActionStepsProvidedError;exports.NoMatchingLogsError=e.NoMatchingLogsError;exports.TooManyEventActionStepsProvidedError=e.TooManyEventActionStepsProvidedError;exports.UnknownTransferPayloadSupplied=e.UnknownTransferPayloadSupplied;exports.UnparseableAbiParamError=e.UnparseableAbiParamError;exports.UnrecognizedFilterTypeError=e.UnrecognizedFilterTypeError;exports.ValidationAbiMissingError=e.ValidationAbiMissingError;exports.CheatCodes=o.CheatCodes;exports.RegistryType=o.RegistryType;exports.assertValidAddressByChainId=o.assertValidAddressByChainId;exports.awaitResult=o.awaitResult;exports.bytes4=o.bytes4;exports.getDeployedContractAddress=o.getDeployedContractAddress;exports.getErc20Balance=o.getErc20Balance;exports.StrategyType=D.StrategyType;exports.prepareClaimPayload=D.prepareClaimPayload;exports.AssetType=t.AssetType;exports.prepareERC1155Payload=t.prepareERC1155Payload;exports.prepareERC1155Transfer=t.prepareERC1155Transfer;exports.prepareFungiblePayload=t.prepareFungiblePayload;exports.prepareFungibleTransfer=t.prepareFungibleTransfer;exports.prepareTransferPayload=t.prepareTransferPayload;exports.PassthroughAuth=L.PassthroughAuth;exports.allowListIncentiveAbi=r.C;exports.boostCoreAbi=r.A;exports.boostRegistryAbi=r.oe;exports.cgdaIncentiveAbi=r.f;exports.erc20IncentiveAbi=r.d;exports.erc20VariableCriteriaIncentiveAbi=r.c;exports.erc20VariableIncentiveAbi=r.v;exports.limitedSignerValidatorAbi=r.z;exports.managedBudgetAbi=r.m;exports.passthroughAuthAbi=r.Ve;exports.pointsIncentiveAbi=r.T;exports.rbacAbi=r.O;exports.signerValidatorAbi=r.S;exports.simpleAllowListAbi=r.g;exports.simpleDenyListAbi=r.M;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { BOOST_REGISTRY_ADDRESS as o, BOOST_REGISTRY_ADDRESSES as a, BoostRegist
|
|
|
2
2
|
import { BOOST_CORE_ADDRESS as n, BOOST_CORE_ADDRESSES as p, BoostCore as l, FEE_DENOMINATOR as d } from "./BoostCore.js";
|
|
3
3
|
import { Boost as m, prepareBoostPayload as c } from "./Boost.js";
|
|
4
4
|
import { ActionByComponentInterface as E, actionFromAddress as y } from "./Actions/Action.js";
|
|
5
|
-
import { EventAction as
|
|
6
|
-
import { AllowListByComponentInterface as
|
|
5
|
+
import { EventAction as f, FilterType as g, PrimitiveType as b, SignatureType as I, anyActionParameter as S, isEventActionPayloadSimple as v, prepareEventActionPayload as P, transactionSenderClaimant as u } from "./Actions/EventAction.js";
|
|
6
|
+
import { AllowListByComponentInterface as D, OpenAllowList as x, allowListFromAddress as B } from "./AllowLists/AllowList.js";
|
|
7
7
|
import { LIST_MANAGER_ROLE as V, SimpleAllowList as L, prepareSimpleAllowListPayload as F } from "./AllowLists/SimpleAllowList.js";
|
|
8
8
|
import { S as h, p as w } from "./SimpleDenyList-D-rGBaay.js";
|
|
9
9
|
import { BudgetByComponentInterface as N, budgetFromAddress as _ } from "./Budgets/Budget.js";
|
|
@@ -16,145 +16,147 @@ import { AllowListIncentive as oe, prepareAllowListIncentivePayload as ae } from
|
|
|
16
16
|
import { CGDAIncentive as ie, prepareCGDAIncentivePayload as ne } from "./Incentives/CGDAIncentive.js";
|
|
17
17
|
import { ERC20Incentive as le, prepareERC20IncentivePayload as de } from "./Incentives/ERC20Incentive.js";
|
|
18
18
|
import { ERC20VariableIncentive as me, prepareERC20VariableIncentivePayload as ce } from "./Incentives/ERC20VariableIncentive.js";
|
|
19
|
-
import { ERC20VariableCriteriaIncentive as Ee, gasRebateIncentiveCriteria as ye, prepareERC20VariableCriteriaIncentivePayload as
|
|
19
|
+
import { ERC20VariableCriteriaIncentive as Ee, gasRebateIncentiveCriteria as ye, prepareERC20VariableCriteriaIncentivePayload as Ce } from "./Incentives/ERC20VariableCriteriaIncentive.js";
|
|
20
20
|
import { IncentiveByComponentInterface as ge, incentiveFromAddress as be } from "./Incentives/Incentive.js";
|
|
21
21
|
import { PointsIncentive as Se, preparePointsIncentivePayload as ve } from "./Incentives/PointsIncentive.js";
|
|
22
|
-
import { SignerValidator as ue, prepareSignerValidatorClaimDataPayload as Re, prepareSignerValidatorInputParams as
|
|
22
|
+
import { SignerValidator as ue, prepareSignerValidatorClaimDataPayload as Re, prepareSignerValidatorInputParams as De, prepareSignerValidatorPayload as xe } from "./Validators/SignerValidator.js";
|
|
23
23
|
import { LimitedSignerValidator as Te, prepareLimitedSignerValidatorClaimDataPayload as Ve, prepareLimitedSignerValidatorInputParams as Le, prepareLimitedSignerValidatorPayload as Fe } from "./Validators/LimitedSignerValidator.js";
|
|
24
|
-
import { BoostValidatorEOA as he, ValidatorByComponentInterface as we,
|
|
25
|
-
import { BoostCoreNoIdentifierEmitted as
|
|
26
|
-
import { CheatCodes as fr, RegistryType as
|
|
27
|
-
import { StrategyType as
|
|
28
|
-
import { AssetType as
|
|
29
|
-
import { PassthroughAuth as
|
|
30
|
-
import { C as
|
|
24
|
+
import { BoostValidatorEOA as he, ValidatorByComponentInterface as we, decodeClaimData as Me, validatorFromAddress as Ne } from "./Validators/Validator.js";
|
|
25
|
+
import { BoostCoreNoIdentifierEmitted as Ue, BoostNotFoundError as Ge, BudgetMustAuthorizeBoostCore as ze, ContractAddressRequiredError as ke, DecodedArgsError as qe, DecodedArgsMalformedError as We, DeployableAlreadyDeployedError as Ye, DeployableBuildParametersUnspecifiedError as je, DeployableMissingPayloadError as He, DeployableUnknownOwnerProvidedError as Je, DeployableWagmiConfigurationRequiredError as Ke, FieldActionValidationError as Qe, FieldValueNotComparableError as Xe, FieldValueUndefinedError as Ze, FunctionDataDecodeError as $e, IncentiveCriteriaNotFoundError as er, IncentiveNotCloneableError as rr, InvalidComponentInterfaceError as or, InvalidCriteriaTypeError as ar, InvalidNumericalCriteriaError as tr, InvalidProtocolChainIdError as ir, MustInitializeBudgetError as nr, NoConnectedChainIdError as pr, NoContractAddressUponReceiptError as lr, NoEventActionStepsProvidedError as dr, NoMatchingLogsError as sr, TooManyEventActionStepsProvidedError as mr, UnknownTransferPayloadSupplied as cr, UnparseableAbiParamError as Ar, UnrecognizedFilterTypeError as Er, ValidationAbiMissingError as yr } from "./errors.js";
|
|
26
|
+
import { CheatCodes as fr, RegistryType as gr, assertValidAddressByChainId as br, awaitResult as Ir, bytes4 as Sr, getDeployedContractAddress as vr, getErc20Balance as Pr } from "./utils.js";
|
|
27
|
+
import { StrategyType as Rr, prepareClaimPayload as Dr } from "./claiming.js";
|
|
28
|
+
import { AssetType as Br, prepareERC1155Payload as Tr, prepareERC1155Transfer as Vr, prepareFungiblePayload as Lr, prepareFungibleTransfer as Fr, prepareTransferPayload as Or } from "./transfers.js";
|
|
29
|
+
import { PassthroughAuth as wr } from "./Auth/PassthroughAuth.js";
|
|
30
|
+
import { C as Nr, A as _r, o as Ur, f as Gr, d as zr, c as kr, v as qr, z as Wr, m as Yr, V as jr, T as Hr, O as Jr, S as Kr, g as Qr, M as Xr } from "./generated-CDEDSOGZ.js";
|
|
31
31
|
export {
|
|
32
32
|
E as ActionByComponentInterface,
|
|
33
|
-
|
|
33
|
+
D as AllowListByComponentInterface,
|
|
34
34
|
oe as AllowListIncentive,
|
|
35
|
-
|
|
35
|
+
Br as AssetType,
|
|
36
36
|
n as BOOST_CORE_ADDRESS,
|
|
37
37
|
p as BOOST_CORE_ADDRESSES,
|
|
38
38
|
o as BOOST_REGISTRY_ADDRESS,
|
|
39
39
|
a as BOOST_REGISTRY_ADDRESSES,
|
|
40
40
|
m as Boost,
|
|
41
41
|
l as BoostCore,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
Ue as BoostCoreNoIdentifierEmitted,
|
|
43
|
+
Ge as BoostNotFoundError,
|
|
44
44
|
t as BoostRegistry,
|
|
45
45
|
he as BoostValidatorEOA,
|
|
46
46
|
N as BudgetByComponentInterface,
|
|
47
|
-
|
|
47
|
+
ze as BudgetMustAuthorizeBoostCore,
|
|
48
48
|
ie as CGDAIncentive,
|
|
49
49
|
fr as CheatCodes,
|
|
50
50
|
K as Contract,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
ke as ContractAddressRequiredError,
|
|
52
|
+
qe as DecodedArgsError,
|
|
53
|
+
We as DecodedArgsMalformedError,
|
|
54
54
|
H as Deployable,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Ye as DeployableAlreadyDeployedError,
|
|
56
|
+
je as DeployableBuildParametersUnspecifiedError,
|
|
57
|
+
He as DeployableMissingPayloadError,
|
|
58
58
|
X as DeployableTarget,
|
|
59
59
|
$ as DeployableTargetWithRBAC,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
Je as DeployableUnknownOwnerProvidedError,
|
|
61
|
+
Ke as DeployableWagmiConfigurationRequiredError,
|
|
62
62
|
le as ERC20Incentive,
|
|
63
63
|
Ee as ERC20VariableCriteriaIncentive,
|
|
64
64
|
me as ERC20VariableIncentive,
|
|
65
|
-
|
|
65
|
+
f as EventAction,
|
|
66
66
|
d as FEE_DENOMINATOR,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
Qe as FieldActionValidationError,
|
|
68
|
+
Xe as FieldValueNotComparableError,
|
|
69
|
+
Ze as FieldValueUndefinedError,
|
|
70
70
|
g as FilterType,
|
|
71
|
-
|
|
71
|
+
$e as FunctionDataDecodeError,
|
|
72
72
|
ge as IncentiveByComponentInterface,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
er as IncentiveCriteriaNotFoundError,
|
|
74
|
+
rr as IncentiveNotCloneableError,
|
|
75
|
+
or as InvalidComponentInterfaceError,
|
|
76
|
+
ar as InvalidCriteriaTypeError,
|
|
77
|
+
tr as InvalidNumericalCriteriaError,
|
|
78
|
+
ir as InvalidProtocolChainIdError,
|
|
79
79
|
V as LIST_MANAGER_ROLE,
|
|
80
80
|
Te as LimitedSignerValidator,
|
|
81
81
|
G as ManagedBudget,
|
|
82
82
|
z as ManagedBudgetRoles,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
nr as MustInitializeBudgetError,
|
|
84
|
+
pr as NoConnectedChainIdError,
|
|
85
|
+
lr as NoContractAddressUponReceiptError,
|
|
86
|
+
dr as NoEventActionStepsProvidedError,
|
|
87
|
+
sr as NoMatchingLogsError,
|
|
88
|
+
x as OpenAllowList,
|
|
89
|
+
wr as PassthroughAuth,
|
|
90
90
|
Se as PointsIncentive,
|
|
91
91
|
b as PrimitiveType,
|
|
92
|
-
|
|
92
|
+
gr as RegistryType,
|
|
93
93
|
ee as Roles,
|
|
94
94
|
I as SignatureType,
|
|
95
95
|
ue as SignerValidator,
|
|
96
96
|
L as SimpleAllowList,
|
|
97
97
|
h as SimpleDenyList,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
Rr as StrategyType,
|
|
99
|
+
mr as TooManyEventActionStepsProvidedError,
|
|
100
|
+
cr as UnknownTransferPayloadSupplied,
|
|
101
|
+
Ar as UnparseableAbiParamError,
|
|
102
|
+
Er as UnrecognizedFilterTypeError,
|
|
103
|
+
yr as ValidationAbiMissingError,
|
|
104
104
|
we as ValidatorByComponentInterface,
|
|
105
105
|
y as actionFromAddress,
|
|
106
106
|
B as allowListFromAddress,
|
|
107
|
-
|
|
107
|
+
Nr as allowListIncentiveAbi,
|
|
108
108
|
S as anyActionParameter,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
br as assertValidAddressByChainId,
|
|
110
|
+
Ir as awaitResult,
|
|
111
|
+
_r as boostCoreAbi,
|
|
112
|
+
Ur as boostRegistryAbi,
|
|
113
113
|
_ as budgetFromAddress,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
Sr as bytes4,
|
|
115
|
+
Gr as cgdaIncentiveAbi,
|
|
116
|
+
Me as decodeClaimData,
|
|
117
|
+
zr as erc20IncentiveAbi,
|
|
118
|
+
kr as erc20VariableCriteriaIncentiveAbi,
|
|
119
|
+
qr as erc20VariableIncentiveAbi,
|
|
119
120
|
ye as gasRebateIncentiveCriteria,
|
|
120
|
-
|
|
121
|
+
vr as getDeployedContractAddress,
|
|
122
|
+
Pr as getErc20Balance,
|
|
121
123
|
be as incentiveFromAddress,
|
|
122
124
|
k as isERC1155TransferPayload,
|
|
123
125
|
v as isEventActionPayloadSimple,
|
|
124
126
|
q as isFungibleTransfer,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
Wr as limitedSignerValidatorAbi,
|
|
128
|
+
Yr as managedBudgetAbi,
|
|
129
|
+
jr as passthroughAuthAbi,
|
|
130
|
+
Hr as pointsIncentiveAbi,
|
|
129
131
|
ae as prepareAllowListIncentivePayload,
|
|
130
132
|
c as prepareBoostPayload,
|
|
131
133
|
ne as prepareCGDAIncentivePayload,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
Dr as prepareClaimPayload,
|
|
135
|
+
Tr as prepareERC1155Payload,
|
|
136
|
+
Vr as prepareERC1155Transfer,
|
|
135
137
|
de as prepareERC20IncentivePayload,
|
|
136
|
-
|
|
138
|
+
Ce as prepareERC20VariableCriteriaIncentivePayload,
|
|
137
139
|
ce as prepareERC20VariableIncentivePayload,
|
|
138
140
|
P as prepareEventActionPayload,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
Lr as prepareFungiblePayload,
|
|
142
|
+
Fr as prepareFungibleTransfer,
|
|
141
143
|
Ve as prepareLimitedSignerValidatorClaimDataPayload,
|
|
142
144
|
Le as prepareLimitedSignerValidatorInputParams,
|
|
143
145
|
Fe as prepareLimitedSignerValidatorPayload,
|
|
144
146
|
W as prepareManagedBudgetPayload,
|
|
145
147
|
ve as preparePointsIncentivePayload,
|
|
146
148
|
Re as prepareSignerValidatorClaimDataPayload,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
De as prepareSignerValidatorInputParams,
|
|
150
|
+
xe as prepareSignerValidatorPayload,
|
|
149
151
|
F as prepareSimpleAllowListPayload,
|
|
150
152
|
w as prepareSimpleDenyListPayload,
|
|
151
153
|
Y as prepareTransfer,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
Or as prepareTransferPayload,
|
|
155
|
+
Jr as rbacAbi,
|
|
156
|
+
Kr as signerValidatorAbi,
|
|
157
|
+
Qr as simpleAllowListAbi,
|
|
158
|
+
Xr as simpleDenyListAbi,
|
|
157
159
|
u as transactionSenderClaimant,
|
|
158
|
-
|
|
160
|
+
Ne as validatorFromAddress
|
|
159
161
|
};
|
|
160
162
|
//# sourceMappingURL=index.js.map
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@wagmi/core"),r=require("viem"),A=require("./errors.cjs");var u=(t=>(t[t.ACTION=0]="ACTION",t[t.ALLOW_LIST=1]="ALLOW_LIST",t[t.BUDGET=2]="BUDGET",t[t.INCENTIVE=3]="INCENTIVE",t[t.VALIDATOR=4]="VALIDATOR",t))(u||{}),s=(t=>(t[t.ANY_ACTION_PARAM=255]="ANY_ACTION_PARAM",t[t.TX_SENDER_CLAIMANT=255]="TX_SENDER_CLAIMANT",t[t.GAS_REBATE_INCENTIVE=255]="GAS_REBATE_INCENTIVE",t))(s||{});function E(t){return r.slice(r.isHex(t)?r.keccak256(t):r.keccak256(r.toHex(t)),0,4)}async function N(t,a,c){const n=await o.waitForTransactionReceipt(t,{...c,hash:await a});if(!n.contractAddress)throw new A.NoContractAddressUponReceiptError(n);return n.contractAddress}async function l(t,a,c){const{hash:n,result:e}=await a;return await o.waitForTransactionReceipt(t,{...c,hash:n}),e}function f(t,a,c){let n;const e=o.getChainId(t);if(e&&a[e]&&(n=e),c!==void 0?a[c]&&(n=c):e!==void 0&&a[e]&&(n=e),n===void 0){const i=o.getAccount(t);i.chainId!==void 0&&a[i.chainId]&&(n=i.chainId)}if(n===void 0&&(n=11155111),!a[n])throw new A.InvalidProtocolChainIdError(n,Object.keys(a).map(Number));return{chainId:n,address:a[n]}}async function I(t,a,c,n){return await o.readContract(t,{...n,functionName:"balanceOf",address:a,args:[c],abi:[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"}]})}exports.CheatCodes=s;exports.RegistryType=u;exports.assertValidAddressByChainId=f;exports.awaitResult=l;exports.bytes4=E;exports.getDeployedContractAddress=N;exports.getErc20Balance=I;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|