error
air158 opened this issue · 9 comments
C:\Users\meng\workspace\rgbpp-sdk\node_modules.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
examples/rgbpp/xudt/1-issue-xudt.ts:2:303 - error TS2307: Cannot find module '@rgbpp-sdk/ckb' or its corresponding type declarations.
2 import { getSecp256k1CellDep,Collector, NoLiveCellError, calculateUdtCellCapacity, MAX_FEE, MIN_CAPACITY, getXudtTypeScript, append0x, getUniqueTypeScript, u128ToLe, encodeRgbppTokenInfo, getXudtDep, getUniqueTypeDep, SECP256K1_WITNESS_LOCK_SIZE, calculateTransactionFee, generateUniqueTypeArgs } from '@rgbpp-sdk/ckb';
~~~~~~~~~~~~~~~~
examples/rgbpp/xudt/1-issue-xudt.ts:51:24 - error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
51 let changeCapacity = sumInputsCapacity - xudtCapacity - xudtInfoCapacity;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
examples/rgbpp/xudt/1-issue-xudt.ts:75:33 - error TS7006: Parameter '_' implicitly has an 'any' type.
75 const witnesses = inputs.map((_, index) => (index === 0 ? emptyWitness : '0x'));
~
examples/rgbpp/xudt/1-issue-xudt.ts:75:36 - error TS7006: Parameter 'index' implicitly has an 'any' type.
75 const witnesses = inputs.map((_, index) => (index === 0 ? emptyWitness : '0x'));
~~~~~
at createTSError (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:859:12)
at reportTSError (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:863:19)
at getOutput (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:1077:36)
at Object.compile (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:1433:41)
at Module.m._compile (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\meng\workspace\rgbpp-sdk\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.12.2_typescript@5.4.5\node_modules\ts-node\src\index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12) {
diagnosticCodes: [ 2307, 2365, 7006, 7006 ]
}
Please give us more information. For example, what are you doing? Which command do you run? How do you import @regbpp-sdk/ckb
?
We cannot find the cause of the problem from the above information.
I install the dependency using pnpm install
and run pnpm add@rgbpp-sdk /ckb@snap
under rgbpp-sdk/packages/ckb, Finally, running npx ts-node examples/rgbpp/xudt/1-issue-xudt.ts
under rgbpp-SDK fails
Please give us more information. For example, what are you doing? Which command do you run? How do you import
@regbpp-sdk/ckb
?请提供更多信息。例如,你在做什么?您运行哪个命令?你如何导入@regbpp-sdk/ckb
?We cannot find the cause of the problem from the above information.我们无法从上述信息中找到问题的原因。
If you want to run examples in rgbpp-sdk, you can run
pnpm install && pnpm build && npx ts-node npx ts-node examples/rgbpp/xudt/1-issue-xudt.ts
in the rgbpp-sdk
root directory,
If you want to run examples in rgbpp-sdk, you can run如果要在 rgbpp-sdk 中运行示例,可以运行
pnpm install && pnpm build && npx ts-node npx ts-node examples/rgbpp/xudt/1-issue-xudt.ts
in thergbpp-sdk
root directory,在根目录中rgbpp-sdk
,
I changed from '@rgbpp-sdk/ckb'
in the second line of examples/rgbpp/xudt/1-issue-xudt.ts to from '@rgbpp-sdk/ckb/src'
and it worked successfully
This error occurs when I run npx ts-node examples/rgbpp/xudt/2-transfer-xudt.ts
. What is the problem and how to solve it
C:\Users\meng\workspace\rgbpp-sdk>npx ts-node examples/rgbpp/queue/2-btc-transfer.ts
ckb address: ckt1qyq829u0x32fchlfe5dqc4awh5q70h0eyj0qh8ngj4
btc address: tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx
C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:5
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
^
NoRgbppLiveCellError: No rgbpp cells found with the xudt type script and the rgbpp lock args
at C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:56:23
at Generator.next (<anonymous>)
at fulfilled (C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 104
}
I made an error when pnpm build
next-example:build: cache bypass, force executing 5083bf0fa0a753fc
vite:build: cache bypass, force executing 46d53fb0417c5295
next-example:build:
next-example:build: > next-example@0.1.0 build C:\Users\meng\workspace\rgbpp-sdk\apps\next
next-example:build: > next build
next-example:build:
vite:build:
vite:build: > vite@0.0.0 build C:\Users\meng\workspace\rgbpp-sdk\apps\vite
vite:build: > tsc && vite build
vite:build:
next-example:build: ▲ Next.js 14.1.2
next-example:build:
next-example:build: Creating an optimized production build ...
vite:build: vite v5.1.4 building for production...
vite:build: transforming...
vite:build: ✓ 34 modules transformed.
vite:build: x Build failed in 455ms
vite:build: error during build:
vite:build: RollupError: src/App.tsx (3:29): "NetworkType" is not exported by "../../packages/btc/lib/index.js", imported by "src/App.tsx".
vite:build: file: C:/Users/meng/workspace/rgbpp-sdk/apps/vite/src/App.tsx:3:29
vite:build: 1: import './App.css';
vite:build: 2: import { sendBtc, NetworkType, DataSource } from '@rgbpp-sdk/btc';
vite:build: 3: import { BtcAssetsApi } from '@rgbpp-sdk/service';
vite:build: ^
vite:build: 4:
vite:build: 5: function App() {
vite:build: at getRollupError (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/parseAst.js:376:41)
vite:build: at error (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/parseAst.js:372:42)
vite:build: at Module.error (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:13654:16)
vite:build: at Module.traceVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:14102:29)
vite:build: at ModuleScope.findVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:11805:39)
vite:build: at FunctionScope.findVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:6019:38)
vite:build: at FunctionBodyScope.findVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:6019:38)
vite:build: at FunctionScope.findVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:6019:38)
vite:build: at FunctionBodyScope.findVariable (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:6019:38)
vite:build: at MemberExpression.bind (file:///C:/Users/meng/workspace/rgbpp-sdk/node_modules/.pnpm/rollup@4.13.0/node_modules/rollup/dist/es/shared/node-entry.js:8606:49)
vite:build: ELIFECYCLE Command failed with exit code 1.
vite:build: ERROR: command finished with error: command (C:\Users\meng\workspace\rgbpp-sdk\apps\vite) C:\Program Files\nodejs\pnpm.CMD run build exited (1)
vite#build: command (C:\Users\meng\workspace\rgbpp-sdk\apps\vite) C:\Program Files\nodejs\pnpm.CMD run build exited (1)
Tasks: 3 successful, 5 total
Cached: 0 cached, 5 total
Time: 12.12s
Failed: vite#build
ERROR run failed: command exited (1)
ELIFECYCLE Command failed with exit code 1.
I made an error when
pnpm build
Hi, the error you encountered is caused by the apps. The build
command tries to build everything in the repo, but in order to run the examples properly, you only need to build the packages. So can you try running pnpm run build:packages
instead?
As an example, the whole install & build pipeline before running the examples:
$ pnpm install
$ pnpm run build:packages
This error occurs when I run
npx ts-node examples/rgbpp/xudt/2-transfer-xudt.ts
. What is the problem and how to solve itC:\Users\meng\workspace\rgbpp-sdk>npx ts-node examples/rgbpp/queue/2-btc-transfer.ts ckb address: ckt1qyq829u0x32fchlfe5dqc4awh5q70h0eyj0qh8ngj4 btc address: tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } ^ NoRgbppLiveCellError: No rgbpp cells found with the xudt type script and the rgbpp lock args at C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:56:23 at Generator.next (<anonymous>) at fulfilled (C:\Users\meng\workspace\rgbpp-sdk\packages\ckb\lib\rgbpp\btc-transfer.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 104 }
This error indicates that the rgbppLockArgsList
you provided has no linked or corresponding L2 assets (CKB RGBPP cells) that can be transferred, meaning the BTC UTXO you provided is not a RGBPP UTXO. You should check and provide valid lock args here: https://github.com/ckb-cell/rgbpp-sdk/blob/develop/examples/rgbpp/queue/2-btc-transfer.ts#L108
I managed to get it up and running, thanks guys