From 7e8a8c119fce63035dd8221d5ddf0129502423c2 Mon Sep 17 00:00:00 2001 From: duanyytop Date: Tue, 3 May 2022 23:13:32 +0800 Subject: [PATCH 1/7] chore: Update getAlwaysSuccessLock annotation --- example/registry.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/example/registry.ts b/example/registry.ts index eafa944..feb74ce 100644 --- a/example/registry.ts +++ b/example/registry.ts @@ -33,6 +33,9 @@ const run = async () => { const registryLock = getAlwaysSuccessLock(false) + // Mainnet + // const registryLock = getAlwaysSuccessLock(true) + let keyMap = new Map() keyMap.set(scriptToHash(registryLock), '') keyMap.set(scriptToHash(provideCKBLock), TEST_PRIVATE_KEY) From 3554d03617cbe7e1ffed6574a9cd0817d7602980 Mon Sep 17 00:00:00 2001 From: duanyytop Date: Tue, 3 May 2022 23:15:47 +0800 Subject: [PATCH 2/7] chore: Update registry annotation --- example/registry.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/registry.js b/example/registry.js index cec312d..13614a2 100644 --- a/example/registry.js +++ b/example/registry.js @@ -31,12 +31,15 @@ const run = async () => { // Mainnet // let rawTx = await generateRegisterCotaTx(service, [unregisteredCotaLock], provideCKBLock, FEE, true) - + const secp256k1Dep = await secp256k1CellDep(ckb) rawTx.cellDeps.push(secp256k1Dep) const registryLock = getAlwaysSuccessLock(false) + // Mainnet + // const registryLock = getAlwaysSuccessLock(true) + let keyMap = new Map() keyMap.set(scriptToHash(registryLock), '') keyMap.set(scriptToHash(provideCKBLock), TEST_PRIVATE_KEY) From e9ffb59901d86690047e2c9bc1f531f800d27585 Mon Sep 17 00:00:00 2001 From: duanyytop Date: Tue, 3 May 2022 23:17:37 +0800 Subject: [PATCH 3/7] chore: Update example FEE import --- example/claim-update.ts | 2 +- example/claim.ts | 2 +- example/define-flashsigner.ts | 2 +- example/define.ts | 2 +- example/issuer.ts | 2 +- example/mint.ts | 2 +- example/transfer-update.ts | 2 +- example/transfer.ts | 2 +- example/update.ts | 2 +- example/withdraw.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/example/claim-update.ts b/example/claim-update.ts index 3d8be8f..952e9c0 100644 --- a/example/claim-update.ts +++ b/example/claim-update.ts @@ -2,7 +2,7 @@ import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateClaimUpdateCotaTx } from '../src/service/cota' -import { CotaNft, Service } from '../src' +import { CotaNft, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' diff --git a/example/claim.ts b/example/claim.ts index 9ba0b32..f79507f 100644 --- a/example/claim.ts +++ b/example/claim.ts @@ -2,7 +2,7 @@ import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateClaimCotaTx } from '../src/service/cota' -import { Claim, Service } from '../src' +import { Claim, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' diff --git a/example/define-flashsigner.ts b/example/define-flashsigner.ts index 62286e7..82506bd 100644 --- a/example/define-flashsigner.ts +++ b/example/define-flashsigner.ts @@ -2,7 +2,7 @@ import { addressToScript, serializeWitnessArgs } from '@nervosnetwork/ckb-sdk-ut import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateDefineCotaTx } from '../src/service/cota' -import { Service } from '../src' +import { Service, FEE } from '../src' import { toSnakeCase } from '../src/utils' const TEST_ADDRESS = 'ckt1qpth5hjexr3wehtzqpm97dzzucgemjv7sl05wnez7y72hqvuszeyyqvz2vhrf3xz0jr8dcmxlv059kmpx4tt5vcluapd4' diff --git a/example/define.ts b/example/define.ts index f5896c4..24f613b 100644 --- a/example/define.ts +++ b/example/define.ts @@ -2,7 +2,7 @@ import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateDefineCotaTx } from '../src/service/cota' -import { CotaInfo, Service } from '../src' +import { CotaInfo, Service, FEE } from '../src' const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' diff --git a/example/issuer.ts b/example/issuer.ts index c7dc589..aa8eb44 100644 --- a/example/issuer.ts +++ b/example/issuer.ts @@ -2,7 +2,7 @@ import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateIssuerInfoTx } from '../src/service/cota' -import { IssuerInfo, Service } from '../src' +import { IssuerInfo, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' diff --git a/example/mint.ts b/example/mint.ts index 6926ded..a15359d 100644 --- a/example/mint.ts +++ b/example/mint.ts @@ -2,7 +2,7 @@ import { addressToScript, serializeScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateMintCotaTx } from '../src/service/cota' -import { MintCotaInfo, Service } from '../src' +import { MintCotaInfo, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' diff --git a/example/transfer-update.ts b/example/transfer-update.ts index 741baca..6d519bc 100644 --- a/example/transfer-update.ts +++ b/example/transfer-update.ts @@ -2,7 +2,7 @@ import { addressToScript, serializeScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateTransferUpdateCotaTx } from '../src/service/cota' -import { Service, TransferUpdate } from '../src' +import { Service, TransferUpdate, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' diff --git a/example/transfer.ts b/example/transfer.ts index 542fc69..53898e2 100644 --- a/example/transfer.ts +++ b/example/transfer.ts @@ -2,7 +2,7 @@ import { addressToScript, serializeScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateTransferCotaTx } from '../src/service/cota' -import { TransferWithdrawal, Service, Hex } from '../src' +import { TransferWithdrawal, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' diff --git a/example/update.ts b/example/update.ts index f08670b..1347d60 100644 --- a/example/update.ts +++ b/example/update.ts @@ -2,7 +2,7 @@ import { addressToScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateUpdateCotaTx } from '../src/service/cota' -import { CotaNft, Service } from '../src' +import { CotaNft, Service, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_PRIVATE_KEY = '0xc5bd09c9b954559c70a77d68bde95369e2ce910556ddc20f739080cde3b62ef2' diff --git a/example/withdraw.ts b/example/withdraw.ts index e9898eb..3984e27 100644 --- a/example/withdraw.ts +++ b/example/withdraw.ts @@ -2,7 +2,7 @@ import { addressToScript, serializeScript } from '@nervosnetwork/ckb-sdk-utils' import { Collector } from '../src/collector' import { Aggregator } from '../src/aggregator' import { generateWithdrawCotaTx } from '../src/service/cota' -import { Service, TransferWithdrawal } from '../src' +import { Service, TransferWithdrawal, FEE } from '../src' import CKB from '@nervosnetwork/ckb-sdk-core' const TEST_ADDRESS = 'ckt1qyq0scej4vn0uka238m63azcel7cmcme7f2sxj5ska' From 58448e5b09b9ea00889efaa9fd8d6f47e4233d7e Mon Sep 17 00:00:00 2001 From: duanyytop Date: Wed, 4 May 2022 13:38:10 +0800 Subject: [PATCH 4/7] refactor: Replace at method of array --- src/service/registry/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/service/registry/index.ts b/src/service/registry/index.ts index c0cbd35..4398d7c 100644 --- a/src/service/registry/index.ts +++ b/src/service/registry/index.ts @@ -70,7 +70,8 @@ export const generateRegisterCotaTx = async ( let outputs = await generateCotaOutputs(capacity, cotaLocks, lock) outputs = [registryCell.output].concat(outputs) - outputs.at(-1).capacity = `0x${(BigInt(outputs.at(-1).capacity) - FEE).toString(16)}` + const length = outputs.length + outputs[length-1].capacity = `0x${(BigInt(outputs[length-1].capacity) - FEE).toString(16)}` const lockHashes = cotaLocks.map(lock => scriptToHash(lock)) const { smtRootHash, registrySmtEntry } = await service.aggregator.generateRegisterCotaSmt(lockHashes) From e5395fe4a9e1948c32687e573c539f4277198513 Mon Sep 17 00:00:00 2001 From: duanyytop Date: Wed, 4 May 2022 13:38:53 +0800 Subject: [PATCH 5/7] refactor: Update aggregator rpc timeout --- src/aggregator/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aggregator/index.ts b/src/aggregator/index.ts index b7b1c1a..f86c3ec 100644 --- a/src/aggregator/index.ts +++ b/src/aggregator/index.ts @@ -66,7 +66,7 @@ export class Aggregator { headers: { 'Content-Type': 'application/json', }, - timeout: 60000, + timeout: 300000, data: body, }) ).data From fe242f248525ff870d51571576012e2704bf8ae2 Mon Sep 17 00:00:00 2001 From: duanyytop Date: Wed, 4 May 2022 13:39:09 +0800 Subject: [PATCH 6/7] chore: Bump to v0.4.6 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 46265e5..647db07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nervina-labs/cota-sdk", - "version": "0.4.5", + "version": "0.4.6", "description": "The SDK of CoTA", "repository": "git@github.com:nervina-labs/cota-sdk-js.git", "author": "duanyytop ", diff --git a/yarn.lock b/yarn.lock index 8482869..c50e020 100644 --- a/yarn.lock +++ b/yarn.lock @@ -890,9 +890,9 @@ follow-redirects@^1.14.0: integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== follow-redirects@^1.14.9: - version "1.14.9" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" - integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== + version "1.15.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4" + integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ== form-data@^4.0.0: version "4.0.0" From 5711cc88cbe0f60f15c7357e5a2c398c128973fb Mon Sep 17 00:00:00 2001 From: duanyytop Date: Wed, 4 May 2022 13:40:51 +0800 Subject: [PATCH 7/7] fix: Update registry aggregator rpc url --- example/registry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/registry.ts b/example/registry.ts index feb74ce..dbacdd2 100644 --- a/example/registry.ts +++ b/example/registry.ts @@ -18,7 +18,7 @@ const secp256k1CellDep = async (ckb: CKB): Promise => { 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' }), + aggregator: new Aggregator({ registryUrl: 'http://localhost:3050', cotaUrl: 'http://localhost:3030' }), } const ckb = service.collector.getCkb() const provideCKBLock = addressToScript(TEST_ADDRESS)