1
1
import * as Trezor from '@trezor/connect' ;
2
+ import { Cardano } from '@cardano-sdk/core' ;
2
3
import { CardanoKeyConst , TxInId , util } from '@cardano-sdk/key-management' ;
3
4
import {
4
5
babbageTxBodyWithScripts ,
@@ -22,6 +23,34 @@ describe('tx', () => {
22
23
expect ( await txToTrezor ( minValidTxBody , contextWithoutKnownAddresses ) ) . toEqual ( {
23
24
additionalWitnessRequests : [ ] ,
24
25
fee : '10' ,
26
+ includeNetworkId : false ,
27
+ inputs : [
28
+ {
29
+ prev_hash : txIn . txId ,
30
+ prev_index : txIn . index
31
+ }
32
+ ] ,
33
+ networkId : 0 ,
34
+ outputs : [
35
+ {
36
+ address :
37
+ 'addr_test1qz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3jcu5d8ps7zex2k2xt3uqxgjqnnj83ws8lhrn648jjxtwq2ytjqp' ,
38
+ amount : '10' ,
39
+ format : Trezor . PROTO . CardanoTxOutputSerializationFormat . ARRAY_LEGACY
40
+ }
41
+ ] ,
42
+ protocolMagic : 999 ,
43
+ tagCborSets : false
44
+ } ) ;
45
+ } ) ;
46
+
47
+ test ( 'can set includeNetworkId if network field is set' , async ( ) => {
48
+ expect (
49
+ await txToTrezor ( { ...minValidTxBody , networkId : Cardano . NetworkId . Mainnet } , contextWithoutKnownAddresses )
50
+ ) . toEqual ( {
51
+ additionalWitnessRequests : [ ] ,
52
+ fee : '10' ,
53
+ includeNetworkId : true ,
25
54
inputs : [
26
55
{
27
56
prev_hash : txIn . txId ,
@@ -69,6 +98,7 @@ describe('tx', () => {
69
98
}
70
99
] ,
71
100
fee : '10' ,
101
+ includeNetworkId : false ,
72
102
inputs : [
73
103
{
74
104
path : knownAddressKeyPath ,
@@ -232,6 +262,7 @@ describe('tx', () => {
232
262
}
233
263
] ,
234
264
fee : '10' ,
265
+ includeNetworkId : false ,
235
266
inputs : [
236
267
{
237
268
path : knownAddressKeyPath ,
@@ -315,6 +346,7 @@ describe('tx', () => {
315
346
format : Trezor . PROTO . CardanoTxOutputSerializationFormat . ARRAY_LEGACY
316
347
} ,
317
348
fee : '10' ,
349
+ includeNetworkId : false ,
318
350
inputs : [
319
351
{
320
352
prev_hash : txIn . txId ,
@@ -385,6 +417,7 @@ describe('tx', () => {
385
417
format : Trezor . PROTO . CardanoTxOutputSerializationFormat . MAP_BABBAGE
386
418
} ,
387
419
fee : '10' ,
420
+ includeNetworkId : false ,
388
421
inputs : [
389
422
{
390
423
path : knownAddressKeyPath ,
0 commit comments