File tree 6 files changed +46
-25
lines changed
6 files changed +46
-25
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @ckb-lumos/toolkit " : patch
3
+ ---
4
+
5
+ remove peer dependencies in toolkit
Original file line number Diff line number Diff line change 26
26
},
27
27
"author" : " Xuejie Xiao" ,
28
28
"license" : " MIT" ,
29
- "peerDependencies" : {
30
- "cross-fetch" : " ^3.1.4" ,
31
- "jsbi" : " ^4.1.0"
32
- },
33
29
"publishConfig" : {
34
30
"access" : " public"
35
31
},
32
+ "dependencies" : {
33
+ "@ckb-lumos/bi" : " 0.21.0-next.0"
34
+ },
36
35
"devDependencies" : {
37
36
"@babel/plugin-proposal-export-namespace-from" : " ^7.18.9" ,
38
- "@babel/plugin-transform-modules-commonjs" : " ^7.21.5" ,
39
- "jsbi" : " ^4.1.0"
37
+ "@babel/plugin-transform-modules-commonjs" : " ^7.21.5"
40
38
}
41
39
}
Original file line number Diff line number Diff line change 10
10
// Note this is only used when you need to deal with CKB structures in molecule
11
11
// format. If you are using RPCs or GraphQL to interact with CKB, chances are you
12
12
// will not need this package.
13
- import JSBI from "jsbi " ;
13
+ import { BI } from "@ckb-lumos/bi " ;
14
14
import { Reader } from "./reader" ;
15
15
/**
16
16
* @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
17
17
*/
18
18
function normalizeHexNumber ( length ) {
19
19
return function ( debugPath , value ) {
20
20
if ( ! ( value instanceof ArrayBuffer ) ) {
21
- let intValue = JSBI . BigInt ( value ) . toString ( 16 ) ;
21
+ let intValue = BI . from ( value ) . toString ( 16 ) ;
22
22
if ( intValue . length % 2 !== 0 ) {
23
23
intValue = "0" + intValue ;
24
24
}
Original file line number Diff line number Diff line change
1
+ const test = require ( "ava" ) ;
2
+ const { normalizers } = require ( "../lib" ) ;
3
+
4
+ test ( "correct outPoint should pass validation" , ( t ) => {
5
+ const normalizedOutpoint = normalizers . NormalizeOutPoint ( {
6
+ txHash : `0x${ "00" . repeat ( 32 ) } ` ,
7
+ index : "0x1" ,
8
+ } ) ;
9
+ const expectedNormalizedIndex = new ArrayBuffer ( 4 ) ;
10
+ const view = new Int32Array ( expectedNormalizedIndex ) ;
11
+ view [ 0 ] = 1 ;
12
+
13
+ t . deepEqual ( normalizedOutpoint , {
14
+ index : expectedNormalizedIndex ,
15
+ txHash : new ArrayBuffer ( 32 ) ,
16
+ } ) ;
17
+ } ) ;
18
+
19
+ test ( "error outPoint should not pass validation" , ( t ) => {
20
+ t . throws ( ( ) => {
21
+ normalizers . NormalizeOutPoint ( {
22
+ txHash : `0x${ "00" . repeat ( 32 ) } ` ,
23
+ index : "0x" ,
24
+ } ) ;
25
+ } ) ;
26
+ t . throws ( ( ) => {
27
+ normalizers . NormalizeOutPoint ( {
28
+ txHash : `0x${ "00" . repeat ( 32 ) } ` ,
29
+ index : "not a number" ,
30
+ } ) ;
31
+ } ) ;
32
+ } ) ;
Original file line number Diff line number Diff line change 1
- import JSBI from "jsbi" ;
2
-
3
1
export * as validators from "./validators" ;
4
2
5
3
/**
@@ -17,15 +15,6 @@ export class Reader {
17
15
serializeJson ( ) : string ;
18
16
}
19
17
20
- /**
21
- * @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
22
- */
23
- export function HexStringToBigInt ( hexString : string ) : JSBI ;
24
- /**
25
- * @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
26
- */
27
- export function BigIntToHexString ( i : JSBI ) : string ;
28
-
29
18
/**
30
19
* @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
31
20
*/
You can’t perform that action at this time.
2 commit comments
github-actions[bot] commentedon Oct 13, 2023
🚀 New canary release:
0.0.0-canary-db34aef-20231013061434
vercel[bot] commentedon Oct 13, 2023
Successfully deployed to the following URLs:
lumos-website – ./
lumos-website.vercel.app
lumos-website-magickbase.vercel.app
lumos-website-git-develop-magickbase.vercel.app