@ledgerhq/coin-tezos 10.2.0 → 10.2.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/CHANGELOG.md +6 -0
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/logic/craftRawOperations.js +26 -17
- package/lib/logic/craftRawOperations.js.map +1 -1
- package/lib/logic/estimateFees.js +4 -4
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/listOperations.d.ts.map +1 -1
- package/lib/logic/listOperations.js +9 -7
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/validateIntent.js +1 -1
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/network/tzkt.js +1 -1
- package/lib/network/tzkt.js.map +1 -1
- package/lib/test/config.d.ts +2 -22
- package/lib/test/config.d.ts.map +1 -1
- package/lib/test/config.js.map +1 -1
- package/lib/utils.d.ts +0 -3
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +17 -3
- package/lib/utils.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +1 -1
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/logic/craftRawOperations.js +26 -17
- package/lib-es/logic/craftRawOperations.js.map +1 -1
- package/lib-es/logic/estimateFees.js +4 -4
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/listOperations.d.ts.map +1 -1
- package/lib-es/logic/listOperations.js +9 -7
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/validateIntent.js +1 -1
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/network/tzkt.js +1 -1
- package/lib-es/network/tzkt.js.map +1 -1
- package/lib-es/test/config.d.ts +2 -22
- package/lib-es/test/config.d.ts.map +1 -1
- package/lib-es/test/config.js.map +1 -1
- package/lib-es/utils.d.ts +0 -3
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js +17 -3
- package/lib-es/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/api/index-mainnet.integ.test.ts +40 -50
- package/src/api/index.integ.test.ts +60 -45
- package/src/api/index.test.ts +229 -180
- package/src/api/index.ts +5 -4
- package/src/logic/broadcast.integ.test.ts +2 -7
- package/src/logic/craftRawOperations.test.ts +11 -10
- package/src/logic/craftRawOperations.ts +35 -19
- package/src/logic/craftTransaction.integ.test.ts +2 -2
- package/src/logic/craftTransaction.test.ts +63 -95
- package/src/logic/estimateFees.integ.test.ts +19 -20
- package/src/logic/estimateFees.test.ts +30 -63
- package/src/logic/estimateFees.ts +4 -4
- package/src/logic/getBalance.test.ts +6 -6
- package/src/logic/getBlock.integ.test.ts +20 -21
- package/src/logic/getBlock.test.ts +44 -51
- package/src/logic/getBlockInfo.integ.test.ts +13 -14
- package/src/logic/getBlockInfo.test.ts +8 -7
- package/src/logic/getStakes.test.ts +17 -17
- package/src/logic/listOperations.integ.test.ts +40 -37
- package/src/logic/listOperations.test.ts +34 -31
- package/src/logic/listOperations.ts +19 -19
- package/src/logic/validateIntent.test.ts +17 -19
- package/src/logic/validateIntent.ts +1 -1
- package/src/network/bakers.integ.test.ts +1 -1
- package/src/network/bakers.test.ts +7 -15
- package/src/network/tzkt.integ.test.ts +13 -14
- package/src/network/tzkt.test.ts +194 -259
- package/src/network/tzkt.ts +1 -1
- package/src/test/config.ts +3 -1
- package/src/utils.ts +18 -3
- package/.oxlintrc.json +0 -20
package/lib-es/test/config.d.ts
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type: string;
|
|
4
|
-
};
|
|
5
|
-
baker: {
|
|
6
|
-
url: string;
|
|
7
|
-
};
|
|
8
|
-
explorer: {
|
|
9
|
-
url: string;
|
|
10
|
-
maxTxQuery: number;
|
|
11
|
-
};
|
|
12
|
-
node: {
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
|
-
fees: {
|
|
16
|
-
minGasLimit: number;
|
|
17
|
-
minRevealGasLimit: number;
|
|
18
|
-
minStorageLimit: number;
|
|
19
|
-
minFees: number;
|
|
20
|
-
minEstimatedFees: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
1
|
+
import type { TezosCoinConfig } from '../config';
|
|
2
|
+
export declare const mockConfig: TezosCoinConfig;
|
|
23
3
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/test/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/test/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,UAAU,EAAE,eAmBxB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/test/config.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/test/config.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAItC,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,KAAK,EAAE;QACL,GAAG,EAAE,0CAA0C;KAChD;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,+CAA+C;QACpD,UAAU,EAAE,GAAG;KAChB;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,sCAAsC;KAC5C;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC;QACd,iBAAiB,EAAE,CAAC;QACpB,eAAe,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;QACV,gBAAgB,EAAE,CAAC;KACpB;CACF,CAAA"}
|
package/lib-es/utils.d.ts
CHANGED
|
@@ -43,9 +43,6 @@ export declare function parseTezosTokenAsset(asset: TezosAssetLike | undefined):
|
|
|
43
43
|
contractAddress: string;
|
|
44
44
|
tokenId: number;
|
|
45
45
|
} | null;
|
|
46
|
-
/**
|
|
47
|
-
* Resolves Tezos operation mode from intent type and asset (native XTZ vs token).
|
|
48
|
-
*/
|
|
49
46
|
export declare function resolveTezosOperationMode(intentType: string, asset: TezosAssetLike | undefined): TezosOperationMode;
|
|
50
47
|
/**
|
|
51
48
|
* Creates a mock signer for Taquito operations (estimation and crafting)
|
package/lib-es/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAMvD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAGpC,eAAO,MAAM,2BAA2B,SAAU,CAAA;AAElD,4IAA4I;AAC5I,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAIvC;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,MAAM,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC,qEAAqE;AACrE,MAAM,MAAM,cA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IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAcrD;AAkBD,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,cAAc,GAAG,SAAS,GAChC,kBAAkB,CAQpB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;EAOxE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CA6CpB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAoC/D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe;;;;;EAO/D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,WAElD"}
|
package/lib-es/utils.js
CHANGED
|
@@ -62,12 +62,26 @@ export function parseTezosTokenAsset(asset) {
|
|
|
62
62
|
/**
|
|
63
63
|
* Resolves Tezos operation mode from intent type and asset (native XTZ vs token).
|
|
64
64
|
*/
|
|
65
|
+
function isTezosOperationMode(v) {
|
|
66
|
+
const modes = [
|
|
67
|
+
'send',
|
|
68
|
+
'delegate',
|
|
69
|
+
'undelegate',
|
|
70
|
+
'stake',
|
|
71
|
+
'unstake',
|
|
72
|
+
'finalize_unstake',
|
|
73
|
+
'send_token',
|
|
74
|
+
];
|
|
75
|
+
return modes.some((m) => m === v);
|
|
76
|
+
}
|
|
65
77
|
export function resolveTezosOperationMode(intentType, asset) {
|
|
66
|
-
|
|
67
|
-
if (base === 'send' && parseTezosTokenAsset(asset) !== null) {
|
|
78
|
+
if (intentType === 'send' && parseTezosTokenAsset(asset) !== null) {
|
|
68
79
|
return 'send_token';
|
|
69
80
|
}
|
|
70
|
-
|
|
81
|
+
if (isTezosOperationMode(intentType)) {
|
|
82
|
+
return intentType;
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`resolveTezosOperationMode: unexpected mode "${intentType}"`);
|
|
71
85
|
}
|
|
72
86
|
/**
|
|
73
87
|
* Creates a mock signer for Taquito operations (estimation and crafting)
|
package/lib-es/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAKtC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC,mFAAmF;AACnF,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAO,CAAA;AAElD,4IAA4I;AAC5I,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,aAAqB,EACrB,eAAuB,EACvB,IAAY;IAEZ,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,sBAAsB,CAAC,OAAO,EAAE,aAAa,EAAE,eAAe,CAAC,CAAA;IAC7F,MAAM,QAAQ,GAAG,IAAI,GAAG,2BAA2B,CAAA;IACnD,OAAO,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAA;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,MAAc,EACd,QAAgB;IAEhB,MA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"@ledgerhq/coin-tezos",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.1",
|
|
4
4
|
"description": "Tezos Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@taquito/rpc": "^23.0.0-RC.0",
|
|
62
62
|
"@taquito/taquito": "^23.0.0-RC.0",
|
|
63
63
|
"@taquito/utils": "^23.0.0-RC.0",
|
|
64
|
-
"@ledgerhq/coin-module-framework": "^8.
|
|
64
|
+
"@ledgerhq/coin-module-framework": "^8.3.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@ledgerhq/live-network": "^3.0.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type { TezosCoinConfig,
|
|
4
|
+
import type { TezosCoinConfig, TezosContext } from '../config'
|
|
5
5
|
import { localForger } from '@taquito/local-forging'
|
|
6
6
|
import { OpKind } from '@taquito/rpc'
|
|
7
7
|
import { createTzktApi } from '../network/tzkt'
|
|
@@ -18,7 +18,8 @@ import { createApi } from '.'
|
|
|
18
18
|
const UNREVEALED_SENDER = 'tz2RZHPmNVQY7h1oopsvDBMrp8i48zhc9cAL'
|
|
19
19
|
const UNREVEALED_PUBLIC_KEY = '0268eae382350b43ba1af0e1140e4b68dc9d2084836494554860c1be0605a7af2d'
|
|
20
20
|
|
|
21
|
-
const defaultConfig:
|
|
21
|
+
const defaultConfig: TezosCoinConfig = {
|
|
22
|
+
status: { type: 'active' },
|
|
22
23
|
baker: {
|
|
23
24
|
url: 'https://baker.example.com',
|
|
24
25
|
},
|
|
@@ -38,16 +39,6 @@ const defaultConfig: TezosConfig = {
|
|
|
38
39
|
},
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
/** Decoded operation. */
|
|
42
|
-
type DecodedOperation = {
|
|
43
|
-
kind: number
|
|
44
|
-
fee?: string
|
|
45
|
-
gas_limit?: string
|
|
46
|
-
storage_limit?: string
|
|
47
|
-
delegate?: string
|
|
48
|
-
source?: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
42
|
/**
|
|
52
43
|
* Mainnet-specific integration tests
|
|
53
44
|
* Please implement your tests in testnet-specific tests file (see index.integ.test.ts)
|
|
@@ -56,10 +47,10 @@ type DecodedOperation = {
|
|
|
56
47
|
describe('Tezos Api - Mainnet', () => {
|
|
57
48
|
const module = createApi()
|
|
58
49
|
const context: TezosContext = {
|
|
59
|
-
config: async () => defaultConfig
|
|
50
|
+
config: async () => defaultConfig,
|
|
60
51
|
logger: () => undefined,
|
|
61
52
|
}
|
|
62
|
-
const tzktApi = createTzktApi(defaultConfig
|
|
53
|
+
const tzktApi = createTzktApi(defaultConfig)
|
|
63
54
|
|
|
64
55
|
describe('estimateFees', () => {
|
|
65
56
|
it('fallback to an estimation without the public key', async () => {
|
|
@@ -124,39 +115,38 @@ describe('Tezos Api - Mainnet', () => {
|
|
|
124
115
|
|
|
125
116
|
expect(decoded.contents.length).toBe(2)
|
|
126
117
|
|
|
127
|
-
const reveal = decoded.contents[0]
|
|
128
|
-
|
|
129
|
-
expect(BigInt(reveal.fee
|
|
130
|
-
expect(Number(reveal.gas_limit
|
|
131
|
-
expect(Number(reveal.storage_limit
|
|
118
|
+
const reveal = decoded.contents[0]
|
|
119
|
+
if (reveal.kind !== OpKind.REVEAL) fail('expected reveal op')
|
|
120
|
+
expect(BigInt(reveal.fee)).toBeGreaterThanOrEqual(500n)
|
|
121
|
+
expect(Number(reveal.gas_limit)).toBeGreaterThanOrEqual(300)
|
|
122
|
+
expect(Number(reveal.storage_limit)).toBeGreaterThanOrEqual(0)
|
|
132
123
|
expect(reveal.source).toEqual(sender)
|
|
133
124
|
|
|
134
|
-
const delegation = decoded.contents[1]
|
|
135
|
-
|
|
136
|
-
expect(BigInt(delegation.fee
|
|
137
|
-
expect(Number(delegation.gas_limit
|
|
138
|
-
expect(Number(delegation.storage_limit
|
|
125
|
+
const delegation = decoded.contents[1]
|
|
126
|
+
if (delegation.kind !== OpKind.DELEGATION) fail('expected delegation op')
|
|
127
|
+
expect(BigInt(delegation.fee)).toBeGreaterThanOrEqual(500n)
|
|
128
|
+
expect(Number(delegation.gas_limit)).toBeGreaterThanOrEqual(2500)
|
|
129
|
+
expect(Number(delegation.storage_limit)).toBeGreaterThanOrEqual(0)
|
|
139
130
|
expect(delegation.delegate).toEqual(delegate)
|
|
140
131
|
expect(delegation.source).toEqual(sender)
|
|
141
132
|
|
|
142
|
-
const total =
|
|
133
|
+
const total = BigInt(reveal.fee) + BigInt(delegation.fee)
|
|
143
134
|
expect(total).toBeGreaterThanOrEqual(1000n)
|
|
144
135
|
})
|
|
145
136
|
})
|
|
146
137
|
|
|
147
138
|
describe('with custom fees settings', () => {
|
|
148
139
|
const contextCustomFees: TezosContext = {
|
|
149
|
-
config: async () =>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}) as TezosCoinConfig,
|
|
140
|
+
config: async () => ({
|
|
141
|
+
...defaultConfig,
|
|
142
|
+
fees: {
|
|
143
|
+
minGasLimit: 600,
|
|
144
|
+
minRevealGasLimit: 300,
|
|
145
|
+
minStorageLimit: 0,
|
|
146
|
+
minFees: 1200,
|
|
147
|
+
minEstimatedFees: 1100,
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
160
150
|
logger: () => undefined,
|
|
161
151
|
}
|
|
162
152
|
|
|
@@ -193,17 +183,17 @@ describe('Tezos Api - Mainnet', () => {
|
|
|
193
183
|
)
|
|
194
184
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
195
185
|
|
|
196
|
-
const reveal = decoded.contents[0]
|
|
197
|
-
|
|
198
|
-
expect(BigInt(reveal.fee
|
|
186
|
+
const reveal = decoded.contents[0]
|
|
187
|
+
if (reveal.kind !== OpKind.REVEAL) fail('expected reveal op')
|
|
188
|
+
expect(BigInt(reveal.fee)).toEqual(1200n)
|
|
199
189
|
|
|
200
|
-
const delegation = decoded.contents[1]
|
|
201
|
-
|
|
202
|
-
expect(BigInt(delegation.fee
|
|
190
|
+
const delegation = decoded.contents[1]
|
|
191
|
+
if (delegation.kind !== OpKind.DELEGATION) fail('expected delegation op')
|
|
192
|
+
expect(BigInt(delegation.fee)).toBeGreaterThanOrEqual(1800n)
|
|
203
193
|
|
|
204
194
|
// The provided customFee exceeds the default estimation. In this case, we expect the fee to be increased on
|
|
205
195
|
// the main operation (delegate) so that total fee paid respects customFee.
|
|
206
|
-
const totalFees =
|
|
196
|
+
const totalFees = BigInt(reveal.fee) + BigInt(delegation.fee)
|
|
207
197
|
expect(totalFees).toBe(3000n)
|
|
208
198
|
})
|
|
209
199
|
|
|
@@ -223,18 +213,18 @@ describe('Tezos Api - Mainnet', () => {
|
|
|
223
213
|
)
|
|
224
214
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
225
215
|
|
|
226
|
-
const reveal = decoded.contents[0]
|
|
227
|
-
|
|
228
|
-
expect(BigInt(reveal.fee
|
|
216
|
+
const reveal = decoded.contents[0]
|
|
217
|
+
if (reveal.kind !== OpKind.REVEAL) fail('expected reveal op')
|
|
218
|
+
expect(BigInt(reveal.fee)).toEqual(1200n)
|
|
229
219
|
|
|
230
|
-
const delegation = decoded.contents[1]
|
|
231
|
-
|
|
232
|
-
expect(BigInt(delegation.fee
|
|
220
|
+
const delegation = decoded.contents[1]
|
|
221
|
+
if (delegation.kind !== OpKind.DELEGATION) fail('expected delegation op')
|
|
222
|
+
expect(BigInt(delegation.fee)).toBeGreaterThanOrEqual(800n)
|
|
233
223
|
|
|
234
224
|
// The provided customFee is less than the default estimation. In this case, we expect the fee to be decreased
|
|
235
225
|
// on the main operation (delegate) so that total fee paid respects customFee. Transaction could fail, but
|
|
236
226
|
// that's caller responsibility.
|
|
237
|
-
const totalFees =
|
|
227
|
+
const totalFees = BigInt(reveal.fee) + BigInt(delegation.fee)
|
|
238
228
|
expect(totalFees).toBe(2000n)
|
|
239
229
|
})
|
|
240
230
|
})
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
import
|
|
4
|
+
import type { TezosContext } from '../config'
|
|
5
|
+
import { createSendTransactionIntentMockData } from '@ledgerhq/coin-module-framework/test-utils'
|
|
6
6
|
import { localForger } from '@taquito/local-forging'
|
|
7
7
|
import { createApi } from '.'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
explorer: { url: 'https://api.shadownet.tzkt.io', maxTxQuery: 100 },
|
|
12
|
-
node: { url: 'https://rpc.shadownet.teztnets.com' },
|
|
13
|
-
fees: {
|
|
14
|
-
minGasLimit: 600,
|
|
15
|
-
minRevealGasLimit: 300,
|
|
16
|
-
minStorageLimit: 0,
|
|
17
|
-
minFees: 500,
|
|
18
|
-
minEstimatedFees: 500,
|
|
19
|
-
},
|
|
9
|
+
function assertHasFee(op: object): asserts op is { fee: string } {
|
|
10
|
+
if (!('fee' in op)) fail('expected fee field on op')
|
|
20
11
|
}
|
|
21
12
|
|
|
22
13
|
/**
|
|
@@ -27,7 +18,19 @@ const defaultConfig: TezosConfig = {
|
|
|
27
18
|
describe('Tezos Api', () => {
|
|
28
19
|
const module = createApi()
|
|
29
20
|
const context: TezosContext = {
|
|
30
|
-
config: async () =>
|
|
21
|
+
config: async () => ({
|
|
22
|
+
status: { type: 'active' },
|
|
23
|
+
baker: { url: 'https://baker.example.com' },
|
|
24
|
+
explorer: { url: 'https://api.shadownet.tzkt.io', maxTxQuery: 100 },
|
|
25
|
+
node: { url: 'https://rpc.shadownet.teztnets.com' },
|
|
26
|
+
fees: {
|
|
27
|
+
minGasLimit: 600,
|
|
28
|
+
minRevealGasLimit: 300,
|
|
29
|
+
minStorageLimit: 0,
|
|
30
|
+
minFees: 500,
|
|
31
|
+
minEstimatedFees: 500,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
31
34
|
logger: () => undefined,
|
|
32
35
|
}
|
|
33
36
|
// Persistent Shadownet test account — see LIVE-28763 PR for chain-of-custody.
|
|
@@ -78,15 +81,16 @@ describe('Tezos Api', () => {
|
|
|
78
81
|
'p2pk66gP3wq6k9QgNwAgaGLeXc3YFfrxgYdC7cdYuJWAHYBw4hExVHW',
|
|
79
82
|
],
|
|
80
83
|
])('does not fail when providing a %s sender with pub key', async (_, sender, pubKey) => {
|
|
81
|
-
const result = await module.estimateFees(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const result = await module.estimateFees(
|
|
85
|
+
context,
|
|
86
|
+
createSendTransactionIntentMockData({
|
|
87
|
+
type: 'send',
|
|
88
|
+
sender,
|
|
89
|
+
senderPublicKey: pubKey,
|
|
90
|
+
recipient: address,
|
|
91
|
+
amount: BigInt(100),
|
|
92
|
+
})
|
|
93
|
+
)
|
|
90
94
|
|
|
91
95
|
expect(result.value).toBeGreaterThanOrEqual(BigInt(0))
|
|
92
96
|
expect(result.parameters?.gasLimit).toBeGreaterThanOrEqual(BigInt(0))
|
|
@@ -214,14 +218,17 @@ describe('Tezos Api', () => {
|
|
|
214
218
|
expect(decodedTransaction.contents).toHaveLength(1)
|
|
215
219
|
|
|
216
220
|
const operationContent = decodedTransaction.contents[0]
|
|
217
|
-
expect(operationContent
|
|
218
|
-
|
|
221
|
+
expect(operationContent).toMatchObject({ source: address })
|
|
222
|
+
assertHasFee(operationContent)
|
|
223
|
+
expect(BigInt(String(operationContent.fee))).toBeGreaterThan(0)
|
|
219
224
|
|
|
220
225
|
if (type === 'send') {
|
|
221
|
-
expect(
|
|
222
|
-
|
|
226
|
+
expect(operationContent).toMatchObject({
|
|
227
|
+
destination: recipient,
|
|
228
|
+
amount: amount.toString(),
|
|
229
|
+
})
|
|
223
230
|
} else if (type === 'delegate') {
|
|
224
|
-
expect(operationContent
|
|
231
|
+
expect(operationContent).toMatchObject({ delegate: recipient })
|
|
225
232
|
}
|
|
226
233
|
}
|
|
227
234
|
)
|
|
@@ -237,7 +244,9 @@ describe('Tezos Api', () => {
|
|
|
237
244
|
})
|
|
238
245
|
|
|
239
246
|
const decodedTransaction = await decode(encodedTransaction)
|
|
240
|
-
const
|
|
247
|
+
const op0 = decodedTransaction.contents[0]
|
|
248
|
+
assertHasFee(op0)
|
|
249
|
+
const transactionFee = BigInt(String(op0.fee))
|
|
241
250
|
expect(transactionFee).toBeGreaterThan(0)
|
|
242
251
|
})
|
|
243
252
|
|
|
@@ -258,7 +267,7 @@ describe('Tezos Api', () => {
|
|
|
258
267
|
)
|
|
259
268
|
|
|
260
269
|
const decodedTransaction = await decode(encodedTransaction)
|
|
261
|
-
expect(decodedTransaction.contents[0]
|
|
270
|
+
expect(decodedTransaction.contents[0]).toMatchObject({ fee: customFees.toString() })
|
|
262
271
|
}
|
|
263
272
|
)
|
|
264
273
|
})
|
|
@@ -268,17 +277,19 @@ describe('Tezos Api', () => {
|
|
|
268
277
|
const minEstimatedFees = 550
|
|
269
278
|
|
|
270
279
|
const contextCustomFees: TezosContext = {
|
|
271
|
-
config: async () =>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
config: async () => ({
|
|
281
|
+
status: { type: 'active' },
|
|
282
|
+
baker: { url: 'https://baker.example.com' },
|
|
283
|
+
explorer: { url: 'https://api.shadownet.tzkt.io', maxTxQuery: 100 },
|
|
284
|
+
node: { url: 'https://rpc.shadownet.teztnets.com' },
|
|
285
|
+
fees: {
|
|
286
|
+
minGasLimit: 600,
|
|
287
|
+
minRevealGasLimit: 300,
|
|
288
|
+
minStorageLimit: 0,
|
|
289
|
+
minFees,
|
|
290
|
+
minEstimatedFees,
|
|
291
|
+
},
|
|
292
|
+
}),
|
|
282
293
|
logger: () => undefined,
|
|
283
294
|
}
|
|
284
295
|
|
|
@@ -324,7 +335,9 @@ describe('Tezos Api', () => {
|
|
|
324
335
|
}
|
|
325
336
|
)
|
|
326
337
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
327
|
-
const
|
|
338
|
+
const op = decoded.contents[0]
|
|
339
|
+
assertHasFee(op)
|
|
340
|
+
const fee = BigInt(String(op.fee))
|
|
328
341
|
expect(fee).toBeGreaterThanOrEqual(BigInt(minFees))
|
|
329
342
|
})
|
|
330
343
|
|
|
@@ -341,7 +354,9 @@ describe('Tezos Api', () => {
|
|
|
341
354
|
}
|
|
342
355
|
)
|
|
343
356
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
344
|
-
const
|
|
357
|
+
const op = decoded.contents[0]
|
|
358
|
+
assertHasFee(op)
|
|
359
|
+
const fee = BigInt(String(op.fee))
|
|
345
360
|
expect(fee).toBeGreaterThanOrEqual(BigInt(minFees))
|
|
346
361
|
})
|
|
347
362
|
|
|
@@ -360,7 +375,7 @@ describe('Tezos Api', () => {
|
|
|
360
375
|
{ customFees: { value: customFee } }
|
|
361
376
|
)
|
|
362
377
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
363
|
-
expect(decoded.contents[0]
|
|
378
|
+
expect(decoded.contents[0]).toMatchObject({ fee: customFee.toString() })
|
|
364
379
|
})
|
|
365
380
|
|
|
366
381
|
it('craft transaction with customFee when default estimation is lesser than customFee', async () => {
|
|
@@ -378,7 +393,7 @@ describe('Tezos Api', () => {
|
|
|
378
393
|
{ customFees: { value: customFee } }
|
|
379
394
|
)
|
|
380
395
|
const decoded = await localForger.parse(encodedTransaction.slice(2))
|
|
381
|
-
expect(decoded.contents[0]
|
|
396
|
+
expect(decoded.contents[0]).toMatchObject({ fee: customFee.toString() })
|
|
382
397
|
})
|
|
383
398
|
})
|
|
384
399
|
})
|