Skip to content

Commit

Permalink
chore: init digital-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
yutingzhao1991 committed Feb 22, 2022
0 parents commit efef700
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Myfish Examples

每个文件夹下都是一个示例。
16 changes: 16 additions & 0 deletions digital-assets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# project
.DS_Store
.vscode
.idea
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# build
dist

# contract
myfish.*.js
testdb
log
5 changes: 5 additions & 0 deletions digital-assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
蚂蚁链 TypeScript 智能合约研发脚手架模板。

**不建议直接使用这个包,请直接使用 [Myfish](https://www.npmjs.com/package/@antchain/myfish) 初始化项目。**

更多信息请查看 [官方文档](https://opendocs.antchain.antgroup.com/) 🚀🚀🚀
20 changes: 20 additions & 0 deletions digital-assets/assembly/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { my, Storage, BaseContract } from '@antchain/myassembly';

export default class Contract extends BaseContract {
protected name: Storage<string> = new Storage('name', 'myfish');

@EXPORT
public SetName(name: string): void {
this.name.setData(name);
}

@EXPORT
public GetName(): string {
return this.name.getData();
}

@EXPORT
public GetLastBlockNumber(): u64 {
return my.getBlockNumber();
}
}
1 change: 1 addition & 0 deletions digital-assets/config/certs/access.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
你需要把这个文件替换成你自己的 Key
1 change: 1 addition & 0 deletions digital-assets/config/certs/user.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
你需要把这个文件替换成你自己的 Key
20 changes: 20 additions & 0 deletions digital-assets/config/myfish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 配置说明请参考 https://opendocs.antchain.antgroup.com/myfish/myfish-config
module.exports = {
// 合约相关配置
contract: {
name: 'myfish-demo',
version: 1,
},
// rest 链接链相关配置
// 请获取你的链的相关 AK/SK 等信息填入配置
// 参考文档 https://opendocs.antchain.antgroup.com/myfish/connect
rest: {
bizid: '0b06e2744ad341538b7a3b3cc5ad9e57', // 链的 ID,这里默认是实验链的 ID
restUrl: 'https://rest.baas.alipay.com',
accessId: 'inputYourAccessId',
accessSecret: './certs/access.key',
account: 'inputYourAccount',
accountPrivateKey: './certs/user.key',
accountPrivateKeyPassword: 'inputYourPassword',
},
};
1 change: 1 addition & 0 deletions digital-assets/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@antchain/myassembly/assembly/types" />
3 changes: 3 additions & 0 deletions digital-assets/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function () {
// 该文件只是用于 require.resolve 可以找到该包,没有任何实际意义
};
21 changes: 21 additions & 0 deletions digital-assets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@antchain/myfish-scaffold",
"version": "0.2.0",
"files": [
"assembly",
"config/myfish.js",
"config/certs",
".gitignore",
"global.d.ts",
"index.js",
"package.json",
"tsconfig.json"
],
"dependencies": {
"@antchain/myassembly": "^0.2.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
}
}
4 changes: 4 additions & 0 deletions digital-assets/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@antchain/myassembly/assembly.json",
"include": ["assembly", "global.d.ts"]
}

0 comments on commit efef700

Please sign in to comment.