Class: LedgerSigner111<T>
Defined in: ledger/ledgerSigner111.ts:19
Signer for accounts using a Ledger Nano S+/X signature (Starknet Ledger APP version 1.1.1).
The Ledger has to be connected, unlocked and the Starknet APP has to be selected before you use
this class. The transport is typed as a Ledger Transport: a value that is not a Ledger
transport is refused at compile time.
Example
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid';
import { LedgerSigner111 } from 'starknet/ledger';
const myNodeTransport = await TransportNodeHid.create();
const myLedgerSigner = new LedgerSigner111(myNodeTransport, 0);
Extends
LedgerSigner111<T>
Type Parameters
T
T extends Transport = Transport
Constructors
Constructor
new LedgerSigner111<
T>(transport,accountID,eip2645application?,pathFunction?):LedgerSigner111<T>
Defined in: signer/ledgerSigner111.ts:77
constructor of the LedgerSigner class.
Parameters
transport
T
5 transports are available to handle USB, bluetooth, Node, Web, Mobile. See Guides for more details.
accountID
number
ID of Ledger Nano (can handle 2**31 accounts).
eip2645application?
string = 'LedgerW'
A wallet is defined by an ERC2645 derivation path (6 items),
and one item is the application and can be customized.
Default value is LedgerW.
pathFunction?
LedgerPathCalculation = getLedgerPathBuffer111
defines the function that will calculate the path. By default getLedgerPathBuffer111 is selected.
Returns
LedgerSigner111<T>
Example
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
const myNodeTransport = await TransportNodeHid.create();
const myLedgerSigner = new LedgerSigner111(myNodeTransport, 0);
Inherited from
starknet.LedgerSigner111<T>.constructor
Properties
transporter
readonlytransporter:T
Defined in: signer/ledgerSigner111.ts:43
Inherited from
starknet.LedgerSigner111.transporter
accountID
readonlyaccountID:number
Defined in: signer/ledgerSigner111.ts:48
Inherited from
starknet.LedgerSigner111.accountID
eip2645applicationName
readonlyeip2645applicationName:string
Defined in: signer/ledgerSigner111.ts:50
Inherited from
starknet.LedgerSigner111.eip2645applicationName
pathBuffer
readonlypathBuffer:Uint8Array
Defined in: signer/ledgerSigner111.ts:52
Inherited from
starknet.LedgerSigner111.pathBuffer
Methods
getPubKey()
getPubKey():
Promise<string>
Defined in: signer/ledgerSigner111.ts:105
provides the Starknet public key
Returns
Promise<string>
an hex string : 64 characters are Point X coordinate.
Example
const result = await myLedgerSigner.getPubKey();
// result= "0x03681417ba3e1f050dd3ccdceb8d22b5e44fa70ee7844d472c6a768bded5174e"
Inherited from
starknet.LedgerSigner111.getPubKey
getFullPubKey()
getFullPubKey():
Promise<string>
Defined in: signer/ledgerSigner111.ts:119
provides the full public key (with parity prefix)
Returns
Promise<string>
an hex string : 2 first characters are the parity, the 64 following characters are Point X coordinate. 64 last characters are Point Y coordinate.
Example
const result = await myLedgerSigner.getFullPubKey();
// result= "0x0403681417ba3e1f050dd3ccdceb8d22b5e44fa70ee7844d472c6a768bded5174e03cbc86f805dcfcb0c1922dd4daf181afa289d86223a18bc856276615bcc7787"
Inherited from
starknet.LedgerSigner111.getFullPubKey
getAppVersion()
getAppVersion():
Promise<string>
Defined in: signer/ledgerSigner111.ts:133
Returns the version of the Starknet APP implemented in the Ledger.
Returns
Promise<string>
version.
Example
const result = await myLedgerSigner.getAppVersion();
// result= "1.1.1"
Inherited from
starknet.LedgerSigner111.getAppVersion
signMessage()
signMessage(
typedDataToHash,accountAddress):Promise<Signature>
Defined in: signer/ledgerSigner111.ts:154
Sign a TypedData message (SNIP-12) in a Ledger.
Parameters
typedDataToHash
TypedData
A TypedData message compatible with SNIP-12.
accountAddress
string
Signer account address (Hex or num string)
Returns
Promise<Signature>
The signed message.
Example
const result = myLedgerSigner.signMessage(snip12Message, account0.address);
// result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
// s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
// recovery: 0}
Inherited from
starknet.LedgerSigner111.signMessage
signTransaction()
signTransaction(
transactions,transactionsDetail):Promise<Signature>
Defined in: signer/ledgerSigner111.ts:194
Sign in a Ledger a V3 transaction. This is a blind sign on the Ledger screen.
Parameters
transactions
Call[]
An array of Call transactions (generated for example by myContract.populate()).
transactionsDetail
InvocationsSignerDetails
An object that includes all the necessary inputs to hash the transaction.
Returns
Promise<Signature>
The signed transaction.
Example
const txDetailsV3: V3InvocationsSignerDetails = {
chainId: constants.StarknetChainId.SN_MAIN,
nonce: "28",
accountDeploymentData: [],
paymasterData: [],
cairoVersion: "1",
feeDataAvailabilityMode: "L1",
nonceDataAvailabilityMode: "L1",
resourceBounds: {
l1_gas: {
max_amount: "0x2a00",
max_price_per_unit: "0x5c00000"
},
l2_gas: {
max_amount: "0x00",
max_price_per_unit: "0x00"
},
},
tip: 0,
version: "0x3",
walletAddress: account0.address
}
const result = myLedgerSigner.signTransaction([call0, call1], txDetailsV3);
// result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
// s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
// recovery: 0}
Inherited from
starknet.LedgerSigner111.signTransaction
signDeployAccountTransaction()
signDeployAccountTransaction(
details):Promise<Signature>
Defined in: signer/ledgerSigner111.ts:223
Sign in a Ledger the deployment of a new account. This is a blind sign on the Ledger screen.
Parameters
details
V3DeployAccountSignerDetails
An object that includes all necessary data to calculate the Hash.
Returns
Promise<Signature>
The deploy account signature.
Example
const result = myLedgerSigner.signDeployAccountTransaction(details);
// result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
// s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
// recovery: 0}
Inherited from
starknet.LedgerSigner111.signDeployAccountTransaction
signDeclareTransaction()
signDeclareTransaction(
details):Promise<Signature>
Defined in: signer/ledgerSigner111.ts:251
Sign in a Ledger the declaration of a new class. This is a blind sign on the Ledger screen.
Parameters
details
V3DeclareSignerDetails
An object that includes all necessary data to calculate the Hash.
Returns
Promise<Signature>
The declare Signature.
Example
const result = myLedgerSigner.signDeclareTransaction(details);
// result = Signature { r: 611475243393396148729326917410546146405234155928298353899191529090923298688n,
// s: 798839819213540985856952481651392652149797817551686626114697493101433761982n,
// recovery: 0}
Inherited from
starknet.LedgerSigner111.signDeclareTransaction