@offckb/cli 0.1.0-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+ -----------
3
+
4
+ Copyright (c) 2024 offckb
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ ## OffCKB
2
+
3
+ ckb development environment for professionals
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ git clone https://github.com/RetricSu/offckb.git
9
+ cd offckb && alias offckb='yarn start'
10
+ ```
11
+
12
+ eventually you will do simple
13
+ ```sh
14
+ npm install -g offckb // not yet, todo
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```sh
20
+ offckb node // start the devnet of CKB
21
+ offckb init // init a typescript boilerplate with lumos to get started with to build CKB DAPP,think 'hardhat init'
22
+ offckb list-hashes // list scripts hashes, equals `ckb list-hashes`
23
+ offckb accounts // list 20 accounts info with prefund CKB tokens
24
+ ```
25
+
26
+ ### Built-in scripts
27
+
28
+ - [x] xUDT https://github.com/nervosnetwork/rfcs/pull/428
29
+ - [x] Omnilock https://github.com/cryptape/omnilock
30
+ - [x] AnyoneCanPay https://github.com/cryptape/anyone-can-pay
31
+ - [x] AlwaysSuccess https://github.com/nervosnetwork/ckb-production-scripts/blob/master/c/always_success.c
32
+ - [ ] Spore https://github.com/sporeprotocol/spore-contract
33
+
34
+ ### Accounts
35
+
36
+ `offckb` comes with 20 accounts, each account is funded with 42_000_000_00000000 capacity in the genesis block.
37
+
38
+ all the private keys are recorded in the `account/keys` file.
39
+ detail informations about each account are recorded in the `account/account.json` file.
40
+
41
+ ## Development
42
+
43
+ update built-in scripts:
44
+
45
+ update submodule inside `docker` and then run
46
+ ```sh
47
+ make all
48
+ ```
@@ -0,0 +1,222 @@
1
+ [
2
+ {
3
+ "privkey": "0x6109170b275a09ad54877b82f7d9930f88cab5717d484fb4741ae9d1dd078cd6",
4
+ "pubkey": "0x02025fa7b61b2365aa459807b84df065f1949d58c0ae590ff22dd2595157bffefa",
5
+ "lockScript": {
6
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
7
+ "hashType": "type",
8
+ "args": "0x8e42b1999f265a0078503c4acec4d5e134534297"
9
+ },
10
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvwg2cen8extgq8s5puft8vf40px3f599cytcyd8",
11
+ "args": "0x8e42b1999f265a0078503c4acec4d5e134534297"
12
+ },
13
+ {
14
+ "privkey": "0x9f315d5a9618a39fdc487c7a67a8581d40b045bd7a42d83648ca80ef3b2cb4a1",
15
+ "pubkey": "0x026efa0579f09cc7c1129b78544f70098c90b2ab155c10746316f945829c034a2d",
16
+ "lockScript": {
17
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
18
+ "hashType": "type",
19
+ "args": "0x758d311c8483e0602dfad7b69d9053e3f917457d"
20
+ },
21
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt435c3epyrupszm7khk6weq5lrlyt52lg48ucew",
22
+ "args": "0x758d311c8483e0602dfad7b69d9053e3f917457d"
23
+ },
24
+ {
25
+ "privkey": "0x59ddda57ba06d6e9c5fa9040bdb98b4b098c2fce6520d39f51bc5e825364697a",
26
+ "pubkey": "0x02f1ec8d18e8ff13ecf7b3ab8f683d0c3a6d63478a7f7d14ca0fdfe8fea331e863",
27
+ "lockScript": {
28
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
29
+ "hashType": "type",
30
+ "args": "0x9d1edebedf8f026c0d597c4c5cd3f45dec1f7557"
31
+ },
32
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvarm0tahu0qfkq6ktuf3wd8azaas0h24c9myfz6",
33
+ "args": "0x9d1edebedf8f026c0d597c4c5cd3f45dec1f7557"
34
+ },
35
+ {
36
+ "privkey": "0xf4a1fc19468b51ba9d1f0f5441fa3f4d91e625b2af105e1e37cc54bf9b19c0a1",
37
+ "pubkey": "0x02e72cbdff20422a3886ec667a138a59478d93da072173be4344c55582acdce67c",
38
+ "lockScript": {
39
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
40
+ "hashType": "type",
41
+ "args": "0xe65f823bc5a48a38515690604e503dba4eb15d61"
42
+ },
43
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0xt7prh3dy3gu9z45svp89q0d6f6c46cg9dp9mn",
44
+ "args": "0xe65f823bc5a48a38515690604e503dba4eb15d61"
45
+ },
46
+ {
47
+ "privkey": "0x0334ddff3b1e19af5c5fddda8dbcfb235416eaaba11cfca8acf63ad46e9f55b2",
48
+ "pubkey": "0x022c0ea6dae4ee9f6a6303ffe85e3223b273e7e1520343f35ad57a50566c306889",
49
+ "lockScript": {
50
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
51
+ "hashType": "type",
52
+ "args": "0x9665e6bc1966ec2bfcca4f11782d2b906f38438f"
53
+ },
54
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvkvhntcxtxas4lejj0z9uz62usduuy8rcwg4fr9",
55
+ "args": "0x9665e6bc1966ec2bfcca4f11782d2b906f38438f"
56
+ },
57
+ {
58
+ "privkey": "0x6f358d92f408511707803d292efa148236a2e114d73a472be2a07e0ba49200c7",
59
+ "pubkey": "0x02ebb6ce7a68eeb34c66d394dab74d20f766e4c711d52cbea7643ae828d3478813",
60
+ "lockScript": {
61
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
62
+ "hashType": "type",
63
+ "args": "0x0df9552f53d51a378aba267bc858dada447e8400"
64
+ },
65
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgdl92j7574rgmc4w3x00y93kk6g3lggqq23mmmd",
66
+ "args": "0x0df9552f53d51a378aba267bc858dada447e8400"
67
+ },
68
+ {
69
+ "privkey": "0xbde2f19c98dc5ab4cc98f73c573757a9f1782dc44398022a23f77ca752ad8fbe",
70
+ "pubkey": "0x02747a187de5f4b5a864d49fd20b8e2d62dfd3dfe3af3fa09155eebe76e3989cf3",
71
+ "lockScript": {
72
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
73
+ "hashType": "type",
74
+ "args": "0x683188bb29502ba6e702b7c650cc80707c3f8b4b"
75
+ },
76
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqtgxxytk22s9wnwwq4hcegveqrs0slckjc2gkygd",
77
+ "args": "0x683188bb29502ba6e702b7c650cc80707c3f8b4b"
78
+ },
79
+ {
80
+ "privkey": "0x7c1280118923ea96529909638dac9bd258251a222783f91dedbf82de15526fd2",
81
+ "pubkey": "0x027d0aaa651657c452ebcf02537fde64a3bf822ec00bd59e658aa3e854e02d3e6e",
82
+ "lockScript": {
83
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
84
+ "hashType": "type",
85
+ "args": "0x532bfb946e4b108d14758ca38e6e3b4af6801996"
86
+ },
87
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2n90aegmjtzzx3gavv5w8xuw6276qpn9s4x74d7",
88
+ "args": "0x532bfb946e4b108d14758ca38e6e3b4af6801996"
89
+ },
90
+ {
91
+ "privkey": "0x1fe1356d47224f34788eb099c4f67ab28a477a5a85d6ff4e54c240c11a0c693c",
92
+ "pubkey": "0x036555a57d4866067f4886a63d34c3f7396aa770c8617b57ff7e0b664e4444ef6e",
93
+ "lockScript": {
94
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
95
+ "hashType": "type",
96
+ "args": "0x3982ac2f4893dfcac091ef795bb778cc2a25edd9"
97
+ },
98
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqfes2kz7jynml9vpy0009dmw7xv9gj7mkgzxwxsx",
99
+ "args": "0x3982ac2f4893dfcac091ef795bb778cc2a25edd9"
100
+ },
101
+ {
102
+ "privkey": "0xc3255dd2bbc3accc69c82bdb2c927ab4a681146331d5e01990890fb3cd732b47",
103
+ "pubkey": "0x03c0a782747b630e101468cac29137a709e14806586d1110d901eeb8a81d2ada47",
104
+ "lockScript": {
105
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
106
+ "hashType": "type",
107
+ "args": "0x5aab386e8a9f4f869776674c7181ea76fef75b55"
108
+ },
109
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq264vuxaz5lf7rfwan8f3ccr6nklmm4k4gwtzp2q",
110
+ "args": "0x5aab386e8a9f4f869776674c7181ea76fef75b55"
111
+ },
112
+ {
113
+ "privkey": "0x8c3f8a6a6847a31af93000a31629f0c674e0cbb1b7cb71bdfbf4fb9dd828a518",
114
+ "pubkey": "0x02de6586e04a9776123fdc2f79e01bd613ab86c0447337392e27376aad8850e854",
115
+ "lockScript": {
116
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
117
+ "hashType": "type",
118
+ "args": "0xf6ca1c08a40ab3d00e2299930cf0f8c298a1a90d"
119
+ },
120
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0kegwq3fq2k0gqug5ejvx0p7xznzs6jrg890q3w",
121
+ "args": "0xf6ca1c08a40ab3d00e2299930cf0f8c298a1a90d"
122
+ },
123
+ {
124
+ "privkey": "0x11e34fc1bad213b1ce3071501a18c39e5dbf1ea2e66ac05059c36a5d1e7a56cf",
125
+ "pubkey": "0x032f632ea8c48329f701d067e77e8e66aacd61522ca7d8409523df746a0b216248",
126
+ "lockScript": {
127
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
128
+ "hashType": "type",
129
+ "args": "0x5cb8098824329c3a2e731641ae4e90ba0a3ec396"
130
+ },
131
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2uhqycsfpjnsazuuckgxhyay96pglv89svgrrcn",
132
+ "args": "0x5cb8098824329c3a2e731641ae4e90ba0a3ec396"
133
+ },
134
+ {
135
+ "privkey": "0x0a0ecce6f15c444e6d0013d6eb79c87babff2c76447f3a2f6b28023490170c1f",
136
+ "pubkey": "0x02081831dc9ae364ef25f327d2c112b39b28ae76de9898a4a9001e6d2d10d64b4e",
137
+ "lockScript": {
138
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
139
+ "hashType": "type",
140
+ "args": "0x516932280d5ff3108119fe2361d0868f1998dcc4"
141
+ },
142
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq23dyezsr2l7vggzx07ydsapp50rxvde3qslv5ac",
143
+ "args": "0x516932280d5ff3108119fe2361d0868f1998dcc4"
144
+ },
145
+ {
146
+ "privkey": "0x006250e940dbce94ad9329ac16c109acf7de98c7e4738013bdd3105d4f004d8a",
147
+ "pubkey": "0x023e57800b040fdd6ae02197033e4cb7b323db11f9b3eb5eb139277eec68767c76",
148
+ "lockScript": {
149
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
150
+ "hashType": "type",
151
+ "args": "0x7a83042ddabeb27294fe62588df7acc627d4181f"
152
+ },
153
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqt6svzzmk47kfefflnztzxl0txxyl2ps8cyvd734",
154
+ "args": "0x7a83042ddabeb27294fe62588df7acc627d4181f"
155
+ },
156
+ {
157
+ "privkey": "0xfc8142dc0a6c1dc9102696e7ca730b8c05e233549ea924fafa477f5086d94ac3",
158
+ "pubkey": "0x02a7c2ea6f66885dde24ac353bc9f62e619e928078bdbc6b6ad50558b81db73b78",
159
+ "lockScript": {
160
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
161
+ "hashType": "type",
162
+ "args": "0x1416fe8e3e1d659a235f5f35b30f7cfbdf9fd77c"
163
+ },
164
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqg5zmlgu0savkdzxh6lxkes7l8mm70awlq3lw7yk",
165
+ "args": "0x1416fe8e3e1d659a235f5f35b30f7cfbdf9fd77c"
166
+ },
167
+ {
168
+ "privkey": "0x711aa98da3e9643170de94d6b16d3a30edf4bb231aa793aaac0fc7373c0f6322",
169
+ "pubkey": "0x039077f3e3f89fb0303faa6ebefe890c5ea89bc5563ade41f9dc33165d27b78e12",
170
+ "lockScript": {
171
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
172
+ "hashType": "type",
173
+ "args": "0xf246d3f9d94aab2688babb4802879056d9bf5810"
174
+ },
175
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0jgmflnk224vng3w4mfqpg0yzkmxl4syqtwnm8g",
176
+ "args": "0xf246d3f9d94aab2688babb4802879056d9bf5810"
177
+ },
178
+ {
179
+ "privkey": "0x76f51bf03e38b7f4a3c2cd8b088103e746f0e425fb0c5e0f8b22061f41c790cc",
180
+ "pubkey": "0x037ebf8c904461cc9fe3c5510f52874d1baf557613cceb4300f82acfdddb7de927",
181
+ "lockScript": {
182
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
183
+ "hashType": "type",
184
+ "args": "0x4ec295923dde1b522835007f9260e8ba398dc7cb"
185
+ },
186
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2wc22ey0w7rdfzsdgq07fxp6968xxu0jcuc7xwl",
187
+ "args": "0x4ec295923dde1b522835007f9260e8ba398dc7cb"
188
+ },
189
+ {
190
+ "privkey": "0x1ef1c9cbf031d7bc181c039cebb4f2914dbad689ab268e192fe22ea314d9b4a4",
191
+ "pubkey": "0x0389a0a718b1eedaedb12fdf61834ada0ee78af6dc7fb2e90c8fc96fd14bf5da73",
192
+ "lockScript": {
193
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
194
+ "hashType": "type",
195
+ "args": "0xd7ab64e757d1177a955a5c997a6ba7feab49161b"
196
+ },
197
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqwh4djww473zaaf2kjun9axhfl74dy3vxctp93d8",
198
+ "args": "0xd7ab64e757d1177a955a5c997a6ba7feab49161b"
199
+ },
200
+ {
201
+ "privkey": "0xa5808e79c243d8e026a034273ad7a5ccdcb2f982392fd0230442b1734c98a4c2",
202
+ "pubkey": "0x034417bf068a1166a1443cfbbf974e61a65bf402dcce7b157a67260c18c6dd76f7",
203
+ "lockScript": {
204
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
205
+ "hashType": "type",
206
+ "args": "0x9ba28269270223ba366a29dc96401910540894a4"
207
+ },
208
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqvm52pxjfczywarv63fmjtyqxgs2syfffq2348ad",
209
+ "args": "0x9ba28269270223ba366a29dc96401910540894a4"
210
+ },
211
+ {
212
+ "privkey": "0xace08599f3174f4376ae51fdc30950d4f2d731440382bb0aa1b6b0bd3a9728cd",
213
+ "pubkey": "0x0216bc7b5b0a30fb910c372062a7f8cfa89f3a231f5d4a975e60a787ea828aa49e",
214
+ "lockScript": {
215
+ "codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
216
+ "hashType": "type",
217
+ "args": "0x4118c8c16749bf126b22468d030bf9de7da3717b"
218
+ },
219
+ "address": "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2prryvze6fhufxkgjx35psh7w70k3hz7c3mtl4d",
220
+ "args": "0x4118c8c16749bf126b22468d030bf9de7da3717b"
221
+ }
222
+ ]
package/account/keys ADDED
@@ -0,0 +1,20 @@
1
+ 6109170b275a09ad54877b82f7d9930f88cab5717d484fb4741ae9d1dd078cd6
2
+ 9f315d5a9618a39fdc487c7a67a8581d40b045bd7a42d83648ca80ef3b2cb4a1
3
+ 59ddda57ba06d6e9c5fa9040bdb98b4b098c2fce6520d39f51bc5e825364697a
4
+ f4a1fc19468b51ba9d1f0f5441fa3f4d91e625b2af105e1e37cc54bf9b19c0a1
5
+ 0334ddff3b1e19af5c5fddda8dbcfb235416eaaba11cfca8acf63ad46e9f55b2
6
+ 6f358d92f408511707803d292efa148236a2e114d73a472be2a07e0ba49200c7
7
+ bde2f19c98dc5ab4cc98f73c573757a9f1782dc44398022a23f77ca752ad8fbe
8
+ 7c1280118923ea96529909638dac9bd258251a222783f91dedbf82de15526fd2
9
+ 1fe1356d47224f34788eb099c4f67ab28a477a5a85d6ff4e54c240c11a0c693c
10
+ c3255dd2bbc3accc69c82bdb2c927ab4a681146331d5e01990890fb3cd732b47
11
+ 8c3f8a6a6847a31af93000a31629f0c674e0cbb1b7cb71bdfbf4fb9dd828a518
12
+ 11e34fc1bad213b1ce3071501a18c39e5dbf1ea2e66ac05059c36a5d1e7a56cf
13
+ 0a0ecce6f15c444e6d0013d6eb79c87babff2c76447f3a2f6b28023490170c1f
14
+ 006250e940dbce94ad9329ac16c109acf7de98c7e4738013bdd3105d4f004d8a
15
+ fc8142dc0a6c1dc9102696e7ca730b8c05e233549ea924fafa477f5086d94ac3
16
+ 711aa98da3e9643170de94d6b16d3a30edf4bb231aa793aaac0fc7373c0f6322
17
+ 76f51bf03e38b7f4a3c2cd8b088103e746f0e425fb0c5e0f8b22061f41c790cc
18
+ 1ef1c9cbf031d7bc181c039cebb4f2914dbad689ab268e192fe22ea314d9b4a4
19
+ a5808e79c243d8e026a034273ad7a5ccdcb2f982392fd0230442b1734c98a4c2
20
+ ace08599f3174f4376ae51fdc30950d4f2d731440382bb0aa1b6b0bd3a9728cd
@@ -0,0 +1,11 @@
1
+ export declare const currentExecPath: string;
2
+ export declare const packageSrcPath: string;
3
+ export declare const packageRootPath: string;
4
+ export declare const dappTemplatePath: string;
5
+ export declare const targetEnvironmentPath: string;
6
+ export declare const devnetSourcePath: string;
7
+ export declare const devnetPath: string;
8
+ export declare const ckbFolderPath: string;
9
+ export declare const ckbBinPath: string;
10
+ export declare const accountTargetDir: string;
11
+ export declare const minimalRequiredCKBVersion = "0.113.1";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.minimalRequiredCKBVersion = exports.accountTargetDir = exports.ckbBinPath = exports.ckbFolderPath = exports.devnetPath = exports.devnetSourcePath = exports.targetEnvironmentPath = exports.dappTemplatePath = exports.packageRootPath = exports.packageSrcPath = exports.currentExecPath = void 0;
27
+ const path = __importStar(require("path"));
28
+ // path
29
+ exports.currentExecPath = process.cwd();
30
+ exports.packageSrcPath = path.dirname(require.main.filename);
31
+ exports.packageRootPath = path.resolve(exports.packageSrcPath, '../');
32
+ exports.dappTemplatePath = path.resolve(exports.packageRootPath, './template');
33
+ exports.targetEnvironmentPath = path.resolve(exports.packageRootPath, './target');
34
+ exports.devnetSourcePath = path.resolve(exports.packageRootPath, './docker/devnet');
35
+ exports.devnetPath = path.resolve(exports.targetEnvironmentPath, `devnet`);
36
+ exports.ckbFolderPath = path.resolve(exports.targetEnvironmentPath, 'ckb');
37
+ exports.ckbBinPath = path.resolve(exports.ckbFolderPath, 'ckb');
38
+ exports.accountTargetDir = path.join(exports.packageRootPath, `account`);
39
+ // Version
40
+ exports.minimalRequiredCKBVersion = '0.113.1';
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const install_1 = require("./cmd/install");
6
+ const genkey_1 = require("./cmd/genkey");
7
+ const list_hashes_1 = require("./cmd/list-hashes");
8
+ const node_1 = require("./cmd/node");
9
+ const init_chain_1 = require("./cmd/init-chain");
10
+ const build_lumos_config_1 = require("./cmd/build-lumos-config");
11
+ const init_1 = require("./cmd/init");
12
+ const accounts_1 = require("./cmd/accounts");
13
+ const version = require('../package.json').version;
14
+ const program = new commander_1.Command();
15
+ program
16
+ .name('offckb')
17
+ .description('CLI to provide full ckb development environment for professionals')
18
+ .version(version);
19
+ // Define the CLI commands and options
20
+ program.command('install').description('Install the ckb dependency binary').action(install_1.installDependency);
21
+ program.command('genkey').description('generate 20 accounts').action(genkey_1.genkey);
22
+ program.command('list-hashes').description('Use the CKB to list blockchain scripts hashes').action(list_hashes_1.listHashes);
23
+ program.command('node').description('Use the CKB to start devnet').action(node_1.node);
24
+ program.command('init-chain').description('Use the CKB to init devnet').action(init_chain_1.initChainIfNeeded);
25
+ program.command('build-lumos-config').description('Use the CKB to generate lumos config.json').action(build_lumos_config_1.buildLumosConfig);
26
+ program.command('build-accounts').description('generate accounts with prefunded CKB tokens').action(genkey_1.buildAccounts);
27
+ program
28
+ .command('print-account-issue-info')
29
+ .description('print account issue cells config toml sections')
30
+ .action(genkey_1.printIssueSectionForToml);
31
+ program.command('accounts').description('print account list info').action(accounts_1.accounts);
32
+ program
33
+ .command('init')
34
+ .description('init dapp project with lumos')
35
+ .argument('<string>', 'name of the dapp')
36
+ .action((str) => {
37
+ const name = str !== null && str !== void 0 ? str : 'offckb-dapp';
38
+ return (0, init_1.init)(name);
39
+ });
40
+ // Parse command-line arguments
41
+ program.parse(process.argv);
42
+ // If no command is specified, display help
43
+ if (!process.argv.slice(2).length) {
44
+ program.outputHelp();
45
+ }
@@ -0,0 +1 @@
1
+ export declare function accounts(): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.accounts = void 0;
7
+ const account_json_1 = __importDefault(require("../../account/account.json"));
8
+ function accounts() {
9
+ console.log(`Print account list, each account is funded with 42_000_000_00000000 capacity in the genesis block.`);
10
+ console.log(account_json_1.default);
11
+ }
12
+ exports.accounts = accounts;
@@ -0,0 +1,64 @@
1
+ export declare const devnetConfig: {
2
+ PREFIX: string;
3
+ SCRIPTS: {
4
+ SECP256K1_BLAKE160: {
5
+ CODE_HASH: string;
6
+ HASH_TYPE: string;
7
+ TX_HASH: string;
8
+ INDEX: string;
9
+ DEP_TYPE: string;
10
+ SHORT_ID: number;
11
+ };
12
+ SECP256K1_BLAKE160_MULTISIG: {
13
+ CODE_HASH: string;
14
+ HASH_TYPE: string;
15
+ TX_HASH: string;
16
+ INDEX: string;
17
+ DEP_TYPE: string;
18
+ };
19
+ DAO: {
20
+ CODE_HASH: string;
21
+ HASH_TYPE: string;
22
+ TX_HASH: string;
23
+ INDEX: string;
24
+ DEP_TYPE: string;
25
+ SHORT_ID: number;
26
+ };
27
+ SUDT: {
28
+ CODE_HASH: string;
29
+ HASH_TYPE: string;
30
+ TX_HASH: string;
31
+ INDEX: string;
32
+ DEP_TYPE: string;
33
+ };
34
+ XUDT: {
35
+ CODE_HASH: string;
36
+ HASH_TYPE: string;
37
+ TX_HASH: string;
38
+ INDEX: string;
39
+ DEP_TYPE: string;
40
+ };
41
+ OMNILOCK: {
42
+ CODE_HASH: string;
43
+ HASH_TYPE: string;
44
+ TX_HASH: string;
45
+ INDEX: string;
46
+ DEP_TYPE: string;
47
+ };
48
+ ANYONE_CAN_PAY: {
49
+ CODE_HASH: string;
50
+ HASH_TYPE: string;
51
+ TX_HASH: string;
52
+ INDEX: string;
53
+ DEP_TYPE: string;
54
+ };
55
+ ALWAYS_SUCCESS: {
56
+ CODE_HASH: string;
57
+ HASH_TYPE: string;
58
+ TX_HASH: string;
59
+ INDEX: string;
60
+ DEP_TYPE: string;
61
+ };
62
+ };
63
+ };
64
+ export declare function buildLumosConfig(): void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildLumosConfig = exports.devnetConfig = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const const_1 = require("../cfg/const");
10
+ const genesisTxHash = '0x920bb4250dc6216c08ee0713f86b3fcb01bf444027b08b7d92db0ed1c0fb9214';
11
+ const depGroupTxHash = '0x37f2b7799b199491f4732c572c086afdace0bf92992faf0b90bae44cdd119f9e';
12
+ exports.devnetConfig = {
13
+ PREFIX: 'ckt',
14
+ SCRIPTS: {
15
+ SECP256K1_BLAKE160: {
16
+ CODE_HASH: '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8',
17
+ HASH_TYPE: 'type',
18
+ TX_HASH: depGroupTxHash,
19
+ INDEX: '0x0',
20
+ DEP_TYPE: 'depGroup',
21
+ SHORT_ID: 1,
22
+ },
23
+ SECP256K1_BLAKE160_MULTISIG: {
24
+ CODE_HASH: '0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8',
25
+ HASH_TYPE: 'type',
26
+ TX_HASH: depGroupTxHash,
27
+ INDEX: '0x1',
28
+ DEP_TYPE: 'depGroup',
29
+ },
30
+ DAO: {
31
+ CODE_HASH: '0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e',
32
+ HASH_TYPE: 'type',
33
+ TX_HASH: genesisTxHash,
34
+ INDEX: '0x2',
35
+ DEP_TYPE: 'code',
36
+ SHORT_ID: 2,
37
+ },
38
+ SUDT: {
39
+ CODE_HASH: '0x6283a479a3cf5d4276cd93594de9f1827ab9b55c7b05b3d28e4c2e0a696cfefd',
40
+ HASH_TYPE: 'type',
41
+ TX_HASH: genesisTxHash,
42
+ INDEX: '0x5',
43
+ DEP_TYPE: 'code',
44
+ },
45
+ XUDT: {
46
+ CODE_HASH: '0x1a1e4fef34f5982906f745b048fe7b1089647e82346074e0f32c2ece26cf6b1e',
47
+ HASH_TYPE: 'type',
48
+ TX_HASH: genesisTxHash,
49
+ INDEX: '0x6',
50
+ DEP_TYPE: 'code',
51
+ },
52
+ OMNILOCK: {
53
+ CODE_HASH: '0x9c6933d977360f115a3e9cd5a2e0e475853681b80d775d93ad0f8969da343e56',
54
+ HASH_TYPE: 'type',
55
+ TX_HASH: genesisTxHash,
56
+ INDEX: '0x7',
57
+ DEP_TYPE: 'code',
58
+ },
59
+ ANYONE_CAN_PAY: {
60
+ CODE_HASH: '0xe09352af0066f3162287763ce4ddba9af6bfaeab198dc7ab37f8c71c9e68bb5b',
61
+ HASH_TYPE: 'type',
62
+ TX_HASH: genesisTxHash,
63
+ INDEX: '0x8',
64
+ DEP_TYPE: 'code',
65
+ },
66
+ ALWAYS_SUCCESS: {
67
+ CODE_HASH: '0xbb4469004225b39e983929db71fe2253cba1d49a76223e9e1d212cdca1f79f28',
68
+ HASH_TYPE: 'type',
69
+ TX_HASH: genesisTxHash,
70
+ INDEX: '0x9',
71
+ DEP_TYPE: 'code',
72
+ },
73
+ },
74
+ };
75
+ function buildLumosConfig() {
76
+ const filePath = path_1.default.resolve(const_1.dappTemplatePath, 'config.json');
77
+ fs_1.default.writeFile(filePath, JSON.stringify(exports.devnetConfig, null, 2), 'utf8', (err) => {
78
+ if (err) {
79
+ return console.error('Error writing file:', err);
80
+ }
81
+ });
82
+ }
83
+ exports.buildLumosConfig = buildLumosConfig;
@@ -0,0 +1,13 @@
1
+ import { Address, HexString, Script } from '@ckb-lumos/lumos';
2
+ interface Account {
3
+ privkey: HexString;
4
+ pubkey: HexString;
5
+ args: HexString;
6
+ lockScript: Script;
7
+ address: Address;
8
+ }
9
+ export declare function genkey(): void;
10
+ export declare function buildAccounts(): Promise<void>;
11
+ export declare function genAccount(privkey: HexString): Account;
12
+ export declare function printIssueSectionForToml(): void;
13
+ export {};