Skip to main content

Module: @shareledgerjs/signing

Classes

Interfaces

Type Aliases

Algo

Ƭ Algo: "secp256k1" | "ed25519" | "sr25519"

This is the same as Algo from @cosmjs/launchpad but those might diverge in the future.


GeneratedType

Ƭ GeneratedType: TsProtoGeneratedType | PbjsGeneratedType


OfflineSigner

Ƭ OfflineSigner: OfflineAminoSigner | OfflineDirectSigner

Variables

supportedAlgorithms

Const supportedAlgorithms: Object

Type declaration

NameType
aes256string
secp256k1string
xchacha20poly1305Ietfstring

Functions

coin

coin(amount, denom): Coin

Creates a coin.

If your values do not exceed the safe integer range of JS numbers (53 bit), you can use the number type here. This is the case for all typical Cosmos SDK chains that use the default 6 decimals.

In case you need to supportr larger values, use unsigned integer strings instead.

Parameters

NameType
amountstring | number
denomstring

Returns

Coin


coins

coins(amount, denom): Coin[]

Creates a list of coins with one element.

Parameters

NameType
amountstring | number
denomstring

Returns

Coin[]


decodePubkey

decodePubkey(pubkey?): Pubkey | null

Parameters

NameType
pubkey?null | Any

Returns

Pubkey | null


decodeTxRaw

decodeTxRaw(tx): DecodedTxRaw

Takes a serialized TxRaw (the bytes stored in Tendermint) and decodes it into something usable.

Parameters

NameType
txUint8Array

Returns

DecodedTxRaw


decrypt

decrypt(ciphertext, encryptionKey, config): Promise<Uint8Array>

Parameters

NameType
ciphertextstring | Uint8Array
encryptionKeystring | Uint8Array
configEncryptionConfiguration

Returns

Promise<Uint8Array>


encodePubkey

encodePubkey(pubkey): Any

Parameters

NameType
pubkeyPubkey

Returns

Any


encrypt

encrypt(plaintext, encryptionKey, config): Promise<Uint8Array>

Parameters

NameType
plaintextstring | Uint8Array
encryptionKeystring | Uint8Array
configEncryptionConfiguration

Returns

Promise<Uint8Array>


executeKdf

executeKdf(password, configuration): Promise<Uint8Array>

Parameters

NameType
passwordstring
configurationKdfConfiguration

Returns

Promise<Uint8Array>


extractKdfConfiguration

extractKdfConfiguration(serialization): KdfConfiguration

Parameters

NameType
serializationstring

Returns

KdfConfiguration


isOfflineDirectSigner

isOfflineDirectSigner(signer): signer is OfflineDirectSigner

Parameters

NameType
signerOfflineSigner

Returns

signer is OfflineDirectSigner


isPbjsGeneratedType

isPbjsGeneratedType(type): type is PbjsGeneratedType

Parameters

NameType
typeGeneratedType

Returns

type is PbjsGeneratedType


isTsProtoGeneratedType

isTsProtoGeneratedType(type): type is TsProtoGeneratedType

Parameters

NameType
typeGeneratedType

Returns

type is TsProtoGeneratedType


isTxBodyEncodeObject

isTxBodyEncodeObject(encodeObject): encodeObject is TxBodyEncodeObject

Parameters

NameType
encodeObjectEncodeObject

Returns

encodeObject is TxBodyEncodeObject


makeAuthInfoBytes

makeAuthInfoBytes(signers, feeAmount, gasLimit, feeGranter?, feePayer?, signMode?): Uint8Array

Creates and serializes an AuthInfo document.

This implementation does not support different signing modes for the different signers.

Parameters

NameTypeDefault value
signersreadonly { pubkey: Any ; sequence: number }[]undefined
feeAmountreadonly Coin[]undefined
gasLimitnumberundefined
feeGranter?stringundefined
feePayer?stringundefined
signModeSignModeSignMode.SIGN_MODE_DIRECT

Returns

Uint8Array


makeShareledgerPath

makeShareledgerPath(a): HdPath

The derivation path in the form m/44'/118'/0'/0/a with 0-based account index a.

Parameters

NameType
anumber

Returns

HdPath


makeSignBytes

makeSignBytes(__namedParameters): Uint8Array

Parameters

NameType
__namedParametersSignDoc

Returns

Uint8Array


makeSignDoc

makeSignDoc(bodyBytes, authInfoBytes, chainId, accountNumber): SignDoc

Parameters

NameType
bodyBytesUint8Array
authInfoBytesUint8Array
chainIdstring
accountNumbernumber

Returns

SignDoc


parseCoins

parseCoins(input): Coin[]

Takes a coins list like "819966000ucosm,700000000ustake" and parses it.

This is a Stargate ready version of parseCoins from @cosmjs/amino and @cosmjs/launchpad. It supports more denoms.

Parameters

NameType
inputstring

Returns

Coin[]


parseDecCoins

parseDecCoins(input, fractionalDigits?): DecCoin[]

Parameters

NameTypeDefault value
inputstringundefined
fractionalDigitsnumber18

Returns

DecCoin[]


pubkeyToAddress

pubkeyToAddress(pubkey, prefix): string

Parameters

NameType
pubkeyPubkey
prefixstring

Returns

string