-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from nervina-labs/develop
Release v0.1.1
- Loading branch information
Showing
26 changed files
with
595 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "aggregator-example", | ||
"version": "1.0.0", | ||
"description": "The example of aggregator rpc", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@nervina-labs/cota-sdk": "0.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@nervina-labs/[email protected]": | ||
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.1.0.tgz#012768d8f048108e93d04269a385e82697716a7b" | ||
integrity sha512-fi7OlfSMbW8IKV1XtuPaQ3JAw8U9c7rbmL33KG+UTOZzM3ws5OEsfCRukSH0cffAtH+mueEtSC+MRgW5htnfvQ== | ||
dependencies: | ||
"@nervosnetwork/ckb-sdk-core" "^0.102.0" | ||
"@nervosnetwork/ckb-sdk-utils" "^0.102.0" | ||
"@nervosnetwork/ckb-types" "^0.102.0" | ||
axios "^0.26.0" | ||
camelcase-keys "^7.0.2" | ||
|
||
"@nervosnetwork/ckb-sdk-core@^0.102.0": | ||
version "0.102.1" | ||
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-core/-/ckb-sdk-core-0.102.1.tgz#680c1ebe6425549132d96da288d7600b24dcd98a" | ||
integrity sha512-q6T5ooNYzA9ZhlV4ad39Zn6ubVOa7gCFZ31O+LJAhSxRZDpKctTiwVbgvNFoa2vDvTZej6hT98fb2pACW4rYnQ== | ||
dependencies: | ||
"@nervosnetwork/ckb-sdk-rpc" "0.102.1" | ||
"@nervosnetwork/ckb-sdk-utils" "0.102.1" | ||
"@nervosnetwork/ckb-types" "0.102.1" | ||
tslib "2.3.1" | ||
|
||
"@nervosnetwork/[email protected]": | ||
version "0.102.1" | ||
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-rpc/-/ckb-sdk-rpc-0.102.1.tgz#6b9d98071428e81d1c28880991a4455458850478" | ||
integrity sha512-xCIhiAunHt9peEY+doxNk28Nc74I8RAN0JHyyhxOYWTZqWg7EwvPeI9CNSi0Do4M/zgJ3Cln6yWjJQrSChMQuA== | ||
dependencies: | ||
"@nervosnetwork/ckb-sdk-utils" "0.102.1" | ||
axios "0.21.4" | ||
tslib "2.3.1" | ||
|
||
"@nervosnetwork/[email protected]", "@nervosnetwork/ckb-sdk-utils@^0.102.0": | ||
version "0.102.1" | ||
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-utils/-/ckb-sdk-utils-0.102.1.tgz#5e9bd9e2ebfbbd7b55f915e087e5cbd557bab34f" | ||
integrity sha512-M+6P+8qhXiJoV5e77KtCLQQoKvuOAYdaCd6FEF5V6OhURbkRdhy6gxulY2YB7chlaw7QbvPhlVHlWB1DFOjkHw== | ||
dependencies: | ||
"@nervosnetwork/ckb-types" "0.102.1" | ||
bech32 "2.0.0" | ||
elliptic "6.5.4" | ||
jsbi "3.1.3" | ||
tslib "2.3.1" | ||
|
||
"@nervosnetwork/[email protected]", "@nervosnetwork/ckb-types@^0.102.0": | ||
version "0.102.1" | ||
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-types/-/ckb-types-0.102.1.tgz#95278bfdbc489ad6225ed8125a235ee7ba378882" | ||
integrity sha512-WFE/wPwZm+UYpgKmP2QX2zQyzCkAocfjQyP8DWJds3KhsI+7Z9EjFZ3lzDEWclU/KokC1fOd9+Bu5DMrfkcZng== | ||
|
||
[email protected]: | ||
version "0.21.4" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" | ||
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== | ||
dependencies: | ||
follow-redirects "^1.14.0" | ||
|
||
axios@^0.26.0: | ||
version "0.26.0" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.0.tgz#9a318f1c69ec108f8cd5f3c3d390366635e13928" | ||
integrity sha512-lKoGLMYtHvFrPVt3r+RBMp9nh34N0M8zEfCWqdWZx6phynIEhQqAdydpyBAAG211zlhX9Rgu08cOamy6XjE5Og== | ||
dependencies: | ||
follow-redirects "^1.14.8" | ||
|
||
[email protected]: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" | ||
integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== | ||
|
||
bn.js@^4.11.9: | ||
version "4.12.0" | ||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" | ||
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== | ||
|
||
brorand@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" | ||
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= | ||
|
||
camelcase-keys@^7.0.2: | ||
version "7.0.2" | ||
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252" | ||
integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg== | ||
dependencies: | ||
camelcase "^6.3.0" | ||
map-obj "^4.1.0" | ||
quick-lru "^5.1.1" | ||
type-fest "^1.2.1" | ||
|
||
camelcase@^6.3.0: | ||
version "6.3.0" | ||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" | ||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== | ||
|
||
[email protected]: | ||
version "6.5.4" | ||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" | ||
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== | ||
dependencies: | ||
bn.js "^4.11.9" | ||
brorand "^1.1.0" | ||
hash.js "^1.0.0" | ||
hmac-drbg "^1.0.1" | ||
inherits "^2.0.4" | ||
minimalistic-assert "^1.0.1" | ||
minimalistic-crypto-utils "^1.0.1" | ||
|
||
follow-redirects@^1.14.0, follow-redirects@^1.14.8: | ||
version "1.14.9" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" | ||
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== | ||
|
||
hash.js@^1.0.0, hash.js@^1.0.3: | ||
version "1.1.7" | ||
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" | ||
integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== | ||
dependencies: | ||
inherits "^2.0.3" | ||
minimalistic-assert "^1.0.1" | ||
|
||
hmac-drbg@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" | ||
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= | ||
dependencies: | ||
hash.js "^1.0.3" | ||
minimalistic-assert "^1.0.0" | ||
minimalistic-crypto-utils "^1.0.1" | ||
|
||
inherits@^2.0.3, inherits@^2.0.4: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" | ||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== | ||
|
||
[email protected]: | ||
version "3.1.3" | ||
resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-3.1.3.tgz#f024b340032f7c7caaa6ca4b32b55e8d33f6e897" | ||
integrity sha512-nBJqA0C6Qns+ZxurbEoIR56wyjiUszpNy70FHvxO5ervMoCbZVE3z3kxr5nKGhlxr/9MhKTSUBs7cAwwuf3g9w== | ||
|
||
map-obj@^4.1.0: | ||
version "4.3.0" | ||
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" | ||
integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== | ||
|
||
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" | ||
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== | ||
|
||
minimalistic-crypto-utils@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" | ||
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= | ||
|
||
quick-lru@^5.1.1: | ||
version "5.1.1" | ||
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" | ||
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== | ||
|
||
[email protected]: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" | ||
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== | ||
|
||
type-fest@^1.2.1: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" | ||
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const { addressToScript } = require('@nervosnetwork/ckb-sdk-utils') | ||
const { Collector, Aggregator, generateDefineCotaTx } = require('@nervina-labs/cota-sdk') | ||
|
||
const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' | ||
const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' | ||
|
||
const secp256k1CellDep = async ckb => { | ||
const secp256k1Dep = (await ckb.loadDeps()).secp256k1Dep | ||
return { outPoint: secp256k1Dep.outPoint, depType: 'depGroup' } | ||
} | ||
|
||
const run = async () => { | ||
const service = { | ||
collector: new Collector({ ckbNodeUrl: 'http://localhost:8114', ckbIndexerUrl: 'http://localhost:8116' }), | ||
aggregator: new Aggregator({ registryUrl: 'http://localhost:3050', cotaUrl: 'http://localhost:3030' }), | ||
} | ||
const ckb = service.collector.getCkb() | ||
const defineLock = addressToScript(TEST_ADDRESS) | ||
let { rawTx, cotaId } = await generateDefineCotaTx(service, defineLock, 100, '0x00') | ||
console.log(`cotaId: ${cotaId}`) | ||
const secp256k1Dep = await secp256k1CellDep(ckb) | ||
rawTx.cellDeps.push(secp256k1Dep) | ||
|
||
const signedTx = ckb.signTransaction(TEST_PRIVATE_KEY)(rawTx) | ||
console.log(JSON.stringify(signedTx)) | ||
let txHash = await ckb.rpc.sendTransaction(signedTx, 'passthrough') | ||
console.info(`Define cota nft tx has been sent with tx hash ${txHash}`) | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' | ||
import { Service, Aggregator, Collector, generateDefineCotaTx } from '@nervina-labs/cota-sdk' | ||
import CKB from '@nervosnetwork/ckb-sdk-core' | ||
|
||
const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' | ||
const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' | ||
|
||
const secp256k1CellDep = async (ckb: CKB): Promise<CKBComponents.CellDep> => { | ||
const secp256k1Dep = (await ckb.loadDeps()).secp256k1Dep | ||
return { outPoint: secp256k1Dep.outPoint, depType: 'depGroup' } | ||
} | ||
|
||
const run = async () => { | ||
const service: Service = { | ||
collector: new Collector({ ckbNodeUrl: 'http://localhost:8114', ckbIndexerUrl: 'http://localhost:8116' }), | ||
aggregator: new Aggregator({ registryUrl: 'http://localhost:3050', cotaUrl: 'http://localhost:3030' }), | ||
} | ||
const ckb = service.collector.getCkb() | ||
const defineLock = addressToScript(TEST_ADDRESS) | ||
let { rawTx, cotaId } = await generateDefineCotaTx(service, defineLock, 100, '0x00') | ||
console.log(`cotaId: ${cotaId}`) | ||
const secp256k1Dep = await secp256k1CellDep(ckb) | ||
rawTx.cellDeps.push(secp256k1Dep) | ||
|
||
const signedTx = ckb.signTransaction(TEST_PRIVATE_KEY)(rawTx) | ||
console.log(JSON.stringify(signedTx)) | ||
let txHash = await ckb.rpc.sendTransaction(signedTx, 'passthrough') | ||
console.info(`Define cota nft tx has been sent with tx hash ${txHash}`) | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "define-example", | ||
"version": "1.0.0", | ||
"description": "The example of defining cota nft", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@nervosnetwork/ckb-sdk-utils": "^0.102.0", | ||
"@nervina-labs/cota-sdk": "0.1.0" | ||
} | ||
} |
Oops, something went wrong.