Compare commits

...
Author SHA1 Message Date
Michael Shaw ac6a5602ad utils/json test for comparing known, but deprecated method to new implementation 2023-01-25 15:05:48 -05:00
Michael Shaw 7de916117d golang linting is really picky 2023-01-19 17:36:16 -05:00
Michael Shaw 44ab3f6fc0 unchecked error complaint from linter 2023-01-19 17:30:47 -05:00
Michael Shaw 7db19ee56d missing unmarshalling of content bytes before encoding and generation of CID 2023-01-19 16:23:42 -05:00
Zach 9ec237e41f Merge pull request #80 from cerc-io/zramsay-patch-1
Update README with ##Usage
2023-01-11 19:18:16 -05:00
dboreham b57ad7d5fa Merge pull request #76 from cerc-io/murali/sdk-integration-tests
sdk-integration: fix private key command
2023-01-11 08:32:08 -07:00
Zach c3138a2615 Update README.md 2023-01-11 09:11:37 -05:00
nabarun 02e9080094 Changes to run laconic-console app with laconicd (#75)
* Add cors middleware for GQL requests (#65)

* Implement loading query from URL in GQL playground (#66)

* Implement loading GQL query from URL

* Fix variable name lint error

* Load record names in `getRecordsByIds` GQL query (#67)

* Fix variable rename

* Load names in getRecordsByIds GQL query

* CI Review fixes

* Make init script executable
2023-01-11 13:06:42 +05:30
0xmuralik 747088deb0 fix private key command 2023-01-11 11:55:14 +05:30
Murali Krishna Komatireddy ab2ea51aac chain id (#73) 2023-01-11 10:52:29 +05:30
18 changed files with 266 additions and 48 deletions
+8
View File
@@ -15,6 +15,14 @@ The Source of Proof. Laconic is a next generation data availability & verifiabil
make install make install
``` ```
## Usage
To quickly get started with a single node fixture, run:
```bash
./init.sh
```
## Community ## Community
The following chat channels and forums are a great spot to ask questions about Ethermint: The following chat channels and forums are a great spot to ask questions about Ethermint:
+1 -1
View File
@@ -77,7 +77,7 @@ func SetupWithDB(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.Genesis
// Initialize the chain // Initialize the chain
app.InitChain( app.InitChain(
abci.RequestInitChain{ abci.RequestInitChain{
ChainId: "ethermint_9000-1", ChainId: "laconic_9000-1",
Validators: []abci.ValidatorUpdate{}, Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams, ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes, AppStateBytes: stateBytes,
+1
View File
@@ -18,6 +18,7 @@ require (
github.com/deckarep/golang-set v1.8.0 github.com/deckarep/golang-set v1.8.0
github.com/ethereum/go-ethereum v1.10.26 github.com/ethereum/go-ethereum v1.10.26
github.com/gibson042/canonicaljson-go v1.0.3 github.com/gibson042/canonicaljson-go v1.0.3
github.com/go-chi/chi/v5 v5.0.7
github.com/gogo/protobuf v1.3.3 github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
+2
View File
@@ -367,6 +367,8 @@ github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjX
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
+165
View File
@@ -0,0 +1,165 @@
package gql
import (
"html/template"
"net/http"
)
// GraphiQL is an in-browser IDE for exploring GraphiQL APIs.
// This handler returns GraphiQL when requested.
//
// For more information, see https://github.com/graphql/graphiql.
func PlaygroundHandler(apiURL string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.Method != "GET" {
http.Error(w, "only GET requests are supported", http.StatusMethodNotAllowed)
return
}
w.Header().Set("Content-Type", "text/html")
err := page.Execute(w, map[string]interface{}{
"apiURL": apiURL,
})
if err != nil {
panic(err)
}
}
}
// https://github.com/graphql/graphiql/blob/main/examples/graphiql-cdn/index.html
var page = template.Must(template.New("graphiql").Parse(`
<!DOCTYPE html>
<html lang="en">
<head>
<title>GraphiQL</title>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}
#graphiql {
height: 100vh;
}
</style>
<!--
This GraphiQL example depends on Promise and fetch, which are available in
modern browsers, but can be "polyfilled" for older browsers.
GraphiQL itself depends on React DOM.
If you do not want to rely on a CDN, you can host these files locally or
include them directly in your favored resource bundler.
-->
<script
src="https://unpkg.com/react@17/umd/react.development.js"
integrity="sha512-Vf2xGDzpqUOEIKO+X2rgTLWPY+65++WPwCHkX2nFMu9IcstumPsf/uKKRd5prX3wOu8Q0GBylRpsDB26R6ExOg=="
crossorigin="anonymous"
></script>
<script
src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"
integrity="sha512-Wr9OKCTtq1anK0hq5bY3X/AvDI5EflDSAh0mE9gma+4hl+kXdTJPKZ3TwLMBcrgUeoY0s3dq9JjhCQc7vddtFg=="
crossorigin="anonymous"
></script>
<!--
These two files can be found in the npm module, however you may wish to
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
</head>
<body>
<div id="graphiql">Loading...</div>
<script
src="https://unpkg.com/graphiql/graphiql.min.js"
type="application/javascript"
></script>
<script>
// https://github.com/graphql/graphiql/blob/main/packages/graphiql/resources/renderExample.js
// Parse the search string to get url parameters.
var search = window.location.search;
var parameters = {};
search
.substr(1)
.split('&')
.forEach(function (entry) {
var eq = entry.indexOf('=');
if (eq >= 0) {
parameters[decodeURIComponent(entry.slice(0, eq))] = decodeURIComponent(
entry.slice(eq + 1),
);
}
});
// When the query and variables string is edited, update the URL bar so
// that it can be easily shared.
function onEditQuery(newQuery) {
parameters.query = newQuery;
updateURL();
}
function onEditVariables(newVariables) {
parameters.variables = newVariables;
updateURL();
}
function onEditHeaders(newHeaders) {
parameters.headers = newHeaders;
updateURL();
}
function onTabChange(tabsState) {
const activeTab = tabsState.tabs[tabsState.activeTabIndex];
parameters.query = activeTab.query;
parameters.variables = activeTab.variables;
parameters.headers = activeTab.headers;
updateURL();
}
function updateURL() {
var newSearch =
'?' +
Object.keys(parameters)
.filter(function (key) {
return Boolean(parameters[key]);
})
.map(function (key) {
return (
encodeURIComponent(key) + '=' + encodeURIComponent(parameters[key])
);
})
.join('&');
history.replaceState(null, null, newSearch);
}
// Render <GraphiQL /> into the body.
// See the README in the top level of this module to learn more about
// how you can customize GraphiQL by providing different values or
// additional child elements.
ReactDOM.render(
React.createElement(GraphiQL, {
fetcher: GraphiQL.createFetcher({
url: {{.apiURL}}
}),
query: parameters.query,
variables: parameters.variables,
headers: parameters.headers,
defaultHeaders: parameters.defaultHeaders,
onEditQuery: onEditQuery,
onEditVariables: onEditVariables,
onEditHeaders: onEditHeaders,
defaultEditorToolsVisibility: true,
isHeadersEditorEnabled: true,
shouldPersistHeaders: true,
onTabChange,
}),
document.getElementById('graphiql'),
);
</script>
</body>
</html>
`))
+18 -7
View File
@@ -5,9 +5,10 @@ import (
"net/http" "net/http"
"github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/go-chi/chi/v5"
"github.com/rs/cors"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@@ -16,6 +17,16 @@ func Server(ctx client.Context) {
if !viper.GetBool("gql-server") { if !viper.GetBool("gql-server") {
return return
} }
router := chi.NewRouter()
// Add CORS middleware around every request
// See https://github.com/rs/cors for full option listing
router.Use(cors.New(cors.Options{
AllowedOrigins: []string{"*"},
Debug: false,
}).Handler)
logFile := viper.GetString("log-file") logFile := viper.GetString("log-file")
port := viper.GetString("gql-port") port := viper.GetString("gql-port")
@@ -25,20 +36,20 @@ func Server(ctx client.Context) {
logFile: logFile, logFile: logFile,
}})) }}))
http.Handle("/", playground.Handler("GraphQL playground", "/api")) router.Handle("/", PlaygroundHandler("/api"))
if viper.GetBool("gql-playground") { if viper.GetBool("gql-playground") {
apiBase := viper.GetString("gql-playground-api-base") apiBase := viper.GetString("gql-playground-api-base")
http.Handle("/webui", playground.Handler("GraphQL playground", apiBase+"/api")) router.Handle("/webui", PlaygroundHandler(apiBase+"/api"))
http.Handle("/console", playground.Handler("GraphQL playground", apiBase+"/graphql")) router.Handle("/console", PlaygroundHandler(apiBase+"/graphql"))
} }
http.Handle("/api", srv) router.Handle("/api", srv)
http.Handle("/graphql", srv) router.Handle("/graphql", srv)
log.Info("Connect to GraphQL playground", "url", fmt.Sprintf("http://localhost:%s", port)) log.Info("Connect to GraphQL playground", "url", fmt.Sprintf("http://localhost:%s", port))
err := http.ListenAndServe(":"+port, nil) //nolint: all err := http.ListenAndServe(":"+port, router) //nolint: all
if err != nil { if err != nil {
panic(err) panic(err)
} }
+1 -1
View File
@@ -9,7 +9,7 @@ rem 3. add path C:\msys64\mingw64\bin
rem C:\msys64\usr\bin rem C:\msys64\usr\bin
set KEY="mykey" set KEY="mykey"
set CHAINID="ethermint_9000-1" set CHAINID="laconic_9000-1"
set MONIKER="localtestnet" set MONIKER="localtestnet"
set KEYRING="test" set KEYRING="test"
set KEYALGO="eth_secp256k1" set KEYALGO="eth_secp256k1"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
KEY="mykey" KEY="mykey"
CHAINID="laconic_2345678-1" CHAINID="laconic_9000-1"
MONIKER="localtestnet" MONIKER="localtestnet"
KEYRING="test" KEYRING="test"
KEYALGO="eth_secp256k1" KEYALGO="eth_secp256k1"
+1 -1
View File
@@ -1,5 +1,5 @@
dotenv: .env dotenv: .env
ethermint_9000-1: laconic_9000-1:
cmd: laconicd cmd: laconicd
start-flags: "--trace" start-flags: "--trace"
app-config: app-config:
+3 -3
View File
@@ -15,7 +15,7 @@ IP_ADDR="0.0.0.0"
MODE="rpc" MODE="rpc"
KEY="mykey" KEY="mykey"
CHAINID="ethermint_9000-1" CHAINID="laconic_9000-1"
MONIKER="mymoniker" MONIKER="mymoniker"
## default port prefixes for laconicd ## default port prefixes for laconicd
@@ -47,14 +47,14 @@ done
set -euxo pipefail set -euxo pipefail
DATA_DIR=$(mktemp -d -t ethermint_9000-datadir.XXXXX) DATA_DIR=$(mktemp -d -t laconic_9000-datadir.XXXXX)
if [[ ! "$DATA_DIR" ]]; then if [[ ! "$DATA_DIR" ]]; then
echo "Could not create $DATA_DIR" echo "Could not create $DATA_DIR"
exit 1 exit 1
fi fi
DATA_CLI_DIR=$(mktemp -d -t ethermint_9000-cli-datadir.XXXXX) DATA_CLI_DIR=$(mktemp -d -t laconic_9000-cli-datadir.XXXXX)
if [[ ! "$DATA_CLI_DIR" ]]; then if [[ ! "$DATA_CLI_DIR" ]]; then
echo "Could not create $DATA_CLI_DIR" echo "Could not create $DATA_CLI_DIR"
+1 -1
View File
@@ -24,7 +24,7 @@ init:
address: "0.0.0.0:8545" # change the JSON-RPC address and port address: "0.0.0.0:8545" # change the JSON-RPC address and port
ws-address: "0.0.0.0:8546" # change the JSON-RPC websocket address and port ws-address: "0.0.0.0:8546" # change the JSON-RPC websocket address and port
genesis: genesis:
chain_id: "ethermint_9000-1" chain_id: "laconic_9000-1"
app_state: app_state:
staking: staking:
params: params:
+1 -1
View File
@@ -3,7 +3,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
# Get the key from laconicd # Get the key from laconicd
laconicd_key=$( docker compose exec laconicd echo y | laconicd keys export mykey --unarmored-hex --unsafe ) laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
# Set parameters for the test suite # Set parameters for the test suite
cosmos_chain_id=laconic_9000-1 cosmos_chain_id=laconic_9000-1
laconicd_rest_endpoint=http://laconicd:1317 laconicd_rest_endpoint=http://laconicd:1317
+16 -15
View File
@@ -8,17 +8,16 @@ import (
"bytes" "bytes"
"errors" "errors"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
"github.com/ipld/go-ipld-prime/fluent"
"github.com/ipld/go-ipld-prime/linking"
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
"github.com/ipld/go-ipld-prime/multicodec"
"github.com/ipld/go-ipld-prime/storage/memstore"
canonicalJson "github.com/gibson042/canonicaljson-go" canonicalJson "github.com/gibson042/canonicaljson-go"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
"github.com/ipld/go-ipld-prime/codec/dagjson"
"github.com/ipld/go-ipld-prime/linking"
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
"github.com/ipld/go-ipld-prime/multicodec"
basicnode "github.com/ipld/go-ipld-prime/node/basic" basicnode "github.com/ipld/go-ipld-prime/node/basic"
"github.com/ipld/go-ipld-prime/storage/memstore"
mh "github.com/multiformats/go-multihash" mh "github.com/multiformats/go-multihash"
) )
@@ -68,7 +67,17 @@ func GetAttributeAsString(obj map[string]interface{}, attr string) (string, erro
} }
// CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes). // CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes).
// This is combination of samples for unmarshalling and linking
// see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) { func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
np := basicnode.Prototype.Any // Pick a stle for the in-memory data.
nb := np.NewBuilder() // Create a builder.
err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in!
if err != nil {
return "", err
}
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!)
lsys := cidlink.DefaultLinkSystem() lsys := cidlink.DefaultLinkSystem()
// We want to store the serialized data somewhere. // We want to store the serialized data somewhere.
@@ -87,14 +96,6 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
MhLength: 32, // sha2-256 hash has a 32-byte sum. MhLength: 32, // sha2-256 hash has a 32-byte sum.
}} }}
// And we need some data to link to! Here's a quick piece of example data:
n, err := fluent.Build(basicnode.Prototype.Any, func(na fluent.NodeAssembler) {
na.AssignBytes(content)
})
if err != nil {
return "", err
}
// Now: time to apply the LinkSystem, and do the actual store operation! // Now: time to apply the LinkSystem, and do the actual store operation!
lnk, err := lsys.Store( lnk, err := lsys.Store(
linking.LinkContext{}, // The zero value is fine. Configure it it you want cancellability or other features. linking.LinkContext{}, // The zero value is fine. Configure it it you want cancellability or other features.
+30
View File
@@ -0,0 +1,30 @@
package utils
import (
"github.com/stretchr/testify/require"
"testing"
)
func TestAndValidateCIDGeneration(t *testing.T) {
testCases := []struct {
name string
content string
}{
{
"empty string", "",
},
{
"empty json", "{}",
},
{
"test record", "\\xa6curlohttps://cerc.iodtypex\\x19WebsiteRegistrationRecordgversione0.0.1ltls_cert_cidx.QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnRrbuild_artifact_cidx.QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9x\\x1crepo_registration_record_cidx.QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D",
},
}
for _, tc := range testCases {
deprecatedAndCorrect, _ := CIDFromJSONBytes([]byte(tc.content))
newImpl, _ := CIDFromJSONBytesUsingIpldPrime([]byte(tc.content))
require.Equal(t, deprecatedAndCorrect, newImpl, tc.name)
}
}
+2 -2
View File
@@ -20,7 +20,7 @@ The following steps need to be followed only before running the chain for the fi
Keep a note of the keyring passphrase if you set it. Keep a note of the keyring passphrase if you set it.
2. Init the chain: 2. Init the chain:
``` ```
./build/laconicd init test-moniker --chain-id ethermint_9000-1 ./build/laconicd init test-moniker --chain-id laconic_9000-1
``` ```
3. Add genesis account: 3. Add genesis account:
``` ```
@@ -28,7 +28,7 @@ The following steps need to be followed only before running the chain for the fi
``` ```
4. Make a genesis tx: 4. Make a genesis tx:
``` ```
./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 ./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1
``` ```
5. Collect gentxs: 5. Collect gentxs:
``` ```
+2 -2
View File
@@ -9,9 +9,9 @@ $ make build
```bash ```bash
./build/laconicd keys add root ./build/laconicd keys add root
./build/laconicd init test-moniker --chain-id ethermint_9000-1 ./build/laconicd init test-moniker --chain-id laconic_9000-1
./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake ./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake
./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 ./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1
./build/laconicd collect-gentxs ./build/laconicd collect-gentxs
./build/laconicd start ./build/laconicd start
``` ```
+12 -12
View File
@@ -9,9 +9,9 @@ $ make build
```bash ```bash
./build/laconicd keys add root ./build/laconicd keys add root
./build/laconicd init test-moniker --chain-id ethermint_9000-1 ./build/laconicd init test-moniker --chain-id laconic_9000-1
./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake ./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake
./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 ./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1
./build/laconicd collect-gentxs ./build/laconicd collect-gentxs
./build/laconicd start ./build/laconicd start
``` ```
@@ -58,7 +58,7 @@ $ ./build/laconicd q registry params -o json | jq .
> First you have to Create bond > First you have to Create bond
```bash ```bash
$ ./build/laconicd tx registry set ~/Desktop/examples/records/service_provider_example.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 --yes -o json $ ./build/laconicd tx registry set ~/Desktop/examples/records/service_provider_example.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id laconic_9000-1 --yes -o json
{ {
"height": "0", "height": "0",
"txhash": "BA44ABE1194724694E7CB290F9F3121DB4E63E1A030D95CB84813EEA132CF95F", "txhash": "BA44ABE1194724694E7CB290F9F3121DB4E63E1A030D95CB84813EEA132CF95F",
@@ -121,7 +121,7 @@ $ ./build/laconicd q registry get bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my
## Reserve name ## Reserve name
```bash ```bash
./build/laconicd tx registry reserve-name hello --from root --chain-id ethermint_9000-1 --owner $(./build/laconicd key ./build/laconicd tx registry reserve-name hello --from root --chain-id laconic_9000-1 --owner $(./build/laconicd key
s show root -a) -y -o json | jq . s show root -a) -y -o json | jq .
{ {
"height": "0", "height": "0",
@@ -181,8 +181,8 @@ $ ./build/laconicd q registry balance -o json | jq .
## add bond to the authority ## add bond to the authority
```bash ```bash
$ ./build/laconicd tx registry authority-bond [Authority Name] [Bond ID ] --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/laconicd tx registry authority-bond [Authority Name] [Bond ID ] --from root --chain-id laconic_9000-1 -y -o json | jq .
$ ./build/laconicd tx registry authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/laconicd tx registry authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id laconic_9000-1 -y -o json | jq .
``` ```
## Query the records by associate bond id ## Query the records by associate bond id
@@ -209,7 +209,7 @@ $ ./build/laconicd q registry query-by-bond 95f68b1b862bfd1609b0c9aaf7300287b92f
## dissociate bond from record ## dissociate bond from record
```bash ```bash
$ ./build/laconicd tx registry dissociate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 $ ./build/laconicd tx registry dissociate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id laconic_9000-1
{"body":{"messages":[{"@type":"/vulcanize.registry.v1beta1.MsgDissociateBond","record_id":"bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} {"body":{"messages":[{"@type":"/vulcanize.registry.v1beta1.MsgDissociateBond","record_id":"bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]}
confirm transaction before signing and broadcasting [y/N]: y confirm transaction before signing and broadcasting [y/N]: y
@@ -231,7 +231,7 @@ txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060
## Associate bond with record ## Associate bond with record
```bash ```bash
./build/laconicd tx registry associate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . ./build/laconicd tx registry associate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id laconic_9000-1 -y -o json | jq .
{ {
"height": "0", "height": "0",
"txhash": "F75C2BF2FE73668AE1332E1237F924AC549E31E822A56394DE5AC17200B199F9", "txhash": "F75C2BF2FE73668AE1332E1237F924AC549E31E822A56394DE5AC17200B199F9",
@@ -252,7 +252,7 @@ txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060
## dissociate-records => remove all record from bond ## dissociate-records => remove all record from bond
```bash ```bash
$./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . $./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id laconic_9000-1 -y -o json | jq .
{ {
"height": "0", "height": "0",
"txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9", "txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9",
@@ -274,14 +274,14 @@ $./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b
> When a record is expires , needs to renew record > When a record is expires , needs to renew record
```bash ```bash
$ ./build/laconicd tx registry renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 $ ./build/laconicd tx registry renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id laconic_9000-1
``` ```
## Set the authority name ## Set the authority name
```bash ```bash
$ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from root --chain-id laconic_9000-1 -y -o json | jq .
{ {
"height": "0", "height": "0",
"txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486", "txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486",
@@ -301,7 +301,7 @@ $ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from
## Delete the name ## Delete the name
```bash ```bash
$./build/laconicd tx registry delete-name crn://hello/test --from root --chain-id ethermint_9000-1 -y $./build/laconicd tx registry delete-name crn://hello/test --from root --chain-id laconic_9000-1 -y
code: 0 code: 0
codespace: "" codespace: ""
data: "" data: ""
+1 -1
View File
@@ -111,7 +111,7 @@ func (k Keeper) GetRecord(ctx sdk.Context, id string) (record types.Record) {
store := ctx.KVStore(k.storeKey) store := ctx.KVStore(k.storeKey)
result := store.Get(GetRecordIndexKey(id)) result := store.Get(GetRecordIndexKey(id))
k.cdc.MustUnmarshal(result, &record) k.cdc.MustUnmarshal(result, &record)
return record return recordObjToRecord(store, record)
} }
// ListRecords - get all records. // ListRecords - get all records.