Resolvers
Converts between different formats.
Resolve Private Key
Provide the mnemonic phrases and resolvePrivateKey
will return a private key.
Resolve Private Key
Convert mnemonic to private key
Mnemonic
[
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution",
"solution"
]
resolvePrivateKey(["solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution","solution"]);
Resolve Transaction Hash
Provide a cborTx
, resolveTxHash
will return the transaction hash. This hash is useful for creating chain transactions.
Resolve Transaction Hash
Convert transaction cborTx to transaction hash
const tx = new Transaction({ initiator: wallet });
tx.sendLovelace('addr_test1vpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0c7e4cxr', '1500000');
const unsignedTx = await tx.build();
const hash1 = resolveTxHash(unsignedTx);
const signedTx = await wallet.signTx(unsignedTx, false);
const hash2 = resolveTxHash(signedTx);
const txHash = await wallet.submitTx(signedTx);
// txHash == hash1 == hash2
Resolve Data Hash
Converts datum into hash. Getting the hash is useful when you need to query for the UTXO that contain the assets you need for your transaction's input.
Explore Transaction to learn more about designing Datum, and learn how to query for UTXOs containing the datum hash.
Resolve Native Script Hash
Converts NativeScript into hash.
Resolve Native Script Hash
Convert NativeScript to hash
Address
addr_test1vpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0c7e4cxr
const keyHash = resolvePaymentKeyHash('addr_test1vpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0c7e4cxr');
const nativeScript: NativeScript = {
type: "all",
scripts: [
{
type: "sig",
keyHash: keyHash,
},
],
};
resolveNativeScriptHash(nativeScript);
Resolve Script Hash
resolveScriptHash
will return a script hash. For example, this is useful when you want to convert a script to a policy ID.
Resolve Script Hash
Convert script to hash (like policy ID)
script address
8200581c5867c3b8e27840f556ac268b781578b14c5661fc63ee720dbeab663f
resolveScriptHash('8200581c5867c3b8e27840f556ac268b781578b14c5661fc63ee720dbeab663f')
Resolve Stake Address
Provide a wallet address, and resolveRewardAddress
will return a staking address in bech32 format.
Resolve Stake Address
Convert wallet address to staking address
Address
addr_test1qpvx0sacuf...swx9
resolveRewardAddress('addr_test1qpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0uafhxhu32dys6pvn6wlw8dav6cmp4pmtv7cc3yel9uu0nq93swx9');
Resolve Fingerprint
Takes policy ID and asset name, and return asset fingerprint based on CIP-14.
Resolve Asset Fingerprint
Convert asset policy ID and asset name to asset fingerprint.
Policy ID
426117329844ccb3b0ba877220ff06a5bdf21eab3fb33e2f3a3f8e69
Asset Name
4d657368546f6b656e
resolveFingerprint(
'426117329844ccb3b0ba877220ff06a5bdf21eab3fb33e2f3a3f8e69',
'4d657368546f6b656e'
)
Resolve Stake Key Hash
Provide a stake address, and resolveStakeKeyHash
will return the pub key hash of the stake address. This key hash is useful for building the NativeScript.
Resolve Stake Key Hash
Convert stake address to pub key hash
Address
stake_test1uzw5mnt7g4xjgdqkfa80hrk7kdvds6sa4k0vvgjvlj7w8eskffj2n
resolveStakeKeyHash('stake_test1uzw5mnt7g4xjgdqkfa80hrk7kdvds6sa4k0vvgjvlj7w8eskffj2n');
Resolve Rep Id
Resolve Rep Id from scrip hash.
Resolve Rep Id
Resolve rep id from scrip hash
let script: NativeScript = {
type: "all",
scripts: [
{
type: "sig",
keyHash: 'aa048e4cc8a1e67e1d97ffbd4be614388014cbc2b2451527202943b6'
},
],
};
resolveScriptHashDRepId(resolveNativeScriptHash(script));
Resolve Epoch Number
With resolveEpochNo
, you can get the current epoch with:
import { resolveEpochNo } from '@meshsdk/core';
const epoch = resolveEpochNo('preprod');
You can also provide date in milliseconds
to get epoch in the past or the future. For example, get the epoch 1 year from now:
import { resolveEpochNo } from '@meshsdk/core';
let oneYearFromNow = new Date();
oneYearFromNow.setFullYear(oneYearFromNow.getFullYear() + 1);
const epoch = resolveEpochNo('preprod', oneYearFromNow.getTime());
Resolve Epoch number
Get the epoch number for the network
Select network
preprod
resolveEpochNo('preprod');
Resolve Epoch number 1 year from now
Get the epoch number for the network 1 year from now
Select network
preprod
let oneYearFromNow = new Date()
oneYearFromNow.setFullYear(oneYearFromNow.getFullYear() + 1);
resolveEpochNo(userInput, oneYearFromNow.getTime());
Resolve Slot Number
With resolveSlotNo
, you can get the current slot number with:
import { resolveSlotNo } from '@meshsdk/core';
const slot = resolveSlotNo('preprod');
You can also provide date in milliseconds
to get slots in the past or the future. For example, get the slot number 1 year from now:
import { resolveSlotNo } from '@meshsdk/core';
let oneYearFromNow = new Date();
oneYearFromNow.setFullYear(oneYearFromNow.getFullYear() + 1);
const slot = resolveSlotNo('preprod', oneYearFromNow.getTime());
Resolve Slot number
Get the Slot number for the network
Select network
preprod
resolveSlotNo('preprod');
Resolve Slot number 1 year from now
Get the Slot number for the network 1 year from now
Select network
preprod
let oneYearFromNow = new Date()
oneYearFromNow.setFullYear(oneYearFromNow.getFullYear() + 1);
resolveSlotNo(userInput, oneYearFromNow.getTime());