Skip to content

Commit

Permalink
Merge pull request #232 from nervina-labs/develop
Browse files Browse the repository at this point in the history
Release v0.9.1
  • Loading branch information
duanyytop authored May 12, 2023
2 parents 79ad5fe + abef9d7 commit 10208a7
Show file tree
Hide file tree
Showing 22 changed files with 667 additions and 656 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.5.1
- uses: actions/setup-node@v3.6.0
with:
node-version: '14'
- name: Install dependency
Expand Down
8 changes: 4 additions & 4 deletions example/aggregator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"build": "tsc"
},
"dependencies": {
"@nervina-labs/cota-sdk": "0.8.0",
"@types/node": "18.11.13",
"@nervina-labs/cota-sdk": "0.9.0",
"@types/node": "18.16.8",
"ts-node": "10.9.1",
"tslib": "2.4.1",
"typescript": "4.9.5"
"tslib": "2.5.0",
"typescript": "5.0.4"
}
}
94 changes: 47 additions & 47 deletions example/aggregator/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,52 +27,52 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@nervina-labs/cota-sdk@0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.8.0.tgz#89028c2874e2bf1f226f3fc95bbc567bca8f34ac"
integrity sha512-3DwI26csftPtvnjFS8Cauf2ybu+8ESLVsGEUQn69aK5m3PKhXJqfuT2DpsXK2v4dmDEQ8MojgK2S0OooH/37ng==
"@nervina-labs/cota-sdk@0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.9.0.tgz#76f4b40653ff1191b4aaf8991ca272b75197d6f0"
integrity sha512-1s9sgfShBAWguUUmyjCpBSwF8alreuCt4SIzBLR5MnahicgyCMAoeJHUPz6kcQZ9X63LmX5kA98jQQmJ57RE3w==
dependencies:
"@nervosnetwork/ckb-sdk-core" "^0.103.0"
"@nervosnetwork/ckb-sdk-utils" "^0.103.0"
"@nervosnetwork/ckb-types" "^0.103.0"
axios "^1.0.0"
camelcase-keys "^7.0.2"
"@nervosnetwork/ckb-sdk-core" "^0.103.1"
"@nervosnetwork/ckb-sdk-utils" "^0.103.1"
"@nervosnetwork/ckb-types" "^0.103.1"
axios "^1.2.1"
camelcase-keys "7.0.2"
convert-keys "1.3.4"

"@nervosnetwork/ckb-sdk-core@^0.103.0":
version "0.103.0"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-core/-/ckb-sdk-core-0.103.0.tgz#48c9f31362bb65f585fd0de783ac740240f821d0"
integrity sha512-FfD/zmaaS6t7sjPAYLTZPtGS58ikyjA4m2b1SVkMGepW0CbuM08NAhVXBBt6c6yEh6aDegCgk9mXr4iQFCOspw==
"@nervosnetwork/ckb-sdk-core@^0.103.1":
version "0.103.1"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-core/-/ckb-sdk-core-0.103.1.tgz#136d616ec53af96d3b93dcbce593e6db484c802d"
integrity sha512-LeNwId3GaQILVpnY1zfNBY897XQJPODKeP6d7w6tww9anu0jSxrvXVxGMDTTn3Yz5mixzBgpFGo4SXRrH0eiaQ==
dependencies:
"@nervosnetwork/ckb-sdk-rpc" "0.103.0"
"@nervosnetwork/ckb-sdk-utils" "0.103.0"
"@nervosnetwork/ckb-types" "0.103.0"
"@nervosnetwork/ckb-sdk-rpc" "0.103.1"
"@nervosnetwork/ckb-sdk-utils" "0.103.1"
"@nervosnetwork/ckb-types" "0.103.1"
tslib "2.3.1"

