[Blockchain] Cosmos Starport 101 - 为你的新数据类型 生成代码
# 项目模板
$ starport app github.com/hello/planet --address-prefix your_new_prefix
项目目录结构的说明看这里: https://docs.starport.network/scaffold/project.html#directory-structure
# 创建数据类型, 比如 post 类型, 包含有 title 和 body, 具体可查看命令帮助
$ starport -h
$ starport type -h
$ starport type post title body
含义: starport type [typeName] [field1] [field2] ... [flags]
这是实际意义上的第一步, 为什么要这么做, 请参考这里: https://tutorials.cosmos.network/blog/tutorial/01-index.html
Starport 进一步帮我们省去手工创建过程, 之后我们才可以进行数据的 CRUD.
字段可以是数字和指定的类型,默认是字符串. https://docs.starport.network/scaffold/type.html#command-overview
在 app 创建的基础模板上,starport v0.15.1 产生以下修改文件 和 新增文件:
modified: proto/planet/genesis.proto
modified: proto/planet/query.proto
modified: proto/planet/tx.proto
modified: vue/planet/store/generated/index.d.ts
modified: vue/planet/store/generated/index.js
modified: vue/planet/store/generated/index.ts
modified: vue/planet/views/Types.vue
modified: x/planet/client/cli/query.go
modified: x/planet/client/cli/tx.go
modified: x/planet/client/rest/rest.go
modified: x/planet/genesis.go
modified: x/planet/handler.go
modified: x/planet/keeper/query.go
modified: x/planet/module.go
modified: x/planet/types/codec.go
modified: x/planet/types/genesis.go
modified: x/planet/types/genesis.pb.go
modified: x/planet/types/keys.go
modified: x/planet/types/query.go
modified: x/planet/types/query.pb.go
modified: x/planet/types/tx.pb.go
Untracked files:
proto/planet/posts.proto
vue/src/store/generated/farwish/
x/planet/client/cli/queryPosts.go
x/planet/client/cli/txPosts.go
x/planet/client/rest/queryPosts.go
x/planet/client/rest/txPosts.go
x/planet/keeper/grpc_query_posts.go
x/planet/keeper/msg_server_posts.go
x/planet/keeper/query_posts.go
x/planet/keeper/posts.go
x/planet/types/messages_posts.go
x/planet/types/query.pb.gw.go
x/planet/types/posts.pb.go
# Cosmos SDK's version is: Stargate v0.40.0
$ starport serve
# 运行起来之后 可以使用根据模块名字而生成的 CLI 命令有 planetd.
# https://docs.starport.network/scaffold/type.html#cli-commands
$ planetd tx planet create-posts hello helloWorld --from=alice
$ planetd tx planet create-posts hi helloWorld --from=bob
$ planetd q planetd list-posts
$ planetd tx planet delete-posts 0 --from=alice
$ planetd tx planet delete-posts 1 --from=bob
[Blockchain] Cosmos Starport 安装的三种方式
[Blockchain] Cosmos Starport 地址前缀的变更方式
Link: https://www.cnblogs.com/farwish/p/14797454.html
[Blockchain] Cosmos Starport 101 - 为你的新数据类型 生成代码的更多相关文章
- MSSQL-Scripter,一个新的生成T-SQL脚本的SQL Server命令行工具
这里向大家介绍一个新的生成T-SQL脚本的SQL Server命令行工具:mssql-scripter.它支持在SQL Server.Azure SQL DB以及Azure SQL DW中为数据库生成 ...
- 【转】SQL Server 2008 新数据类型
概览: 新日期和时间数据类型 代表在层次结构中的位置 用于处理空间数据的两种模型 在全球经济环境下开展业务这一趋势越来越要求各公司使用新型的数据.应用程序以及复杂的计算.SQL Server 2008 ...
- JDK新特性——Stream代码简洁之道的详细用法
一.概述 Stream 是一组用来处理数组.集合的API,Stream API 提供了一种高效且易于使用的处理数据的方式. Java 8 中之所以费这么大的功夫引入 函数式编程 ,原因有两个: 代码简 ...
- 用java实现新浪爬虫,代码完整剖析(仅针对当前SinaSignOn有效)
先来看我们的web.xml文件,如下 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application ...
- [转]Material Design Library 23.1.0的新变化与代码实战
Design Library出来已经快有一个月了,当时大概看了一下介绍这个新版本变化的译文,内容不多,给我印象最深的就是Percent lib.AppBarLayout 和NavigationView ...
- Python3中的新特性(3)——代码迁移与2to3
1.将代码移植到Python2.6 建议任何要将代码移植到Python3的用户首先将代码移植到Python2.6.Python2.6不仅与Python2.5向后兼容,而且支持Python3中的部分新特 ...
- 《photoshop cc 新功能 生成图像资源》智能切图逆天啦!
作为一个前端工程师切图这个步骤是必不可少的,方式多种多样,有和切图工具的,也有是把要切的图层元素或者组直接新建保存成文件的,现在photoshop cc2015,可以让你轻松切图,摆脱繁琐的切图步骤. ...
- Material Design Library 23.1.0的新变化与代码实战
Design Library出来已经快有一个月了,当时大概看了一下介绍这个新版本变化的译文,内容不多,给我印象最深的就是Percent lib.AppBarLayout 和NavigationView ...
- 理解ES6的新数据类型:Symbol
ES6之前的数组类型 在ES6之前JS只有6种数据类型,分别是:Undefined.Null.布尔值(Boolean).字符串(String).数值(Number).对象(Object). ES6引入 ...
- Redis6通信协议升级至RESP3,一口气看完13种新数据类型
原创:微信公众号 码农参上,欢迎分享,转载请保留出处. 在前面的文章 Redis:我是如何与客户端进行通信的 中,我们介绍过RESP V2版本协议的规范,RESP的全程是Redis Serializa ...
随机推荐
- django项目(博客二)
扩展1:admin路由分发的本质 路由分发本质 include 可以无限制的 嵌套N多层 url(r'^index/',([],None,None)) 扩展2: 由于url方法第一个参数是正则表达式, ...
- HTML(html结构、标签导读 、路径))
HTML第一天 我们接下来是进行的网页开发网页的相关概念: 什么是网页? 什么是HTML? 网页的形成? 一 什么是网页: 1.网站是指在因特网上根据一定的规则,使用 HTML 等制作的用于展示特定内 ...
- Spring Boot框架中针对数据文件模板的下载总结
1.前言 在我们的日常开发中,经常会碰到注入导入Excel数据到系统中的需求,而在导入Excel数据时,一般的业务系统都会提供数据的Excel模板,只有提交的Excel数据满足业务系统要求的模板时,数 ...
- 替换Spring容器中已经存在的Bean
一.背景 我们在开发的过程中,经常会引入别人写的jar包实现某些功能.而别人的jar包一般都自动注入Spring容器中,假设别人都是通过@Bean或@Component注入的,并且没有加入@Condi ...
- linux 检查是否安装过某软件包
1.rpm包安装的,可以用 rpm -qa 看到,如果要查找某软件包是否安装,用 rpm -qa | grep "软件或者包的名字" 2.以deb包安装的,可以用 dpkg -l ...
- 实例演示如何使用CCE XGPU虚拟化
本文分享自华为云社区<CCE XGPU虚拟化的使用>,作者: 可以交个朋友. 一 背景 在互联网场景中,用户的AI训练和推理任务对GPU虚拟化有着强烈的诉求.GPU卡作为重要的计算资源不管 ...
- #倍增,floyd#CF147B Smile House
题目 求一张有向图的最小正环(环上结点数最小) 分析 有环当且仅当 \(f[i][i]\) 为正数, 那么考虑跑 \(n\) 次 floyd 直接转移,时间复杂度为 \(O(n^4)\) 然而没必要这 ...
- #Manacher,并查集#洛谷 3279 [SCOI2013]密码
题目 分析 这些回文长度可以提供相等或者不等的信息, 不等的直接连边强制不等,相等用并查集合并连通块, 但是这样判断是\(O(n^2)\),考虑这些回文长度当用Manacher求时, 所有的回文长度都 ...
- 前端使用 Konva 实现可视化设计器(2)
作为继续创作的动力,继续求 github Star 能超过 50 个(目前惨淡的 0 个),望多多支持. 源码 示例地址 在上一章,实现了"无限画布"."画布移动&quo ...
- Docker学习路线6:使用第三方镜像
第三方镜像是在Docker Hub或其他容器注册表上提供的预构建Docker容器镜像.这些镜像由个人或组织创建和维护,可以作为您容器化应用程序的起点. 查找第三方镜像 Docker Hub 是最大和最 ...