Skip to content

Commit

Permalink
Merge pull request #144 from nervina-labs/develop
Browse files Browse the repository at this point in the history
Release v0.6.1
  • Loading branch information
duanyytop authored Jun 29, 2022
2 parents 822031c + 4b306da commit c6e3ba5
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 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.5.6",
"@nervina-labs/cota-sdk": "0.6.0",
"@types/node": "17.0.21",
"ts-node": "10.8.1",
"tslib": "2.4.0",
"typescript": "4.7.3"
"typescript": "4.7.4"
}
}
16 changes: 8 additions & 8 deletions example/aggregator/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@nervina-labs/cota-sdk@0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.5.6.tgz#942d9e69b5f39dcdd23bf28e7d7ed7e0b345100a"
integrity sha512-xCTswdASpZWQ2lxZBl4IsQmA1m1RcA+kruCdZoi2zlEJwnG1Y4mV4BbDECbMKecwlBY02z2PEsF6HWDyjVhpnA==
"@nervina-labs/cota-sdk@0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.6.0.tgz#5fa479ef96946f818e19c07f54726c1890db9de0"
integrity sha512-dEztdIMqR3si2rH26QlzXbSf3kr8fKHsgxyRq/1IsSAR7ykyG5Xae9wE+wook9BYbDBEfti+bXe/nHIggUvrYQ==
dependencies:
"@nervosnetwork/ckb-sdk-core" "^0.103.0"
"@nervosnetwork/ckb-sdk-utils" "^0.103.0"
Expand Down Expand Up @@ -346,10 +346,10 @@ type-fest@^1.2.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==

[email protected].3:
version "4.7.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d"
integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==
[email protected].4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

v8-compile-cache-lib@^3.0.1:
version "3.0.1"
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.5.6"
"@nervina-labs/cota-sdk": "0.6.0"
}
}
8 changes: 4 additions & 4 deletions example/mainnet/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@nervina-labs/cota-sdk@0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.5.6.tgz#942d9e69b5f39dcdd23bf28e7d7ed7e0b345100a"
integrity sha512-xCTswdASpZWQ2lxZBl4IsQmA1m1RcA+kruCdZoi2zlEJwnG1Y4mV4BbDECbMKecwlBY02z2PEsF6HWDyjVhpnA==
"@nervina-labs/cota-sdk@0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@nervina-labs/cota-sdk/-/cota-sdk-0.6.0.tgz#5fa479ef96946f818e19c07f54726c1890db9de0"
integrity sha512-dEztdIMqR3si2rH26QlzXbSf3kr8fKHsgxyRq/1IsSAR7ykyG5Xae9wE+wook9BYbDBEfti+bXe/nHIggUvrYQ==
dependencies:
"@nervosnetwork/ckb-sdk-core" "^0.103.0"
"@nervosnetwork/ckb-sdk-utils" "^0.103.0"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervina-labs/cota-sdk",
"version": "0.6.0",
"version": "0.6.1",
"description": "The SDK of CoTA",
"repository": "[email protected]:nervina-labs/cota-sdk-js.git",
"author": "duanyytop <[email protected]>",
Expand Down Expand Up @@ -34,17 +34,17 @@
"devDependencies": {
"@types/crypto-js": "4.1.1",
"@types/node": "17.0.31",
"@typescript-eslint/parser": "5.28.0",
"@typescript-eslint/parser": "5.29.0",
"babel-eslint": "10.1.0",
"eslint": "8.14.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.0.0",
"husky": "8.0.1",
"prettier": "2.7.0",
"prettier": "2.7.1",
"ts-node": "10.8.1",
"tslib": "2.4.0",
"typescript": "4.7.3"
"typescript": "4.7.4"
},
"homepage": "https://github.com/nervina-labs/cota-sdk-js#readme"
}
4 changes: 2 additions & 2 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const FEE = BigInt(160000)
export const FEE = BigInt(30000)
export const MIN_CAPACITY = BigInt(61) * BigInt(100000000)

