-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbridge_centralized.go
More file actions
37 lines (29 loc) · 849 Bytes
/
bridge_centralized.go
File metadata and controls
37 lines (29 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/urfave/cli/v2"
)
func shieldCentralized(c *cli.Context) error {
adminPrivateKey := c.String(adminPrivateKeyFlag)
if !isValidPrivateKey(adminPrivateKey) {
return newAppError(InvalidPrivateKeyError)
}
receiver := c.String(addressFlag)
if !isValidAddress(receiver) {
return newAppError(InvalidPaymentAddressError)
}
amt := c.Uint64(amountFlag)
if amt == 0 {
return newAppError(InvalidAmountError)
}
tokenIDStr := c.String(tokenIDFlag)
if !isValidTokenID(tokenIDStr) {
return newAppError(InvalidTokenIDError)
}
tokenName := c.String(tokenNameFlag)
txHash, err := cfg.incClient.CreateAndSendIssuingRequestTransaction(adminPrivateKey,
receiver, tokenIDStr, tokenName, amt)
if err != nil {
return newAppError(CentralizedShieldError, err)
}
return jsonPrintWithKey("TxHash", txHash)
}