createWallet(sender, currencyID, amount, ?:seed)

Feature

Return an account and a raw operation for creating a new contract-account. Note : Like other blockchains, newly created accounts are recorded in blocks when the first transaction occurs. This function returns the raw operation to initiate the first transaction (native token transfer). The owner of the newly created contract-account is sender. Since it's a CA, the private and public keys are generally useless. (The public key can be used for account lookup)

Parameters

string sender, string currency ID, int | string amount, null | string seed (optional),

Return Value

object { object wallet, object create contract account operation }

example

const sender = "0x76107260461B2Cb63D78e8E7957feFa3E72f6Ac2fca";
const currencyID = "SIT";
const amount = 10;
const seed = "The MITUM blockchain is evolving every day.";

const { wallet, operation } = mitum.contract.createWallet(sender, currencyID, amount, seed);
console.log(wallet);
console.log(operation);

// output
{
  privatekey: '4d4c7a3632526575aa5e56c6ee64dc174b67a7edc155ebdb63c333180898f1e6fpr',
  publickey: '029187852a565afa52cc7def7b3d86624a042d9138522a729fffc082e080aa6297fpu',
  address: '0x76107260461B2Cb63D78e8E7957feFa3E72f6Ac2fca'
}
Operation {
  id: 'mitum',
  fact: CreateContractAccountFact {
    hint: Hint { s: 'mitum-extension-create-contract-account-operation-fact' },
    token: Token { s: '2024-05-20 08:14:37.501 +0000 UTC' },
    _hash: <Buffer 6e 63 d4 4f da 0e 5d 7b b8 7d d3 f9 6e 48 f0 0c 64 5a 47 19 06 bc 1d 79 18 07 d9 80 6c 44 91 4d>,
    sender: Address {
      s: '0x76107260461B2Cb63D78e8E7957feFa3E72f6Ac2fca',
      type: 'mitum'
    },
    items: [ [CreateContractAccountItem] ]
  },
  hint: Hint { s: 'mitum-extension-create-contract-account-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated