Module: @shareledgerjs/signing
Classes
Interfaces
- AccountData
- DecodeObject
- DecodedTxRaw
- DirectSignResponse
- EncodeObject
- KdfConfiguration
- OfflineDirectSigner
- PbjsGeneratedType
- Secp256k1HdWalletOptions
- TsProtoGeneratedType
- TxBodyEncodeObject
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
Name | Type |
---|---|
aes256 | string |
secp256k1 | string |
xchacha20poly1305Ietf | string |
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
Name | Type |
---|---|
amount | string | number |
denom | string |
Returns
Coin
coins
▸ coins(amount
, denom
): Coin
[]
Creates a list of coins with one element.
Parameters
Name | Type |
---|---|
amount | string | number |
denom | string |
Returns
Coin
[]
decodePubkey
▸ decodePubkey(pubkey?
): Pubkey
| null
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
tx | Uint8Array |
Returns
decrypt
▸ decrypt(ciphertext
, encryptionKey
, config
): Promise
<Uint8Array
>
Parameters
Name | Type |
---|---|
ciphertext | string | Uint8Array |
encryptionKey | string | Uint8Array |
config | EncryptionConfiguration |
Returns
Promise
<Uint8Array
>
encodePubkey
▸ encodePubkey(pubkey
): Any
Parameters
Name | Type |
---|---|
pubkey | Pubkey |
Returns
Any
encrypt
▸ encrypt(plaintext
, encryptionKey
, config
): Promise
<Uint8Array
>
Parameters
Name | Type |
---|---|
plaintext | string | Uint8Array |
encryptionKey | string | Uint8Array |
config | EncryptionConfiguration |
Returns
Promise
<Uint8Array
>
executeKdf
▸ executeKdf(password
, configuration
): Promise
<Uint8Array
>
Parameters
Name | Type |
---|---|
password | string |
configuration | KdfConfiguration |
Returns
Promise
<Uint8Array
>
extractKdfConfiguration
▸ extractKdfConfiguration(serialization
): KdfConfiguration
Parameters
Name | Type |
---|---|
serialization | string |
Returns
isOfflineDirectSigner
▸ isOfflineDirectSigner(signer
): signer is OfflineDirectSigner
Parameters
Name | Type |
---|---|
signer | OfflineSigner |
Returns
signer is OfflineDirectSigner
isPbjsGeneratedType
▸ isPbjsGeneratedType(type
): type is PbjsGeneratedType
Parameters
Name | Type |
---|---|
type | GeneratedType |
Returns
type is PbjsGeneratedType
isTsProtoGeneratedType
▸ isTsProtoGeneratedType(type
): type is TsProtoGeneratedType
Parameters
Name | Type |
---|---|
type | GeneratedType |
Returns
type is TsProtoGeneratedType
isTxBodyEncodeObject
▸ isTxBodyEncodeObject(encodeObject
): encodeObject is TxBodyEncodeObject
Parameters
Name | Type |
---|---|
encodeObject | EncodeObject |
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
Name | Type | Default value |
---|---|---|
signers | readonly { pubkey : Any ; sequence : number }[] | undefined |
feeAmount | readonly Coin [] | undefined |
gasLimit | number | undefined |
feeGranter? | string | undefined |
feePayer? | string | undefined |
signMode | SignMode | SignMode.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
Name | Type |
---|---|
a | number |
Returns
HdPath
makeSignBytes
▸ makeSignBytes(__namedParameters
): Uint8Array
Parameters
Name | Type |
---|---|
__namedParameters | SignDoc |
Returns
Uint8Array
makeSignDoc
▸ makeSignDoc(bodyBytes
, authInfoBytes
, chainId
, accountNumber
): SignDoc
Parameters
Name | Type |
---|---|
bodyBytes | Uint8Array |
authInfoBytes | Uint8Array |
chainId | string |
accountNumber | number |
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
Name | Type |
---|---|
input | string |
Returns
Coin
[]
parseDecCoins
▸ parseDecCoins(input
, fractionalDigits?
): DecCoin
[]
Parameters
Name | Type | Default value |
---|---|---|
input | string | undefined |
fractionalDigits | number | 18 |
Returns
DecCoin
[]
pubkeyToAddress
▸ pubkeyToAddress(pubkey
, prefix
): string
Parameters
Name | Type |
---|---|
pubkey | Pubkey |
prefix | string |
Returns
string