@@ -13,20 +13,20 @@ describe("Transaction Forging - Delegate Registration", () => {
13
13
// Initial Funds
14
14
const initialFunds = TransactionFactory . transfer ( Identities . Address . fromPassphrase ( passphrase ) , 100 * 1e8 )
15
15
. withPassphrase ( secrets [ 0 ] )
16
- . create ( ) ;
16
+ . createOne ( ) ;
17
17
18
- await support . expectAcceptAndBroadcast ( initialFunds , initialFunds [ 0 ] . id ) ;
18
+ await expect ( initialFunds ) . toBeAccepted ( ) ;
19
19
await support . snoozeForBlock ( 1 ) ;
20
- await support . expectTransactionForged ( initialFunds [ 0 ] . id ) ;
20
+ await expect ( initialFunds . id ) . toBeForged ( ) ;
21
21
22
22
// Register a delegate
23
23
const transactions = TransactionFactory . delegateRegistration ( )
24
24
. withPassphrase ( passphrase )
25
- . create ( ) ;
25
+ . createOne ( ) ;
26
26
27
- await support . expectAcceptAndBroadcast ( transactions , transactions [ 0 ] . id ) ;
27
+ await expect ( transactions ) . toBeAccepted ( ) ;
28
28
await support . snoozeForBlock ( 1 ) ;
29
- await support . expectTransactionForged ( transactions [ 0 ] . id ) ;
29
+ await expect ( transactions . id ) . toBeForged ( ) ;
30
30
} ) ;
31
31
32
32
it ( "should broadcast, accept and forge it [Signed with 2 Passphrases]" , async ( ) => {
@@ -36,40 +36,40 @@ describe("Transaction Forging - Delegate Registration", () => {
36
36
// Initial Funds
37
37
const initialFunds = TransactionFactory . transfer ( Identities . Address . fromPassphrase ( passphrase ) , 100 * 1e8 )
38
38
. withPassphrase ( secrets [ 0 ] )
39
- . create ( ) ;
39
+ . createOne ( ) ;
40
40
41
- await support . expectAcceptAndBroadcast ( initialFunds , initialFunds [ 0 ] . id ) ;
41
+ await expect ( initialFunds ) . toBeAccepted ( ) ;
42
42
await support . snoozeForBlock ( 1 ) ;
43
- await support . expectTransactionForged ( initialFunds [ 0 ] . id ) ;
43
+ await expect ( initialFunds . id ) . toBeForged ( ) ;
44
44
45
45
// Register a second passphrase
46
46
const secondSignature = TransactionFactory . secondSignature ( secondPassphrase )
47
47
. withPassphrase ( passphrase )
48
- . create ( ) ;
48
+ . createOne ( ) ;
49
49
50
- await support . expectAcceptAndBroadcast ( secondSignature , secondSignature [ 0 ] . id ) ;
50
+ await expect ( secondSignature ) . toBeAccepted ( ) ;
51
51
await support . snoozeForBlock ( 1 ) ;
52
- await support . expectTransactionForged ( secondSignature [ 0 ] . id ) ;
52
+ await expect ( secondSignature . id ) . toBeForged ( ) ;
53
53
54
54
// Register a delegate
55
55
const delegateRegistration = TransactionFactory . delegateRegistration ( )
56
56
. withPassphrasePair ( { passphrase, secondPassphrase } )
57
- . create ( ) ;
57
+ . createOne ( ) ;
58
58
59
- await support . expectAcceptAndBroadcast ( delegateRegistration , delegateRegistration [ 0 ] . id ) ;
59
+ await expect ( delegateRegistration ) . toBeAccepted ( ) ;
60
60
await support . snoozeForBlock ( 1 ) ;
61
- await support . expectTransactionForged ( delegateRegistration [ 0 ] . id ) ;
61
+ await expect ( delegateRegistration . id ) . toBeForged ( ) ;
62
62
} ) ;
63
63
64
64
it ( "should broadcast, accept and forge it [3-of-3 multisig]" , async ( ) => {
65
65
// Funds to register a multi signature wallet
66
66
const initialFunds = TransactionFactory . transfer ( Identities . Address . fromPassphrase ( secrets [ 3 ] ) , 50 * 1e8 )
67
67
. withPassphrase ( secrets [ 0 ] )
68
- . create ( ) ;
68
+ . createOne ( ) ;
69
69
70
- await support . expectAcceptAndBroadcast ( initialFunds , initialFunds [ 0 ] . id ) ;
70
+ await expect ( initialFunds ) . toBeAccepted ( ) ;
71
71
await support . snoozeForBlock ( 1 ) ;
72
- await support . expectTransactionForged ( initialFunds [ 0 ] . id ) ;
72
+ await expect ( initialFunds . id ) . toBeForged ( ) ;
73
73
74
74
// Register a multi signature wallet with defaults
75
75
const passphrases = [ secrets [ 3 ] , secrets [ 4 ] , secrets [ 5 ] ] ;
@@ -82,42 +82,42 @@ describe("Transaction Forging - Delegate Registration", () => {
82
82
const multiSignature = TransactionFactory . multiSignature ( participants , 3 )
83
83
. withPassphrase ( secrets [ 3 ] )
84
84
. withPassphraseList ( passphrases )
85
- . create ( ) ;
85
+ . createOne ( ) ;
86
86
87
- await support . expectAcceptAndBroadcast ( multiSignature , multiSignature [ 0 ] . id ) ;
87
+ await expect ( multiSignature ) . toBeAccepted ( ) ;
88
88
await support . snoozeForBlock ( 1 ) ;
89
- await support . expectTransactionForged ( multiSignature [ 0 ] . id ) ;
89
+ await expect ( multiSignature . id ) . toBeForged ( ) ;
90
90
91
91
// Send funds to multi signature wallet
92
- const multiSigAddress = Identities . Address . fromMultiSignatureAsset ( multiSignature [ 0 ] . asset . multiSignature ) ;
93
- const multiSigPublicKey = Identities . PublicKey . fromMultiSignatureAsset ( multiSignature [ 0 ] . asset . multiSignature ) ;
92
+ const multiSigAddress = Identities . Address . fromMultiSignatureAsset ( multiSignature . asset . multiSignature ) ;
93
+ const multiSigPublicKey = Identities . PublicKey . fromMultiSignatureAsset ( multiSignature . asset . multiSignature ) ;
94
94
95
95
const multiSignatureFunds = TransactionFactory . transfer ( multiSigAddress , 30 * 1e8 )
96
96
. withPassphrase ( secrets [ 0 ] )
97
- . create ( ) ;
97
+ . createOne ( ) ;
98
98
99
- await support . expectAcceptAndBroadcast ( multiSignatureFunds , multiSignatureFunds [ 0 ] . id ) ;
99
+ await expect ( multiSignatureFunds ) . toBeAccepted ( ) ;
100
100
await support . snoozeForBlock ( 1 ) ;
101
- await support . expectTransactionForged ( multiSignatureFunds [ 0 ] . id ) ;
101
+ await expect ( multiSignatureFunds . id ) . toBeForged ( ) ;
102
102
103
103
// Try to register a delegate which should fail
104
104
const delegateRegistration = TransactionFactory . delegateRegistration ( )
105
105
. withSenderPublicKey ( multiSigPublicKey )
106
106
. withPassphraseList ( passphrases )
107
- . create ( ) ;
107
+ . createOne ( ) ;
108
108
109
- await support . expectInvalidAndError ( delegateRegistration , delegateRegistration [ 0 ] . id ) ;
109
+ await expect ( delegateRegistration . id ) . toBeRejected ( ) ;
110
110
await support . snoozeForBlock ( 1 ) ;
111
- await support . expectTransactionNotForged ( delegateRegistration [ 0 ] . id ) ;
111
+ await expect ( delegateRegistration . id ) . not . toBeForged ( ) ;
112
112
113
- // Create transfer to assert multi sig wallet can still send funds
113
+ // createOne transfer to assert multi sig wallet can still send funds
114
114
const transfer = TransactionFactory . transfer ( multiSigAddress , 29 * 1e8 )
115
115
. withSenderPublicKey ( multiSigPublicKey )
116
116
. withPassphraseList ( passphrases )
117
- . create ( ) ;
117
+ . createOne ( ) ;
118
118
119
- await support . expectAcceptAndBroadcast ( transfer , transfer [ 0 ] . id ) ;
119
+ await expect ( transfer ) . toBeAccepted ( ) ;
120
120
await support . snoozeForBlock ( 1 ) ;
121
- await support . expectTransactionForged ( transfer [ 0 ] . id ) ;
121
+ await expect ( transfer . id ) . toBeForged ( ) ;
122
122
} ) ;
123
123
} ) ;
0 commit comments