How to make web app with out wallet open it will do transaction, by a dedicated wallet address?
Hi there.
You are asking how to send transactions for your user where you pay and send them, meaning the user donât need to use the web wallet, right?
For that, you will need some backend which have access to your keys, taking care of signing and sending the transactions. Youâll want to use one of our SDKs.
Yes we are using this:
Inside NodeJs Example:
When we run following commands, it gives same error on all the commands:yarn run-example common/delegationAdd.ts --wallet-file file.export -stake 1000
OR
yarn run-example common/delegationAdd.ts
OR
yarn run-example common/simpleTransfer.ts
OR
yarn run-example client/getBlockInfo.ts
OR
yarn run-example client/getBlockInfo.ts --endpoint localhost:20000 It gives the following error, only the url is different according to the command file.TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension â.tsâ for C:\Users\dell\Downloads\concordium-node-sdk-js-main\examples\nodejs\client\getBlockInfo.ts
And inside packages\sdk, after installing package when I run â yarn test â , it says grpc-api/v2/concordium/types.js is missing:Cannot find module ââŚ/grpc-api/v2/concordium/types.jsâ or its corresponding type declarations.
import type * as Proto from ââŚ/grpc-api/v2/concordium/types.jsâ;
Make sure you have run the following commands in the root of the repository:
git submodule update --init --recursive
yarn
yarn build
I run these commands but its ending with errors.
can you please share any working demo, which do simple transaction without wallet opening?
and when I do run this command inside nodejs example:
yarn run-example common/simpleTransfer.ts
its giving me code: âERR_UNKNOWN_FILE_EXTENSIONâ ,
To run the examples you will need to fix the errors when running my above-mentioned commands, can you provide me with the errors?
This run succesfully:
git submodule update --init --recursive
when I do run; yarn:
this is giving this error:
reactnative@workspace:examples/reactnative couldnât be built successfully (exit code 1, logs can be found here: /private/var/folders/fy/5m5n_fk93j31t8g_jhg0k0340000gn/T/xfs-946b06e2/build.log)
⤠â Completed in 13s 620ms
⤠Failed with errors in 14s 781ms
and when I do run: yarn build:
[@concordium/rust-bindings]: Process exited (exit code 1), completed in 4s 526ms
⤠The command failed for workspaces that are depended upon by other workspaces; canât satisfy the dependency graph
⤠Failed with errors in 4s 536ms
otherwise what we do you do send me zip file of working these all things in which all above packages install and I can do run, as you know its in urgent to deliver.
I have sent you a zip with a smaller demo, which does not require to build the project first.
Iâll need more information on what exactly is failing to help you further with building the project.
yes thank you limemloh, I exported web wallet private key and placed in the project folder, and run second command, and now giving this error:
/Users/muhammadusman/Downloads/demo/src/simple_transfer.ts:18
import { parseEndpoint } from â./shared/utilâ;
^
SyntaxError: The requested module â./shared/utilâ does not provide an export named âparseEndpointâ
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.10.0
second time I run again by cloning project now:
(base) muhammadusman@Muhammads-MacBook-Pro projectsimpletransfer % npm start â --amount 3 --receiver â4YcqN6Uq6U8Pw6YcTmSLpThszaT7iyxdkQne44V4JSVuddQ1kFâ --wallet-file .â/src/mywallet.exportâ
demo@1.0.0 start
tsx ./src/simple_transfer.ts --amount 3 --receiver 4YcqN6Uq6U8Pw6YcTmSLpThszaT7iyxdkQne44V4JSVuddQ1kF --wallet-file ./src/mywallet.export
RpcError: No connection established. Last error: connect ECONNREFUSED ::1:20000 (2024-02-16T14:12:04.618Z)
at Object.callback (/Users/muhammadusman/Documents/UNIAL/Projects /2024/Testing For Demos/projectsimpletransfer/node_modules/@protobuf-ts/grpc-transport/build/commonjs/grpc-transport.js:37:27)
at Object.onReceiveStatus (/Users/muhammadusman/Documents/UNIAL/Projects /2024/Testing For Demos/projectsimpletransfer/node_modules/@grpc/grpc-js/src/client.ts:360:26)
at Object.onReceiveStatus (/Users/muhammadusman/Documents/UNIAL/Projects /2024/Testing For Demos/projectsimpletransfer/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34)
at Object.onReceiveStatus (/Users/muhammadusman/Documents/UNIAL/Projects /2024/Testing For Demos/projectsimpletransfer/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
at (/Users/muhammadusman/Documents/UNIAL/Projects /2024/Testing For Demos/projectsimpletransfer/node_modules/@grpc/grpc-js/src/resolving-call.ts:132:24)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Now error changed and this:
npm start â --amount 5 --receiver â31veNwUKgGmwMb1njCDefjozMmZrtbu1z1LdfeSQRiBdctnAPEâ --wallet-file â./main.exportâ
demo@1.0.0 start
tsx ./src/simple_transfer.ts --amount 5 --receiver 31veNwUKgGmwMb1njCDefjozMmZrtbu1z1LdfeSQRiBdctnAPE --wallet-file ./main.export
RpcError: Nonexisting sender account
at Object.callback (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@protobuf-ts\grpc-transport\build\commonjs\grpc-transport.js:37:27)
at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client.ts:360:26)
at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client-interceptors.ts:458:34)
at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client-interceptors.ts:419:48)
at (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\resolving-call.ts:132:24)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
The example is probably running against a concordium node on testnet.
The account that you are trying to use is on mainnet, so if you want to use this account then you will need access to a node on mainnet.
If you are building something, then you probably want an account on testnet to avoid spending CCD during testing.
Iâm trying for both testnet and mainnet, for testnet Iâm running this command but causing same error:
npm start â --amount 5 --receiver â3L3YPWmEw99W45aa5Mj3hagnxHQTviz3vDuQLhVyfrULcHMBcLâ --wallet-file test.export
demo@1.0.0 start
tsx ./src/simple_transfer.ts --amount 5 --receiver 3L3YPWmEw99W45aa5Mj3hagnxHQTviz3vDuQLhVyfrULcHMBcL --wallet-file test.export
RpcError: Nonexisting sender account
at Object.callback (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@protobuf-ts\grpc-transport\build\commonjs\grpc-transport.js:37:27)
at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client.ts:360:26) at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client-interceptors.ts:458:34)
at Object.onReceiveStatus (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\client-interceptors.ts:419:48)
at (E:\UNIAL\HealthResearch\Project\Concordium\demo\node_modules@grpc\grpc-js\src\resolving-call.ts:132:24)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
The error means that the account, which you are using for sending the transaction (i.e. the exported keys) does not exist on the chain.
This is from the point of view of the node that you are using, so if you just started your own node against testnet, then it will need to first catch up to the rest of the chain, for it to know about your account, which can takes some time.
As an alternative to running your own node, you can use our testnet node at grpc.testnet.concordium.com:20000
.
In most examples, this can be done using --endpoint grpc.testnet.concordium.com:20000
.