Skip to content

Commit

Permalink
Merge branch 'main' into docs/update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
izyak authored Aug 14, 2023
2 parents 381c9dc + 242e516 commit b3eb428
Show file tree
Hide file tree
Showing 16 changed files with 216 additions and 143 deletions.
9 changes: 8 additions & 1 deletion cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
const (
flagCoinType = "coin-type"
flagAlgo = "signing-algorithm"
flagPassword = "password"
defaultCoinType uint32 = sdk.CoinType
)

Expand Down Expand Up @@ -97,6 +98,11 @@ $ %s k a cosmoshub testkey`, appName, appName, appName)),
return err
}

password, err := cmdFlags.GetString(flagPassword)
if err != nil {
return err
}

Check warning on line 104 in cmd/keys.go

View check run for this annotation

Codecov / codecov/patch

cmd/keys.go#L101-L104

Added lines #L101 - L104 were not covered by tests

if algo == "" {
if ccp, ok := chain.ChainProvider.(*cosmos.CosmosProvider); ok {
algo = ccp.PCfg.SigningAlgorithm
Expand All @@ -105,7 +111,7 @@ $ %s k a cosmoshub testkey`, appName, appName, appName)),
}
}

ko, err := chain.ChainProvider.AddKey(keyName, uint32(coinType), algo)
ko, err := chain.ChainProvider.AddKey(keyName, uint32(coinType), algo, password)

Check warning on line 114 in cmd/keys.go

View check run for this annotation

Codecov / codecov/patch

cmd/keys.go#L114

