@ledgerhq/coin-aptos 1.9.5 → 1.10.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/__tests__/api/index.test.js +61 -5
- package/lib/__tests__/api/index.test.js.map +1 -1
- package/lib/__tests__/bridge/buildTransaction.test.js +57 -2
- package/lib/__tests__/bridge/buildTransaction.test.js.map +1 -1
- package/lib/__tests__/bridge/getFeesForTransaction.test.js +109 -8
- package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
- package/lib/__tests__/bridge/getTransactionStatus.test.js +175 -37
- package/lib/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
- package/lib/__tests__/bridge/logic.test.js +889 -115
- package/lib/__tests__/bridge/logic.test.js.map +1 -1
- package/lib/__tests__/bridge/signOperation.test.js +128 -2
- package/lib/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib/__tests__/bridge/synchronisation.test.js +1214 -67
- package/lib/__tests__/bridge/synchronisation.test.js.map +1 -1
- package/lib/api/graphql/queries.js +6 -6
- package/lib/api/graphql/types.d.ts +9 -9
- package/lib/api/graphql/types.d.ts.map +1 -1
- package/lib/api/index.d.ts +5 -2
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +30 -4
- package/lib/api/index.js.map +1 -1
- package/lib/bridge/bridge.fixture.d.ts +2 -0
- package/lib/bridge/bridge.fixture.d.ts.map +1 -1
- package/lib/bridge/bridge.fixture.js +85 -13
- package/lib/bridge/bridge.fixture.js.map +1 -1
- package/lib/bridge/buildTransaction.d.ts.map +1 -1
- package/lib/bridge/buildTransaction.js +29 -3
- package/lib/bridge/buildTransaction.js.map +1 -1
- package/lib/bridge/estimateMaxSpendable.js +1 -1
- package/lib/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib/bridge/getFeesForTransaction.js +12 -7
- package/lib/bridge/getFeesForTransaction.js.map +1 -1
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +28 -14
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/logic.d.ts +13 -8
- package/lib/bridge/logic.d.ts.map +1 -1
- package/lib/bridge/logic.js +152 -54
- package/lib/bridge/logic.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +2 -2
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +17 -3
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/bridge/synchronisation.d.ts +15 -0
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +127 -4
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/constants.d.ts +5 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +6 -2
- package/lib/constants.js.map +1 -1
- package/lib/test/bot-specs.d.ts.map +1 -1
- package/lib/test/bot-specs.js +40 -1
- package/lib/test/bot-specs.js.map +1 -1
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib/test/bridgeDatasetTest.js +44 -62
- package/lib/test/bridgeDatasetTest.js.map +1 -1
- package/lib/test/speculos-deviceActions.d.ts +1 -0
- package/lib/test/speculos-deviceActions.d.ts.map +1 -1
- package/lib/test/speculos-deviceActions.js +37 -5
- package/lib/test/speculos-deviceActions.js.map +1 -1
- package/lib/types/index.d.ts +18 -7
- package/lib/types/index.d.ts.map +1 -1
- package/lib-es/__tests__/api/index.test.js +61 -5
- package/lib-es/__tests__/api/index.test.js.map +1 -1
- package/lib-es/__tests__/bridge/buildTransaction.test.js +58 -3
- package/lib-es/__tests__/bridge/buildTransaction.test.js.map +1 -1
- package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +110 -9
- package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
- package/lib-es/__tests__/bridge/getTransactionStatus.test.js +177 -39
- package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
- package/lib-es/__tests__/bridge/logic.test.js +891 -117
- package/lib-es/__tests__/bridge/logic.test.js.map +1 -1
- package/lib-es/__tests__/bridge/signOperation.test.js +128 -2
- package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -1
- package/lib-es/__tests__/bridge/synchronisation.test.js +1213 -69
- package/lib-es/__tests__/bridge/synchronisation.test.js.map +1 -1
- package/lib-es/api/graphql/queries.js +6 -6
- package/lib-es/api/graphql/types.d.ts +9 -9
- package/lib-es/api/graphql/types.d.ts.map +1 -1
- package/lib-es/api/index.d.ts +5 -2
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +30 -4
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/bridge/bridge.fixture.d.ts +2 -0
- package/lib-es/bridge/bridge.fixture.d.ts.map +1 -1
- package/lib-es/bridge/bridge.fixture.js +82 -12
- package/lib-es/bridge/bridge.fixture.js.map +1 -1
- package/lib-es/bridge/buildTransaction.d.ts.map +1 -1
- package/lib-es/bridge/buildTransaction.js +30 -4
- package/lib-es/bridge/buildTransaction.js.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
- package/lib-es/bridge/getFeesForTransaction.js +13 -8
- package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +28 -14
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/logic.d.ts +13 -8
- package/lib-es/bridge/logic.d.ts.map +1 -1
- package/lib-es/bridge/logic.js +146 -52
- package/lib-es/bridge/logic.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +2 -2
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/signOperation.js +17 -3
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/bridge/synchronisation.d.ts +15 -0
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +123 -3
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/constants.d.ts +5 -1
- package/lib-es/constants.d.ts.map +1 -1
- package/lib-es/constants.js +5 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/test/bot-specs.d.ts.map +1 -1
- package/lib-es/test/bot-specs.js +41 -2
- package/lib-es/test/bot-specs.js.map +1 -1
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
- package/lib-es/test/bridgeDatasetTest.js +44 -59
- package/lib-es/test/bridgeDatasetTest.js.map +1 -1
- package/lib-es/test/speculos-deviceActions.d.ts +1 -0
- package/lib-es/test/speculos-deviceActions.d.ts.map +1 -1
- package/lib-es/test/speculos-deviceActions.js +36 -4
- package/lib-es/test/speculos-deviceActions.js.map +1 -1
- package/lib-es/types/index.d.ts +18 -7
- package/lib-es/types/index.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/__tests__/api/index.test.ts +75 -5
- package/src/__tests__/bridge/buildTransaction.test.ts +85 -3
- package/src/__tests__/bridge/getFeesForTransaction.test.ts +144 -9
- package/src/__tests__/bridge/getTransactionStatus.test.ts +217 -38
- package/src/__tests__/bridge/logic.test.ts +922 -118
- package/src/__tests__/bridge/signOperation.test.ts +141 -2
- package/src/__tests__/bridge/synchronisation.test.ts +1265 -71
- package/src/api/graphql/queries.ts +6 -6
- package/src/api/graphql/types.ts +9 -9
- package/src/api/index.ts +32 -5
- package/src/bridge/bridge.fixture.ts +91 -12
- package/src/bridge/buildTransaction.ts +39 -6
- package/src/bridge/estimateMaxSpendable.ts +1 -1
- package/src/bridge/getFeesForTransaction.ts +14 -9
- package/src/bridge/getTransactionStatus.ts +35 -13
- package/src/bridge/logic.ts +202 -63
- package/src/bridge/prepareTransaction.ts +4 -3
- package/src/bridge/signOperation.ts +19 -3
- package/src/bridge/synchronisation.ts +170 -3
- package/src/constants.ts +12 -1
- package/src/test/bot-specs.ts +63 -3
- package/src/test/bridgeDatasetTest.ts +46 -59
- package/src/test/speculos-deviceActions.ts +40 -4
- package/src/types/index.ts +15 -1
package/src/test/bot-specs.ts
CHANGED
|
@@ -5,8 +5,9 @@ import BigNumber from "bignumber.js";
|
|
|
5
5
|
import type { Transaction } from "../types";
|
|
6
6
|
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
|
7
7
|
import { genericTestDestination, pickSiblings, botTest } from "@ledgerhq/coin-framework/bot/specs";
|
|
8
|
-
import type { AppSpec } from "@ledgerhq/coin-framework/bot/types";
|
|
9
|
-
import { acceptTransaction } from "./speculos-deviceActions";
|
|
8
|
+
import type { AppSpec, TransactionTestInput } from "@ledgerhq/coin-framework/bot/types";
|
|
9
|
+
import { acceptTokenTransaction, acceptTransaction } from "./speculos-deviceActions";
|
|
10
|
+
import { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
10
11
|
|
|
11
12
|
const MIN_SAFE = new BigNumber(0.0001);
|
|
12
13
|
const maxAccount = 6;
|
|
@@ -19,7 +20,7 @@ const aptosSpecs: AppSpec<Transaction> = {
|
|
|
19
20
|
appName: "Aptos",
|
|
20
21
|
},
|
|
21
22
|
genericDeviceAction: acceptTransaction,
|
|
22
|
-
testTimeout:
|
|
23
|
+
testTimeout: 2 * 60 * 1000,
|
|
23
24
|
minViableAmount: MIN_SAFE,
|
|
24
25
|
transactionCheck: ({ maxSpendable }) => {
|
|
25
26
|
invariant(maxSpendable.gt(MIN_SAFE), "balance is too low");
|
|
@@ -84,9 +85,68 @@ const aptosSpecs: AppSpec<Transaction> = {
|
|
|
84
85
|
);
|
|
85
86
|
},
|
|
86
87
|
},
|
|
88
|
+
{
|
|
89
|
+
name: "Send ~50% of token amount",
|
|
90
|
+
feature: "tokens",
|
|
91
|
+
maxRun: 1,
|
|
92
|
+
deviceAction: acceptTokenTransaction,
|
|
93
|
+
transaction: ({ account, bridge, siblings, maxSpendable }) => {
|
|
94
|
+
invariant(maxSpendable.gt(MIN_SAFE), "Balance is too low");
|
|
95
|
+
|
|
96
|
+
const senderTokenAcc = findTokenSubAccountWithBalance(account);
|
|
97
|
+
invariant(senderTokenAcc, "Sender token account with available balance not found");
|
|
98
|
+
|
|
99
|
+
const sibling = pickSiblings(siblings, maxAccount);
|
|
100
|
+
|
|
101
|
+
const recipientTokenAcc = findTokenSubAccountWithBalance(sibling);
|
|
102
|
+
invariant(recipientTokenAcc, "Receiver token account with available balance not found");
|
|
103
|
+
|
|
104
|
+
const amount = senderTokenAcc.spendableBalance.div(2).integerValue();
|
|
105
|
+
const recipient = sibling.freshAddress;
|
|
106
|
+
const transaction = bridge.createTransaction(account);
|
|
107
|
+
const subAccountId = senderTokenAcc.id;
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
transaction,
|
|
111
|
+
updates: [{ subAccountId }, { recipient }, { amount }],
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
test: input => {
|
|
115
|
+
expectTokenAccountCorrectBalanceChange(input);
|
|
116
|
+
},
|
|
117
|
+
},
|
|
87
118
|
],
|
|
88
119
|
};
|
|
89
120
|
|
|
121
|
+
function findTokenSubAccountWithBalance(account: Account) {
|
|
122
|
+
return account.subAccounts?.find(acc => acc.type === "TokenAccount" && acc.balance.gt(0)) as
|
|
123
|
+
| TokenAccount
|
|
124
|
+
| undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function expectTokenAccountCorrectBalanceChange({
|
|
128
|
+
account,
|
|
129
|
+
accountBeforeTransaction,
|
|
130
|
+
status,
|
|
131
|
+
transaction,
|
|
132
|
+
}: TransactionTestInput<Transaction>) {
|
|
133
|
+
const tokenAccId = transaction.subAccountId;
|
|
134
|
+
if (!tokenAccId) throw new Error("Wrong subAccountId");
|
|
135
|
+
|
|
136
|
+
const tokenAccAfterTx = account.subAccounts?.find(acc => acc.id === tokenAccId);
|
|
137
|
+
const tokenAccBeforeTx = accountBeforeTransaction.subAccounts?.find(acc => acc.id === tokenAccId);
|
|
138
|
+
|
|
139
|
+
if (!tokenAccAfterTx || !tokenAccBeforeTx) {
|
|
140
|
+
throw new Error("Token sub accounts not found!");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
botTest("Token balance decreased with operation", () =>
|
|
144
|
+
expect(tokenAccAfterTx.balance.toString()).toBe(
|
|
145
|
+
tokenAccBeforeTx.balance.minus(status.amount).toString(),
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
90
150
|
export default {
|
|
91
151
|
aptosSpecs,
|
|
92
152
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CurrenciesData, DatasetTest } from "@ledgerhq/types-live";
|
|
2
|
-
import BigNumber from "bignumber.js";
|
|
3
|
-
import { fromTransactionRaw } from "../bridge/transaction";
|
|
4
2
|
import { Transaction } from "../types";
|
|
5
3
|
|
|
6
4
|
const aptos: CurrenciesData<Transaction> = {
|
|
@@ -21,86 +19,75 @@ const aptos: CurrenciesData<Transaction> = {
|
|
|
21
19
|
],
|
|
22
20
|
accounts: [
|
|
23
21
|
{
|
|
22
|
+
FIXME_tests: ["balance is sum of ops"],
|
|
24
23
|
raw: {
|
|
25
|
-
id: "js:2:aptos:d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956:",
|
|
24
|
+
id: "js:2:aptos:d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956:aptos",
|
|
26
25
|
seedIdentifier: "d6816f4f22f867b56cf9304b776f452a16d107835d73ee8a33c4ced210300583",
|
|
27
26
|
used: true,
|
|
28
|
-
derivationMode: "",
|
|
27
|
+
derivationMode: "aptos",
|
|
29
28
|
index: 0,
|
|
30
29
|
freshAddress: "0x445fa0013887abd1a0c14acdec6e48090e0ad3fed3e08202aac15ca14f3be26b",
|
|
31
30
|
freshAddressPath: "44'/637'/0'/0'/0'",
|
|
32
|
-
blockHeight:
|
|
31
|
+
blockHeight: 302459501,
|
|
33
32
|
creationDate: "2024-12-18T12:26:31.070Z",
|
|
34
|
-
operationsCount:
|
|
33
|
+
operationsCount: 6,
|
|
35
34
|
operations: [],
|
|
36
35
|
pendingOperations: [],
|
|
37
36
|
currencyId: "aptos",
|
|
38
|
-
lastSyncDate: "2025-
|
|
39
|
-
balance: "
|
|
40
|
-
spendableBalance: "
|
|
37
|
+
lastSyncDate: "2025-03-12T10:42:53.570Z",
|
|
38
|
+
balance: "19949100",
|
|
39
|
+
spendableBalance: "19949100",
|
|
41
40
|
balanceHistoryCache: {
|
|
42
41
|
HOUR: {
|
|
43
42
|
balances: [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
54
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
55
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
56
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
57
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
58
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
59
|
-
30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
|
|
60
|
-
30100,
|
|
43
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
44
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
45
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
46
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
47
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
48
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
49
|
+
0, 19949100, 19949100, 19949100, 19949100, 19949100, 19949100, 19949100, 19949100,
|
|
50
|
+
19949100, 19949100, 19949100, 19949100, 19949100, 19949100, 19949100, 19949100,
|
|
51
|
+
19949100, 19949100,
|
|
61
52
|
],
|
|
62
|
-
latestDate:
|
|
53
|
+
latestDate: 1741773600000,
|
|
63
54
|
},
|
|
64
55
|
DAY: {
|
|
65
56
|
balances: [
|
|
66
|
-
0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
58
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
59
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
60
|
+
19949100,
|
|
70
61
|
],
|
|
71
|
-
latestDate:
|
|
72
|
-
},
|
|
73
|
-
WEEK: {
|
|
74
|
-
balances: [0, 30100, 30100, 30100, 30100, 30100, 30100, 30100],
|
|
75
|
-
latestDate: 1738454400000,
|
|
62
|
+
latestDate: 1741737600000,
|
|
76
63
|
},
|
|
64
|
+
WEEK: { balances: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], latestDate: 1741478400000 },
|
|
77
65
|
},
|
|
78
66
|
xpub: "d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956",
|
|
67
|
+
subAccounts: [
|
|
68
|
+
{
|
|
69
|
+
type: "TokenAccountRaw",
|
|
70
|
+
id: "js:2:aptos:d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956:aptos+aptos%2Fcoin%2Fdstapt~!underscore!~0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5%3A%3Astaked~!underscore!~coin%3A%3Astakedaptos",
|
|
71
|
+
parentId:
|
|
72
|
+
"js:2:aptos:d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956:aptos",
|
|
73
|
+
tokenId:
|
|
74
|
+
"aptos/coin/dstapt_0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::stakedaptos",
|
|
75
|
+
balance: "30000000",
|
|
76
|
+
spendableBalance: "30000000",
|
|
77
|
+
balanceHistoryCache: {
|
|
78
|
+
HOUR: { latestDate: null, balances: [] },
|
|
79
|
+
DAY: { latestDate: null, balances: [] },
|
|
80
|
+
WEEK: { latestDate: null, balances: [] },
|
|
81
|
+
},
|
|
82
|
+
creationDate: "2025-03-12T10:42:53.570Z",
|
|
83
|
+
operationsCount: 2,
|
|
84
|
+
operations: [],
|
|
85
|
+
pendingOperations: [],
|
|
86
|
+
swapHistory: [],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
79
89
|
swapHistory: [],
|
|
80
90
|
},
|
|
81
|
-
transactions: [
|
|
82
|
-
{
|
|
83
|
-
name: "NO_NAME",
|
|
84
|
-
transaction: fromTransactionRaw({
|
|
85
|
-
amount: "1000",
|
|
86
|
-
recipient: "0xd20fa44192f94ba086ab16bfdf57e43ff118ada69b4c66fa9b9a9223cbc068c1",
|
|
87
|
-
useAllAmount: false,
|
|
88
|
-
subAccountId: null,
|
|
89
|
-
family: "aptos",
|
|
90
|
-
mode: "send",
|
|
91
|
-
fees: "900",
|
|
92
|
-
options: '{"maxGasAmount":"9","gasUnitPrice":"100"}',
|
|
93
|
-
errors: "{}",
|
|
94
|
-
}),
|
|
95
|
-
expectedStatus: () =>
|
|
96
|
-
// you can use account and transaction for smart logic. drop the =>fn otherwise
|
|
97
|
-
({
|
|
98
|
-
errors: {},
|
|
99
|
-
warnings: {},
|
|
100
|
-
amount: BigNumber("1000"),
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
91
|
},
|
|
105
92
|
],
|
|
106
93
|
};
|
|
@@ -10,7 +10,7 @@ export const acceptTransaction: DeviceAction<Transaction, State<Transaction>> =
|
|
|
10
10
|
button: SpeculosButton.RIGHT,
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
title: "Transaction",
|
|
13
|
+
title: "Transaction Type",
|
|
14
14
|
button: SpeculosButton.RIGHT,
|
|
15
15
|
},
|
|
16
16
|
{
|
|
@@ -18,21 +18,57 @@ export const acceptTransaction: DeviceAction<Transaction, State<Transaction>> =
|
|
|
18
18
|
button: SpeculosButton.RIGHT,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
title: "
|
|
21
|
+
title: "Amount",
|
|
22
|
+
button: SpeculosButton.RIGHT,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "To (1/2)",
|
|
26
|
+
button: SpeculosButton.RIGHT,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "To (2/2)",
|
|
30
|
+
button: SpeculosButton.RIGHT,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: "Gas Fee",
|
|
34
|
+
button: SpeculosButton.RIGHT,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: "Approve",
|
|
38
|
+
button: SpeculosButton.BOTH,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const acceptTokenTransaction: DeviceAction<
|
|
44
|
+
Transaction,
|
|
45
|
+
State<Transaction>
|
|
46
|
+
> = deviceActionFlow({
|
|
47
|
+
steps: [
|
|
48
|
+
{
|
|
49
|
+
title: "Review",
|
|
22
50
|
button: SpeculosButton.RIGHT,
|
|
23
51
|
},
|
|
24
52
|
{
|
|
25
|
-
title: "
|
|
53
|
+
title: "Transaction Type",
|
|
26
54
|
button: SpeculosButton.RIGHT,
|
|
27
55
|
},
|
|
28
56
|
{
|
|
29
|
-
title: "
|
|
57
|
+
title: "Function",
|
|
30
58
|
button: SpeculosButton.RIGHT,
|
|
31
59
|
},
|
|
32
60
|
{
|
|
33
61
|
title: "Amount",
|
|
34
62
|
button: SpeculosButton.RIGHT,
|
|
35
63
|
},
|
|
64
|
+
{
|
|
65
|
+
title: "To (1/2)",
|
|
66
|
+
button: SpeculosButton.RIGHT,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "To (2/2)",
|
|
70
|
+
button: SpeculosButton.RIGHT,
|
|
71
|
+
},
|
|
36
72
|
{
|
|
37
73
|
title: "Gas Fee",
|
|
38
74
|
button: SpeculosButton.RIGHT,
|
package/src/types/index.ts
CHANGED
|
@@ -69,6 +69,20 @@ export type TransactionRaw = TransactionCommonRaw & {
|
|
|
69
69
|
errors?: string;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
export type AptosFungibleStoreResourceData = {
|
|
73
|
+
balance: BigNumber;
|
|
74
|
+
frozen: boolean;
|
|
75
|
+
metadata: { inner: string };
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type AptosFungibleoObjectCoreResourceData = {
|
|
79
|
+
owner: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type AptosMoveResourceData = {
|
|
83
|
+
guid: { id: { addr: string; creation_num: string } };
|
|
84
|
+
};
|
|
85
|
+
|
|
72
86
|
export type AptosMoveResource = {
|
|
73
|
-
[key: string]:
|
|
87
|
+
[key: string]: AptosMoveResourceData;
|
|
74
88
|
};
|