"@nervosnetwork/[email protected].0":
version "0.103.0"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-rpc/-/ckb-sdk-rpc-0.103.0.tgz#c75480e02686e760b664de6859e1d0679553f13a"
integrity sha512-Ea6wymHEXHtsntYVvJIu8hhbygr1uLEFh9nCjhMmmf0M269DOZi6IbeXer2tUkmulTeFLxZN7ipsSi1v7kp6Cw==
"@nervosnetwork/[email protected].1":
version "0.103.1"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-rpc/-/ckb-sdk-rpc-0.103.1.tgz#6c0d0bad8a05a9280ddc34adf973bf55e0725e06"
integrity sha512-n3V/5Be7PilyHXUcR6yAiwanMcuZNLfslu9A84OpfB22hlkwIv7OFG/JvFNack/cANPfChRAWB+VWiYGwSON/A==
dependencies:
"@nervosnetwork/ckb-sdk-utils" "0.103.0"
"@nervosnetwork/ckb-sdk-utils" "0.103.1"
axios "0.21.4"
tslib "2.3.1"

"@nervosnetwork/[email protected].0", "@nervosnetwork/ckb-sdk-utils@^0.103.0":
version "0.103.0"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-utils/-/ckb-sdk-utils-0.103.0.tgz#ce027ab4604f4ceb04e06ab5c3525db4d6e6c536"
integrity sha512-2CU8fMQfVuCfhE4QbIUtGe+H75c0t8XjZLla32jSA0gFWSpRFx29E8O2VbtcnQPyfwz3myly8X7UhOZid1iFuQ==
"@nervosnetwork/[email protected].1", "@nervosnetwork/ckb-sdk-utils@^0.103.1":
version "0.103.1"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-sdk-utils/-/ckb-sdk-utils-0.103.1.tgz#8356f88027a4054835fee0648617cc7020c8db1b"
integrity sha512-OzpFNKkOOqYWDHDjPf11uOfOf8EQOEstOBxVtyFjrGEx3B9FwsGxItlHYeuTfpFkHF2Ut+G9M3X71w8h/IApdQ==
dependencies:
"@nervosnetwork/ckb-types" "0.103.0"
"@nervosnetwork/ckb-types" "0.103.1"
bech32 "2.0.0"
elliptic "6.5.4"
jsbi "3.1.3"
tslib "2.3.1"

"@nervosnetwork/[email protected].0", "@nervosnetwork/ckb-types@^0.103.0":
version "0.103.0"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-types/-/ckb-types-0.103.0.tgz#df6115f8d353f4d3a92ddf1fea56419cec10e565"
integrity sha512-0JDanWQro5jwSYAd8QDYnEFcbGQoQAkUJUkocfhHU2xoVbkbZLuoXqspsl25ON3PEuC5RYeBCkF+70sqL2QAQQ==
"@nervosnetwork/[email protected].1", "@nervosnetwork/ckb-types@^0.103.1":
version "0.103.1"
resolved "https://registry.yarnpkg.com/@nervosnetwork/ckb-types/-/ckb-types-0.103.1.tgz#b5626ce905353e70136bfaccf9def0819b76ca27"
integrity sha512-gGRR1VvUS/KRq2ChhXHPiHpgyLYazPM2R8lK87shQI82Gp2/m6k1HVDeNR5XOYwQ3YmBbxHGQtQr/kMq7DUlZA==

"@tsconfig/node10@^1.0.7":
version "1.0.8"
Expand All @@ -94,10 +94,10 @@
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e"
integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==

"@types/node@18.11.13":
version "18.11.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.13.tgz#dff34f226ec1ac0432ae3b136ec5552bd3b9c0fe"
integrity sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w==
"@types/node@18.16.8":
version "18.16.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.8.tgz#fcd9bd0a793aba2701caff4aeae7c988d4da6ce5"
integrity sha512-p0iAXcfWCOTCBbsExHIDFCfwsqFwBTgETJveKMT+Ci3LY9YqQCI91F5S+TB20+aRCXpcWfvx5Qr5EccnwCm2NA==

acorn-walk@^8.1.1:
version "8.2.0"
Expand Down Expand Up @@ -126,10 +126,10 @@ [email protected]:
dependencies:
follow-redirects "^1.14.0"

