44 createModularAccountV2Client ,
55 ModularAccountV2Client ,
66} from "@account-kit/smart-contracts" ;
7- import { createPublicClient , decodeEventLog , http , zeroAddress } from "viem" ;
7+ import { createPublicClient , decodeEventLog , http } from "viem" ;
88import { AcpContractConfig , baseAcpConfigV2 } from "../configs/acpConfigs" ;
99import AcpError from "../acpError" ;
1010import BaseAcpContractClient , {
@@ -20,14 +20,11 @@ import {
2020 X402PaymentResponse ,
2121} from "../interfaces" ;
2222import { AcpX402 } from "../acpX402" ;
23- import SINGLE_SIGNER_VALIDATION_MODULE_ABI from "../abis/singleSignerValidationModuleAbi" ;
2423
2524class AcpContractClientV2 extends BaseAcpContractClient {
2625 private PRIORITY_FEE_MULTIPLIER = 2 ;
2726 private MAX_FEE_PER_GAS = 20000000 ;
2827 private MAX_PRIORITY_FEE_PER_GAS = 21000000 ;
29- private readonly SINGLE_SIGNER_VALIDATION_MODULE_ADDRESS : Address =
30- "0x00000000000099DE0BF6fA90dEB851E2A2df7d83" as Address ;
3128
3229 private _sessionKeyClient : ModularAccountV2Client | undefined ;
3330 private _acpX402 : AcpX402 | undefined ;
@@ -135,47 +132,6 @@ class AcpContractClientV2 extends BaseAcpContractClient {
135132 } ) ;
136133 }
137134
138- private async validateSessionKeyOnChain (
139- sessionSignerAddress : Address ,
140- sessionEntityKeyId : number
141- ) : Promise < void > {
142- const onChainSignerAddress = ( await this . publicClient . readContract ( {
143- address : this . SINGLE_SIGNER_VALIDATION_MODULE_ADDRESS ,
144- abi : SINGLE_SIGNER_VALIDATION_MODULE_ABI ,
145- functionName : "signers" ,
146- args : [ sessionEntityKeyId , this . agentWalletAddress ] ,
147- } ) ) as Address ;
148-
149- if ( ! onChainSignerAddress || onChainSignerAddress . toLowerCase ( ) === zeroAddress . toLowerCase ( ) ) {
150- throw new AcpError (
151- `ACP Contract Client validation failed:\n${ JSON . stringify (
152- {
153- reason : "no whitelisted wallet registered on-chain for entity id" ,
154- entityId : sessionEntityKeyId ,
155- agentWalletAddress : this . agentWalletAddress ,
156- } ,
157- null ,
158- 2
159- ) } `
160- ) ;
161- }
162-
163- if ( onChainSignerAddress . toLowerCase ( ) !== sessionSignerAddress . toLowerCase ( ) ) {
164- throw new AcpError (
165- `ACP Contract Client validation failed:\n${ JSON . stringify (
166- {
167- agentWalletAddress : this . agentWalletAddress ,
168- entityId : sessionEntityKeyId ,
169- givenSessionSignerAddress : sessionSignerAddress ,
170- expectedSignerAddress : onChainSignerAddress ,
171- } ,
172- null ,
173- 2
174- ) } `
175- ) ;
176- }
177- }
178-
179135 getRandomNonce ( bits = 152 ) {
180136 const bytes = bits / 8 ;
181137 const array = new Uint8Array ( bytes ) ;
0 commit comments