Skip to main content
Version: 5.14.1

Class: Signer

Implements

Constructors

constructor

new Signer(pk?)

Parameters

NameType
pkstring | Uint8Array

Defined in

src/signer/default.ts:26

Properties

pk

Protected pk: string | Uint8Array

Defined in

src/signer/default.ts:24

Methods

getPubKey

getPubKey(): Promise<string>

Method to get the public key of the signer

Returns

Promise<string>

public key of signer as hex string with 0x prefix

Implementation of

SignerInterface.getPubKey

Defined in

src/signer/default.ts:30


signMessage

signMessage(typedData, accountAddress): Promise<Signature>

Sign an JSON object for off-chain usage with the starknet private key and return the signature This adds a message prefix so it cant be interchanged with transactions

Throws

if the JSON object is not a valid JSON

Parameters

NameTypeDescription
typedDataTypedDataJSON object to be signed
accountAddressstringaccount

Returns

Promise<Signature>

the signature of the JSON object

Implementation of

SignerInterface.signMessage

Defined in

src/signer/default.ts:34


signTransaction

signTransaction(transactions, transactionsDetail, abis?): Promise<Signature>

Signs a transaction with the starknet private key and returns the signature

Parameters

NameType
transactionsCall[]
transactionsDetailInvocationsSignerDetails
abis?Abi[]

Returns

Promise<Signature>

signature

Implementation of

SignerInterface.signTransaction

Defined in

src/signer/default.ts:39


signDeployAccountTransaction

signDeployAccountTransaction(«destructured»): Promise<Signature>

Signs a DEPLOY_ACCOUNT transaction with the starknet private key and returns the signature

Parameters

NameTypeDescription
«destructured»DeployAccountSignerDetailscontractAddress - the computed address of the contract - constructorCalldata - calldata to be passed in deploy constructor - addressSalt - contract address salt - chainId - the chainId to declare contract on - maxFee - maxFee for the declare transaction - version - transaction version - nonce - Nonce of the declare transaction

Returns

Promise<Signature>

signature

Implementation of

SignerInterface.signDeployAccountTransaction

Defined in

src/signer/default.ts:63


signDeclareTransaction

signDeclareTransaction(«destructured»): Promise<Signature>

Signs a DECLARE transaction with the starknet private key and returns the signature

Parameters

NameTypeDescription
«destructured»DeclareSignerDetailsclassHash - computed class hash. Will be replaced by ContractClass in future once class hash is present in CompiledContract - senderAddress - the address of the sender - chainId - the chainId to declare contract on - maxFee - maxFee for the declare transaction - version - transaction version - nonce - Nonce of the declare transaction

Returns

Promise<Signature>

signature

Implementation of

SignerInterface.signDeclareTransaction

Defined in

src/signer/default.ts:87