axios@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.0.tgz#1cb65bd75162c70e9f8d118a905126c4a201d383"
integrity sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw==
axios@^1.2.1:
version "1.3.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.4.tgz#f5760cefd9cfb51fd2481acf88c05f67c4523024"
integrity sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
Expand All @@ -150,7 +150,7 @@ brorand@^1.1.0:
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=

camelcase-keys@^7.0.2:
[email protected]:
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==
Expand Down Expand Up @@ -342,20 +342,20 @@ [email protected]:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

tslib@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e"
integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==
tslib@2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

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==

typescript@4.9.5:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
typescript@5.0.4:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==

v8-compile-cache-lib@^3.0.1:
version "3.0.1"
Expand Down
18 changes: 12 additions & 6 deletions example/claim-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Aggregator } from '../src/aggregator'
import { generateClaimUpdateCotaTx } from '../src/service/cota'
import { CotaNft, Service, FEE } from '../src'

const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska'
const RECEIVER_PRIVATE_KEY = '0xf0d72b5e3a27e603efb304aa16608ba3e480cb1c6790bced80fb82c53a822cee'
const RECEIVER_ADDRESS = 'ckt1qyqy6xew5q449zg5du7wdjhgrxschjkg3n2q8h5ycc'
const TEST_ADDRESS = 'ckt1qyqp8ydxwz3p4vcmjwc2d7zqk4xhv707j80q4yrap2'
const RECEIVER_PRIVATE_KEY = '0xb9449dc7e16f89bc2840f2e4c8a2fbbbd71f56aeca7f6e8d34d8b31192e5f93f'
const RECEIVER_ADDRESS = 'ckt1qyqdvq39qrxcw6hpl0lp07y0qu2659ml7h5sfz8s6a'

