Skip to content

Commit

Permalink
Merge pull request #93 from nervina-labs/develop
Browse files Browse the repository at this point in the history
Release v0.4.6
  • Loading branch information
duanyytop authored May 4, 2022
2 parents f1bc249 + 5711cc8 commit 90deb83
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion example/claim-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/define-flashsigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/issuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion example/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion example/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const secp256k1CellDep = async (ckb: CKB): Promise<CKBComponents.CellDep> => {
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)
Expand All @@ -33,6 +33,9 @@ const run = async () => {

const registryLock = getAlwaysSuccessLock(false)

// Mainnet
// const registryLock = getAlwaysSuccessLock(true)

let keyMap = new Map<string, string>()
keyMap.set(scriptToHash(registryLock), '')
keyMap.set(scriptToHash(provideCKBLock), TEST_PRIVATE_KEY)
Expand Down
2 changes: 1 addition & 1 deletion example/transfer-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion example/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervina-labs/cota-sdk",
"version": "0.4.5",
"version": "0.4.6",
"description": "The SDK of CoTA",
"repository": "[email protected]:nervina-labs/cota-sdk-js.git",
"author": "duanyytop <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/aggregator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Aggregator {
headers: {
'Content-Type': 'application/json',
},
timeout: 60000,
timeout: 300000,
data: body,
})
).data
Expand Down
3 changes: 2 additions & 1 deletion src/service/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 90deb83

Please sign in to comment.