registerCurrency(genesisAddress, initialSupply, currency, decimal, data)
Feature
Return raw operation for creating a new currency. Signature of nodes is required, not a general account signature.
Parameters
string
| Address
genesisAddress,
number
| string
initialSupply,
string
currency ID,
number
| string
decimal,
object
currencyPolicyData
Return Value
object
operation for creating new currency
//[ 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 “nil" or "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 genesisAddress = "0x517ffA55D06AaEc6Fa9d27B54e21ebfeb58Ff692fca";
const initialSupply = 1000;
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.registerCurrency(genesisAddress, initialSupply, currencyID, decimal, inputData);
console.log(rawOperation);
//output
Operation {
id: 'mitum',
fact: RegisterCurrencyFact {
hint: Hint { s: 'mitum-currency-register-currency-operation-fact' },
token: Token { s: '2024-06-25 04:24:49.465 +0000 UTC' },
_hash: <Buffer 0f 92 23 56 6f e4 e6 a3 52 a5 00 c6 2b cd 6f b9 68 fa 88 3a b5 63 0f 15 c5 0a f0 35 af c8 1a 22>,
design: CurrencyDesign {
initialSupply: [Big],
currencyID: [CurrencyID],
genesisAccount: [Address],
policy: [CurrencyPolicy],
totalSupply: [Big],
decimal: [Big]
}
},
hint: Hint { s: 'mitum-currency-register-currency-operation' },
_factSigns: [],
_hash: <Buffer >
}
Last updated