const TestnetInfo = {
Expand Down Expand Up @@ -45,7 +45,7 @@ const MainnetInfo = {
} as CKBComponents.Script,

CotaTypeDep: {
outPoint: { txHash: '0x207c0ab1a25f63198c0cb73a9f201585ac39619e0a32cb2339e7cd95858dbe72', index: '0x0' },
outPoint: { txHash: '0x875db3381ebe7a730676c110e1c0d78ae1bdd0c11beacb7db4db08e368c2cd95', index: '0x0' },
depType: 'depGroup',
} as CKBComponents.CellDep,

Expand Down
2 changes: 1 addition & 1 deletion src/service/cota/claim-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const generateClaimUpdateCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x07${claimUpdateSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x07${claimUpdateSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const generateClaimCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x04${claimSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x04${claimSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const generateDefineCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x01${defineSmtEntry}`, outputType: generateCotaMetadata(cotaInfo, cotaId) },
i > 0 ? '0x' : { lock: '', inputType: `0x01${defineSmtEntry}`, outputType: generateCotaMetadata(cotaInfo, cotaId) },
)
return { rawTx, cotaId }
}
2 changes: 1 addition & 1 deletion src/service/cota/isssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const generateIssuerInfoTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: '', outputType: generateIssuerMetadata(issuerInfo) },
i > 0 ? '0x' : { lock: '', inputType: '', outputType: generateIssuerMetadata(issuerInfo) },
)
return rawTx
}
8 changes: 4 additions & 4 deletions src/service/cota/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export const generateMintCotaTx = async (
outputs[0].capacity = `0x${(BigInt(outputs[0].capacity) - fee).toString(16)}`

const cotaId = append0x(mintCotaInfo.cotaId)

let withdrawals = mintCotaInfo.withdrawals
const isTokenIndexNull = withdrawals.some(withdrawal => withdrawal.tokenIndex == null || withdrawal.tokenIndex === '')
if (isTokenIndexNull) {
const { issued } = await service.aggregator.getDefineInfo({cotaId})
const { issued } = await service.aggregator.getDefineInfo({ cotaId })
withdrawals = withdrawals.map((withdrawal, index) => ({
...withdrawal,
tokenIndex: append0x(u32ToBe(issued + index))
tokenIndex: append0x(u32ToBe(issued + index)),
}))
}

Expand All @@ -62,7 +62,7 @@ export const generateMintCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x02${mintSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x02${mintSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/transfer-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const generateTransferUpdateCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x08${transferUpdateSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x08${transferUpdateSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const generateTransferCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x06${transferSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x06${transferSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const generateUpdateCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x05${updateSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x05${updateSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/cota/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const generateWithdrawCotaTx = async (
witnesses: [],
}
rawTx.witnesses = rawTx.inputs.map((_, i) =>
i > 0 ? '' : { lock: '', inputType: `0x03${withdrawalSmtEntry}`, outputType: '' },
i > 0 ? '0x' : { lock: '', inputType: `0x03${withdrawalSmtEntry}`, outputType: '' },
)
return rawTx
}
2 changes: 1 addition & 1 deletion src/service/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ export const generateRegisterCotaTx = async (
}
const registryWitness = serializeWitnessArgs({ lock: '', inputType: append0x(registrySmtEntry), outputType: '' })
const emptyWitness = { lock: '', inputType: '', outputType: '' }
rawTx.witnesses = rawTx.inputs.map((_, i) => (i === 0 ? registryWitness : i === 1 ? emptyWitness : ''))
rawTx.witnesses = rawTx.inputs.map((_, i) => (i === 0 ? registryWitness : i === 1 ? emptyWitness : '0x'))
return rawTx
}
74 changes: 37 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,48 +252,48 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.31.tgz#a5bb84ecfa27eec5e1c802c6bbf8139bdb163a5d"
integrity sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==

"@typescript-eslint/parser@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.28.0.tgz#639b101cad2bfb7ae16e69710ac95c42bd4eae33"
integrity sha512-ekqoNRNK1lAcKhZESN/PdpVsWbP9jtiNqzFWkp/yAUdZvJalw2heCYuqRmM5eUJSIYEkgq5sGOjq+ZqsLMjtRA==
dependencies:
"@typescript-eslint/scope-manager" "5.28.0"
"@typescript-eslint/types" "5.28.0"
"@typescript-eslint/typescript-estree" "5.28.0"
"@typescript-eslint/parser@5.29.0":
version "5.29.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.29.0.tgz#41314b195b34d44ff38220caa55f3f93cfca43cf"
integrity sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==
dependencies:
"@typescript-eslint/scope-manager" "5.29.0"
"@typescript-eslint/types" "5.29.0"
"@typescript-eslint/typescript-estree" "5.29.0"
debug "^4.3.4"

"@typescript-eslint/scope-manager@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.28.0.tgz#ef9a5c68fecde72fd2ff8a84b9c120324826c1b9"
integrity sha512-LeBLTqF/he1Z+boRhSqnso6YrzcKMTQ8bO/YKEe+6+O/JGof9M0g3IJlIsqfrK/6K03MlFIlycbf1uQR1IjE+w==
"@typescript-eslint/scope-manager@5.29.0":
version "5.29.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz#2a6a32e3416cb133e9af8dcf54bf077a916aeed3"
integrity sha512-etbXUT0FygFi2ihcxDZjz21LtC+Eps9V2xVx09zFoN44RRHPrkMflidGMI+2dUs821zR1tDS6Oc9IXxIjOUZwA==
dependencies:
"@typescript-eslint/types" "5.28.0"
"@typescript-eslint/visitor-keys" "5.28.0"
"@typescript-eslint/types" "5.29.0"
"@typescript-eslint/visitor-keys" "5.29.0"

"@typescript-eslint/types@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.28.0.tgz#cffd9bcdce28db6daaa146e48a0be4387a6f4e9d"
integrity sha512-2OOm8ZTOQxqkPbf+DAo8oc16sDlVR5owgJfKheBkxBKg1vAfw2JsSofH9+16VPlN9PWtv8Wzhklkqw3k/zCVxA==
"@typescript-eslint/types@5.29.0":
version "5.29.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.29.0.tgz#7861d3d288c031703b2d97bc113696b4d8c19aab"
integrity sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==

"@typescript-eslint/typescript-estree@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.28.0.tgz#3487d158d091ca2772b285e67412ff6d9797d863"
integrity sha512-9GX+GfpV+F4hdTtYc6OV9ZkyYilGXPmQpm6AThInpBmKJEyRSIjORJd1G9+bknb7OTFYL+Vd4FBJAO6T78OVqA==
"@typescript-eslint/typescript-estree@5.29.0":
version "5.29.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz#e83d19aa7fd2e74616aab2f25dfbe4de4f0b5577"
integrity sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==
dependencies:
"@typescript-eslint/types" "5.28.0"
"@typescript-eslint/visitor-keys" "5.28.0"
"@typescript-eslint/types" "5.29.0"
"@typescript-eslint/visitor-keys" "5.29.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/visitor-keys@5.28.0":
version "5.28.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.28.0.tgz#982bb226b763c48fc1859a60de33fbf939d40a0f"
integrity sha512-BtfP1vCor8cWacovzzPFOoeW4kBQxzmhxGoOpt0v1SFvG+nJ0cWaVdJk7cky1ArTcFHHKNIxyo2LLr3oNkSuXA==
"@typescript-eslint/visitor-keys@5.29.0":
version "5.29.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz#7a4749fa7ef5160c44a451bf060ac1dc6dfb77ee"
integrity sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==
dependencies:
"@typescript-eslint/types" "5.28.0"
"@typescript-eslint/types" "5.29.0"
eslint-visitor-keys "^3.3.0"

acorn-jsx@^5.3.1:
Expand Down Expand Up @@ -1490,10 +1490,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

[email protected].0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.0.tgz#a4fdae07e5596c51c9857ea676cd41a0163879d6"
integrity sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==
[email protected].1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==

punycode@^2.1.0:
version "2.1.1"
Expand Down Expand Up @@ -1723,10 +1723,10 @@ type-fest@^1.2.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==

[email protected].3:
version "4.7.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d"
integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==
[email protected].4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

unbox-primitive@^1.0.1:
version "1.0.1"
Expand Down

0 comments on commit c6e3ba5

Please sign in to comment.