createMultiSig(sender, keys, currency, amount, threshold)

Feature

Return a raw operation for creating a new multi-sig contract-account via given public keys. Each public key should have a weight set based on its priority or importance in the multi sig account. 1 ≤ weight ≤ 100, threshold ≤ 100 & sum of weights 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). Since it's a CA, the public keys are generally useless. (The public key can be used for account lookup)

Parameters

string sender address, array keys {key : string public key, weight : int | string weight}, string currency ID, int | string amount, int | string threshold

Return Value

object create account operation

example

const senderAddress = "0x78f707a5CB15924b5edf7E45cD8df06b577984F7fca";
const currencyID = "MCC";
const threshold = 100;
const amount = 10000;

const pubkey01 = {
    key: "0399623f76b2d62a54b368f367426704d5af14aed09c9ed67104c225fcfda429bdfpu",
    weight: 50
};
const pubkey02 = {
    key: "029187852a565afa52cc7def7b3d86624a042d9138522a729fffc082e080aa6297fpu",
    weight: 50
};
const keysArray = [pubkey01, pubkey02];

const createOperation = mitum.contract.createMultiSig(
    senderAddress,
    keysArray,
    currencyID,
    amount,
    threshold,
);
console.log(createOperation);

// output
Operation {
  id: 'mitum',
  fact: CreateContractAccountFact {
    hint: Hint { s: 'mitum-currency-create-contract-account-operation-fact' },
    token: Token { s: '2024-05-20 08:16:41.783 +0000 UTC' },
    _hash: <Buffer 1a fe 46 47 38 11 19 ab 36 c6 94 5b e1 48 67 a1 85 25 fe fc 62 02 41 95 7a f5 4e 44 a1 ea 2c 8b>,
    sender: Address {
      s: '0x78f707a5CB15924b5edf7E45cD8df06b577984F7fca',
      type: 'mitum'
    },
    items: [ [CreateContractAccountItem] ]
  },
  hint: Hint { s: 'mitum-currency-create-contract-account-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated