Nhảy tới nội dung
Phiên bản: near-api-js@1.1.0

Class: InMemorySigner

signer.InMemorySigner

Signs using in memory key store.

Hierarchy

Constructors

constructor

new InMemorySigner(keyStore)

Parameters

NameType
keyStoreKeyStore

Overrides

Signer.constructor

Defined in

signer.ts:38

Properties

keyStore

Readonly keyStore: KeyStore

Defined in

signer.ts:36

Methods

createKey

createKey(accountId, networkId): Promise<PublicKey>

Creates a public key for the account given

Parameters

NameTypeDescription
accountIdstringThe NEAR account to assign a public key to
networkIdstringThe targeted network. (ex. default, betanet, etc…)

Returns

Promise<PublicKey>

Overrides

Signer.createKey

Defined in

signer.ts:64


getPublicKey

getPublicKey(accountId?, networkId?): Promise<PublicKey>

Gets the existing public key for a given account

Parameters

NameTypeDescription
accountId?stringThe NEAR account to assign a public key to
networkId?stringThe targeted network. (ex. default, betanet, etc…)

Returns

Promise<PublicKey>

Returns the public key or null if not found

Overrides

Signer.getPublicKey

Defined in

signer.ts:76


signMessage

signMessage(message, accountId?, networkId?): Promise<Signature>

Parameters

NameTypeDescription
messageUint8ArrayA message to be signed, typically a serialized transaction
accountId?stringthe NEAR account signing the message
networkId?stringThe targeted network. (ex. default, betanet, etc…)

Returns

Promise<Signature>

Overrides

Signer.signMessage

Defined in

signer.ts:90


toString

toString(): string

Returns

string

Defined in

signer.ts:102


fromKeyPair

Static fromKeyPair(networkId, accountId, keyPair): Promise<Signer>

Creates a single account Signer instance with account, network and keyPair provided.

Intended to be useful for temporary keys (e.g. claiming a Linkdrop).

Parameters

NameTypeDescription
networkIdstringThe targeted network. (ex. default, betanet, etc…)
accountIdstringThe NEAR account to assign the key pair to
keyPairKeyPairThe keyPair to use for signing

Returns

Promise<Signer>

Defined in

signer.ts:52