createMultiData(contracts, sender, dataKeys, dataValues, currency)

Feature

Return raw operation for creating multiple data. The length of dataKeys must same with length of dataValues and contracts. (max length is 100) Note: Handler of contract also can execute the function.

Parameters

string | string[] contract address, // If given a string, it is automatically converted to an array filled with the same values. string sender, string[] dataKeys, (element’s max length is 200, must not contain: space / : ? # [ ] @) string[] dataValues, (element’s max length is 20000) string currency ID

Return Value

object create-data operation with multi items.

example1. create data to each contract

const contract = "0xb2310381f7E51a69d0C4cCdbE7a6DCB3B7353192fca";
const contract2 = "0xa6283308BBedbfB8041A2Ea950A11D142A0F4FD9fca";
const sender = "0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca";
const currencyId = "MCC";
const contracts = [contract, contract, contract2, contract2];
const dataKeys = ["key1", "key2", "key3", "key4"];
const dataValues = ["value1", "value2", "value3", "value4"];
const op = mitum.storage.createMultiData(contracts, sender, dataKeys, dataValues, currencyId);
console.log(op)

// output
BaseOperation {
  id: 'mitum',
  fact: CreateDataFact {
    hint: Hint { s: 'mitum-storage-create-data-operation-fact' },
    token: Token { s: '2026-02-19 05:36:25.282 +0000 UTC' },
    _hash: <Buffer 9e f1 e4 75 de fd f2 a9 c6 b3 cd 55 d6 40 c9 cc 6a de 5e 45 b0 5e d1 de 2b 74 70 74 6e a4 49 5d>,
    sender: Address {
      s: '0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca',
      type: 'mitum'
    },
    items: [
      [CreateDataItem],
      [CreateDataItem],
      [CreateDataItem],
      [CreateDataItem]
    ]
  },
  hint: Hint { s: 'mitum-storage-create-data-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

example2. create four data to contract (0xb2…)

Last updated