updateCurrency(currency, data)
Feature
Return raw operation for creating a new currency policy. Signature of nodes is required, not a general account signature.
Parameters
string
currency ID,
object
currencyPolicyData
Return Value
object
operation to update currency policy
// [ parameter for currencyPolicyData structure ]
type currencyPolicyData = {
initialSupply: string | number | Big
minBalance: string | number | Big
feeType: "nil" | "fixed" | "ratio"
feeReceiver: string | Address // receiver address
fee?: string | number | Big // need to assign when feeType is "fixed" or “ratio”
ratio?: number
minFee?: string | number | Big
maxFee?: string | number | Big
}
feeType is optional and can be one of "none", "fixed", or "ratio".
"none" means no transaction fee is collected.
"fixed" collects a fixed fee, so you must enter a fee receiver address "feeReceiver" and a fixed fee "fee".
"ratio" collects a percentage of the transaction volume, so you must provide the address "feeReceiver", the fee ratio "fee", the minimum fee "minFee", and the maximum fee "maxFee".
example
const currencyID = "SIT";
const decimal = 9;
const inputData = {
minBalance: 5,
feeType: "fixed",
feeReceiver: "0xdCA5d22F192a5703d629602c25AC7252cE94dBa8fca",
fee: 3, // 3%
minFee: 5,
maxFee: 10000,
}
const rawOperation = mitum.currency.updateCurrency(currencyID, inputData);
console.log(rawOperation);
// output
Operation {
id: 'mitum',
fact: UpdateCurrencyFact {
hint: Hint { s: 'mitum-currency-update-currency-operation-fact' },
token: Token { s: '2024-06-25 04:27:22.662 +0000 UTC' },
_hash: <Buffer b7 e6 fa 5e 34 e0 d0 c4 13 44 e1 4b 31 11 67 58 a9 e1 50 01 a8 32 7e b1 0a 03 08 a5 37 d0 d6 5f>,
currency: CurrencyID { s: 'SIT' },
policy: CurrencyPolicy { newAccountMinBalance: [Big], feeer: [FixedFeeer] },
decimal: Big { big: 9n }
},
hint: Hint { s: 'mitum-currency-update-currency-operation' },
_factSigns: [],
_hash: <Buffer >
}
PreviousregisterCurrency(genesisAddress, initialSupply, currency, decimal, data)Nexttransfer(sender, receiver, currency, amount)
Last updated