Skip to content

Commit 42211e5

Browse files
committed
chore: save work
1 parent 78bcb1a commit 42211e5

File tree

2 files changed

+13
-30
lines changed

2 files changed

+13
-30
lines changed

libs/coin-modules/coin-aptos/src/test/bot-specs.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const aptosSpecs: AppSpec<Transaction> = {
1818
appQuery: {
1919
model: DeviceModelId.nanoSP,
2020
appName: "Aptos",
21+
appVersion: "0.8.11",
22+
firmware: "1.3.2",
2123
},
2224
genericDeviceAction: acceptTransaction,
2325
testTimeout: 6 * 60 * 1000,
@@ -96,12 +98,11 @@ const aptosSpecs: AppSpec<Transaction> = {
9698
const senderTokenAcc = findTokenSubAccountWithBalance(account);
9799
invariant(senderTokenAcc, "Sender token account with available balance not found");
98100

99-
const token = senderTokenAcc.token;
100-
const siblingWithoutToken = siblings.find(acc => !findTokenSubAccount(acc, token.id));
101-
invariant(siblingWithoutToken, `Recipient without ${token.ticker} ATA not found`);
101+
const receiverTokenAcc = siblings.find(acc => findTokenSubAccountWithBalance(acc));
102+
invariant(receiverTokenAcc, "Recipient not found");
102103

103-
const amount = senderTokenAcc.balance.div(1.9 + 0.2 * Math.random()).integerValue();
104-
const recipient = siblingWithoutToken.freshAddress;
104+
const amount = senderTokenAcc.spendableBalance.div(2).integerValue();
105+
const recipient = receiverTokenAcc.freshAddress;
105106
const transaction = bridge.createTransaction(account);
106107
const subAccountId = senderTokenAcc.id;
107108

@@ -123,12 +124,6 @@ function findTokenSubAccountWithBalance(account: Account) {
123124
| undefined;
124125
}
125126

126-
function findTokenSubAccount(account: Account, tokenId: string) {
127-
return account.subAccounts?.find(
128-
acc => acc.type === "TokenAccount" && acc.token.id === tokenId,
129-
) as TokenAccount | undefined;
130-
}
131-
132127
function expectTokenAccountCorrectBalanceChange({
133128
account,
134129
accountBeforeTransaction,

libs/coin-modules/coin-aptos/src/test/speculos-deviceActions.ts

+7-19
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,23 @@ export const acceptTransaction: DeviceAction<Transaction, State<Transaction>> =
1010
button: SpeculosButton.RIGHT,
1111
},
1212
{
13-
title: "Transaction",
13+
title: "Transaction Type",
1414
button: SpeculosButton.RIGHT,
1515
},
1616
{
1717
title: "Function",
1818
button: SpeculosButton.RIGHT,
1919
},
2020
{
21-
title: "Coin Type",
22-
button: SpeculosButton.RIGHT,
23-
},
24-
{
25-
title: "Receiver (1/2)",
21+
title: "Amount",
2622
button: SpeculosButton.RIGHT,
2723
},
2824
{
29-
title: "Receiver (2/2)",
25+
title: "To (1/2)",
3026
button: SpeculosButton.RIGHT,
3127
},
3228
{
33-
title: "Amount",
29+
title: "To (2/2)",
3430
button: SpeculosButton.RIGHT,
3531
},
3632
{
@@ -62,23 +58,15 @@ export const acceptTokenTransaction: DeviceAction<
6258
button: SpeculosButton.RIGHT,
6359
},
6460
{
65-
title: "Coin Type (1/2)",
66-
button: SpeculosButton.RIGHT,
67-
},
68-
{
69-
title: "Coin Type (2/2)",
70-
button: SpeculosButton.RIGHT,
71-
},
72-
{
73-
title: "Receiver (1/2)",
61+
title: "Amount",
7462
button: SpeculosButton.RIGHT,
7563
},
7664
{
77-
title: "Receiver (2/2)",
65+
title: "To (1/2)",
7866
button: SpeculosButton.RIGHT,
7967
},
8068
{
81-
title: "Amount",
69+
title: "To (2/2)",
8270
button: SpeculosButton.RIGHT,
8371
},
8472
{

0 commit comments

Comments
 (0)