@boostxyz/sdk 0.0.0-alpha.10
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/LICENSE +674 -0
- package/README.md +7 -0
- package/dist/Actions/Action.cjs +2 -0
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +31 -0
- package/dist/Actions/Action.d.ts.map +1 -0
- package/dist/Actions/Action.js +29 -0
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/ContractAction.d.ts +370 -0
- package/dist/Actions/ContractAction.d.ts.map +1 -0
- package/dist/Actions/ERC721MintAction.d.ts +513 -0
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -0
- package/dist/Actions/EventAction.cjs +2 -0
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts +694 -0
- package/dist/Actions/EventAction.d.ts.map +1 -0
- package/dist/Actions/EventAction.js +491 -0
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -0
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +32 -0
- package/dist/AllowLists/AllowList.d.ts.map +1 -0
- package/dist/AllowLists/AllowList.js +30 -0
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +2 -0
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.d.ts +481 -0
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.js +154 -0
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +2 -0
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.d.ts +335 -0
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleDenyList.js +115 -0
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +2 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.d.ts +10 -0
- package/dist/Auth/Auth.d.ts.map +1 -0
- package/dist/Auth/Auth.js +5 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +2 -0
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.d.ts +51 -0
- package/dist/Auth/PassthroughAuth.d.ts.map +1 -0
- package/dist/Auth/PassthroughAuth.js +39 -0
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +2 -0
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.d.ts +234 -0
- package/dist/Boost.d.ts.map +1 -0
- package/dist/Boost.js +162 -0
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore.cjs +3 -0
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.d.ts +498 -0
- package/dist/BoostCore.d.ts.map +1 -0
- package/dist/BoostCore.js +1153 -0
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +2 -0
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.d.ts +243 -0
- package/dist/BoostRegistry.d.ts.map +1 -0
- package/dist/BoostRegistry.js +262 -0
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -0
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +31 -0
- package/dist/Budgets/Budget.d.ts.map +1 -0
- package/dist/Budgets/Budget.js +29 -0
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +2 -0
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.d.ts +1103 -0
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -0
- package/dist/Budgets/ManagedBudget.js +516 -0
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Budgets/SimpleBudget.d.ts +824 -0
- package/dist/Budgets/SimpleBudget.d.ts.map +1 -0
- package/dist/Budgets/VestingBudget.d.ts +778 -0
- package/dist/Budgets/VestingBudget.d.ts.map +1 -0
- package/dist/Deployable/Contract.cjs +2 -0
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.d.ts +125 -0
- package/dist/Deployable/Contract.d.ts.map +1 -0
- package/dist/Deployable/Contract.js +150 -0
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +2 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.d.ts +161 -0
- package/dist/Deployable/Deployable.d.ts.map +1 -0
- package/dist/Deployable/Deployable.js +131 -0
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +2 -0
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.d.ts +116 -0
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -0
- package/dist/Deployable/DeployableTarget.js +132 -0
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +2 -0
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.d.ts +513 -0
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -0
- package/dist/Incentives/AllowListIncentive.js +201 -0
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +2 -0
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.d.ts +644 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -0
- package/dist/Incentives/CGDAIncentive.js +271 -0
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC1155Incentive.d.ts +713 -0
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20Incentive.cjs +2 -0
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.d.ts +666 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20Incentive.js +312 -0
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +582 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -0
- package/dist/Incentives/Incentive.cjs +2 -0
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +36 -0
- package/dist/Incentives/Incentive.d.ts.map +1 -0
- package/dist/Incentives/Incentive.js +299 -0
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +2 -0
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.d.ts +659 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -0
- package/dist/Incentives/PointsIncentive.js +215 -0
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +2 -0
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.d.ts +745 -0
- package/dist/Validators/SignerValidator.d.ts.map +1 -0
- package/dist/Validators/SignerValidator.js +293 -0
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -0
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +31 -0
- package/dist/Validators/Validator.d.ts.map +1 -0
- package/dist/Validators/Validator.js +27 -0
- package/dist/Validators/Validator.js.map +1 -0
- 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/componentInterfaces-CKCBwG16.cjs +2 -0
- package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
- package/dist/componentInterfaces-DYkaxBda.js +13 -0
- package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +441 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +262 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated-BDeDiaCK.js +4625 -0
- package/dist/generated-BDeDiaCK.js.map +1 -0
- package/dist/generated-wKBNvm48.cjs +3 -0
- package/dist/generated-wKBNvm48.cjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- 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 +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +116 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +30 -0
- package/dist/utils.js.map +1 -0
- package/package.json +211 -0
- package/src/Actions/Action.test.ts +75 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +197 -0
- package/src/Actions/ContractAction.ts +301 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +292 -0
- package/src/Actions/EventAction.test.ts +205 -0
- package/src/Actions/EventAction.ts +811 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +60 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +284 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +227 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +290 -0
- package/src/BoostCore.test.ts +773 -0
- package/src/BoostCore.ts +1261 -0
- package/src/BoostRegistry.ts +467 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +61 -0
- package/src/Budgets/ManagedBudget.test.ts +154 -0
- package/src/Budgets/ManagedBudget.ts +796 -0
- package/src/Budgets/SimpleBudget.test.ts +152 -0
- package/src/Budgets/SimpleBudget.ts +564 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +602 -0
- package/src/Deployable/Contract.ts +229 -0
- package/src/Deployable/Deployable.ts +250 -0
- package/src/Deployable/DeployableTarget.ts +223 -0
- package/src/Incentives/AllowListIncentive.test.ts +143 -0
- package/src/Incentives/AllowListIncentive.ts +334 -0
- package/src/Incentives/CGDAIncentive.test.ts +132 -0
- package/src/Incentives/CGDAIncentive.ts +468 -0
- package/src/Incentives/ERC1155Incentive.test.ts +87 -0
- package/src/Incentives/ERC1155Incentive.ts +466 -0
- package/src/Incentives/ERC20Incentive.test.ts +130 -0
- package/src/Incentives/ERC20Incentive.ts +482 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
- package/src/Incentives/ERC20VariableIncentive.ts +420 -0
- package/src/Incentives/Incentive.test.ts +92 -0
- package/src/Incentives/Incentive.ts +85 -0
- package/src/Incentives/PointsIncentive.test.ts +139 -0
- package/src/Incentives/PointsIncentive.ts +365 -0
- package/src/Validators/SignerValidator.test.ts +159 -0
- package/src/Validators/SignerValidator.ts +681 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/claiming.ts +56 -0
- package/src/errors.ts +542 -0
- package/src/index.test.ts +40 -0
- package/src/index.ts +53 -0
- package/src/transfers.ts +284 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +198 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contractActionAbi,
|
|
3
|
+
readContractActionChainId,
|
|
4
|
+
readContractActionPrepare,
|
|
5
|
+
readContractActionSelector,
|
|
6
|
+
readContractActionTarget,
|
|
7
|
+
readContractActionValue,
|
|
8
|
+
simulateContractActionExecute,
|
|
9
|
+
writeContractActionExecute,
|
|
10
|
+
} from '@boostxyz/evm';
|
|
11
|
+
import { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/ContractAction.sol/ContractAction.json';
|
|
12
|
+
import {
|
|
13
|
+
type Abi,
|
|
14
|
+
type Address,
|
|
15
|
+
type ContractEventName,
|
|
16
|
+
type Hex,
|
|
17
|
+
encodeAbiParameters,
|
|
18
|
+
parseAbiParameters,
|
|
19
|
+
} from 'viem';
|
|
20
|
+
import type {
|
|
21
|
+
DeployableOptions,
|
|
22
|
+
GenericDeployableParams,
|
|
23
|
+
} from '../Deployable/Deployable';
|
|
24
|
+
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
25
|
+
import {
|
|
26
|
+
type GenericLog,
|
|
27
|
+
type ReadParams,
|
|
28
|
+
RegistryType,
|
|
29
|
+
type WriteParams,
|
|
30
|
+
} from '../utils';
|
|
31
|
+
|
|
32
|
+
export { contractActionAbi };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The object representation of a `ContractAction.InitPayload`
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @interface ContractActionPayload
|
|
39
|
+
* @typedef {ContractActionPayload}
|
|
40
|
+
*/
|
|
41
|
+
export interface ContractActionPayload {
|
|
42
|
+
/**
|
|
43
|
+
* The chain ID on which the target exists
|
|
44
|
+
*
|
|
45
|
+
* @type {bigint}
|
|
46
|
+
*/
|
|
47
|
+
chainId: bigint;
|
|
48
|
+
/**
|
|
49
|
+
* The target contract address
|
|
50
|
+
*
|
|
51
|
+
* @type {Address}
|
|
52
|
+
*/
|
|
53
|
+
target: Address;
|
|
54
|
+
/**
|
|
55
|
+
* The selector for the function to be called
|
|
56
|
+
*
|
|
57
|
+
* @type {Hex}
|
|
58
|
+
*/
|
|
59
|
+
selector: Hex;
|
|
60
|
+
/**
|
|
61
|
+
* The native token value to send with the function call
|
|
62
|
+
*
|
|
63
|
+
* @type {bigint}
|
|
64
|
+
*/
|
|
65
|
+
value: bigint;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A generic `viem.Log` event with support for `ContractAction` event types.
|
|
70
|
+
*
|
|
71
|
+
* @export
|
|
72
|
+
* @typedef {ContractActionLog}
|
|
73
|
+
* @template {ContractEventName<typeof contractActionAbi>} [event=ContractEventName<
|
|
74
|
+
* typeof contractActionAbi
|
|
75
|
+
* >]
|
|
76
|
+
*/
|
|
77
|
+
export type ContractActionLog<
|
|
78
|
+
event extends ContractEventName<typeof contractActionAbi> = ContractEventName<
|
|
79
|
+
typeof contractActionAbi
|
|
80
|
+
>,
|
|
81
|
+
> = GenericLog<typeof contractActionAbi, event>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A generic contract action
|
|
85
|
+
*
|
|
86
|
+
* @export
|
|
87
|
+
* @class ContractAction
|
|
88
|
+
* @typedef {ContractAction}
|
|
89
|
+
* @extends {DeployableTarget<ContractActionPayload>}
|
|
90
|
+
*/
|
|
91
|
+
export class ContractAction<
|
|
92
|
+
ContractActionAbi extends Abi = typeof contractActionAbi,
|
|
93
|
+
> extends DeployableTarget<ContractActionPayload, ContractActionAbi> {
|
|
94
|
+
//@ts-expect-error should never be constructed with variant typ
|
|
95
|
+
public override readonly abi = contractActionAbi;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @inheritdoc
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
* @static
|
|
102
|
+
* @type {Address}
|
|
103
|
+
*/
|
|
104
|
+
public static override base: Address = import.meta.env
|
|
105
|
+
.VITE_CONTRACT_ACTION_BASE;
|
|
106
|
+
/**
|
|
107
|
+
* @inheritdoc
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
* @static
|
|
111
|
+
* @type {RegistryType}
|
|
112
|
+
*/
|
|
113
|
+
public static override registryType: RegistryType = RegistryType.ACTION;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The target chain ID
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
* @async
|
|
120
|
+
* @param {?ReadParams<typeof contractActionAbi, 'chainId'>} [params]
|
|
121
|
+
* @returns {Promise<bigint>}
|
|
122
|
+
*/
|
|
123
|
+
public async chainId(
|
|
124
|
+
params?: ReadParams<typeof contractActionAbi, 'chainId'>,
|
|
125
|
+
) {
|
|
126
|
+
return await readContractActionChainId(this._config, {
|
|
127
|
+
address: this.assertValidAddress(),
|
|
128
|
+
...this.optionallyAttachAccount(),
|
|
129
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
130
|
+
...(params as any),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The target contract
|
|
136
|
+
*
|
|
137
|
+
* @public
|
|
138
|
+
* @async
|
|
139
|
+
* @param {?ReadParams<typeof contractActionAbi, 'target'>} [params]
|
|
140
|
+
* @returns {Promise<`0x${string}`>}
|
|
141
|
+
*/
|
|
142
|
+
public async target(params?: ReadParams<typeof contractActionAbi, 'target'>) {
|
|
143
|
+
return await readContractActionTarget(this._config, {
|
|
144
|
+
address: this.assertValidAddress(),
|
|
145
|
+
...this.optionallyAttachAccount(),
|
|
146
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
147
|
+
...(params as any),
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The selector for the function to be called
|
|
153
|
+
*
|
|
154
|
+
* @example `function mint(address to, uint256 amount)`
|
|
155
|
+
* @public
|
|
156
|
+
* @async
|
|
157
|
+
* @param {?ReadParams<typeof contractActionAbi, 'selector'>} [params]
|
|
158
|
+
* @returns {Promise<`0x${string}`>}
|
|
159
|
+
*/
|
|
160
|
+
public async selector(
|
|
161
|
+
params?: ReadParams<typeof contractActionAbi, 'selector'>,
|
|
162
|
+
) {
|
|
163
|
+
return await readContractActionSelector(this._config, {
|
|
164
|
+
address: this.assertValidAddress(),
|
|
165
|
+
...this.optionallyAttachAccount(),
|
|
166
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
167
|
+
...(params as any),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The native token value to send with the function call
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
* @async
|
|
176
|
+
* @param {?ReadParams<typeof contractActionAbi, 'value'>} [params]
|
|
177
|
+
* @returns {Promise<bigint>}
|
|
178
|
+
*/
|
|
179
|
+
public async value(params?: ReadParams<typeof contractActionAbi, 'value'>) {
|
|
180
|
+
return await readContractActionValue(this._config, {
|
|
181
|
+
address: this.assertValidAddress(),
|
|
182
|
+
...this.optionallyAttachAccount(),
|
|
183
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
184
|
+
...(params as any),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Executes a prepared contract action
|
|
190
|
+
*
|
|
191
|
+
* @public
|
|
192
|
+
* @async
|
|
193
|
+
* @param {Hex} data
|
|
194
|
+
* @param {?WriteParams<typeof contractActionAbi, 'execute'>} [params]
|
|
195
|
+
* @returns {Promise<readonly [boolean, `0x${string}`]>}
|
|
196
|
+
*/
|
|
197
|
+
public async execute(
|
|
198
|
+
data: Hex,
|
|
199
|
+
params?: WriteParams<typeof contractActionAbi, 'execute'>,
|
|
200
|
+
) {
|
|
201
|
+
return await this.awaitResult(this.executeRaw(data, params));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Executes a prepared contract action
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
* @async
|
|
209
|
+
* @param {Hex} data
|
|
210
|
+
* @param {?WriteParams<typeof contractActionAbi, 'execute'>} [params]
|
|
211
|
+
* @returns {unknown}
|
|
212
|
+
*/
|
|
213
|
+
public async executeRaw(
|
|
214
|
+
data: Hex,
|
|
215
|
+
params?: WriteParams<typeof contractActionAbi, 'execute'>,
|
|
216
|
+
) {
|
|
217
|
+
const { request, result } = await simulateContractActionExecute(
|
|
218
|
+
this._config,
|
|
219
|
+
{
|
|
220
|
+
address: this.assertValidAddress(),
|
|
221
|
+
...this.optionallyAttachAccount(),
|
|
222
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
223
|
+
...(params as any),
|
|
224
|
+
args: [data],
|
|
225
|
+
},
|
|
226
|
+
);
|
|
227
|
+
const hash = await writeContractActionExecute(this._config, request);
|
|
228
|
+
return { hash, result };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The encoded execution payload
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
* @async
|
|
236
|
+
* @param {Hex} calldata
|
|
237
|
+
* @param {?ReadParams<typeof contractActionAbi, 'prepare'>} [params]
|
|
238
|
+
* @returns {unknown}
|
|
239
|
+
*/
|
|
240
|
+
public async prepare(
|
|
241
|
+
calldata: Hex,
|
|
242
|
+
params?: ReadParams<typeof contractActionAbi, 'prepare'>,
|
|
243
|
+
) {
|
|
244
|
+
return await readContractActionPrepare(this._config, {
|
|
245
|
+
address: this.assertValidAddress(),
|
|
246
|
+
args: [calldata],
|
|
247
|
+
...this.optionallyAttachAccount(),
|
|
248
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
249
|
+
...(params as any),
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @inheritdoc
|
|
255
|
+
*
|
|
256
|
+
* @public
|
|
257
|
+
* @param {?ContractActionPayload} [_payload]
|
|
258
|
+
* @param {?DeployableOptions} [_options]
|
|
259
|
+
* @returns {GenericDeployableParams}
|
|
260
|
+
*/
|
|
261
|
+
public override buildParameters(
|
|
262
|
+
_payload?: ContractActionPayload,
|
|
263
|
+
_options?: DeployableOptions,
|
|
264
|
+
): GenericDeployableParams {
|
|
265
|
+
const [payload, options] = this.validateDeploymentConfig(
|
|
266
|
+
_payload,
|
|
267
|
+
_options,
|
|
268
|
+
);
|
|
269
|
+
return {
|
|
270
|
+
abi: contractActionAbi,
|
|
271
|
+
bytecode: bytecode as Hex,
|
|
272
|
+
args: [prepareContractActionPayload(payload)],
|
|
273
|
+
...this.optionallyAttachAccount(options.account),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Given a {@link ContractActionPayload}, properly encode a `ContractAction.InitPayload` for use with {@link ContractAction} initialization.
|
|
280
|
+
*
|
|
281
|
+
* @param {ContractActionPayload} param0
|
|
282
|
+
* @param {bigint} param0.chainId - The chain ID on which the target exists
|
|
283
|
+
* @param {Address} param0.target - The target contract address
|
|
284
|
+
* @param {Hex} param0.selector - The selector for the function to be called
|
|
285
|
+
* @param {bigint} param0.value - The native token value to send with the function call
|
|
286
|
+
* @returns {Hex}
|
|
287
|
+
*/
|
|
288
|
+
export function prepareContractActionPayload({
|
|
289
|
+
chainId,
|
|
290
|
+
target,
|
|
291
|
+
selector,
|
|
292
|
+
value,
|
|
293
|
+
}: ContractActionPayload) {
|
|
294
|
+
return encodeAbiParameters(
|
|
295
|
+
parseAbiParameters([
|
|
296
|
+
'ContractActionPayload payload',
|
|
297
|
+
'struct ContractActionPayload { uint256 chainId; address target; bytes4 selector; uint256 value; }',
|
|
298
|
+
]),
|
|
299
|
+
[{ chainId, target, selector, value }],
|
|
300
|
+
);
|
|
301
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { mockErc721Abi } from '@boostxyz/evm';
|
|
2
|
+
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
3
|
+
import {
|
|
4
|
+
encodeAbiParameters,
|
|
5
|
+
encodeFunctionData,
|
|
6
|
+
isAddress,
|
|
7
|
+
parseEther,
|
|
8
|
+
toFunctionSelector,
|
|
9
|
+
zeroAddress,
|
|
10
|
+
} from 'viem';
|
|
11
|
+
import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
12
|
+
import type { MockERC721 } from '../../test/MockERC721';
|
|
13
|
+
import { accounts } from '../../test/accounts';
|
|
14
|
+
import {
|
|
15
|
+
type Fixtures,
|
|
16
|
+
defaultOptions,
|
|
17
|
+
deployFixtures,
|
|
18
|
+
fundErc721,
|
|
19
|
+
} from '../../test/helpers';
|
|
20
|
+
import { ERC721MintAction } from './ERC721MintAction';
|
|
21
|
+
|
|
22
|
+
let fixtures: Fixtures, erc721: MockERC721;
|
|
23
|
+
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
fixtures = await loadFixture(deployFixtures);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const mintSelector = toFunctionSelector('function mint(address to)');
|
|
29
|
+
|
|
30
|
+
function nonPayableAction(fixtures: Fixtures, erc721: MockERC721) {
|
|
31
|
+
return function nonPayableAction() {
|
|
32
|
+
return fixtures.registry.clone(
|
|
33
|
+
crypto.randomUUID(),
|
|
34
|
+
fixtures.core.ERC721MintAction({
|
|
35
|
+
chainId: BigInt(31_337),
|
|
36
|
+
target: erc721.assertValidAddress(),
|
|
37
|
+
selector: mintSelector,
|
|
38
|
+
value: 0n,
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe.skip('ERC721MintAction', () => {
|
|
45
|
+
beforeEach(async () => {
|
|
46
|
+
erc721 = await loadFixture(fundErc721(defaultOptions));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('can successfully be deployed', async () => {
|
|
50
|
+
const action = new ERC721MintAction(defaultOptions, {
|
|
51
|
+
chainId: BigInt(31_337),
|
|
52
|
+
target: zeroAddress,
|
|
53
|
+
selector: '0xdeadbeef',
|
|
54
|
+
value: 2n,
|
|
55
|
+
});
|
|
56
|
+
await action.deploy();
|
|
57
|
+
expect(isAddress(action.assertValidAddress())).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('can read chain id', async () => {
|
|
61
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
62
|
+
expect(await action.chainId()).toBe(BigInt(31_337));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('can read target', async () => {
|
|
66
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
67
|
+
expect((await action.target()).toLowerCase()).toBe(
|
|
68
|
+
erc721.assertValidAddress().toLowerCase(),
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('can read selector', async () => {
|
|
73
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
74
|
+
expect(await action.selector()).toBe(mintSelector);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('can read value', async () => {
|
|
78
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
79
|
+
expect(await action.value()).toBe(0n);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('prepare will properly encode execution payload', async () => {
|
|
83
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
84
|
+
const { account } = accounts[1];
|
|
85
|
+
const payload = await action.prepare(
|
|
86
|
+
encodeAbiParameters([{ type: 'address', name: 'address' }], [account]),
|
|
87
|
+
);
|
|
88
|
+
expect(payload).toBe(
|
|
89
|
+
encodeFunctionData({
|
|
90
|
+
abi: mockErc721Abi,
|
|
91
|
+
functionName: 'mint',
|
|
92
|
+
args: [account],
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// TODO implement execute
|
|
98
|
+
test.skip('nonpayable execute', async () => {
|
|
99
|
+
const action = await loadFixture(nonPayableAction(fixtures, erc721));
|
|
100
|
+
const { account } = accounts[1];
|
|
101
|
+
const [success] = await action.execute(
|
|
102
|
+
encodeAbiParameters(
|
|
103
|
+
[
|
|
104
|
+
{ type: 'address', name: 'to' },
|
|
105
|
+
{ type: 'uint256', name: 'amount' },
|
|
106
|
+
],
|
|
107
|
+
[account, parseEther('100')],
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
expect(success).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import {
|
|
2
|
+
erc721MintActionAbi,
|
|
3
|
+
readErc721MintActionPrepare,
|
|
4
|
+
readErc721MintActionValidated,
|
|
5
|
+
simulateErc721MintActionExecute,
|
|
6
|
+
simulateErc721MintActionValidate,
|
|
7
|
+
writeErc721MintActionExecute,
|
|
8
|
+
writeErc721MintActionValidate,
|
|
9
|
+
} from '@boostxyz/evm';
|
|
10
|
+
import { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/ERC721MintAction.sol/ERC721MintAction.json';
|
|
11
|
+
import {
|
|
12
|
+
type Address,
|
|
13
|
+
type ContractEventName,
|
|
14
|
+
type Hex,
|
|
15
|
+
encodeAbiParameters,
|
|
16
|
+
toHex,
|
|
17
|
+
} from 'viem';
|
|
18
|
+
import type {
|
|
19
|
+
DeployableOptions,
|
|
20
|
+
GenericDeployableParams,
|
|
21
|
+
} from '../Deployable/Deployable';
|
|
22
|
+
import {
|
|
23
|
+
type GenericLog,
|
|
24
|
+
type ReadParams,
|
|
25
|
+
RegistryType,
|
|
26
|
+
type WriteParams,
|
|
27
|
+
} from '../utils';
|
|
28
|
+
import {
|
|
29
|
+
ContractAction,
|
|
30
|
+
type ContractActionPayload,
|
|
31
|
+
prepareContractActionPayload,
|
|
32
|
+
} from './ContractAction';
|
|
33
|
+
|
|
34
|
+
export { erc721MintActionAbi };
|
|
35
|
+
/**
|
|
36
|
+
* `ERC721MintActionPayload` is a re-exported `ContractActionPayload`
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
* @typedef {ERC721MintActionPayload}
|
|
40
|
+
*/
|
|
41
|
+
export type ERC721MintActionPayload = ContractActionPayload;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A generic `viem.Log` event with support for `ERC721MintAction` event types.
|
|
45
|
+
*
|
|
46
|
+
* @export
|
|
47
|
+
* @typedef {ERC721MintActionLog}
|
|
48
|
+
* @template {ContractEventName<
|
|
49
|
+
* typeof erc721MintActionAbi
|
|
50
|
+
* >} [event=ContractEventName<typeof erc721MintActionAbi>]
|
|
51
|
+
*/
|
|
52
|
+
export type ERC721MintActionLog<
|
|
53
|
+
event extends ContractEventName<
|
|
54
|
+
typeof erc721MintActionAbi
|
|
55
|
+
> = ContractEventName<typeof erc721MintActionAbi>,
|
|
56
|
+
> = GenericLog<typeof erc721MintActionAbi, event>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A primitive action to mint and/or validate that an ERC721 token has been minted
|
|
60
|
+
* The action is expected to be prepared with the data payload for the minting of the token
|
|
61
|
+
* This a minimal generic implementation that should be extended if additional functionality or customizations are required
|
|
62
|
+
* It is expected that the target contract has an externally accessible mint function whose selector
|
|
63
|
+
*
|
|
64
|
+
* @export
|
|
65
|
+
* @class ERC721MintAction
|
|
66
|
+
* @typedef {ERC721MintAction}
|
|
67
|
+
* @extends {ContractAction}
|
|
68
|
+
*/
|
|
69
|
+
export class ERC721MintAction extends ContractAction<
|
|
70
|
+
typeof erc721MintActionAbi
|
|
71
|
+
> {
|
|
72
|
+
//@ts-expect-error should never be constructed with variant typ
|
|
73
|
+
public override readonly abi = erc721MintActionAbi;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @inheritdoc
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @static
|
|
80
|
+
* @type {Address}
|
|
81
|
+
*/
|
|
82
|
+
public static override base: Address = import.meta.env
|
|
83
|
+
.VITE_ERC721_MINT_ACTION_BASE;
|
|
84
|
+
/**
|
|
85
|
+
* @inheritdoc
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @static
|
|
89
|
+
* @type {RegistryType}
|
|
90
|
+
*/
|
|
91
|
+
public static override registryType: RegistryType = RegistryType.ACTION;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The set of validated tokens
|
|
95
|
+
* This is intended to prevent multiple validations against the same token ID
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
* @async
|
|
99
|
+
* @param {bigint} token
|
|
100
|
+
* @param {?ReadParams<typeof erc721MintActionAbi, 'validated'>} [params]
|
|
101
|
+
* @returns {unknown}
|
|
102
|
+
*/
|
|
103
|
+
public async validated(
|
|
104
|
+
token: bigint,
|
|
105
|
+
params?: ReadParams<typeof erc721MintActionAbi, 'validated'>,
|
|
106
|
+
) {
|
|
107
|
+
return await readErc721MintActionValidated(this._config, {
|
|
108
|
+
address: this.assertValidAddress(),
|
|
109
|
+
...this.optionallyAttachAccount(),
|
|
110
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
111
|
+
...(params as any),
|
|
112
|
+
args: [token],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @inheritdoc
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
* @async
|
|
121
|
+
* @param {Hex} data
|
|
122
|
+
* @param {?WriteParams<typeof erc721MintActionAbi, 'execute'>} [params]
|
|
123
|
+
* @returns {unknown}
|
|
124
|
+
*/
|
|
125
|
+
public override async execute(
|
|
126
|
+
data: Hex,
|
|
127
|
+
params?: WriteParams<typeof erc721MintActionAbi, 'execute'>,
|
|
128
|
+
) {
|
|
129
|
+
return await this.awaitResult(this.executeRaw(data, params));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @inheritdoc
|
|
134
|
+
*
|
|
135
|
+
* @public
|
|
136
|
+
* @async
|
|
137
|
+
* @param {Hex} data
|
|
138
|
+
* @param {?WriteParams<typeof erc721MintActionAbi, 'execute'>} [params]
|
|
139
|
+
* @returns {unknown}
|
|
140
|
+
*/
|
|
141
|
+
public override async executeRaw(
|
|
142
|
+
data: Hex,
|
|
143
|
+
params?: WriteParams<typeof erc721MintActionAbi, 'execute'>,
|
|
144
|
+
) {
|
|
145
|
+
const { request, result } = await simulateErc721MintActionExecute(
|
|
146
|
+
this._config,
|
|
147
|
+
{
|
|
148
|
+
address: this.assertValidAddress(),
|
|
149
|
+
args: [data],
|
|
150
|
+
...this.optionallyAttachAccount(),
|
|
151
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
152
|
+
...(params as any),
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
const hash = await writeErc721MintActionExecute(this._config, request);
|
|
156
|
+
return { hash, result };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @inheritdoc
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
* @async
|
|
164
|
+
* @param {Hex} data
|
|
165
|
+
* @param {?ReadParams<typeof erc721MintActionAbi, 'prepare'>} [params]
|
|
166
|
+
* @returns {unknown}
|
|
167
|
+
*/
|
|
168
|
+
public override async prepare(
|
|
169
|
+
data: Hex,
|
|
170
|
+
params?: ReadParams<typeof erc721MintActionAbi, 'prepare'>,
|
|
171
|
+
) {
|
|
172
|
+
return await readErc721MintActionPrepare(this._config, {
|
|
173
|
+
address: this.assertValidAddress(),
|
|
174
|
+
args: [data],
|
|
175
|
+
...this.optionallyAttachAccount(),
|
|
176
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
177
|
+
...(params as any),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Validate that the action has been completed successfully. This API is protected to prevent accidental signature burning.
|
|
183
|
+
*
|
|
184
|
+
* @protected
|
|
185
|
+
* @async
|
|
186
|
+
* @param {Address} holder - The holder
|
|
187
|
+
* @param {BigInt} tokenId - The token ID
|
|
188
|
+
* @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
|
|
189
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
|
|
190
|
+
*/
|
|
191
|
+
protected async validate(
|
|
192
|
+
holder: Address,
|
|
193
|
+
tokenId: bigint,
|
|
194
|
+
params?: WriteParams<typeof erc721MintActionAbi, 'validate'>,
|
|
195
|
+
) {
|
|
196
|
+
return await this.awaitResult(this.validateRaw(holder, tokenId, params));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Validate that the action has been completed successfully
|
|
201
|
+
*
|
|
202
|
+
* @protected
|
|
203
|
+
* @async
|
|
204
|
+
* @param {Address} holder - The holder
|
|
205
|
+
* @param {BigInt} tokenId - The token ID
|
|
206
|
+
* @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
|
|
207
|
+
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
|
|
208
|
+
*/
|
|
209
|
+
protected async validateRaw(
|
|
210
|
+
holder: Address,
|
|
211
|
+
tokenId: bigint,
|
|
212
|
+
params?: WriteParams<typeof erc721MintActionAbi, 'validate'>,
|
|
213
|
+
) {
|
|
214
|
+
const { request, result } = await simulateErc721MintActionValidate(
|
|
215
|
+
this._config,
|
|
216
|
+
{
|
|
217
|
+
address: this.assertValidAddress(),
|
|
218
|
+
args: [prepareERC721MintActionValidate(holder, tokenId)],
|
|
219
|
+
...this.optionallyAttachAccount(),
|
|
220
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
221
|
+
...(params as any),
|
|
222
|
+
},
|
|
223
|
+
);
|
|
224
|
+
const hash = await writeErc721MintActionValidate(this._config, request);
|
|
225
|
+
return { hash, result };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @inheritdoc
|
|
230
|
+
*
|
|
231
|
+
* @public
|
|
232
|
+
* @param {?ERC721MintActionPayload} [_payload]
|
|
233
|
+
* @param {?DeployableOptions} [_options]
|
|
234
|
+
* @returns {GenericDeployableParams}
|
|
235
|
+
*/
|
|
236
|
+
public override buildParameters(
|
|
237
|
+
_payload?: ERC721MintActionPayload,
|
|
238
|
+
_options?: DeployableOptions,
|
|
239
|
+
): GenericDeployableParams {
|
|
240
|
+
const [payload, options] = this.validateDeploymentConfig(
|
|
241
|
+
_payload,
|
|
242
|
+
_options,
|
|
243
|
+
);
|
|
244
|
+
return {
|
|
245
|
+
abi: erc721MintActionAbi,
|
|
246
|
+
bytecode: bytecode as Hex,
|
|
247
|
+
args: [prepareERC721MintActionPayload(payload)],
|
|
248
|
+
...this.optionallyAttachAccount(options.account),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
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
|
+
}
|