@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.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +1 -1
- package/dist/Actions/ContractAction.d.ts +46 -3
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +37 -10
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +257 -11
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +249 -82
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.d.ts +2 -2
- package/dist/AllowLists/AllowList.js +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +33 -4
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +52 -37
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +41 -129
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.cjs.map +1 -1
- package/dist/Auth/PassthroughAuth.js +4 -4
- package/dist/Auth/PassthroughAuth.js.map +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +93 -1
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +151 -5
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +45 -7
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +352 -305
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +18 -4
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +36 -25
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +40 -2
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +53 -36
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/SimpleBudget.d.ts +33 -2
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +54 -2
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.js +1 -1
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +8 -2
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +6 -0
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +4 -3
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +31 -28
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +35 -5
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +33 -21
- 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 +89 -5
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +44 -23
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +49 -5
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +46 -27
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.js +48 -32
- package/dist/Incentives/Incentive.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 +49 -5
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -21
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +298 -5
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +151 -26
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +1 -1
- package/dist/claiming.cjs +2 -0
- package/dist/claiming.cjs.map +1 -0
- package/dist/claiming.d.ts +43 -0
- package/dist/claiming.d.ts.map +1 -0
- package/dist/claiming.js +17 -0
- package/dist/claiming.js.map +1 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +15 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +30 -21
- package/dist/errors.js.map +1 -1
- package/dist/{generated-DGpIVcv5.js → generated-57_Kffpz.js} +293 -282
- package/dist/generated-57_Kffpz.js.map +1 -0
- package/dist/{generated-Cd-Fe7W7.cjs → generated-wKBNvm48.cjs} +3 -3
- package/dist/generated-wKBNvm48.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -124
- package/dist/transfers.cjs +2 -0
- package/dist/transfers.cjs.map +1 -0
- package/dist/transfers.d.ts +198 -0
- package/dist/transfers.d.ts.map +1 -0
- package/dist/transfers.js +84 -0
- package/dist/transfers.js.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +2 -1371
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +26 -653
- package/dist/utils.js.map +1 -1
- package/package.json +17 -3
- package/src/Actions/Action.test.ts +5 -4
- package/src/Actions/ContractAction.test.ts +4 -6
- package/src/Actions/ContractAction.ts +73 -10
- package/src/Actions/ERC721MintAction.test.ts +2 -2
- package/src/Actions/ERC721MintAction.ts +70 -16
- package/src/Actions/EventAction.test.ts +43 -17
- package/src/Actions/EventAction.ts +451 -26
- package/src/AllowLists/SimpleAllowList.ts +51 -7
- package/src/AllowLists/SimpleDenyList.ts +47 -109
- package/src/Auth/PassthroughAuth.ts +1 -1
- package/src/Boost.ts +136 -1
- package/src/BoostCore.test.ts +4 -11
- package/src/BoostCore.ts +114 -45
- package/src/BoostRegistry.ts +39 -21
- package/src/Budgets/ManagedBudget.ts +69 -16
- package/src/Budgets/SimpleBudget.ts +57 -14
- package/src/Budgets/VestingBudget.ts +79 -9
- package/src/Deployable/Contract.ts +1 -1
- package/src/Deployable/Deployable.ts +8 -2
- package/src/Deployable/DeployableTarget.ts +19 -6
- package/src/Incentives/AllowListIncentive.test.ts +2 -5
- package/src/Incentives/AllowListIncentive.ts +59 -15
- package/src/Incentives/CGDAIncentive.test.ts +3 -7
- package/src/Incentives/CGDAIncentive.ts +123 -19
- package/src/Incentives/ERC1155Incentive.test.ts +2 -13
- package/src/Incentives/ERC1155Incentive.ts +104 -22
- package/src/Incentives/ERC20Incentive.test.ts +6 -17
- package/src/Incentives/ERC20Incentive.ts +86 -21
- package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
- package/src/Incentives/ERC20VariableIncentive.ts +71 -19
- package/src/Incentives/Incentive.test.ts +1 -1
- package/src/Incentives/PointsIncentive.test.ts +3 -6
- package/src/Incentives/PointsIncentive.ts +79 -17
- package/src/Validators/SignerValidator.test.ts +3 -7
- package/src/Validators/SignerValidator.ts +422 -13
- package/src/claiming.ts +56 -0
- package/src/errors.ts +19 -1
- package/src/index.ts +10 -7
- package/src/transfers.ts +284 -0
- package/src/utils.ts +3 -2052
- package/dist/generated-Cd-Fe7W7.cjs.map +0 -1
- package/dist/generated-DGpIVcv5.js.map +0 -1
|
@@ -8,24 +8,37 @@ import {
|
|
|
8
8
|
writeErc721MintActionValidate,
|
|
9
9
|
} from '@boostxyz/evm';
|
|
10
10
|
import { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/ERC721MintAction.sol/ERC721MintAction.json';
|
|
11
|
-
import
|
|
11
|
+
import {
|
|
12
|
+
type Address,
|
|
13
|
+
type ContractEventName,
|
|
14
|
+
type Hex,
|
|
15
|
+
encodeAbiParameters,
|
|
16
|
+
toHex,
|
|
17
|
+
} from 'viem';
|
|
12
18
|
import type {
|
|
13
19
|
DeployableOptions,
|
|
14
20
|
GenericDeployableParams,
|
|
15
21
|
} from '../Deployable/Deployable';
|
|
16
22
|
import {
|
|
17
|
-
type ERC721MintActionPayload,
|
|
18
23
|
type GenericLog,
|
|
19
24
|
type ReadParams,
|
|
20
25
|
RegistryType,
|
|
21
26
|
type WriteParams,
|
|
22
|
-
prepareERC721MintActionPayload,
|
|
23
|
-
prepareERC721MintActionValidate,
|
|
24
27
|
} from '../utils';
|
|
25
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
ContractAction,
|
|
30
|
+
type ContractActionPayload,
|
|
31
|
+
prepareContractActionPayload,
|
|
32
|
+
} from './ContractAction';
|
|
26
33
|
|
|
27
|
-
export { erc721MintActionAbi
|
|
28
|
-
|
|
34
|
+
export { erc721MintActionAbi };
|
|
35
|
+
/**
|
|
36
|
+
* `ERC721MintActionPayload` is a re-exported `ContractActionPayload`
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @typedef {ERC721MintActionPayload}
|
|
40
|
+
*/
|
|
41
|
+
export type ERC721MintActionPayload = ContractActionPayload;
|
|
29
42
|
|
|
30
43
|
/**
|
|
31
44
|
* A generic `viem.Log` event with support for `ERC721MintAction` event types.
|
|
@@ -91,7 +104,7 @@ export class ERC721MintAction extends ContractAction<
|
|
|
91
104
|
token: bigint,
|
|
92
105
|
params?: ReadParams<typeof erc721MintActionAbi, 'validated'>,
|
|
93
106
|
) {
|
|
94
|
-
return readErc721MintActionValidated(this._config, {
|
|
107
|
+
return await readErc721MintActionValidated(this._config, {
|
|
95
108
|
address: this.assertValidAddress(),
|
|
96
109
|
...this.optionallyAttachAccount(),
|
|
97
110
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -113,7 +126,7 @@ export class ERC721MintAction extends ContractAction<
|
|
|
113
126
|
data: Hex,
|
|
114
127
|
params?: WriteParams<typeof erc721MintActionAbi, 'execute'>,
|
|
115
128
|
) {
|
|
116
|
-
return this.awaitResult(this.executeRaw(data, params));
|
|
129
|
+
return await this.awaitResult(this.executeRaw(data, params));
|
|
117
130
|
}
|
|
118
131
|
|
|
119
132
|
/**
|
|
@@ -156,7 +169,7 @@ export class ERC721MintAction extends ContractAction<
|
|
|
156
169
|
data: Hex,
|
|
157
170
|
params?: ReadParams<typeof erc721MintActionAbi, 'prepare'>,
|
|
158
171
|
) {
|
|
159
|
-
return readErc721MintActionPrepare(this._config, {
|
|
172
|
+
return await readErc721MintActionPrepare(this._config, {
|
|
160
173
|
address: this.assertValidAddress(),
|
|
161
174
|
args: [data],
|
|
162
175
|
...this.optionallyAttachAccount(),
|
|
@@ -166,34 +179,34 @@ export class ERC721MintAction extends ContractAction<
|
|
|
166
179
|
}
|
|
167
180
|
|
|
168
181
|
/**
|
|
169
|
-
* Validate that the action has been completed successfully
|
|
182
|
+
* Validate that the action has been completed successfully. This API is protected to prevent accidental signature burning.
|
|
170
183
|
*
|
|
171
|
-
* @
|
|
184
|
+
* @protected
|
|
172
185
|
* @async
|
|
173
186
|
* @param {Address} holder - The holder
|
|
174
187
|
* @param {BigInt} tokenId - The token ID
|
|
175
188
|
* @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
|
|
176
189
|
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
|
|
177
190
|
*/
|
|
178
|
-
|
|
191
|
+
protected async validate(
|
|
179
192
|
holder: Address,
|
|
180
193
|
tokenId: bigint,
|
|
181
194
|
params?: WriteParams<typeof erc721MintActionAbi, 'validate'>,
|
|
182
195
|
) {
|
|
183
|
-
return this.awaitResult(this.validateRaw(holder, tokenId, params));
|
|
196
|
+
return await this.awaitResult(this.validateRaw(holder, tokenId, params));
|
|
184
197
|
}
|
|
185
198
|
|
|
186
199
|
/**
|
|
187
200
|
* Validate that the action has been completed successfully
|
|
188
201
|
*
|
|
189
|
-
* @
|
|
202
|
+
* @protected
|
|
190
203
|
* @async
|
|
191
204
|
* @param {Address} holder - The holder
|
|
192
205
|
* @param {BigInt} tokenId - The token ID
|
|
193
206
|
* @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
|
|
194
207
|
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
|
|
195
208
|
*/
|
|
196
|
-
|
|
209
|
+
protected async validateRaw(
|
|
197
210
|
holder: Address,
|
|
198
211
|
tokenId: bigint,
|
|
199
212
|
params?: WriteParams<typeof erc721MintActionAbi, 'validate'>,
|
|
@@ -236,3 +249,44 @@ export class ERC721MintAction extends ContractAction<
|
|
|
236
249
|
};
|
|
237
250
|
}
|
|
238
251
|
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Encodes a payload to validate that an action has been completed successfully.
|
|
255
|
+
*
|
|
256
|
+
*
|
|
257
|
+
* @export
|
|
258
|
+
* @param {Address} holder - The holder address
|
|
259
|
+
* @param {bigint} payload - The token ID
|
|
260
|
+
* @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)
|
|
261
|
+
*/
|
|
262
|
+
export function prepareERC721MintActionValidate(
|
|
263
|
+
holder: Address,
|
|
264
|
+
payload: bigint,
|
|
265
|
+
) {
|
|
266
|
+
return encodeAbiParameters(
|
|
267
|
+
[
|
|
268
|
+
{ type: 'address', name: 'holder' },
|
|
269
|
+
{ type: 'bytes', name: 'payload' },
|
|
270
|
+
],
|
|
271
|
+
[holder, toHex(payload)],
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Given a {@link ContractActionPayload}, properly encode a `ContractAction.InitPayload` for use with {@link ERC721MintAction} initialization.
|
|
277
|
+
*
|
|
278
|
+
* @param {ContractActionPayload} param0
|
|
279
|
+
* @param {bigint} param0.chainId - The chain ID on which the target exists
|
|
280
|
+
* @param {Address} param0.target - The target contract address
|
|
281
|
+
* @param {Hex} param0.selector - The selector for the function to be called
|
|
282
|
+
* @param {bigint} param0.value - The native token value to send with the function call
|
|
283
|
+
* @returns {*}
|
|
284
|
+
*/
|
|
285
|
+
export function prepareERC721MintActionPayload({
|
|
286
|
+
chainId,
|
|
287
|
+
target,
|
|
288
|
+
selector,
|
|
289
|
+
value,
|
|
290
|
+
}: ContractActionPayload) {
|
|
291
|
+
return prepareContractActionPayload({ chainId, target, selector, value });
|
|
292
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readAActionGetComponentInterface,
|
|
3
|
-
readEventActionGetComponentInterface,
|
|
4
|
-
} from '@boostxyz/evm';
|
|
5
|
-
import { selectors } from '@boostxyz/signatures/events';
|
|
1
|
+
import { selectors as eventSelectors } from '@boostxyz/signatures/events';
|
|
6
2
|
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
7
3
|
import { type Hex, type Log, isAddress } from 'viem';
|
|
8
4
|
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
@@ -15,12 +11,12 @@ import {
|
|
|
15
11
|
fundErc721,
|
|
16
12
|
} from '../../test/helpers';
|
|
17
13
|
import {
|
|
14
|
+
EventAction,
|
|
18
15
|
type EventActionPayloadSimple,
|
|
19
16
|
FilterType,
|
|
20
17
|
PrimitiveType,
|
|
21
18
|
SignatureType,
|
|
22
|
-
} from '
|
|
23
|
-
import { EventAction } from './EventAction';
|
|
19
|
+
} from './EventAction';
|
|
24
20
|
|
|
25
21
|
let fixtures: Fixtures, erc721: MockERC721;
|
|
26
22
|
|
|
@@ -34,26 +30,56 @@ function basicErc721TransferAction(
|
|
|
34
30
|
return {
|
|
35
31
|
actionClaimant: {
|
|
36
32
|
signatureType: SignatureType.EVENT,
|
|
37
|
-
signature:
|
|
33
|
+
signature: eventSelectors['Transfer(address,address,uint256)'] as Hex,
|
|
38
34
|
fieldIndex: 2,
|
|
39
35
|
targetContract: erc721.assertValidAddress(),
|
|
36
|
+
chainid: defaultOptions.config.chains[0].id,
|
|
40
37
|
},
|
|
41
38
|
actionSteps: [
|
|
42
39
|
{
|
|
43
|
-
signature:
|
|
40
|
+
signature: eventSelectors['Transfer(address,address,uint256)'] as Hex,
|
|
44
41
|
signatureType: SignatureType.EVENT,
|
|
42
|
+
targetContract: erc721.assertValidAddress(),
|
|
43
|
+
chainid: defaultOptions.config.chains[0].id,
|
|
44
|
+
actionParameter: {
|
|
45
|
+
filterType: FilterType.EQUAL,
|
|
46
|
+
fieldType: PrimitiveType.ADDRESS,
|
|
47
|
+
fieldIndex: 2,
|
|
48
|
+
filterData: accounts[1].account,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
function basicErc721MintFuncAction(
|
|
57
|
+
erc721: MockERC721,
|
|
58
|
+
): EventActionPayloadSimple {
|
|
59
|
+
return {
|
|
60
|
+
actionClaimant: {
|
|
61
|
+
signatureType: SignatureType.FUNC,
|
|
62
|
+
signature: funcSelectors['mint(address)'] as Hex,
|
|
63
|
+
fieldIndex: 0,
|
|
64
|
+
targetContract: erc721.assertValidAddress(),
|
|
65
|
+
},
|
|
66
|
+
actionSteps: [
|
|
67
|
+
{
|
|
68
|
+
signature: funcSelectors['mint(address)'] as Hex,
|
|
69
|
+
signatureType: SignatureType.FUNC,
|
|
45
70
|
actionType: 0,
|
|
46
71
|
targetContract: erc721.assertValidAddress(),
|
|
47
72
|
actionParameter: {
|
|
48
73
|
filterType: FilterType.EQUAL,
|
|
49
74
|
fieldType: PrimitiveType.ADDRESS,
|
|
50
75
|
fieldIndex: 2,
|
|
51
|
-
filterData: accounts.
|
|
76
|
+
filterData: accounts[1].account,
|
|
52
77
|
},
|
|
53
78
|
},
|
|
54
79
|
],
|
|
55
80
|
};
|
|
56
81
|
}
|
|
82
|
+
*/
|
|
57
83
|
|
|
58
84
|
function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
|
|
59
85
|
return function cloneEventAction() {
|
|
@@ -89,7 +115,7 @@ describe('EventAction', () => {
|
|
|
89
115
|
step.actionParameter.filterData =
|
|
90
116
|
step.actionParameter.filterData.toUpperCase() as Hex;
|
|
91
117
|
expect(step).toMatchObject({
|
|
92
|
-
signature:
|
|
118
|
+
signature: eventSelectors['Transfer(address,address,uint256)'] as Hex,
|
|
93
119
|
signatureType: SignatureType.EVENT,
|
|
94
120
|
actionType: 0,
|
|
95
121
|
targetContract: erc721.assertValidAddress().toUpperCase(),
|
|
@@ -97,7 +123,7 @@ describe('EventAction', () => {
|
|
|
97
123
|
filterType: FilterType.EQUAL,
|
|
98
124
|
fieldType: PrimitiveType.ADDRESS,
|
|
99
125
|
fieldIndex: 2,
|
|
100
|
-
filterData: accounts.
|
|
126
|
+
filterData: accounts[1].account.toUpperCase(),
|
|
101
127
|
},
|
|
102
128
|
});
|
|
103
129
|
});
|
|
@@ -106,12 +132,12 @@ describe('EventAction', () => {
|
|
|
106
132
|
const action = await loadFixture(cloneEventAction(fixtures, erc721));
|
|
107
133
|
const steps = await action.getActionSteps();
|
|
108
134
|
expect(steps.length).toBe(1);
|
|
109
|
-
const step = steps
|
|
135
|
+
const step = steps[0]!;
|
|
110
136
|
step.targetContract = step.targetContract.toUpperCase() as Hex;
|
|
111
137
|
step.actionParameter.filterData =
|
|
112
138
|
step.actionParameter.filterData.toUpperCase() as Hex;
|
|
113
139
|
expect(step).toMatchObject({
|
|
114
|
-
signature:
|
|
140
|
+
signature: eventSelectors['Transfer(address,address,uint256)'] as Hex,
|
|
115
141
|
signatureType: SignatureType.EVENT,
|
|
116
142
|
actionType: 0,
|
|
117
143
|
targetContract: erc721.assertValidAddress().toUpperCase(),
|
|
@@ -119,7 +145,7 @@ describe('EventAction', () => {
|
|
|
119
145
|
filterType: FilterType.EQUAL,
|
|
120
146
|
fieldType: PrimitiveType.ADDRESS,
|
|
121
147
|
fieldIndex: 2,
|
|
122
|
-
filterData: accounts.
|
|
148
|
+
filterData: accounts[1].account.toUpperCase(),
|
|
123
149
|
},
|
|
124
150
|
});
|
|
125
151
|
});
|
|
@@ -136,7 +162,7 @@ describe('EventAction', () => {
|
|
|
136
162
|
claimant.targetContract = claimant.targetContract.toUpperCase() as Hex;
|
|
137
163
|
expect(claimant).toMatchObject({
|
|
138
164
|
signatureType: SignatureType.EVENT,
|
|
139
|
-
signature:
|
|
165
|
+
signature: eventSelectors['Transfer(address,address,uint256)'] as Hex,
|
|
140
166
|
fieldIndex: 2,
|
|
141
167
|
targetContract: erc721.assertValidAddress().toUpperCase(),
|
|
142
168
|
});
|
|
@@ -149,7 +175,7 @@ describe('EventAction', () => {
|
|
|
149
175
|
|
|
150
176
|
test('with a correct log, validates', async () => {
|
|
151
177
|
const action = await loadFixture(cloneEventAction(fixtures, erc721));
|
|
152
|
-
const recipient = accounts.
|
|
178
|
+
const recipient = accounts[1].account;
|
|
153
179
|
await erc721.approve(recipient, 1n);
|
|
154
180
|
await erc721.transferFrom(defaultOptions.account.address, recipient, 1n);
|
|
155
181
|
expect(await action.validateActionSteps()).toBe(true);
|