@@ -20,21 +20,20 @@ fn sign() {
20
20
21
21
let address = addresses. first_key_value ( ) . unwrap ( ) . 0 ;
22
22
23
- let message = "HelloWorld" ;
23
+ let text = "HelloWorld" ;
24
24
25
25
let sign = CommandBuilder :: new ( format ! (
26
- "wallet sign --address {} --message {message }" ,
26
+ "wallet sign --signer {} --text {text }" ,
27
27
address. clone( ) . assume_checked( ) ,
28
28
) )
29
29
. core ( & core)
30
30
. ord ( & ord)
31
31
. run_and_deserialize_output :: < SignOutput > ( ) ;
32
32
33
33
assert_eq ! ( address, & sign. address) ;
34
- assert_eq ! ( message, & sign. message. unwrap( ) ) ;
35
34
36
35
CommandBuilder :: new ( format ! (
37
- "verify --address {} --message {message } --witness {}" ,
36
+ "verify --address {} --text {text } --witness {}" ,
38
37
address. clone( ) . assume_checked( ) ,
39
38
sign. witness,
40
39
) )
@@ -61,7 +60,7 @@ fn sign_file() {
61
60
let address = addresses. first_key_value ( ) . unwrap ( ) . 0 ;
62
61
63
62
let sign = CommandBuilder :: new ( format ! (
64
- "wallet sign --address {} --file hello.txt" ,
63
+ "wallet sign --signer {} --file hello.txt" ,
65
64
address. clone( ) . assume_checked( ) ,
66
65
) )
67
66
. write ( "hello.txt" , "Hello World" )
@@ -70,7 +69,6 @@ fn sign_file() {
70
69
. run_and_deserialize_output :: < SignOutput > ( ) ;
71
70
72
71
assert_eq ! ( address, & sign. address) ;
73
- assert ! ( sign. message. is_none( ) ) ;
74
72
75
73
CommandBuilder :: new ( format ! (
76
74
"verify --address {} --file hello.txt --witness {}" ,
@@ -94,3 +92,57 @@ fn sign_file() {
94
92
. stderr_regex ( "error: Invalid signature.*" )
95
93
. run_and_extract_stdout ( ) ;
96
94
}
95
+
96
+ #[ test]
97
+ fn sign_for_inscription ( ) {
98
+ let core = mockcore:: spawn ( ) ;
99
+
100
+ let ord = TestServer :: spawn_with_server_args ( & core, & [ ] , & [ ] ) ;
101
+
102
+ create_wallet ( & core, & ord) ;
103
+
104
+ let ( inscription, _reveal) = inscribe ( & core, & ord) ;
105
+
106
+ core. mine_blocks ( 1 ) ;
107
+
108
+ let addresses = CommandBuilder :: new ( "wallet addresses" )
109
+ . core ( & core)
110
+ . ord ( & ord)
111
+ . run_and_deserialize_output :: < BTreeMap < Address < NetworkUnchecked > , Vec < AddressesOutput > > > ( ) ;
112
+
113
+ let text = "HelloWorld" ;
114
+
115
+ let sign = CommandBuilder :: new ( format ! ( "wallet sign --signer {inscription} --text {text}" , ) )
116
+ . core ( & core)
117
+ . ord ( & ord)
118
+ . run_and_deserialize_output :: < SignOutput > ( ) ;
119
+
120
+ assert ! ( addresses. contains_key( & sign. address) ) ;
121
+ }
122
+
123
+ #[ test]
124
+ fn sign_for_output ( ) {
125
+ let core = mockcore:: spawn ( ) ;
126
+
127
+ let ord = TestServer :: spawn_with_server_args ( & core, & [ ] , & [ ] ) ;
128
+
129
+ create_wallet ( & core, & ord) ;
130
+
131
+ core. mine_blocks ( 1 ) ;
132
+
133
+ let addresses = CommandBuilder :: new ( "wallet addresses" )
134
+ . core ( & core)
135
+ . ord ( & ord)
136
+ . run_and_deserialize_output :: < BTreeMap < Address < NetworkUnchecked > , Vec < AddressesOutput > > > ( ) ;
137
+
138
+ let output = addresses. first_key_value ( ) . unwrap ( ) . 1 [ 0 ] . output ;
139
+
140
+ let text = "HelloWorld" ;
141
+
142
+ let sign = CommandBuilder :: new ( format ! ( "wallet sign --signer {output} --text {text}" , ) )
143
+ . core ( & core)
144
+ . ord ( & ord)
145
+ . run_and_deserialize_output :: < SignOutput > ( ) ;
146
+
147
+ assert ! ( addresses. contains_key( & sign. address) ) ;
148
+ }
0 commit comments