updateKey(sender, newKeys, currency, threshold)
Feature
Return raw operation for replace the public keys involved in given multi-sig address.
Also useful for single-sig account ↔ multi-sig account.
Currency ID indicates in which currency the fee will be paid.
Note: Changing the public key means changing the private key of the account. The address does not change, thus the formula for calculating address from public key, fromPrivateKey(), is no longer valid.
Parameters
string sender,
array new keys {key : string public key, weight : int | string weight},
string currency ID,
int | string threshold
Return Value
object update key operation
example
const sender = "0x517ffA55D06AaEc6Fa9d27B54e21ebfeb58Ff692fca";
const currencyID = "MIT";
const threshold = 100;
const pubkey01 = {
key: "029187852a565afa52cc7def7b3d86624a042d9138522a729fffc082e080aa6297fpu",
weight: 50
};
const pubkey02 = {
key: "03a5860f94c6228e7601d4727ba3cfba11c5320c52e8b71f74d9ae9999fd6ff7d3fpu",
weight: 50
};
const newPublickeys = [pubkey01, pubkey02];
const updateOperation = mitum.account.updateKey(sender, newPublickeys, currencyID, threshold);
console.log(updateOperation);
// output
Operation {
id: 'mitum',
fact: UpdateKeyFact {
hint: Hint { s: 'mitum-currency-update-key-operation-fact' },
token: Token { s: '2024-05-20 07:31:05.065 +0000 UTC' },
_hash: <Buffer 60 04 65 68 e0 71 54 c1 4d d0 44 23 43 66 2d 3e 39 73 e2 b8 4d f5 e6 7a db 1e a5 e1 20 77 cc b1>,
target: Address {
s: '0x517ffA55D06AaEc6Fa9d27B54e21ebfeb58Ff692fca',
type: 'mitum'
},
keys: Keys { _keys: [Array], threshold: [Big] },
currency: CurrencyID { s: 'MIT' }
},
hint: Hint { s: 'mitum-currency-update-key-operation' },
_factSigns: [],
_hash: <Buffer >
}Last updated