@ledgerhq/coin-mina
Version:
174 lines • 7.18 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dataset = void 0;
const bignumber_js_1 = require("bignumber.js");
const errors_1 = require("@ledgerhq/errors");
const transaction_1 = require("../bridge/transaction");
const errors_2 = require("../bridge/errors");
const ACCOUNT_ADDRESS = "B62qjWLs1W3J2fFGixeX49w1o7VvSGuMBNotnFhzs3PZ7PbtdFbhdeD";
const ACCOUNT_ADDRESS_1 = "B62qkWcHhoisWDCR7v3gvWzX6wXEVuGYLHXq3mSym4GEzfYXmSDv314";
const mina = {
FIXME_ignoreAccountFields: ["blockHash"],
scanAccounts: [
{
name: "mina seed 1",
apdus: `
=> e00201000400000000
<= 423632716a574c733157334a3266464769786558343977316f3756765347754d424e6f746e46687a7333505a3750627464466268646544009000
=> e00201000400000001
<= 423632716e4438387474693632364d694d6e7568504d624c69504c766664644657486a47667377795646754c5845614b644b366f344263009000
=> e00201000400000002
<= 423632716a7048577878544457506e474372714b546b56414b596f4e5250374c6e454b356564766d717151394658736e61313166674741009000
`,
},
],
accounts: [
{
// Skipping due to rewards being auto-compounded, no operation as evidence
FIXME_tests: ["balance is sum of ops"],
raw: {
id: `js:2:mina:${ACCOUNT_ADDRESS}:`,
seedIdentifier: `${ACCOUNT_ADDRESS}`,
name: "MINA 1",
derivationMode: "minabip44",
index: 0,
freshAddress: `${ACCOUNT_ADDRESS}`,
freshAddressPath: "44'/12586'/0'/0'/0'",
blockHeight: 0,
operations: [],
pendingOperations: [],
currencyId: "mina",
lastSyncDate: "",
balance: "1000000",
},
transactions: [
{
name: "not a valid address",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: "novalidaddress",
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
amount: "1000",
memo: undefined,
nonce: 0,
}),
expectedStatus: {
errors: {
recipient: new errors_1.InvalidAddress(),
},
warnings: {},
},
},
{
name: "not enough balance",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: ACCOUNT_ADDRESS_1,
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
amount: (300 * 1e9).toString(),
memo: undefined,
nonce: 0,
}),
expectedStatus: {
errors: {
amount: new errors_1.NotEnoughBalance(),
},
warnings: {},
},
},
{
name: "invalid Memo",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: ACCOUNT_ADDRESS_1,
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
amount: "1000",
memo: "string greated than 32 chars is invalid",
nonce: 0,
}),
expectedStatus: {
errors: {
transaction: new errors_2.InvalidMemoMina(),
},
warnings: {},
},
},
{
name: "amount Required",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: ACCOUNT_ADDRESS_1,
memo: undefined,
amount: "0",
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
nonce: 0,
}),
expectedStatus: {
errors: {
amount: new errors_1.AmountRequired(),
},
warnings: {},
},
},
{
name: "recipient same as source",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: ACCOUNT_ADDRESS,
amount: "10",
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
memo: undefined,
nonce: 0,
}),
expectedStatus: {
errors: {
recipient: new errors_1.InvalidAddressBecauseDestinationIsAlsoSource(),
},
warnings: {},
},
},
{
name: "new account and sufficient amount",
transaction: (0, transaction_1.fromTransactionRaw)({
family: "mina",
recipient: ACCOUNT_ADDRESS_1,
amount: "1000",
fees: {
fee: new bignumber_js_1.BigNumber(0).toString(),
accountCreationFee: new bignumber_js_1.BigNumber(0).toString(),
},
memo: undefined,
nonce: 0,
}),
expectedStatus: {
amount: new bignumber_js_1.BigNumber("1000"),
errors: {},
warnings: {},
},
},
],
},
],
};
exports.dataset = {
implementations: ["js"],
currencies: {
mina,
},
};
//# sourceMappingURL=bridgeDatasetTest.js.map