updateData(contract, sender, dataKey, dataValue, currency)
Feature
Return raw operation to update exist data with new dataValue. Note: Handler of contract also can execute the function.
Parameters
string
contract address,
string
sender,
string
dataKey, (max length is 200, must not contain: space / : ? # [ ] @) string
dataValue, (max length is 20000)
string
currency ID
Return Value
object
update-data operation
example
const contract = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const dataKey = "server_access_record"
const dataValue = "2024-08-21 10:20:32 - Alex entered the main office through the front entrance"
const currencyId = "MCC";
const updateDataOperation = mitum.storage.updateData(contract, sender, dataKey, dataValue, currencyId);
console.log(updateDataOperation);
// output
Operation {
id: 'mitum',
fact: UpdateDataFact {
hint: Hint { s: 'mitum-storage-update-data-operation-fact' },
token: Token { s: '2024-08-22 06:22:25.074 +0000 UTC' },
_hash: <Buffer dc 96 88 3e bf 83 e5 d8 de 27 39 48 c1 d0 49 e5 61 c6 b6 30 6d d6 99 b9 9e c6 1f e6 39 90 6b 32>,
sender: Address {
s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
type: 'mitum'
},
contract: Address {
s: '0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca',
type: 'mitum'
},
currency: CurrencyID { s: 'MCC' },
dataKey: LongString { s: 'server_access_record' },
dataValue: LongString {
s: '2024-08-22 10:20:32 - Alex entered the main office through the front entrance'
}
},
hint: Hint { s: 'mitum-storage-update-data-operation' },
_factSigns: [],
_hash: <Buffer >
}
PreviousgetData(contract, dataKey)NextupdateMultiData(contracts, sender, dataKeys, dataValues, currency)
Last updated