Added line #L114 was not covered by tests
if err != nil {
return fmt.Errorf("failed to add key: %w", err)
}
Expand All @@ -121,6 +127,7 @@ $ %s k a cosmoshub testkey`, appName, appName, appName)),
}
cmd.Flags().Int32(flagCoinType, -1, "coin type number for HD derivation")
cmd.Flags().String(flagAlgo, "", "signing algorithm for key (secp256k1, sr25519)")
cmd.Flags().String(flagPassword, "x", "icon keystore password")

return cmd
}
Expand Down
14 changes: 7 additions & 7 deletions examples/config_IBC_ICON.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chains:
archway:
type: wasm
value:
key-directory: /home/user/.relayer/keys/localnet
key-directory: /home/user/.relayer/keys
key: relayWallet
chain-id: localnet
rpc-addr: http://localhost:26657
Expand All @@ -24,24 +24,24 @@ chains:
extra-codecs: []
coin-type: 0
broadcast-mode: batch
ibc-handler-address: archway14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy85n2u
ibc-handler-address: archway1pvrwmjuusn9wh34j7y520g8gumuy9xtl3gvprlljfdpwju3x7ucszwhc7n
first-retry-block-after: 0
start-height: 0
block-interval: 6000
block-interval: 3000
icon:
type: icon
value:
key: ""
key-directory: /home/user/.relayer/keys
chain-id: ibc-icon
rpc-addr: http://localhost:9082/api/v3/
timeout: 30s
keystore: /home/user/keystore/godWallet.json
keystore: godWallet
password: gochain
icon-network-id: 3
btp-network-id: 1
btp-network-type-id: 1
start-height: 0
ibc-handler-address: cxa1daa337788364a72644860a5097e3eef7a5d416
ibc-handler-address: cxbeb5929616e0dbd2fec1e6e950ab09e45e6fb25a
first-retry-block-after: 0
block-interval: 2000
paths:
Expand All @@ -56,4 +56,4 @@ paths:
connection-id: connection-0
src-channel-filter:
rule: ""
channel-list: []
channel-list: []
31 changes: 16 additions & 15 deletions examples/demo/configs/chains/ibc-icon.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"type": "icon",
"value": {
"key-directory": "/home/.relayer/keys",
"chain-id": "ibc-icon",
"rpc-addr": "http://localhost:9082/api/v3/",
"timeout": "30s",
"keystore": "relayerWallet",
"password": "gochain",
"btp-network-id":2,
"icon-network-id":3,
"start-height":0,
"ibc-handler-address":"cxfffe383e4780084e48e477935099b03193d952fe",
"block-interval":2000,
"first-retry-block-after":8
}
"type": "icon",
"value": {
"key-directory": "/home/user/.relayer/keys",
"chain-id": "ibc-icon",
"rpc-addr": "http://localhost:9082/api/v3/",
"timeout": "30s",
"keystore": "relayerWallet",
"password": "gochain",
"icon-network-id": 3,
"btp-network-id": 2,
"btp-network-type-id": 1,
"start-height": 0,
"ibc-handler-address": "cxbeb5929616e0dbd2fec1e6e950ab09e45e6fb25a",
"first-retry-block-after": 0,
"block-interval": 2000
}
}
29 changes: 15 additions & 14 deletions examples/demo/configs/chains/ibc-wasm.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"type": "wasm",
"value": {
"key": "default",
"chain-id": "test-1",
"rpc-addr": "https://rpc.constantine-2.archway.tech:443",
"key-directory":"/Users/viveksharmapoudel/.relayer/keys/test-1",
"grpc-addr": "",
"account-prefix": "neutron",
"key-directory": "/home/user/.relayer/keys",
"key": "relayWallet",
"chain-id": "localnet",
"rpc-addr": "http://localhost:26657",
"account-prefix": "archway",
"keyring-backend": "test",
"gas-adjustment": 1.5,
"gas-prices": "0.02uconst",
"gas-prices": "0.025stake",
"min-gas-amount": 1000000,
"debug": true,
"timeout": "20s",
"block-timeout": "",
"output-format": "json",
"sign-mode": "direct",
"ibc-handler-address":"neutron1fde8lfydxgwg6p7xe9ugx5a6ysj37zfvn9m9z5rxt4mqvdcneczsczq2a4",
"extra-codecs": [],
"coin-type": 0,
"broadcast-mode": "batch",
"block-timeout": "",
"start-height":0,
"block-interval": 6000
"ibc-handler-address": "archway1pvrwmjuusn9wh34j7y520g8gumuy9xtl3gvprlljfdpwju3x7ucszwhc7n",
"first-retry-block-after": 0,
"start-height": 0,
"block-interval": 3000
}
}


}
2 changes: 1 addition & 1 deletion examples/demo/configs/paths/icon-archway.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"chain-id": "ibc-icon"
},
"dst": {
"chain-id": "constantine-2"
"chain-id": "localnet"
},
"src-channel-filter": {
"rule": null,
Expand Down
2 changes: 1 addition & 1 deletion relayer/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (c *Chain) CreateTestKey() error {
if c.ChainProvider.KeyExists(c.ChainProvider.Key()) {
return fmt.Errorf("key {%s} exists for chain {%s}", c.ChainProvider.Key(), c.ChainID())
}
_, err := c.ChainProvider.AddKey(c.ChainProvider.Key(), defaultCoinType, defaultAlgo)
_, err := c.ChainProvider.AddKey(c.ChainProvider.Key(), defaultCoinType, defaultAlgo, "")

Check warning on line 152 in relayer/chain.go

View check run for this annotation

Codecov / codecov/patch

relayer/chain.go#L152

Added line #L152 was not covered by tests
return err
}

Expand Down
2 changes: 1 addition & 1 deletion relayer/chains/cosmos/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (cc *CosmosProvider) KeystoreCreated(path string) bool {

// AddKey generates a new mnemonic which is then converted to a private key and BIP-39 HD Path and persists it to the keystore.
// It fails if there is an existing key with the same address.
func (cc *CosmosProvider) AddKey(name string, coinType uint32, signingAlgorithm string) (output *provider.KeyOutput, err error) {
func (cc *CosmosProvider) AddKey(name string, coinType uint32, signingAlgorithm string, password string) (output *provider.KeyOutput, err error) {

Check warning on line 64 in relayer/chains/cosmos/keys.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/cosmos/keys.go#L64

Added line #L64 was not covered by tests
ko, err := cc.KeyAddOrRestore(name, coinType, signingAlgorithm)
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit b3eb428

Please sign in to comment.