@ledgerhq/coin-aptos 1.9.6-next.0 → 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.
Files changed (158) hide show
  1. package/CHANGELOG.md +13 -4
  2. package/lib/__tests__/api/index.test.js +61 -5
  3. package/lib/__tests__/api/index.test.js.map +1 -1
  4. package/lib/__tests__/bridge/buildTransaction.test.js +57 -2
  5. package/lib/__tests__/bridge/buildTransaction.test.js.map +1 -1
  6. package/lib/__tests__/bridge/getFeesForTransaction.test.js +109 -8
  7. package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
  8. package/lib/__tests__/bridge/getTransactionStatus.test.js +175 -37
  9. package/lib/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
  10. package/lib/__tests__/bridge/logic.test.js +889 -115
  11. package/lib/__tests__/bridge/logic.test.js.map +1 -1
  12. package/lib/__tests__/bridge/signOperation.test.js +128 -2
  13. package/lib/__tests__/bridge/signOperation.test.js.map +1 -1
  14. package/lib/__tests__/bridge/synchronisation.test.js +1214 -67
  15. package/lib/__tests__/bridge/synchronisation.test.js.map +1 -1
  16. package/lib/api/graphql/queries.js +6 -6
  17. package/lib/api/graphql/types.d.ts +9 -9
  18. package/lib/api/graphql/types.d.ts.map +1 -1
  19. package/lib/api/index.d.ts +5 -2
  20. package/lib/api/index.d.ts.map +1 -1
  21. package/lib/api/index.js +30 -4
  22. package/lib/api/index.js.map +1 -1
  23. package/lib/bridge/bridge.fixture.d.ts +2 -0
  24. package/lib/bridge/bridge.fixture.d.ts.map +1 -1
  25. package/lib/bridge/bridge.fixture.js +85 -13
  26. package/lib/bridge/bridge.fixture.js.map +1 -1
  27. package/lib/bridge/buildTransaction.d.ts.map +1 -1
  28. package/lib/bridge/buildTransaction.js +29 -3
  29. package/lib/bridge/buildTransaction.js.map +1 -1
  30. package/lib/bridge/estimateMaxSpendable.js +1 -1
  31. package/lib/bridge/estimateMaxSpendable.js.map +1 -1
  32. package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
  33. package/lib/bridge/getFeesForTransaction.js +12 -7
  34. package/lib/bridge/getFeesForTransaction.js.map +1 -1
  35. package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
  36. package/lib/bridge/getTransactionStatus.js +28 -14
  37. package/lib/bridge/getTransactionStatus.js.map +1 -1
  38. package/lib/bridge/logic.d.ts +13 -8
  39. package/lib/bridge/logic.d.ts.map +1 -1
  40. package/lib/bridge/logic.js +152 -54
  41. package/lib/bridge/logic.js.map +1 -1
  42. package/lib/bridge/prepareTransaction.d.ts.map +1 -1
  43. package/lib/bridge/prepareTransaction.js +2 -2
  44. package/lib/bridge/prepareTransaction.js.map +1 -1
  45. package/lib/bridge/signOperation.d.ts.map +1 -1
  46. package/lib/bridge/signOperation.js +17 -3
  47. package/lib/bridge/signOperation.js.map +1 -1
  48. package/lib/bridge/synchronisation.d.ts +15 -0
  49. package/lib/bridge/synchronisation.d.ts.map +1 -1
  50. package/lib/bridge/synchronisation.js +127 -4
  51. package/lib/bridge/synchronisation.js.map +1 -1
  52. package/lib/constants.d.ts +5 -1
  53. package/lib/constants.d.ts.map +1 -1
  54. package/lib/constants.js +6 -2
  55. package/lib/constants.js.map +1 -1
  56. package/lib/test/bot-specs.d.ts.map +1 -1
  57. package/lib/test/bot-specs.js +40 -1
  58. package/lib/test/bot-specs.js.map +1 -1
  59. package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
  60. package/lib/test/bridgeDatasetTest.js +44 -62
  61. package/lib/test/bridgeDatasetTest.js.map +1 -1
  62. package/lib/test/speculos-deviceActions.d.ts +1 -0
  63. package/lib/test/speculos-deviceActions.d.ts.map +1 -1
  64. package/lib/test/speculos-deviceActions.js +37 -5
  65. package/lib/test/speculos-deviceActions.js.map +1 -1
  66. package/lib/types/index.d.ts +18 -7
  67. package/lib/types/index.d.ts.map +1 -1
  68. package/lib-es/__tests__/api/index.test.js +61 -5
  69. package/lib-es/__tests__/api/index.test.js.map +1 -1
  70. package/lib-es/__tests__/bridge/buildTransaction.test.js +58 -3
  71. package/lib-es/__tests__/bridge/buildTransaction.test.js.map +1 -1
  72. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +110 -9
  73. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +1 -1
  74. package/lib-es/__tests__/bridge/getTransactionStatus.test.js +177 -39
  75. package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +1 -1
  76. package/lib-es/__tests__/bridge/logic.test.js +891 -117
  77. package/lib-es/__tests__/bridge/logic.test.js.map +1 -1
  78. package/lib-es/__tests__/bridge/signOperation.test.js +128 -2
  79. package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -1
  80. package/lib-es/__tests__/bridge/synchronisation.test.js +1213 -69
  81. package/lib-es/__tests__/bridge/synchronisation.test.js.map +1 -1
  82. package/lib-es/api/graphql/queries.js +6 -6
  83. package/lib-es/api/graphql/types.d.ts +9 -9
  84. package/lib-es/api/graphql/types.d.ts.map +1 -1
  85. package/lib-es/api/index.d.ts +5 -2
  86. package/lib-es/api/index.d.ts.map +1 -1
  87. package/lib-es/api/index.js +30 -4
  88. package/lib-es/api/index.js.map +1 -1
  89. package/lib-es/bridge/bridge.fixture.d.ts +2 -0
  90. package/lib-es/bridge/bridge.fixture.d.ts.map +1 -1
  91. package/lib-es/bridge/bridge.fixture.js +82 -12
  92. package/lib-es/bridge/bridge.fixture.js.map +1 -1
  93. package/lib-es/bridge/buildTransaction.d.ts.map +1 -1
  94. package/lib-es/bridge/buildTransaction.js +30 -4
  95. package/lib-es/bridge/buildTransaction.js.map +1 -1
  96. package/lib-es/bridge/estimateMaxSpendable.js +1 -1
  97. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
  98. package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
  99. package/lib-es/bridge/getFeesForTransaction.js +13 -8
  100. package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
  101. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
  102. package/lib-es/bridge/getTransactionStatus.js +28 -14
  103. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  104. package/lib-es/bridge/logic.d.ts +13 -8
  105. package/lib-es/bridge/logic.d.ts.map +1 -1
  106. package/lib-es/bridge/logic.js +146 -52
  107. package/lib-es/bridge/logic.js.map +1 -1
  108. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
  109. package/lib-es/bridge/prepareTransaction.js +2 -2
  110. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  111. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  112. package/lib-es/bridge/signOperation.js +17 -3
  113. package/lib-es/bridge/signOperation.js.map +1 -1
  114. package/lib-es/bridge/synchronisation.d.ts +15 -0
  115. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  116. package/lib-es/bridge/synchronisation.js +123 -3
  117. package/lib-es/bridge/synchronisation.js.map +1 -1
  118. package/lib-es/constants.d.ts +5 -1
  119. package/lib-es/constants.d.ts.map +1 -1
  120. package/lib-es/constants.js +5 -1
  121. package/lib-es/constants.js.map +1 -1
  122. package/lib-es/test/bot-specs.d.ts.map +1 -1
  123. package/lib-es/test/bot-specs.js +41 -2
  124. package/lib-es/test/bot-specs.js.map +1 -1
  125. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
  126. package/lib-es/test/bridgeDatasetTest.js +44 -59
  127. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  128. package/lib-es/test/speculos-deviceActions.d.ts +1 -0
  129. package/lib-es/test/speculos-deviceActions.d.ts.map +1 -1
  130. package/lib-es/test/speculos-deviceActions.js +36 -4
  131. package/lib-es/test/speculos-deviceActions.js.map +1 -1
  132. package/lib-es/types/index.d.ts +18 -7
  133. package/lib-es/types/index.d.ts.map +1 -1
  134. package/package.json +9 -8
  135. package/src/__tests__/api/index.test.ts +75 -5
  136. package/src/__tests__/bridge/buildTransaction.test.ts +85 -3
  137. package/src/__tests__/bridge/getFeesForTransaction.test.ts +144 -9
  138. package/src/__tests__/bridge/getTransactionStatus.test.ts +217 -38
  139. package/src/__tests__/bridge/logic.test.ts +922 -118
  140. package/src/__tests__/bridge/signOperation.test.ts +141 -2
  141. package/src/__tests__/bridge/synchronisation.test.ts +1265 -71
  142. package/src/api/graphql/queries.ts +6 -6
  143. package/src/api/graphql/types.ts +9 -9
  144. package/src/api/index.ts +32 -5
  145. package/src/bridge/bridge.fixture.ts +91 -12
  146. package/src/bridge/buildTransaction.ts +39 -6
  147. package/src/bridge/estimateMaxSpendable.ts +1 -1
  148. package/src/bridge/getFeesForTransaction.ts +14 -9
  149. package/src/bridge/getTransactionStatus.ts +35 -13
  150. package/src/bridge/logic.ts +202 -63
  151. package/src/bridge/prepareTransaction.ts +4 -3
  152. package/src/bridge/signOperation.ts +19 -3
  153. package/src/bridge/synchronisation.ts +170 -3
  154. package/src/constants.ts +12 -1
  155. package/src/test/bot-specs.ts +63 -3
  156. package/src/test/bridgeDatasetTest.ts +46 -59
  157. package/src/test/speculos-deviceActions.ts +40 -4
  158. package/src/types/index.ts +15 -1
