@@ -17,74 +17,99 @@ const digest = ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Hello Eigen"));
17
17
18
18
async function keygen ( m , delay ) {
19
19
user_id = 1 ;
20
- keygen_url = `${ eigen_service } /user/${ user_id } /tss/keygen` ;
21
- res = await axios . post ( keygen_url , {
22
- headers : {
23
- "Content-Type" : "application/x-www-form-urlencoded" ,
24
- } ,
25
- } ) ;
26
- console . log ( res ) ;
20
+ key_name = "Just test" ;
21
+ keygen_url = `${ eigen_service } /tss/keygen` ;
22
+ res = await axios . post (
23
+ keygen_url ,
24
+ querystring . stringify ( { user_id : user_id , name : key_name } ) ,
25
+ {
26
+ headers : {
27
+ "Content-Type" : "application/x-www-form-urlencoded" ,
28
+ } ,
29
+ }
30
+ ) ;
31
+ console . log ( res . data ) ;
27
32
await delay_ms ( 1000 ) ;
28
33
29
34
let context = await m . gg18_keygen_client_new_context ( addr , t , n , delay ) ;
30
35
31
36
console . log ( "keygen new context: " ) ;
32
37
33
38
round = 1 ;
34
- res = await axios . post ( keygen_url , querystring . stringify ( { round : round } ) , {
35
- headers : {
36
- "Content-Type" : "application/x-www-form-urlencoded" ,
37
- } ,
38
- } ) ;
39
- console . log ( res ) ;
39
+ res = await axios . post (
40
+ keygen_url ,
41
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
42
+ {
43
+ headers : {
44
+ "Content-Type" : "application/x-www-form-urlencoded" ,
45
+ } ,
46
+ }
47
+ ) ;
48
+ console . log ( res . data ) ;
40
49
await delay_ms ( 1000 ) ;
41
50
42
51
context = await m . gg18_keygen_client_round1 ( context , delay ) ;
43
52
console . log ( "keygen round1:" ) ;
44
53
45
54
round = 2 ;
46
- res = await axios . post ( keygen_url , querystring . stringify ( { round : round } ) , {
47
- headers : {
48
- "Content-Type" : "application/x-www-form-urlencoded" ,
49
- } ,
50
- } ) ;
51
- console . log ( res ) ;
55
+ res = await axios . post (
56
+ keygen_url ,
57
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
58
+ {
59
+ headers : {
60
+ "Content-Type" : "application/x-www-form-urlencoded" ,
61
+ } ,
62
+ }
63
+ ) ;
64
+ console . log ( res . data ) ;
52
65
await delay_ms ( 1000 ) ;
53
66
54
67
context = await m . gg18_keygen_client_round2 ( context , delay ) ;
55
68
console . log ( "keygen round2: " ) ;
56
69
57
70
round = 3 ;
58
- res = await axios . post ( keygen_url , querystring . stringify ( { round : round } ) , {
59
- headers : {
60
- "Content-Type" : "application/x-www-form-urlencoded" ,
61
- } ,
62
- } ) ;
63
- console . log ( res ) ;
71
+ res = await axios . post (
72
+ keygen_url ,
73
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
74
+ {
75
+ headers : {
76
+ "Content-Type" : "application/x-www-form-urlencoded" ,
77
+ } ,
78
+ }
79
+ ) ;
80
+ console . log ( res . data ) ;
64
81
await delay_ms ( 1000 ) ;
65
82
66
83
context = await m . gg18_keygen_client_round3 ( context , delay ) ;
67
84
console . log ( "keygen round3: " ) ;
68
85
69
86
round = 4 ;
70
- res = await axios . post ( keygen_url , querystring . stringify ( { round : round } ) , {
71
- headers : {
72
- "Content-Type" : "application/x-www-form-urlencoded" ,
73
- } ,
74
- } ) ;
75
- console . log ( res ) ;
87
+ res = await axios . post (
88
+ keygen_url ,
89
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
90
+ {
91
+ headers : {
92
+ "Content-Type" : "application/x-www-form-urlencoded" ,
93
+ } ,
94
+ }
95
+ ) ;
96
+ console . log ( res . data ) ;
76
97
await delay_ms ( 1000 ) ;
77
98
78
99
context = await m . gg18_keygen_client_round4 ( context , delay ) ;
79
100
console . log ( "keygen round4: " ) ;
80
101
81
102
round = 5 ;
82
- res = await axios . post ( keygen_url , querystring . stringify ( { round : round } ) , {
83
- headers : {
84
- "Content-Type" : "application/x-www-form-urlencoded" ,
85
- } ,
86
- } ) ;
87
- console . log ( res ) ;
103
+ res = await axios . post (
104
+ keygen_url ,
105
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
106
+ {
107
+ headers : {
108
+ "Content-Type" : "application/x-www-form-urlencoded" ,
109
+ } ,
110
+ }
111
+ ) ;
112
+ console . log ( res . data ) ;
88
113
await delay_ms ( 1000 ) ;
89
114
90
115
keygen_json = await m . gg18_keygen_client_round5 ( context , delay ) ;
@@ -99,20 +124,21 @@ async function keygen(m, delay) {
99
124
async function sign ( m , key_store , delay , public_key_address ) {
100
125
console . log ( "public_key_address = " , public_key_address ) ;
101
126
user_id = 1 ;
102
- sign_url = `${ eigen_service } /user/ ${ user_id } / tss/sign` ;
127
+ sign_url = `${ eigen_service } /tss/sign` ;
103
128
res = await axios . post (
104
129
sign_url ,
105
130
querystring . stringify ( {
106
131
digest : digest . slice ( 2 ) ,
107
132
user_address : public_key_address ,
133
+ user_id : user_id ,
108
134
} ) ,
109
135
{
110
136
headers : {
111
137
"Content-Type" : "application/x-www-form-urlencoded" ,
112
138
} ,
113
139
}
114
140
) ;
115
- console . log ( res ) ;
141
+ console . log ( res . data ) ;
116
142
await delay_ms ( 1000 ) ;
117
143
118
144
let context = await m . gg18_sign_client_new_context (
@@ -125,120 +151,160 @@ async function sign(m, key_store, delay, public_key_address) {
125
151
console . log ( "sign new context: " , context ) ;
126
152
127
153
round = 0 ;
128
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
129
- headers : {
130
- "Content-Type" : "application/x-www-form-urlencoded" ,
131
- } ,
132
- } ) ;
133
- console . log ( res ) ;
154
+ res = await axios . post (
155
+ sign_url ,
156
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
157
+ {
158
+ headers : {
159
+ "Content-Type" : "application/x-www-form-urlencoded" ,
160
+ } ,
161
+ }
162
+ ) ;
163
+ console . log ( res . data ) ;
134
164
await delay_ms ( 1000 ) ;
135
165
136
166
context = await m . gg18_sign_client_round0 ( context , delay ) ;
137
167
console . log ( "sign round0: " ) ;
138
168
139
169
round = 1 ;
140
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
141
- headers : {
142
- "Content-Type" : "application/x-www-form-urlencoded" ,
143
- } ,
144
- } ) ;
145
- console . log ( res ) ;
170
+ res = await axios . post (
171
+ sign_url ,
172
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
173
+ {
174
+ headers : {
175
+ "Content-Type" : "application/x-www-form-urlencoded" ,
176
+ } ,
177
+ }
178
+ ) ;
179
+ console . log ( res . data ) ;
146
180
await delay_ms ( 1000 ) ;
147
181
148
182
context = await m . gg18_sign_client_round1 ( context , delay ) ;
149
183
console . log ( "sign round1: " ) ;
150
184
151
185
round = 2 ;
152
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
153
- headers : {
154
- "Content-Type" : "application/x-www-form-urlencoded" ,
155
- } ,
156
- } ) ;
157
- console . log ( res ) ;
186
+ res = await axios . post (
187
+ sign_url ,
188
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
189
+ {
190
+ headers : {
191
+ "Content-Type" : "application/x-www-form-urlencoded" ,
192
+ } ,
193
+ }
194
+ ) ;
195
+ console . log ( res . data ) ;
158
196
await delay_ms ( 1000 ) ;
159
197
160
198
context = await m . gg18_sign_client_round2 ( context , delay ) ;
161
199
console . log ( "sign round2: " ) ;
162
200
163
201
round = 3 ;
164
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
165
- headers : {
166
- "Content-Type" : "application/x-www-form-urlencoded" ,
167
- } ,
168
- } ) ;
169
- console . log ( res ) ;
202
+ res = await axios . post (
203
+ sign_url ,
204
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
205
+ {
206
+ headers : {
207
+ "Content-Type" : "application/x-www-form-urlencoded" ,
208
+ } ,
209
+ }
210
+ ) ;
211
+ console . log ( res . data ) ;
170
212
await delay_ms ( 1000 ) ;
171
213
172
214
context = await m . gg18_sign_client_round3 ( context , delay ) ;
173
215
console . log ( "sign round3: " ) ;
174
216
175
217
round = 4 ;
176
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
177
- headers : {
178
- "Content-Type" : "application/x-www-form-urlencoded" ,
179
- } ,
180
- } ) ;
181
- console . log ( res ) ;
218
+ res = await axios . post (
219
+ sign_url ,
220
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
221
+ {
222
+ headers : {
223
+ "Content-Type" : "application/x-www-form-urlencoded" ,
224
+ } ,
225
+ }
226
+ ) ;
227
+ console . log ( res . data ) ;
182
228
await delay_ms ( 1000 ) ;
183
229
184
230
context = await m . gg18_sign_client_round4 ( context , delay ) ;
185
231
console . log ( "sign round4: " ) ;
186
232
187
233
round = 5 ;
188
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
189
- headers : {
190
- "Content-Type" : "application/x-www-form-urlencoded" ,
191
- } ,
192
- } ) ;
193
- console . log ( res ) ;
234
+ res = await axios . post (
235
+ sign_url ,
236
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
237
+ {
238
+ headers : {
239
+ "Content-Type" : "application/x-www-form-urlencoded" ,
240
+ } ,
241
+ }
242
+ ) ;
243
+ console . log ( res . data ) ;
194
244
await delay_ms ( 1000 ) ;
195
245
196
246
context = await m . gg18_sign_client_round5 ( context , delay ) ;
197
247
console . log ( "sign round5: " ) ;
198
248
199
249
round = 6 ;
200
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
201
- headers : {
202
- "Content-Type" : "application/x-www-form-urlencoded" ,
203
- } ,
204
- } ) ;
205
- console . log ( res ) ;
250
+ res = await axios . post (
251
+ sign_url ,
252
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
253
+ {
254
+ headers : {
255
+ "Content-Type" : "application/x-www-form-urlencoded" ,
256
+ } ,
257
+ }
258
+ ) ;
259
+ console . log ( res . data ) ;
206
260
await delay_ms ( 1000 ) ;
207
261
208
262
context = await m . gg18_sign_client_round6 ( context , delay ) ;
209
263
console . log ( "sign round6: " ) ;
210
264
211
265
round = 7 ;
212
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
213
- headers : {
214
- "Content-Type" : "application/x-www-form-urlencoded" ,
215
- } ,
216
- } ) ;
217
- console . log ( res ) ;
266
+ res = await axios . post (
267
+ sign_url ,
268
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
269
+ {
270
+ headers : {
271
+ "Content-Type" : "application/x-www-form-urlencoded" ,
272
+ } ,
273
+ }
274
+ ) ;
275
+ console . log ( res . data ) ;
218
276
await delay_ms ( 1000 ) ;
219
277
220
278
context = await m . gg18_sign_client_round7 ( context , delay ) ;
221
279
console . log ( "sign round7: " ) ;
222
280
223
281
round = 8 ;
224
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
225
- headers : {
226
- "Content-Type" : "application/x-www-form-urlencoded" ,
227
- } ,
228
- } ) ;
229
- console . log ( res ) ;
282
+ res = await axios . post (
283
+ sign_url ,
284
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
285
+ {
286
+ headers : {
287
+ "Content-Type" : "application/x-www-form-urlencoded" ,
288
+ } ,
289
+ }
290
+ ) ;
291
+ console . log ( res . data ) ;
230
292
await delay_ms ( 1000 ) ;
231
293
232
294
context = await m . gg18_sign_client_round8 ( context , delay ) ;
233
295
console . log ( "sign round8: " ) ;
234
296
235
297
round = 9 ;
236
- res = await axios . post ( sign_url , querystring . stringify ( { round : round } ) , {
237
- headers : {
238
- "Content-Type" : "application/x-www-form-urlencoded" ,
239
- } ,
240
- } ) ;
241
- console . log ( res ) ;
298
+ res = await axios . post (
299
+ sign_url ,
300
+ querystring . stringify ( { user_id : user_id , round : round } ) ,
301
+ {
302
+ headers : {
303
+ "Content-Type" : "application/x-www-form-urlencoded" ,
304
+ } ,
305
+ }
306
+ ) ;
307
+ console . log ( res . data ) ;
242
308
await delay_ms ( 1000 ) ;
243
309
244
310
sign_json = await m . gg18_sign_client_round9 ( context , delay ) ;
0 commit comments