Skip to content

Commit

Permalink
Pass EIP6492 inside MsgToSign
Browse files Browse the repository at this point in the history
  • Loading branch information
Agusx1211 committed Jun 30, 2023
1 parent fb8958b commit a294c7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/provider/src/transports/wallet-request-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
// prompter is null, so we'll sign from here
sig = await account.signMessage(prefixedMessage, chainId ?? this.defaultChainId(), sequenceVerified ? 'eip6492' : 'ignore')
} else {
const promptResultForDeployment = await this.handleConfirmWalletDeployPrompt(this.prompter, account, sequenceVerified, chainId)
if (promptResultForDeployment) {
sig = await this.prompter.promptSignMessage({ chainId: chainId, message: prefixedMessage }, sequenceVerified, this.connectOptions)
}
sig = await this.prompter.promptSignMessage({
chainId: chainId,
message: prefixedMessage,
eip6492: sequenceVerified
}, this.connectOptions)
}

if (sig && sig.length > 0) {
Expand Down Expand Up @@ -393,10 +394,11 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
// prompter is null, so we'll sign from here
sig = await account.signTypedData(typedData.domain, typedData.types, typedData.message, chainId ?? this.defaultChainId(), sequenceVerified ? 'eip6492' : 'ignore')
} else {
const promptResultForDeployment = await this.handleConfirmWalletDeployPrompt(this.prompter, account, sequenceVerified, chainId)
if (promptResultForDeployment) {
sig = await this.prompter.promptSignMessage({ chainId: chainId, typedData: typedData }, sequenceVerified, this.connectOptions)
}
sig = await this.prompter.promptSignMessage({
chainId: chainId,
typedData: typedData,
eip6492: sequenceVerified
}, this.connectOptions)
}

if (sig && sig.length > 0) {
Expand Down Expand Up @@ -844,7 +846,7 @@ export interface WalletUserPrompter {
promptConnect(options?: ConnectOptions): Promise<PromptConnectDetails>
promptSignInConnect(options?: ConnectOptions): Promise<PromptConnectDetails>

promptSignMessage(message: MessageToSign, sequenceVerified: boolean, options?: ConnectOptions): Promise<string>
promptSignMessage(message: MessageToSign, options?: ConnectOptions): Promise<string>
promptSignTransaction(txn: commons.transaction.Transactionish, chainId?: number, options?: ConnectOptions): Promise<string>
promptSendTransaction(txn: commons.transaction.Transactionish, chainId?: number, options?: ConnectOptions): Promise<string>
promptConfirmWalletDeploy(chainId: number, options?: ConnectOptions): Promise<boolean>
Expand Down
2 changes: 2 additions & 0 deletions packages/provider/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ export interface MessageToSign {
message?: Uint8Array
typedData?: TypedData
chainId?: number

eip6492?: boolean
}

export type ETHAuthProof = AuthETHAuthProof
Expand Down

0 comments on commit a294c7b

Please sign in to comment.