Skip to content

Commit

Permalink
update signer to always return serialized 6492 signature
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeexcoin committed Oct 14, 2024
1 parent 1a1659c commit e78b5dd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/agw-client/src/transformEIP1193Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ import {
hashMessage,
type Hex,
parseAbiParameters,
serializeErc6492Signature,
serializeTypedData,
toHex,
type Transport,
zeroAddress,
} from 'viem';
import { toAccount } from 'viem/accounts';

import { createAbstractClient } from './abstractClient.js';
import { VALIDATOR_ADDRESS } from './constants.js';
import { getSmartAccountAddressFromInitialSigner } from './utils.js';
import {
getInitializerCalldata,
getSmartAccountAddressFromInitialSigner,
} from './utils.js';

interface TransformEIP1193ProviderOptions {
provider: EIP1193Provider;
Expand Down Expand Up @@ -91,6 +96,17 @@ async function getAgwTypedSignature(
[rawSignature, VALIDATOR_ADDRESS],
);

return serializeErc6492Signature({
address: account,
data: getInitializerCalldata(signer, VALIDATOR_ADDRESS, {
target: zeroAddress,
allowFailure: false,
callData: '0x',
value: 0n,
}),
signature,
});

return signature;
}

Expand Down

0 comments on commit e78b5dd

Please sign in to comment.