"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const currencies_1 = require("../currencies");
const account_1 = require("@ledgerhq/coin-framework/mocks/account");
const serialization_1 = require("./serialization");
const version_1 = require("../wallet-api/version");
const constants_1 = require("../wallet-api/constants");
(0, version_1.setWalletAPIVersion)(constants_1.WALLET_API_VERSION);
(0, currencies_1.setSupportedCurrencies)(["solana"]);
const Solana = (0, currencies_1.getCryptoCurrencyById)("solana");
const USDC = (0, currencies_1.getTokenById)("solana/spl/epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v");
describe("serialization", () => {
    test("TokenAccount extra fields should be serialized/deserialized", () => {
        const acc = (0, account_1.genAccount)("mocked-account-1", { currency: Solana });
        const tokenAcc = (0, account_1.genTokenAccount)(1, acc, USDC);
        tokenAcc.state = "initialized";
        acc.subAccounts = [tokenAcc];
        const accRaw = (0, serialization_1.toAccountRaw)(acc);
        expect(accRaw.subAccounts?.[0]?.state).toBe("initialized");
        const deserializedAcc = (0, serialization_1.fromAccountRaw)(accRaw);
        expect(deserializedAcc.subAccounts?.[0]?.state).toBe("initialized");
    });
});
//# sourceMappingURL=serialization.test.js.map