@@ -20,7 +20,6 @@ export const setDefaultName = async (cli: CLIEnvironment, cliArgs: CLIArgs): Pro
20
20
21
21
export const publishNewSubgraph = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
22
22
const ipfs = cliArgs . ipfs
23
- const graphAccount = cliArgs . graphAccount
24
23
const subgraphDeploymentID = cliArgs . subgraphDeploymentID
25
24
const versionPath = cliArgs . versionPath
26
25
const subgraphPath = cliArgs . subgraphPath
@@ -30,89 +29,77 @@ export const publishNewSubgraph = async (cli: CLIEnvironment, cliArgs: CLIArgs):
30
29
const subgraphHashBytes = await pinMetadataToIPFS ( ipfs , 'subgraph' , subgraphPath )
31
30
const gns = cli . contracts . GNS
32
31
33
- logger . info ( `Publishing new subgraph for ${ graphAccount } ` )
32
+ logger . info ( `Publishing new subgraph for ${ cli . walletAddress } ... ` )
34
33
await sendTransaction ( cli . wallet , gns , 'publishNewSubgraph' , [
35
- graphAccount ,
36
34
subgraphDeploymentIDBytes ,
37
35
versionHashBytes ,
38
36
subgraphHashBytes ,
39
37
] )
40
38
}
41
39
42
40
export const publishNewVersion = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
41
+ const subgraphID = cliArgs . subgraphID
43
42
const ipfs = cliArgs . ipfs
44
- const graphAccount = cliArgs . graphAccount
45
43
const subgraphDeploymentID = cliArgs . subgraphDeploymentID
46
44
const versionPath = cliArgs . versionPath
47
- const subgraphNumber = cliArgs . subgraphNumber
48
45
49
46
const subgraphDeploymentIDBytes = IPFS . ipfsHashToBytes32 ( subgraphDeploymentID )
50
47
const versionHashBytes = await pinMetadataToIPFS ( ipfs , 'version' , versionPath )
51
48
const gns = cli . contracts . GNS
52
49
53
- logger . info ( `Publishing new subgraph version for ${ graphAccount } ` )
50
+ logger . info ( `Publishing new subgraph version for ${ subgraphID } ... ` )
54
51
await sendTransaction ( cli . wallet , gns , 'publishNewVersion' , [
55
- graphAccount ,
56
- subgraphNumber ,
52
+ subgraphID ,
57
53
subgraphDeploymentIDBytes ,
58
54
versionHashBytes ,
59
55
] )
60
56
}
61
57
62
58
export const deprecate = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
63
- const graphAccount = cliArgs . graphAccount
64
- const subgraphNumber = cliArgs . subgraphNumber
59
+ const subgraphID = cliArgs . subgraphID
65
60
const gns = cli . contracts . GNS
66
- logger . info ( `Deprecating subgraph ${ graphAccount } - ${ subgraphNumber } ...` )
67
- await sendTransaction ( cli . wallet , gns , 'deprecate ' , [ graphAccount , subgraphNumber ] )
61
+ logger . info ( `Deprecating subgraph ${ subgraphID } ...` )
62
+ await sendTransaction ( cli . wallet , gns , 'deprecateSubgraph ' , [ subgraphID ] )
68
63
}
69
64
70
65
export const updateSubgraphMetadata = async (
71
66
cli : CLIEnvironment ,
72
67
cliArgs : CLIArgs ,
73
68
) : Promise < void > => {
74
69
const ipfs = cliArgs . ipfs
75
- const graphAccount = cliArgs . graphAccount
76
- const subgraphNumber = cliArgs . subgraphNumber
70
+ const subgraphID = cliArgs . subgraphID
77
71
const subgraphPath = cliArgs . subgraphPath
78
72
const subgraphHashBytes = await pinMetadataToIPFS ( ipfs , 'subgraph' , subgraphPath )
79
73
const gns = cli . contracts . GNS
80
74
81
- logger . info ( `Updating subgraph metadata for ${ graphAccount } -${ subgraphNumber } ...` )
82
- await sendTransaction ( cli . wallet , gns , 'updateSubgraphMetadata' , [
83
- graphAccount ,
84
- subgraphNumber ,
85
- subgraphHashBytes ,
86
- ] )
75
+ logger . info ( `Updating subgraph metadata for ${ subgraphID } ...` )
76
+ await sendTransaction ( cli . wallet , gns , 'updateSubgraphMetadata' , [ subgraphID , subgraphHashBytes ] )
87
77
}
88
78
89
- export const mintNSignal = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
90
- const graphAccount = cliArgs . graphAccount
91
- const subgraphNumber = cliArgs . subgraphNumber
79
+ export const mintSignal = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
80
+ const subgraphID = cliArgs . subgraphID
92
81
const tokens = parseGRT ( cliArgs . tokens )
93
82
const gns = cli . contracts . GNS
94
83
95
- logger . info ( `Minting nSignal for ${ graphAccount } - ${ subgraphNumber } ...` )
96
- await sendTransaction ( cli . wallet , gns , 'mintNSignal ' , [ graphAccount , subgraphNumber , tokens , 0 ] )
84
+ logger . info ( `Minting signal for ${ subgraphID } ...` )
85
+ await sendTransaction ( cli . wallet , gns , 'mintSignal ' , [ subgraphID , tokens , 0 ] )
97
86
}
98
87
99
- export const burnNSignal = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
100
- const graphAccount = cliArgs . graphAccount
101
- const subgraphNumber = cliArgs . subgraphNumber
102
- const nSignal = cliArgs . nSignal
88
+ export const burnSignal = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
89
+ const subgraphID = cliArgs . subgraphID
90
+ const signal = cliArgs . signal
103
91
const gns = cli . contracts . GNS
104
92
105
- logger . info ( `Burning nSignal from ${ graphAccount } - ${ subgraphNumber } ...` )
106
- await sendTransaction ( cli . wallet , gns , 'burnNSignal ' , [ graphAccount , subgraphNumber , nSignal ] )
93
+ logger . info ( `Burning signal from ${ subgraphID } ...` )
94
+ await sendTransaction ( cli . wallet , gns , 'burnSignal ' , [ subgraphID , signal , 0 ] )
107
95
}
108
96
109
- export const withdrawGRT = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
110
- const graphAccount = cliArgs . graphAccount
111
- const subgraphNumber = cliArgs . subgraphNumber
97
+ export const withdraw = async ( cli : CLIEnvironment , cliArgs : CLIArgs ) : Promise < void > => {
98
+ const subgraphID = cliArgs . subgraphID
112
99
const gns = cli . contracts . GNS
113
100
114
- logger . info ( `Withdrawing locked GRT from subgraph ${ graphAccount } - ${ subgraphNumber } ...` )
115
- await sendTransaction ( cli . wallet , gns , 'withdrawGRT ' , [ graphAccount , subgraphNumber ] )
101
+ logger . info ( `Withdrawing locked GRT from subgraph ${ subgraphID } ...` )
102
+ await sendTransaction ( cli . wallet , gns , 'withdraw ' , [ subgraphID ] )
116
103
}
117
104
118
105
export const gnsCommand = {
@@ -153,12 +140,6 @@ export const gnsCommand = {
153
140
requiresArg : true ,
154
141
demandOption : true ,
155
142
} )
156
- . option ( 'graphAccount' , {
157
- description : 'graph account address' ,
158
- type : 'string' ,
159
- requiresArg : true ,
160
- demandOption : true ,
161
- } )
162
143
. option ( 'subgraphDeploymentID' , {
163
144
description : 'subgraph deployment ID in base58' ,
164
145
type : 'string' ,
@@ -194,14 +175,14 @@ export const gnsCommand = {
194
175
describe : 'Withdraw unlocked GRT' ,
195
176
builder : ( yargs : Argv ) => {
196
177
return yargs
197
- . option ( 'ipfs ' , {
198
- description : 'ipfs endpoint. ex. https://api.thegraph.com/ipfs/ ' ,
178
+ . option ( 'subgraphID ' , {
179
+ description : 'Subgraph identifier ' ,
199
180
type : 'string' ,
200
181
requiresArg : true ,
201
182
demandOption : true ,
202
183
} )
203
- . option ( 'graphAccount ' , {
204
- description : 'graph account address ' ,
184
+ . option ( 'ipfs ' , {
185
+ description : 'ipfs endpoint. ex. https://api.thegraph.com/ipfs/ ' ,
205
186
type : 'string' ,
206
187
requiresArg : true ,
207
188
demandOption : true ,
@@ -220,12 +201,6 @@ export const gnsCommand = {
220
201
requiresArg : true ,
221
202
demandOption : true ,
222
203
} )
223
- . option ( 'subgraphNumber' , {
224
- description : 'subgraph number the account is updating' ,
225
- type : 'number' ,
226
- requiresArg : true ,
227
- demandOption : true ,
228
- } )
229
204
} ,
230
205
handler : async ( argv : CLIArgs ) : Promise < void > => {
231
206
return publishNewVersion ( await loadEnv ( argv ) , argv )
@@ -235,19 +210,12 @@ export const gnsCommand = {
235
210
command : 'deprecate' ,
236
211
describe : 'Deprecate a subgraph' ,
237
212
builder : ( yargs : Argv ) => {
238
- return yargs
239
- . option ( 'graphAccount' , {
240
- description : 'graph account address' ,
241
- type : 'string' ,
242
- requiresArg : true ,
243
- demandOption : true ,
244
- } )
245
- . option ( 'subgraphNumber' , {
246
- description : 'subgraph number the account is deprecating' ,
247
- type : 'string' ,
248
- requiresArg : true ,
249
- demandOption : true ,
250
- } )
213
+ return yargs . option ( 'subgraphID' , {
214
+ description : 'Subgraph identifier' ,
215
+ type : 'string' ,
216
+ requiresArg : true ,
217
+ demandOption : true ,
218
+ } )
251
219
} ,
252
220
handler : async ( argv : CLIArgs ) : Promise < void > => {
253
221
return deprecate ( await loadEnv ( argv ) , argv )
@@ -258,14 +226,8 @@ export const gnsCommand = {
258
226
describe : 'Update a subgraphs metadata' ,
259
227
builder : ( yargs : Argv ) => {
260
228
return yargs
261
- . option ( 'graphAccount' , {
262
- description : 'graph account address' ,
263
- type : 'string' ,
264
- requiresArg : true ,
265
- demandOption : true ,
266
- } )
267
- . option ( 'subgraphNumber' , {
268
- description : 'subgraph number to update' ,
229
+ . option ( 'subgraphID' , {
230
+ description : 'Subgraph identifier' ,
269
231
type : 'string' ,
270
232
requiresArg : true ,
271
233
demandOption : true ,
@@ -287,18 +249,12 @@ export const gnsCommand = {
287
249
} ,
288
250
} )
289
251
. command ( {
290
- command : 'mintNSignal ' ,
252
+ command : 'mintSignal ' ,
291
253
describe : 'Mint Name Signal by depositing tokens' ,
292
254
builder : ( yargs : Argv ) => {
293
255
return yargs
294
- . option ( 'graphAccount' , {
295
- description : 'graph account address' ,
296
- type : 'string' ,
297
- requiresArg : true ,
298
- demandOption : true ,
299
- } )
300
- . option ( 'subgraphNumber' , {
301
- description : 'subgraph number of the name signal' ,
256
+ . option ( 'subgraphID' , {
257
+ description : 'Subgraph identifier' ,
302
258
type : 'string' ,
303
259
requiresArg : true ,
304
260
demandOption : true ,
@@ -311,57 +267,44 @@ export const gnsCommand = {
311
267
} )
312
268
} ,
313
269
handler : async ( argv : CLIArgs ) : Promise < void > => {
314
- return mintNSignal ( await loadEnv ( argv ) , argv )
270
+ return mintSignal ( await loadEnv ( argv ) , argv )
315
271
} ,
316
272
} )
317
273
. command ( {
318
- command : 'burnNSignal ' ,
274
+ command : 'burnSignal ' ,
319
275
describe : 'Burn Name Signal and receive tokens' ,
320
276
builder : ( yargs : Argv ) => {
321
277
return yargs
322
- . option ( 'graphAccount ' , {
323
- description : 'graph account address ' ,
278
+ . option ( 'subgraphID ' , {
279
+ description : 'Subgraph identifier ' ,
324
280
type : 'string' ,
325
281
requiresArg : true ,
326
282
demandOption : true ,
327
283
} )
328
- . option ( 'subgraphNumber' , {
329
- description : 'subgraph number of the name signal' ,
330
- type : 'string' ,
331
- requiresArg : true ,
332
- demandOption : true ,
333
- } )
334
- . option ( 'nSignal' , {
335
- description : 'Amount of nSignal to burn' ,
284
+ . option ( 'signal' , {
285
+ description : 'Amount of signal to burn' ,
336
286
type : 'string' ,
337
287
requiresArg : true ,
338
288
demandOption : true ,
339
289
} )
340
290
} ,
341
291
handler : async ( argv : CLIArgs ) : Promise < void > => {
342
- return burnNSignal ( await loadEnv ( argv ) , argv )
292
+ return burnSignal ( await loadEnv ( argv ) , argv )
343
293
} ,
344
294
} )
345
295
. command ( {
346
- command : 'withdrawGRT ' ,
296
+ command : 'withdraw ' ,
347
297
describe : 'Withdraw GRT from a deprecated subgraph' ,
348
298
builder : ( yargs : Argv ) => {
349
- return yargs
350
- . option ( 'graphAccount' , {
351
- description : 'graph account address' ,
352
- type : 'string' ,
353
- requiresArg : true ,
354
- demandOption : true ,
355
- } )
356
- . option ( 'subgraphNumber' , {
357
- description : 'subgraph number to withdraw from' ,
358
- type : 'string' ,
359
- requiresArg : true ,
360
- demandOption : true ,
361
- } )
299
+ return yargs . option ( 'subgraphID' , {
300
+ description : 'Subgraph identifier' ,
301
+ type : 'string' ,
302
+ requiresArg : true ,
303
+ demandOption : true ,
304
+ } )
362
305
} ,
363
306
handler : async ( argv : CLIArgs ) : Promise < void > => {
364
- return withdrawGRT ( await loadEnv ( argv ) , argv )
307
+ return withdraw ( await loadEnv ( argv ) , argv )
365
308
} ,
366
309
} )
367
310
} ,
0 commit comments