@@ -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: 6 * 60 * 1000,
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: 286066372,
31
+ blockHeight: 302459501,
33
32
  creationDate: "2024-12-18T12:26:31.070Z",
34
- operationsCount: 5,
33
+ operationsCount: 6,
35
34
  operations: [],
36
35
  pendingOperations: [],
37
36
  currencyId: "aptos",
38
- lastSyncDate: "2025-02-04T14:00:46.693Z",
39
- balance: "30100",
40
- spendableBalance: "30100",
37
+ lastSyncDate: "2025-03-12T10:42:53.570Z",
38
+ balance: "19949100",
39
+ spendableBalance: "19949100",
41
40
  balanceHistoryCache: {
42
41
  HOUR: {
43
42
  balances: [
44
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
45
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
46
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
47
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
48
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
49
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
50
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
51
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
52
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
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: 1738677600000,
53
+ latestDate: 1741773600000,
63
54
  },
64
55
  DAY: {
65
56
  balances: [
66
- 0, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
67
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
68
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
69
- 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100, 30100,
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: 1738627200000,
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: "Coin Type",
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: "Receiver (1/2)",
53
+ title: "Transaction Type",
26
54
  button: SpeculosButton.RIGHT,
27
55
  },
28
56
  {
29
- title: "Receiver (2/2)",
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,
@@ -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]: { guid: { id: { addr: string; creation_num: string } } };
87
+ [key: string]: AptosMoveResourceData;
74
88
  };