@ledgerhq/coin-aptos 2.4.0 → 2.5.0-nightly.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -0
- package/lib/__tests__/api/craftTransaction.unit.test.js +16 -31
- package/lib/__tests__/api/craftTransaction.unit.test.js.map +1 -1
- package/lib/__tests__/api/index.integ.test.js +14 -7
- package/lib/__tests__/api/index.integ.test.js.map +1 -1
- package/lib/__tests__/api/index.test.js.map +1 -1
- package/lib/__tests__/network/client.test.js +6 -3
- package/lib/__tests__/network/client.test.js.map +1 -1
- package/lib/api/index.d.ts +3 -3
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +2 -2
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +3 -3
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/network/client.d.ts +2 -2
- package/lib/network/client.d.ts.map +1 -1
- package/lib/network/client.js +3 -2
- package/lib/network/client.js.map +1 -1
- package/lib/types/assets.d.ts +0 -4
- package/lib/types/assets.d.ts.map +1 -1
- package/lib-es/__tests__/api/craftTransaction.unit.test.js +16 -31
- package/lib-es/__tests__/api/craftTransaction.unit.test.js.map +1 -1
- package/lib-es/__tests__/api/index.integ.test.js +14 -7
- package/lib-es/__tests__/api/index.integ.test.js.map +1 -1
- package/lib-es/__tests__/api/index.test.js.map +1 -1
- package/lib-es/__tests__/network/client.test.js +6 -3
- package/lib-es/__tests__/network/client.test.js.map +1 -1
- package/lib-es/api/index.d.ts +3 -3
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +2 -2
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +3 -3
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/network/client.d.ts +2 -2
- package/lib-es/network/client.d.ts.map +1 -1
- package/lib-es/network/client.js +3 -2
- package/lib-es/network/client.js.map +1 -1
- package/lib-es/types/assets.d.ts +0 -4
- package/lib-es/types/assets.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/api/craftTransaction.unit.test.ts +22 -37
- package/src/__tests__/api/index.integ.test.ts +17 -11
- package/src/__tests__/api/index.test.ts +4 -6
- package/src/__tests__/network/client.test.ts +13 -10
- package/src/api/index.ts +4 -6
- package/src/logic/craftTransaction.ts +6 -8
- package/src/network/client.ts +5 -10
- package/src/types/assets.ts +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TransactionIntent } from "@ledgerhq/coin-framework/lib/api/types";
|
|
2
|
-
import type { AptosAsset
|
|
2
|
+
import type { AptosAsset } from "../types/assets";
|
|
3
3
|
import type { AptosAPI } from "../network";
|
|
4
|
-
export declare function craftTransaction(aptosClient: AptosAPI, transactionIntent: TransactionIntent<AptosAsset
|
|
4
|
+
export declare function craftTransaction(aptosClient: AptosAPI, transactionIntent: TransactionIntent<AptosAsset>): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=craftTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"craftTransaction.d.ts","sourceRoot":"","sources":["../../src/logic/craftTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"craftTransaction.d.ts","sourceRoot":"","sources":["../../src/logic/craftTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,QAAQ,EACrB,iBAAiB,EAAE,iBAAiB,CAAC,UAAU,CAAC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAyCjB"}
|
|
@@ -9,15 +9,15 @@ export async function craftTransaction(aptosClient, transactionIntent) {
|
|
|
9
9
|
newTx.mode = transactionIntent.type;
|
|
10
10
|
newTx.useAllAmount = transactionIntent.amount === BigInt(0);
|
|
11
11
|
const account = {
|
|
12
|
-
freshAddress: transactionIntent.sender
|
|
13
|
-
xpub: transactionIntent.
|
|
12
|
+
freshAddress: transactionIntent.sender,
|
|
13
|
+
xpub: transactionIntent.senderPublicKey,
|
|
14
14
|
subAccounts: new Array(),
|
|
15
15
|
};
|
|
16
16
|
let tokenType;
|
|
17
17
|
const contractAddress = getContractAddress(transactionIntent);
|
|
18
18
|
let balance;
|
|
19
19
|
if (newTx.useAllAmount === true) {
|
|
20
|
-
const balances = await aptosClient.getBalances(transactionIntent.sender
|
|
20
|
+
const balances = await aptosClient.getBalances(transactionIntent.sender);
|
|
21
21
|
balance = balances?.find(b => b.contractAddress.toLowerCase() === contractAddress?.toLowerCase());
|
|
22
22
|
if (balance !== undefined) {
|
|
23
23
|
newTx.amount = BigNumber(balance.amount.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"craftTransaction.js","sourceRoot":"","sources":["../../src/logic/craftTransaction.ts"],"names":[],"mappings":"AAIA,OAAO,gBAAgB,EAAE,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AAG/D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,WAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"craftTransaction.js","sourceRoot":"","sources":["../../src/logic/craftTransaction.ts"],"names":[],"mappings":"AAIA,OAAO,gBAAgB,EAAE,E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,QAAQ,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7C,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAsB,CAAC;IAC7D,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,gBAAgB,CACpC,OAAO,EACP,KAAK,EACL,WAAW,EACX,eAAe,EACf,SAAS,IAAI,SAAS,CACvB,CAAC;IAEF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAuC;IACjE,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5E,OAAO,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC;IACxC,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type AccountData, Ed25519PublicKey, type GasEstimation, type InputEntry
|
|
|
2
2
|
import BigNumber from "bignumber.js";
|
|
3
3
|
import type { AptosBalance, AptosTransaction, TransactionOptions } from "../types";
|
|
4
4
|
import { BlockInfo, FeeEstimation, Operation, Pagination, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
5
|
-
import { AptosAsset
|
|
5
|
+
import { AptosAsset } from "../types/assets";
|
|
6
6
|
export declare class AptosAPI {
|
|
7
7
|
private readonly aptosConfig;
|
|
8
8
|
private readonly aptosClient;
|
|
@@ -23,7 +23,7 @@ export declare class AptosAPI {
|
|
|
23
23
|
}): Promise<UserTransactionResponse[]>;
|
|
24
24
|
broadcast(tx: string): Promise<string>;
|
|
25
25
|
getLastBlock(): Promise<BlockInfo>;
|
|
26
|
-
estimateFees(transactionIntent: TransactionIntent<AptosAsset
|
|
26
|
+
estimateFees(transactionIntent: TransactionIntent<AptosAsset>): Promise<FeeEstimation>;
|
|
27
27
|
listOperations(rawAddress: string, pagination: Pagination): Promise<[Operation<AptosAsset>[], string]>;
|
|
28
28
|
private fetchTransactions;
|
|
29
29
|
private richItemByVersion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/network/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,WAAW,EAGhB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAG3B,KAAK,cAAc,EAGnB,KAAK,uBAAuB,EAE5B,KAAK,aAAa,EAInB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,SAAS,MAAM,cAAc,CAAC;AASrC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMnF,OAAO,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/network/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,WAAW,EAGhB,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAG3B,KAAK,cAAc,EAGnB,KAAK,uBAAuB,EAE5B,KAAK,aAAa,EAInB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,SAAS,MAAM,cAAc,CAAC;AASrC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMnF,OAAO,EACL,SAAS,EACT,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAa7C,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc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25519PublicKey(transactionIntent
|
|
116
|
+
const publicKeyEd = new Ed25519PublicKey(transactionIntent?.senderPublicKey ?? "");
|
|
117
117
|
const txPayload = {
|
|
118
118
|
function: "0x1::aptos_account::transfer_coins",
|
|
119
119
|
typeArguments: [APTOS_ASSET_ID],
|
|
@@ -139,7 +139,7 @@ export class AptosAPI {
|
|
|
139
139
|
maxGasAmount: DEFAULT_GAS.toString(),
|
|
140
140
|
gasUnitPrice: DEFAULT_GAS_PRICE.toString(),
|
|
141
141
|
};
|
|
142
|
-
const tx = await this.generateTransaction(transactionIntent.sender
|
|
142
|
+
const tx = await this.generateTransaction(transactionIntent.sender, txPayload, txOptions);
|
|
143
143
|
const simulation = await this.simulateTransaction(publicKeyEd, tx);
|
|
144
144
|
const completedTx = simulation[0];
|
|
145
145
|
const gasLimit = new BigNumber(completedTx.gas_used).multipliedBy(ESTIMATE_GAS_MUL);
|
|
@@ -148,6 +148,7 @@ export class AptosAPI {
|
|
|
148
148
|
return {
|
|
149
149
|
value: BigInt(expectedGas.toString()),
|
|
150
150
|
parameters: {
|
|
151
|
+
storageLimit: BigInt(0),
|
|
151
152
|
gasLimit: BigInt(gasLimit.toString()),
|
|
152
153
|
gasPrice: BigInt(gasPrice.toString()),
|
|
153
154
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/network/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAEL,KAAK,EACL,WAAW,EACX,gBAAgB,EAIhB,QAAQ,EAOR,GAAG,EACH,iBAAiB,GAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,O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,IAAI,EAAE;gBACnC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;aAC5B,CAAC,CAAC,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE;gBAC7B,KAAK;aACN,CAAC,CAAC;YACH,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF"}
|
package/lib-es/types/assets.d.ts
CHANGED
|
@@ -5,10 +5,6 @@ export type AptosTokenInformation = {
|
|
|
5
5
|
contractAddress: string;
|
|
6
6
|
};
|
|
7
7
|
export type AptosExtra = Record<string, unknown>;
|
|
8
|
-
export type AptosSender = {
|
|
9
|
-
xpub: string;
|
|
10
|
-
freshAddress: string;
|
|
11
|
-
};
|
|
12
8
|
export type AptosFeeParameters = {
|
|
13
9
|
gasLimit: bigint;
|
|
14
10
|
gasPrice: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/types/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/types/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-aptos",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0-nightly.1",
|
|
4
4
|
"description": "Ledger Aptos Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"invariant": "^2.2.4",
|
|
91
91
|
"lodash": "^4.17.21",
|
|
92
92
|
"rxjs": "^7.8.1",
|
|
93
|
-
"@ledgerhq/coin-framework": "^5.
|
|
94
|
-
"@ledgerhq/cryptoassets": "^13.
|
|
93
|
+
"@ledgerhq/coin-framework": "^5.5.0-nightly.1",
|
|
94
|
+
"@ledgerhq/cryptoassets": "^13.21.0-nightly.1",
|
|
95
95
|
"@ledgerhq/devices": "8.4.7",
|
|
96
96
|
"@ledgerhq/errors": "^6.22.0",
|
|
97
97
|
"@ledgerhq/live-env": "^2.11.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hex, RawTransaction, Deserializer } from "@aptos-labs/ts-sdk";
|
|
2
2
|
import type { TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
3
3
|
import { createApi } from "../../api";
|
|
4
|
-
import type { AptosAsset
|
|
4
|
+
import type { AptosAsset } from "../../types/assets";
|
|
5
5
|
import { AptosAPI } from "../../network";
|
|
6
6
|
import { APTOS_ASSET_ID } from "../../constants";
|
|
7
7
|
|
|
@@ -41,20 +41,17 @@ describe("craftTransaction", () => {
|
|
|
41
41
|
getBalances: mockGetBalances,
|
|
42
42
|
}));
|
|
43
43
|
|
|
44
|
-
const SENDER: AptosSender = {
|
|
45
|
-
xpub: "public-key",
|
|
46
|
-
freshAddress: SENDER_ADDR,
|
|
47
|
-
};
|
|
48
44
|
const api = createApi({
|
|
49
45
|
aptosSettings: {},
|
|
50
46
|
});
|
|
51
47
|
|
|
52
|
-
const txArg: TransactionIntent<AptosAsset
|
|
48
|
+
const txArg: TransactionIntent<AptosAsset> = {
|
|
53
49
|
type: "send",
|
|
54
|
-
sender:
|
|
50
|
+
sender: SENDER_ADDR,
|
|
51
|
+
senderPublicKey: "public-key",
|
|
55
52
|
recipient: RECIPIENT_ADDR,
|
|
56
53
|
amount: 10n,
|
|
57
|
-
asset: { type: "
|
|
54
|
+
asset: { type: "token", standard: "coin", contractAddress: "0x42::token::Token" },
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
const tx = await api.craftTransaction(txArg);
|
|
@@ -65,10 +62,10 @@ describe("craftTransaction", () => {
|
|
|
65
62
|
expect(mockGenerateTransaction).toHaveBeenCalledTimes(1);
|
|
66
63
|
|
|
67
64
|
expect(mockGenerateTransaction).toHaveBeenCalledWith(
|
|
68
|
-
|
|
65
|
+
SENDER_ADDR,
|
|
69
66
|
expect.objectContaining({
|
|
70
67
|
function: "0x1::aptos_account::transfer_coins",
|
|
71
|
-
typeArguments: [
|
|
68
|
+
typeArguments: ["0x42::token::Token"],
|
|
72
69
|
functionArguments: [RECIPIENT_ADDR, txArg.amount.toString()],
|
|
73
70
|
}),
|
|
74
71
|
expect.anything(),
|
|
@@ -85,17 +82,14 @@ describe("craftTransaction", () => {
|
|
|
85
82
|
getBalances: mockGetBalances,
|
|
86
83
|
}));
|
|
87
84
|
|
|
88
|
-
const SENDER: AptosSender = {
|
|
89
|
-
xpub: "public-key",
|
|
90
|
-
freshAddress: SENDER_ADDR,
|
|
91
|
-
};
|
|
92
85
|
const api = createApi({
|
|
93
86
|
aptosSettings: {},
|
|
94
87
|
});
|
|
95
88
|
|
|
96
|
-
const txArg: TransactionIntent<AptosAsset
|
|
89
|
+
const txArg: TransactionIntent<AptosAsset> = {
|
|
97
90
|
type: "send",
|
|
98
|
-
sender:
|
|
91
|
+
sender: SENDER_ADDR,
|
|
92
|
+
senderPublicKey: "public-key",
|
|
99
93
|
recipient: RECIPIENT_ADDR,
|
|
100
94
|
amount: 0n,
|
|
101
95
|
asset: { type: "native" },
|
|
@@ -109,7 +103,7 @@ describe("craftTransaction", () => {
|
|
|
109
103
|
expect(mockGenerateTransaction).toHaveBeenCalledTimes(1);
|
|
110
104
|
|
|
111
105
|
expect(mockGenerateTransaction).toHaveBeenCalledWith(
|
|
112
|
-
|
|
106
|
+
SENDER_ADDR,
|
|
113
107
|
expect.objectContaining({
|
|
114
108
|
function: "0x1::aptos_account::transfer_coins",
|
|
115
109
|
typeArguments: [APTOS_ASSET_ID],
|
|
@@ -129,17 +123,14 @@ describe("craftTransaction", () => {
|
|
|
129
123
|
getBalances: mockGetBalances,
|
|
130
124
|
}));
|
|
131
125
|
|
|
132
|
-
const SENDER: AptosSender = {
|
|
133
|
-
xpub: "public-key",
|
|
134
|
-
freshAddress: SENDER_ADDR,
|
|
135
|
-
};
|
|
136
126
|
const api = createApi({
|
|
137
127
|
aptosSettings: {},
|
|
138
128
|
});
|
|
139
129
|
|
|
140
|
-
const txArg: TransactionIntent<AptosAsset
|
|
130
|
+
const txArg: TransactionIntent<AptosAsset> = {
|
|
141
131
|
type: "send",
|
|
142
|
-
sender:
|
|
132
|
+
sender: SENDER_ADDR,
|
|
133
|
+
senderPublicKey: "public-key",
|
|
143
134
|
recipient: RECIPIENT_ADDR,
|
|
144
135
|
amount: 10n,
|
|
145
136
|
asset: { type: "token", standard: "coin", contractAddress: "0x42::token::Token" },
|
|
@@ -153,7 +144,7 @@ describe("craftTransaction", () => {
|
|
|
153
144
|
expect(mockGenerateTransaction).toHaveBeenCalledTimes(1);
|
|
154
145
|
|
|
155
146
|
expect(mockGenerateTransaction).toHaveBeenCalledWith(
|
|
156
|
-
|
|
147
|
+
SENDER_ADDR,
|
|
157
148
|
expect.objectContaining({
|
|
158
149
|
function: "0x1::aptos_account::transfer_coins",
|
|
159
150
|
typeArguments: ["0x42::token::Token"],
|
|
@@ -173,17 +164,14 @@ describe("craftTransaction", () => {
|
|
|
173
164
|
getBalances: mockGetBalances,
|
|
174
165
|
}));
|
|
175
166
|
|
|
176
|
-
const SENDER: AptosSender = {
|
|
177
|
-
xpub: "public-key",
|
|
178
|
-
freshAddress: SENDER_ADDR,
|
|
179
|
-
};
|
|
180
167
|
const api = createApi({
|
|
181
168
|
aptosSettings: {},
|
|
182
169
|
});
|
|
183
170
|
|
|
184
|
-
const txArg: TransactionIntent<AptosAsset
|
|
171
|
+
const txArg: TransactionIntent<AptosAsset> = {
|
|
185
172
|
type: "send",
|
|
186
|
-
sender:
|
|
173
|
+
sender: SENDER_ADDR,
|
|
174
|
+
senderPublicKey: "public-key",
|
|
187
175
|
recipient: RECIPIENT_ADDR,
|
|
188
176
|
amount: 0n,
|
|
189
177
|
asset: { type: "token", standard: "fungible_asset", contractAddress: "0x42" },
|
|
@@ -197,7 +185,7 @@ describe("craftTransaction", () => {
|
|
|
197
185
|
expect(mockGenerateTransaction).toHaveBeenCalledTimes(1);
|
|
198
186
|
|
|
199
187
|
expect(mockGenerateTransaction).toHaveBeenCalledWith(
|
|
200
|
-
|
|
188
|
+
SENDER_ADDR,
|
|
201
189
|
expect.objectContaining({
|
|
202
190
|
function: "0x1::primary_fungible_store::transfer",
|
|
203
191
|
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
@@ -217,17 +205,14 @@ describe("craftTransaction", () => {
|
|
|
217
205
|
getBalances: mockGetBalances,
|
|
218
206
|
}));
|
|
219
207
|
|
|
220
|
-
const SENDER: AptosSender = {
|
|
221
|
-
xpub: "public-key",
|
|
222
|
-
freshAddress: SENDER_ADDR,
|
|
223
|
-
};
|
|
224
208
|
const api = createApi({
|
|
225
209
|
aptosSettings: {},
|
|
226
210
|
});
|
|
227
211
|
|
|
228
|
-
const txArg: TransactionIntent<AptosAsset
|
|
212
|
+
const txArg: TransactionIntent<AptosAsset> = {
|
|
229
213
|
type: "send",
|
|
230
|
-
sender:
|
|
214
|
+
sender: SENDER_ADDR,
|
|
215
|
+
senderPublicKey: "public-key",
|
|
231
216
|
recipient: RECIPIENT_ADDR,
|
|
232
217
|
amount: 10n,
|
|
233
218
|
asset: { type: "token", standard: "asset", contractAddress: "0x42::token::Token" },
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Deserializer, Hex, Network, RawTransaction } from "@aptos-labs/ts-sdk";
|
|
2
2
|
import { createApi } from "../../api";
|
|
3
3
|
import { getEnv } from "@ledgerhq/live-env";
|
|
4
|
-
import type { AptosSender } from "../../types/assets";
|
|
5
4
|
import { DEFAULT_GAS, DEFAULT_GAS_PRICE } from "../../constants";
|
|
6
5
|
|
|
7
6
|
describe("createApi", () => {
|
|
@@ -15,17 +14,17 @@ describe("createApi", () => {
|
|
|
15
14
|
const assetTypeNative = "native";
|
|
16
15
|
const assetTypeToken = "token";
|
|
17
16
|
|
|
18
|
-
const sender
|
|
17
|
+
const sender = {
|
|
19
18
|
xpub: "0x934887885b27a0407bf8a5e0bbc6b6371254bea94de5510e948bcc92dc0a519b",
|
|
20
19
|
freshAddress: "0x0ef3b40f6ecd5583218d1985e0d54b54e8785ad2ec2d27ed1720ec16bb11686f",
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
const recipient
|
|
22
|
+
const recipient = {
|
|
24
23
|
xpub: "0x7fd6bfaac17c2c763f624b1f95cd4911e3646a5b777b03cc24f93ed0ac3f3e2b",
|
|
25
24
|
freshAddress: "0x4859a161dfe13081cf5a5eac409cd38f707c06176a21ddc875260c2ce63f3a28",
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
const tokenAccount
|
|
27
|
+
const tokenAccount = {
|
|
29
28
|
xpub: "0xeacada8192f15185637e475d7783e14486e232d8b9978ffa127383847ffc5318",
|
|
30
29
|
freshAddress: "0xb8922507317d85197d70c2bc1afc949c759fd0a62c8841a4300d1e2b63649bf6",
|
|
31
30
|
};
|
|
@@ -58,7 +57,8 @@ describe("createApi", () => {
|
|
|
58
57
|
type: "native",
|
|
59
58
|
},
|
|
60
59
|
type: "send",
|
|
61
|
-
sender,
|
|
60
|
+
sender: sender.freshAddress,
|
|
61
|
+
senderPublicKey: sender.xpub,
|
|
62
62
|
amount,
|
|
63
63
|
recipient: recipient.freshAddress,
|
|
64
64
|
});
|
|
@@ -77,7 +77,8 @@ describe("createApi", () => {
|
|
|
77
77
|
"0x50788befc1107c0cc4473848a92e5c783c635866ce3c98de71d2eeb7d2a34f85::usdc_coin::USDCoin",
|
|
78
78
|
},
|
|
79
79
|
type: "send",
|
|
80
|
-
sender,
|
|
80
|
+
sender: sender.freshAddress,
|
|
81
|
+
senderPublicKey: sender.xpub,
|
|
81
82
|
amount,
|
|
82
83
|
recipient: recipient.freshAddress,
|
|
83
84
|
});
|
|
@@ -95,7 +96,8 @@ describe("createApi", () => {
|
|
|
95
96
|
contractAddress: "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b",
|
|
96
97
|
},
|
|
97
98
|
type: "send",
|
|
98
|
-
sender,
|
|
99
|
+
sender: sender.freshAddress,
|
|
100
|
+
senderPublicKey: sender.xpub,
|
|
99
101
|
amount,
|
|
100
102
|
recipient: recipient.freshAddress,
|
|
101
103
|
});
|
|
@@ -109,7 +111,8 @@ describe("createApi", () => {
|
|
|
109
111
|
const hex = await api.craftTransaction(
|
|
110
112
|
{
|
|
111
113
|
amount: 1n,
|
|
112
|
-
sender: sender,
|
|
114
|
+
sender: sender.freshAddress,
|
|
115
|
+
senderPublicKey: sender.xpub,
|
|
113
116
|
recipient: recipient.freshAddress,
|
|
114
117
|
type: "send",
|
|
115
118
|
asset: { type: "native" },
|
|
@@ -130,7 +133,8 @@ describe("createApi", () => {
|
|
|
130
133
|
const hex = await api.craftTransaction(
|
|
131
134
|
{
|
|
132
135
|
amount: 1n,
|
|
133
|
-
sender: sender,
|
|
136
|
+
sender: sender.freshAddress,
|
|
137
|
+
senderPublicKey: sender.xpub,
|
|
134
138
|
recipient: recipient.freshAddress,
|
|
135
139
|
type: "send",
|
|
136
140
|
asset: {
|
|
@@ -156,7 +160,8 @@ describe("createApi", () => {
|
|
|
156
160
|
const hex = await api.craftTransaction(
|
|
157
161
|
{
|
|
158
162
|
amount: 0n,
|
|
159
|
-
sender: sender,
|
|
163
|
+
sender: sender.freshAddress,
|
|
164
|
+
senderPublicKey: sender.xpub,
|
|
160
165
|
recipient: recipient.freshAddress,
|
|
161
166
|
type: "send",
|
|
162
167
|
asset: {
|
|
@@ -184,7 +189,8 @@ describe("createApi", () => {
|
|
|
184
189
|
const hex = await api.craftTransaction(
|
|
185
190
|
{
|
|
186
191
|
amount: 0n,
|
|
187
|
-
sender: s,
|
|
192
|
+
sender: s.freshAddress,
|
|
193
|
+
senderPublicKey: s.xpub,
|
|
188
194
|
recipient: r.freshAddress,
|
|
189
195
|
type: "send",
|
|
190
196
|
asset: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Aptos } from "@aptos-labs/ts-sdk";
|
|
2
|
-
import type {
|
|
3
|
-
import type { AptosAsset
|
|
2
|
+
import type { AlpacaApi } from "@ledgerhq/coin-framework/api/types";
|
|
3
|
+
import type { AptosAsset } from "../../types/assets";
|
|
4
4
|
import type { AptosConfig } from "../../config";
|
|
5
5
|
import { createApi } from "../../api";
|
|
6
6
|
import coinConfig from "../../config";
|
|
@@ -33,8 +33,7 @@ describe("createApi", () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("should return an API object with alpaca api methods", () => {
|
|
36
|
-
const api:
|
|
37
|
-
createApi(mockAptosConfig);
|
|
36
|
+
const api: AlpacaApi<AptosAsset> = createApi(mockAptosConfig);
|
|
38
37
|
|
|
39
38
|
// Check that methods are set with what we expect
|
|
40
39
|
expect(api.broadcast).toBeDefined();
|
|
@@ -70,8 +69,7 @@ describe("lastBlock", () => {
|
|
|
70
69
|
}),
|
|
71
70
|
}));
|
|
72
71
|
|
|
73
|
-
const api:
|
|
74
|
-
createApi(mockAptosConfig);
|
|
72
|
+
const api: AlpacaApi<AptosAsset> = createApi(mockAptosConfig);
|
|
75
73
|
|
|
76
74
|
expect(await api.lastBlock()).toStrictEqual({
|
|
77
75
|
height: 123,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import network from "@ledgerhq/live-network";
|
|
15
15
|
import BigNumber from "bignumber.js";
|
|
16
16
|
import { AptosAPI } from "../../network";
|
|
17
|
-
import { AptosAsset
|
|
17
|
+
import { AptosAsset } from "../../types/assets";
|
|
18
18
|
import { Pagination, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
19
19
|
import { APTOS_ASSET_ID } from "../../constants";
|
|
20
20
|
import { AptosBalance, AptosTransaction } from "../../types";
|
|
@@ -615,19 +615,20 @@ describe("Aptos API", () => {
|
|
|
615
615
|
}));
|
|
616
616
|
|
|
617
617
|
const amount = BigInt(100);
|
|
618
|
-
const sender
|
|
618
|
+
const sender = {
|
|
619
619
|
xpub: "xpub",
|
|
620
620
|
freshAddress: "address1",
|
|
621
621
|
};
|
|
622
622
|
const recipient = "address2";
|
|
623
623
|
|
|
624
624
|
const api = new AptosAPI("aptos");
|
|
625
|
-
const transactionIntent: TransactionIntent<AptosAsset
|
|
625
|
+
const transactionIntent: TransactionIntent<AptosAsset> = {
|
|
626
626
|
asset: {
|
|
627
627
|
type: "native",
|
|
628
628
|
},
|
|
629
629
|
type: "send",
|
|
630
|
-
sender,
|
|
630
|
+
sender: sender.freshAddress,
|
|
631
|
+
senderPublicKey: sender.xpub,
|
|
631
632
|
amount,
|
|
632
633
|
recipient,
|
|
633
634
|
};
|
|
@@ -679,21 +680,22 @@ describe("Aptos API", () => {
|
|
|
679
680
|
}));
|
|
680
681
|
|
|
681
682
|
const amount = BigInt(100);
|
|
682
|
-
const sender
|
|
683
|
+
const sender = {
|
|
683
684
|
xpub: "xpub",
|
|
684
685
|
freshAddress: "address1",
|
|
685
686
|
};
|
|
686
687
|
const recipient = "address2";
|
|
687
688
|
|
|
688
689
|
const api = new AptosAPI("aptos");
|
|
689
|
-
const transactionIntent: TransactionIntent<AptosAsset
|
|
690
|
+
const transactionIntent: TransactionIntent<AptosAsset> = {
|
|
690
691
|
asset: {
|
|
691
692
|
type: "token",
|
|
692
693
|
standard: "coin",
|
|
693
694
|
contractAddress: "0x111",
|
|
694
695
|
},
|
|
695
696
|
type: "send",
|
|
696
|
-
sender,
|
|
697
|
+
sender: sender.freshAddress,
|
|
698
|
+
senderPublicKey: sender.xpub,
|
|
697
699
|
amount,
|
|
698
700
|
recipient,
|
|
699
701
|
};
|
|
@@ -744,21 +746,22 @@ describe("Aptos API", () => {
|
|
|
744
746
|
}));
|
|
745
747
|
|
|
746
748
|
const amount = BigInt(100);
|
|
747
|
-
const sender
|
|
749
|
+
const sender = {
|
|
748
750
|
xpub: "xpub",
|
|
749
751
|
freshAddress: "address1",
|
|
750
752
|
};
|
|
751
753
|
const recipient = "address2";
|
|
752
754
|
|
|
753
755
|
const api = new AptosAPI("aptos");
|
|
754
|
-
const transactionIntent: TransactionIntent<AptosAsset
|
|
756
|
+
const transactionIntent: TransactionIntent<AptosAsset> = {
|
|
755
757
|
asset: {
|
|
756
758
|
type: "token",
|
|
757
759
|
standard: "fungible_asset",
|
|
758
760
|
contractAddress: "0x111",
|
|
759
761
|
},
|
|
760
762
|
type: "send",
|
|
761
|
-
sender,
|
|
763
|
+
sender: sender.freshAddress,
|
|
764
|
+
senderPublicKey: sender.xpub,
|
|
762
765
|
amount,
|
|
763
766
|
recipient,
|
|
764
767
|
};
|
package/src/api/index.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AlpacaApi } from "@ledgerhq/coin-framework/api/index";
|
|
2
2
|
import type { AptosConfig as AptosConfigApi } from "../config";
|
|
3
3
|
import type { Balance, Pagination, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
4
4
|
import coinConfig from "../config";
|
|
5
|
-
import type { AptosAsset
|
|
5
|
+
import type { AptosAsset } from "../types/assets";
|
|
6
6
|
import { AptosAPI } from "../network";
|
|
7
7
|
import { combine } from "../logic/combine";
|
|
8
8
|
import { craftTransaction } from "../logic/craftTransaction";
|
|
9
9
|
import { getBalances } from "../logic/getBalances";
|
|
10
10
|
|
|
11
|
-
export function createApi(
|
|
12
|
-
config: AptosConfigApi,
|
|
13
|
-
): Api<AptosAsset, AptosExtra, AptosSender, AptosFeeParameters> {
|
|
11
|
+
export function createApi(config: AptosConfigApi): AlpacaApi<AptosAsset> {
|
|
14
12
|
coinConfig.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
|
|
15
13
|
|
|
16
14
|
const client = new AptosAPI(config.aptosSettings);
|
|
@@ -20,7 +18,7 @@ export function createApi(
|
|
|
20
18
|
combine: (tx, signature, pubkey): string => combine(tx, signature, pubkey),
|
|
21
19
|
craftTransaction: (transactionIntent, _customFees): Promise<string> =>
|
|
22
20
|
craftTransaction(client, transactionIntent),
|
|
23
|
-
estimateFees: (transactionIntent: TransactionIntent<AptosAsset
|
|
21
|
+
estimateFees: (transactionIntent: TransactionIntent<AptosAsset>) =>
|
|
24
22
|
client.estimateFees(transactionIntent),
|
|
25
23
|
getBalance: (address): Promise<Balance<AptosAsset>[]> => getBalances(client, address),
|
|
26
24
|
lastBlock: () => client.getLastBlock(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TransactionIntent } from "@ledgerhq/coin-framework/lib/api/types";
|
|
2
|
-
import type { AptosAsset
|
|
2
|
+
import type { AptosAsset } from "../types/assets";
|
|
3
3
|
import type { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
4
4
|
import type { AptosAPI } from "../network";
|
|
5
5
|
import buildTransaction, { isTokenType } from "./buildTransaction";
|
|
@@ -10,7 +10,7 @@ import type { AptosBalance } from "../types";
|
|
|
10
10
|
|
|
11
11
|
export async function craftTransaction(
|
|
12
12
|
aptosClient: AptosAPI,
|
|
13
|
-
transactionIntent: TransactionIntent<AptosAsset
|
|
13
|
+
transactionIntent: TransactionIntent<AptosAsset>,
|
|
14
14
|
): Promise<string> {
|
|
15
15
|
const newTx = createTransaction();
|
|
16
16
|
newTx.amount = BigNumber(transactionIntent.amount.toString());
|
|
@@ -19,8 +19,8 @@ export async function craftTransaction(
|
|
|
19
19
|
newTx.useAllAmount = transactionIntent.amount === BigInt(0);
|
|
20
20
|
|
|
21
21
|
const account = {
|
|
22
|
-
freshAddress: transactionIntent.sender
|
|
23
|
-
xpub: transactionIntent.
|
|
22
|
+
freshAddress: transactionIntent.sender,
|
|
23
|
+
xpub: transactionIntent.senderPublicKey,
|
|
24
24
|
subAccounts: new Array<TokenAccount>(),
|
|
25
25
|
} as Account;
|
|
26
26
|
|
|
@@ -29,7 +29,7 @@ export async function craftTransaction(
|
|
|
29
29
|
let balance: AptosBalance | undefined;
|
|
30
30
|
|
|
31
31
|
if (newTx.useAllAmount === true) {
|
|
32
|
-
const balances = await aptosClient.getBalances(transactionIntent.sender
|
|
32
|
+
const balances = await aptosClient.getBalances(transactionIntent.sender);
|
|
33
33
|
balance = balances?.find(
|
|
34
34
|
b => b.contractAddress.toLowerCase() === contractAddress?.toLowerCase(),
|
|
35
35
|
);
|
|
@@ -54,9 +54,7 @@ export async function craftTransaction(
|
|
|
54
54
|
return aptosTx.bcsToHex().toString();
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function getContractAddress(
|
|
58
|
-
txIntent: TransactionIntent<AptosAsset, AptosExtra, AptosSender>,
|
|
59
|
-
): string {
|
|
57
|
+
function getContractAddress(txIntent: TransactionIntent<AptosAsset>): string {
|
|
60
58
|
if (txIntent.asset.type === "token" && isTokenType(txIntent.asset.standard)) {
|
|
61
59
|
return txIntent.asset.contractAddress;
|
|
62
60
|
}
|