createAccount(sender, key, currency, amount)
Feature
Return raw operation to transfer native token from sender to account corresponding to the given public key. Used to create a single sig account.
Parameters
string sender address,
string receiver public key,
string currency ID,
int | string amount
Return Value
object currency transfer operation
example
const sender = "0x77A1a35dEB2bcc5Ed061524aa9758f2605F7DA13fca";
const currencyID = "MIT";
const amount = 10;
// create new account and raw operation
const wallet = mitum.account.createWallet(sender, currencyID, amount);
// private key of sender to sign the operation
const privatekey = "fa6b1197ec14133d0cbf026b623586ecad79e3ac4c48158e8b06093a3cf7d2c1fpr";
// sign and send the operation to API server
const accountCreate = async () => {
const res = await mitum.account.touch(privatekey, wallet);
console.log(res.response.data);
};
accountCreate();
// output
{
_hint: 'mitum-currency-hal-v0.0.1',
_embedded: {
hash: 'HPh64PShQoVepK9hfjDEz4DHhieEF7w4pqNu2HDaxXmQ',
fact: {
hash: 'CThMfhZ8Een8YsLkGjdLxBcVtCtyonxD9wCU2o1XPZTJ',
token: 'MjAyMy0xMC0wNiAwNzowMjowOS4wNzYgKzAwMDAgVVRD',
_hint: 'mitum-currency-transfer-operation-fact-v0.0.1',
sender: '0x77A1a35dEB2bcc5Ed061524aa9758f2605F7DA13fca',
items: [Array]
},
signs: [ [Object] ],
_hint: 'mitum-currency-transfer-operation-v0.0.1'
},
_links: { self: { href: '' } }
}Last updated