@ledgerhq/coin-celo
Version:
24 lines • 1.06 kB
JavaScript
import invariant from "invariant";
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/index";
import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/parseCurrencyUnit";
const currency = getCryptoCurrencyById("celo");
const minimalAmount = parseCurrencyUnit(currency.units[0], "0.001");
export const createRegisterAccountMutation = () => ({
name: "Celo: Register Account",
feature: "staking",
maxRun: 1,
transaction: ({ account, bridge, maxSpendable }) => {
const { celoResources } = account;
invariant(!celoResources?.registrationStatus, "Celo: Register Account | Celo account is already registered");
invariant(maxSpendable.gt(minimalAmount), "Celo: Register Account | Celo account balance is too low to register account");
return {
transaction: bridge.createTransaction(account),
updates: [
{
mode: "register",
},
],
};
},
});
//# sourceMappingURL=createRegisterAccountMutation.js.map