Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add SignTypedDataOptions optional param #1409

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/network/src/signer/signers/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ interface TransactionRequestInput {
// END: NOT SUPPORTED FIELDS in VeChain BUT added to take compatibility with ethers
}

/**
* Options for signing typed data
*
* @NOTE: To enhance compatibility with extension and mobile and to allow account switching when signing typed data, we define this interface.
*/
interface SignTypedDataOptions {
signer?: string;
}

/**
* A signer for VeChain, adding specific methods for VeChain to the ethers signer
*
Expand Down Expand Up @@ -353,7 +362,8 @@ interface VeChainSigner {
signTypedData: (
domain: vechain_sdk_core_ethers.TypedDataDomain,
types: Record<string, vechain_sdk_core_ethers.TypedDataField[]>,
value: Record<string, unknown>
value: Record<string, unknown>,
options?: SignTypedDataOptions
) => Promise<string>;

/**
Expand All @@ -365,5 +375,6 @@ interface VeChainSigner {
export {
type AvailableVeChainProviders,
type TransactionRequestInput,
type SignTypedDataOptions,
type VeChainSigner
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { RPC_METHODS } from '../../../provider/utils/const/rpc-mapper/rpc-method
import { type TransactionSimulationResult } from '../../../thor-client';
import { vnsUtils } from '../../../utils';
import {
type SignTypedDataOptions,
type AvailableVeChainProviders,
type TransactionRequestInput,
type VeChainSigner
Expand Down Expand Up @@ -344,7 +345,8 @@ abstract class VeChainAbstractSigner implements VeChainSigner {
abstract signTypedData(
domain: vechain_sdk_core_ethers.TypedDataDomain,
types: Record<string, vechain_sdk_core_ethers.TypedDataField[]>,
value: Record<string, unknown>
value: Record<string, unknown>,
options?: SignTypedDataOptions
): Promise<string>;

/**
Expand Down