const secp256k1CellDep = (isMainnet: boolean): CKBComponents.CellDep => {
if (isMainnet) {
Expand All @@ -32,16 +32,22 @@ const run = async () => {
const isMainnet = false

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' }),
collector: new Collector({
ckbNodeUrl: 'https://testnet.ckbapp.dev/rpc',
ckbIndexerUrl: 'https://testnet.ckbapp.dev/rpc',
}),
aggregator: new Aggregator({
registryUrl: 'https://cota.nervina.dev/registry-aggregator',
cotaUrl: 'https://cota.nervina.dev/aggregator',
}),
}
const ckb = service.collector.getCkb()
const claimLock = addressToScript(RECEIVER_ADDRESS)
const withdrawLock = addressToScript(TEST_ADDRESS)

const nfts: CotaNft[] = [
{
cotaId: '0xc27328c95e27723d42770261d05355977aa5c89a',
cotaId: '0x003688bb1cba009d89dd3f1c8a6027a0c5851e86',
tokenIndex: '0x00000000',
state: '0x00',
characteristic: '0xa5a5a50505050505050505050505050505050505',
Expand Down
20 changes: 13 additions & 7 deletions example/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Aggregator } from '../src/aggregator'
import { generateClaimCotaTx } from '../src/service/cota'
import { Claim, Service, FEE } from '../src'

const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska'
const RECEIVER_PRIVATE_KEY = '0xf0d72b5e3a27e603efb304aa16608ba3e480cb1c6790bced80fb82c53a822cee'
const RECEIVER_ADDRESS = 'ckt1qyqy6xew5q449zg5du7wdjhgrxschjkg3n2q8h5ycc'
const TEST_ADDRESS = 'ckt1qyqp8ydxwz3p4vcmjwc2d7zqk4xhv707j80q4yrap2'
const RECEIVER_PRIVATE_KEY = '0xb9449dc7e16f89bc2840f2e4c8a2fbbbd71f56aeca7f6e8d34d8b31192e5f93f'
const RECEIVER_ADDRESS = 'ckt1qyqdvq39qrxcw6hpl0lp07y0qu2659ml7h5sfz8s6a'

const secp256k1CellDep = (isMainnet: boolean): CKBComponents.CellDep => {
if (isMainnet) {
Expand All @@ -32,17 +32,23 @@ const run = async () => {
const isMainnet = false

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' }),
collector: new Collector({
ckbNodeUrl: 'https://testnet.ckbapp.dev/rpc',
ckbIndexerUrl: 'https://testnet.ckbapp.dev/rpc',
}),
aggregator: new Aggregator({
registryUrl: 'https://cota.nervina.dev/registry-aggregator',
cotaUrl: 'https://cota.nervina.dev/aggregator',
}),
}
const ckb = service.collector.getCkb()
const claimLock = addressToScript(RECEIVER_ADDRESS)
const withdrawLock = addressToScript(TEST_ADDRESS)

const claims: Claim[] = [
{
cotaId: '0xc27328c95e27723d42770261d05355977aa5c89a',
tokenIndex: '0x0000000b',
cotaId: '0x003688bb1cba009d89dd3f1c8a6027a0c5851e86',
tokenIndex: '0x00000000',
},
]
let rawTx = await generateClaimCotaTx(service, claimLock, withdrawLock, claims, FEE, isMainnet)
Expand Down
55 changes: 0 additions & 55 deletions example/define-flashsigner.ts

This file was deleted.

14 changes: 10 additions & 4 deletions example/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Aggregator } from '../src/aggregator'
import { generateDefineCotaTx } from '../src/service/cota'
import { CotaInfo, Service, FEE } from '../src'

const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2'
const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska'
const TEST_PRIVATE_KEY = '0x59df3d4584579a4b8ae77e4d7a851d68178a0e19dbbdd53b5daab543943e1b31'
const TEST_ADDRESS = 'ckt1qyqp8ydxwz3p4vcmjwc2d7zqk4xhv707j80q4yrap2'

const secp256k1CellDep = (isMainnet: boolean): CKBComponents.CellDep => {
if (isMainnet) {
Expand All @@ -31,8 +31,14 @@ const run = async () => {
const isMainnet = false

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' }),
collector: new Collector({
ckbNodeUrl: 'https://testnet.ckbapp.dev/rpc',
ckbIndexerUrl: 'https://testnet.ckbapp.dev/rpc',
}),
aggregator: new Aggregator({
registryUrl: 'https://cota.nervina.dev/registry-aggregator',
cotaUrl: 'https://cota.nervina.dev/aggregator',
}),
}
const ckb = service.collector.getCkb()
const defineLock = addressToScript(TEST_ADDRESS)
Expand Down
16 changes: 11 additions & 5 deletions example/issuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Aggregator } from '../src/aggregator'
import { generateIssuerInfoTx } from '../src/service/cota'
import { IssuerInfo, Service, FEE } from '../src'

const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2'
const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska'
const TEST_PRIVATE_KEY = '0x59df3d4584579a4b8ae77e4d7a851d68178a0e19dbbdd53b5daab543943e1b31'
const TEST_ADDRESS = 'ckt1qyqp8ydxwz3p4vcmjwc2d7zqk4xhv707j80q4yrap2'

const secp256k1CellDep = (isMainnet: boolean): CKBComponents.CellDep => {
if (isMainnet) {
Expand All @@ -31,14 +31,20 @@ const run = async () => {
const isMainnet = false

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' }),
collector: new Collector({
ckbNodeUrl: 'https://testnet.ckbapp.dev/rpc',
ckbIndexerUrl: 'https://testnet.ckbapp.dev/rpc',
}),
aggregator: new Aggregator({
registryUrl: 'https://cota.nervina.dev/registry-aggregator',
cotaUrl: 'https://cota.nervina.dev/aggregator',
}),
}
const ckb = service.collector.getCkb()
const cotaLock = addressToScript(TEST_ADDRESS)

const issuer: IssuerInfo = {
name: 'Nervina Labs',
name: 'Nervina Labs example',
description: 'Melting Two Worlds Together.',
avatar: 'https://i.loli.net/2021/04/29/IigbpOWP8fw9qDn.png',
}
Expand Down
2 changes: 1 addition & 1 deletion example/mainnet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"description": "The examples for mainnet",
"license": "MIT",
"dependencies": {
"@nervina-labs/cota-sdk": "0.8.0"
"@nervina-labs/cota-sdk": "0.9.0"
}
}
Loading

0 comments on commit 10208a7

Please sign in to comment.