everx-labs / ever-sdk-js Goto Github PK
View Code? Open in Web Editor NEWJavascript SDK for TVM blockchains (Everscale, TON, Venom, etc)
Home Page: https://tonlabs.github.io/ever-sdk-js/
License: Apache License 2.0
Javascript SDK for TVM blockchains (Everscale, TON, Venom, etc)
Home Page: https://tonlabs.github.io/ever-sdk-js/
License: Apache License 2.0
Detail experiment can be found here: readme
I think it's pretty easy to add Deno support. Deno can work almost like web runtime with wasm.
We just need to fix some hardcoded assumptions like fetch('/evernode.wasm')
because this is too browser-specific.
import { TonClient } from "npm:@eversdk/core";
import { libWeb } from "npm:@eversdk/lib-web"; // or lib-node
TonClient.useBinaryLibrary(libWeb);
const client = new TonClient();
const { phrase } = await client.crypto.mnemonic_from_random({});
console.log(phrase);
client.close();
Will give us:
error: Could not resolve 'npm:@eversdk/lib-web'
lib-node
approach also doesn't work.In short:
error: Uncaught TypeError: /root/.tonlabs/binaries/1/eversdk.node: undefined symbol: SSL_CTX_free
Seems like something with dynamic linking made for nodejs runtime. It feels easily fixable since Deno is made on Rust and Eversdk too.
UPD
3. Workaround: https://github.com/awnion/example-ever-sdk-deno/blob/main/deno-custom-wasm-url.ts
import { TonClient } from "npm:@eversdk/core";
// require npm i @eversdk/lib-web
import { libWeb, libWebSetup } from "./node_modules/@eversdk/lib-web/index.js";
// require npm i @eversdk/lib-web
libWebSetup({
disableSeparateWorker: true,
binaryURL: new URL(
"./node_modules/@eversdk/lib-web/eversdk.wasm",
import.meta.url,
),
});
TonClient.useBinaryLibrary(libWeb);
// ------------------------^^^^^^
// here linter will complain but it's OK
const client = new TonClient();
const { phrase } = await client.crypto.mnemonic_from_random({});
console.log(phrase);
client.close();
Whilst it works it's not very convenient because we have to manually import index.js
from node_modules
. The main concern is that we use two different ways of distribution:
npm:
and we can't easily vendor it from node_modules since its internals link to each other node-js (or rather CommonJS) way.lib-web
can be imported only via index.js
directly and doesn't work with npm:
deno-way.The ideal solution would be to have libDeno (or rather libWasm / libWasi / etc) for server-side WASM + deno modules deployed on Deno
I've placed eversdk.wasm in my next.js public folder which loads everytime my app renders which results in high bandwidth consumption. I've followed this step for setting up eversdk in next.js (https://github.com/tonlabs/sdk-samples/tree/master/core-examples/next-js/normal-transfer#2-handling-the-wasm-file).
Is is possible to host this eversdk.wasm file somewhere else and then pass it's link in the app or any other possible solution instead of saving the wasm file itself in public folder?
@eversdk/lib-web
package includes post-install scripts. As a security best practice, it's generally a good idea to install npm modules with the --ignore-scripts
flag to prevent any potentially malicious code from being executed. It would be great if the option to skip these scripts could be added to the package in the future. Just wanted to pass this suggestion along in case it's something that could be implemented.
android/src/main/AndroidManifest.xml
В манифесте андроида указано название пакета “ton”.
Он не может так называться и должен иметь хотя бы одну точку.
Согласно https://developer.android.com/guide/topics/manifest/manifest-element#package рекомендуется использовать обратное написание доменного имени разработчика.
В эмуляторе приложение собирается и работает. При попытке собрать apk релиз получаем ошибку:
AAPT: error: attribute 'package' in tag is not a valid Android package name: 'ton'.
Пробовал переименовать вручную во что-то вроде com.ton, переложить файлы. В этом случае приложение собирается, устанавливается, но не запускается 🙁
Here's the sample code
const secret = '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb';
const keyPair = await client.crypto.nacl_sign_keypair_from_secret_key({
secret
});
console.log(keyPair);
The keypair in the output is wrong. Looks like the secret
is actual secret concatenated with public
:
{
public: '88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e',
secret: '59ad891197c4eee4ecf156470ecfd2ab42abc89e069f243874a88bcf74f002cb88674ff490dab330f2dc1b09374bdf4e4366e707a78db810ac741383be35616e'
}
git clone [email protected]:tonlabs/ever-sdk-js.git
cd ever-sdk-js/packages/lib-web/example/
npm i
npm run build
Compiling ton_client_node_addon v1.2.0 (C:\Users\User\tonlabs\ton-client-js\packages\lib-node\lib)
Finished release [optimized] target(s) in 6m 46s
Add package file: lib/tonclient.lib
"node-gyp" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 3, kind: NotFound, message: "Системе не удается найти указанный путь." }', C:\Users\User\tonlabs\ton-client-js\build\src\lib.rs:98:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `C:\Users\User\tonlabs\ton-client-js\target\debug\ton_client_node_build.exe` (exit code: 101)
Using 'fetch' to get tonclient.wasm makes impossible to run js applications locally without any webserver:
https://github.com/tonlabs/ton-client-js/blob/a1d43ede6e3186d58c6fbb03e98655018bd606db/packages/lib-web/lib/index-template.js#L126
Any ideas to solve this problem?
Thank you.
Here is traceback of this error:
TypeError: Cannot read property 'startSpan' of undefined
at TONClient._callee11$ (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:627:43)
at tryCatch (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\regenerator-runtime\runtime.js:63:40)
at Generator.invoke [as _invoke] (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\regenerator-runtime\runtime.js:293:22)
at Generator.next (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\regenerator-runtime\runtime.js:118:21)
at asyncGeneratorStep (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:42:103)
at _next (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:44:194)
at C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:44:364
at new Promise ()
at TONClient. (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:44:97)
at TONClient.trace (C:\Users\User\Documents\github\SmartContractsForTON\node_modules\ton-client-js\dist\TONClient.js:664:23)
Function call paramters:
{
address: validContractAddress,
abi: contractAbi,
functionName: contractFunctionName,
input: {contractFunctionInput},
keyPair: keysCreatedFromSeedPhrase
}
Client was created by:
let client = await new TONClient({servers: ['https://net.ton.dev']});
Used node version:
12.18.4
Suppose following code:
Client.contracts.convertAddress({
address: 'ылвоаиывлоиаыловиалоывиалоывиалоывиалоывиалоыиав', // Just a long random string with Cyrillic symbols
convertTo: 'Hex', // Not sure if it only hex, but I tested with it
});
This call lead to a crash on mobile devices.
Right now I use a workaround, I just filter incoming address with a RegExp - /[^:0-9a-zA-Z\-_+/=]/
, but it would be great if the library did it, that could prevent a library users from unpredictable crashes.
tvm.run_executor with this object as the argument:
{
"message": "te6ccgEBBQEA2QABRYgAhWSMyfwSrUApdY7ejDsG0AonE45wNaQ3LaACiLkX/yIMAQHh/gukFT5Cw8HWojdnJ8VDspoyBDTSOczaa3jres/taQARv1Qnsogjqkz5lJvYJsyCvNeycp0y5NaYH7O9Ry3TAE+Jbltx55TJAaCHiGfGoe6ujqfBuVL2u//+ERpmDUNsAAAAX5UxDw2YeBz7UzuZGyACAWWAGuSjEiBxCHXN5F+0k7IlVYCsciNxP1XmvGuCCnNAiecgAAAAAAAAAAAAAAAAAAAAGCgDAQgAAAAABAAA",
"account": {
"type": "Account",
"boc": "te6ccgECRgEAEawAAnHABCskZk/glWoBS6x29GHYNoBROJxzga0huW0AFEXIv/kSjKD6gw8CVbAAAANVnHS+EXu9CVP/00ADAQHVPiW5bceeUyQGgh4hnxqHuro6nwblS9rv//hEaZg1DbAAAAF+VCPSFJ8S3LbjzymSA0EPEM+NQ91dHU+DcqXtd//8IjTMGobYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgDACAEWgB8S3LbjzymSA0EPEM+NQ91dHU+DcqXtd//8IjTMGobYAEAIm/wD0pCAiwAGS9KDhiu1TWDD0oQYEAQr0pCD0oQUAAAIBIAkHAcj/fyHtRNAg10nCAY4n0//TP9MA0//T/9MH0wf0BPQF+G34bPhv+G74a/hqf/hh+Gb4Y/hijir0BXD4anD4a234bG34bXD4bnD4b3ABgED0DvK91wv/+GJw+GNw+GZ/+GHi0wABCAC4jh2BAgDXGCD5AQHTAAGU0/8DAZMC+ELiIPhl+RDyqJXTAAHyeuLTPwH4QyG5IJ8wIPgjgQPoq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wvIglhgAAAAAAAAAAAAAAAAzwtmIUQAns8xgQOYuZZxz0AhzxeVcc9BIc3iIMlx+wBbMMD/jiz4QsjL//hDzws/+EbPCwD4SvhL+E74T/hM+E1eUMv/y//LB8sH9AD0AMntVN5/+GcAattwIccAnSLQc9ch1wsAwAGQkOLgIdcNH5DhUxHAAJDgwQMighD////9vLGQ4AHwAfhHbpDe",
"unlimited_balance": true
},
"abi": {
"type": "Contract",
"value": {
"ABI version": 2,
"header": [
"pubkey",
"time",
"expire"
],
"functions": [
{
"name": "constructor",
"inputs": [
{
"name": "owners",
"type": "uint256[]"
},
{
"name": "reqConfirms",
"type": "uint8"
}
],
"outputs": []
},
{
"name": "acceptTransfer",
"inputs": [
{
"name": "payload",
"type": "bytes"
}
],
"outputs": []
},
{
"name": "sendTransaction",
"inputs": [
{
"name": "dest",
"type": "address"
},
{
"name": "value",
"type": "uint128"
},
{
"name": "bounce",
"type": "bool"
},
{
"name": "flags",
"type": "uint8"
},
{
"name": "payload",
"type": "cell"
}
],
"outputs": []
},
{
"name": "submitTransaction",
"inputs": [
{
"name": "dest",
"type": "address"
},
{
"name": "value",
"type": "uint128"
},
{
"name": "bounce",
"type": "bool"
},
{
"name": "allBalance",
"type": "bool"
},
{
"name": "payload",
"type": "cell"
}
],
"outputs": [
{
"name": "transId",
"type": "uint64"
}
]
},
{
"name": "confirmTransaction",
"inputs": [
{
"name": "transactionId",
"type": "uint64"
}
],
"outputs": []
},
{
"name": "isConfirmed",
"inputs": [
{
"name": "mask",
"type": "uint32"
},
{
"name": "index",
"type": "uint8"
}
],
"outputs": [
{
"name": "confirmed",
"type": "bool"
}
]
},
{
"name": "getParameters",
"inputs": [],
"outputs": [
{
"name": "maxQueuedTransactions",
"type": "uint8"
},
{
"name": "maxCustodianCount",
"type": "uint8"
},
{
"name": "expirationTime",
"type": "uint64"
},
{
"name": "minValue",
"type": "uint128"
},
{
"name": "requiredTxnConfirms",
"type": "uint8"
}
]
},
{
"name": "getTransaction",
"inputs": [
{
"name": "transactionId",
"type": "uint64"
}
],
"outputs": [
{
"components": [
{
"name": "id",
"type": "uint64"
},
{
"name": "confirmationsMask",
"type": "uint32"
},
{
"name": "signsRequired",
"type": "uint8"
},
{
"name": "signsReceived",
"type": "uint8"
},
{
"name": "creator",
"type": "uint256"
},
{
"name": "index",
"type": "uint8"
},
{
"name": "dest",
"type": "address"
},
{
"name": "value",
"type": "uint128"
},
{
"name": "sendFlags",
"type": "uint16"
},
{
"name": "payload",
"type": "cell"
},
{
"name": "bounce",
"type": "bool"
}
],
"name": "trans",
"type": "tuple"
}
]
},
{
"name": "getTransactions",
"inputs": [],
"outputs": [
{
"components": [
{
"name": "id",
"type": "uint64"
},
{
"name": "confirmationsMask",
"type": "uint32"
},
{
"name": "signsRequired",
"type": "uint8"
},
{
"name": "signsReceived",
"type": "uint8"
},
{
"name": "creator",
"type": "uint256"
},
{
"name": "index",
"type": "uint8"
},
{
"name": "dest",
"type": "address"
},
{
"name": "value",
"type": "uint128"
},
{
"name": "sendFlags",
"type": "uint16"
},
{
"name": "payload",
"type": "cell"
},
{
"name": "bounce",
"type": "bool"
}
],
"name": "transactions",
"type": "tuple[]"
}
]
},
{
"name": "getTransactionIds",
"inputs": [],
"outputs": [
{
"name": "ids",
"type": "uint64[]"
}
]
},
{
"name": "getCustodians",
"inputs": [],
"outputs": [
{
"components": [
{
"name": "index",
"type": "uint8"
},
{
"name": "pubkey",
"type": "uint256"
}
],
"name": "custodians",
"type": "tuple[]"
}
]
}
],
"data": [],
"events": [
{
"name": "TransferAccepted",
"inputs": [
{
"name": "payload",
"type": "bytes"
}
],
"outputs": []
}
]
}
},
"skip_transaction_check": false,
"return_updated_account": false
}
gives this error -
"Error: 18446744073697658955 can't be represented as a JavaScript number"
Probably, by following line, tonclient.wasm can be cached by browser and it's problem on updates:
https://github.com/tonlabs/ton-client-js/blob/ad8000b42897d911284e5e2d67b12dd228d14642/packages/lib-web/lib/index-template.js#L126
Please, check it and add hash or something to address.
Thank you
I'm trying to setup ton client in my next-app under api/test.js. but when I use (TonClient.useBinaryLibrary(libNode);) it throws me this error "eversdk.node is not a valid Win32 application".
@melsomino @ilyar
Do you have plans to add support for SSR to @tonclient/core and @tonclient/lib-web? I'm using this library inside my Next.js app and getting a lot of errors related to using web-specific API inside node environment (ReferenceError for Blob, URL, etc.)
You have an error logged without the ability to disable it, which fills the logs with unnecessary garbage. Can you somehow solve this issue?
Resolve #165
It looks like keyPair parameter doesn't affect anything while calling deploy or run.
Have two key pairs, deployed smart contract, msg.sender in constructor is 0x0, msg.sender on every run changing state is 0x0. both keyPairs can change state of deployed contract.
I suggest there's a default keyPair used or something like that.
Trying to install core and node js on my backend server, and just adding the package and running it produces an error:
Error: dlopen(/Users/deveoloper/dev/repos/app1/node_modules/@eversdk/lib-node/eversdk.node, 0x0001): symbol not found in flat namespace '_kSCDynamicStoreUseSessionKeys'
On a Mac, Node version v20.9.0
Full error:
Error: dlopen(/Users/deveoloper/dev/repos/app1r/node_modules/@eversdk/lib-node/eversdk.node, 0x0001): symbol not found in flat namespace '_kSCDynamicStoreUseSessionKeys'
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1327:18)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Function.Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at loadAddon (/Users/deveoloper/dev/repos/app1/node_modules/@eversdk/lib-node/index.js:29:16)
at new BinaryBridge (/Users/deveoloper/dev/repos/app1/node_modules/@eversdk/core/dist/bin.js:58:34)
at useLibrary (/Users/deveoloper/dev/repos/app1/node_modules/@eversdk/core/dist/bin.js:32:14)
at Function.useBinaryLibrary (/Users/deveoloper/dev/repos/app1/node_modules/@eversdk/core/dist/client.js:61:30)
at Object. (/Users/deveoloper/dev/repos/app1/src/modules/ton/ton.service.ts:10:11)
I'm gettting this error when i import (
import { TonClient } from "@eversdk/core";
import { libWeb } from "@eversdk/lib-web";
)
when i post this transaction to rpc, i got response only hash, and i can not found it on blockchain or any error message. i want to know where my problem is ?
sdk is: wallet-core, like this
code:
Future<String> signTransaction(String toAddress, String privateKeyHex,
BigInt amount, String? encodedContractData) async {
var expire =
(DateTime.now().microsecondsSinceEpoch / 1000000 + 300).toInt();
Log.d("expire: $expire");
var transfer = Everscale.Transfer(
amount: $fixnum.Int64(amount.toInt()),
expiredAt: expire,
to: toAddress,
behavior: Everscale.MessageBehavior.SimpleTransfer,
bounce: false,
encodedContractData: encodedContractData);
var signingInput = Everscale.SigningInput(
transfer: transfer, privateKey: privateKeyHex.toUint8List());
var signed = AnySigner.sign(
signingInput.writeToBuffer(), TWCoinType.TWCoinTypeEverscale);
Everscale.SigningOutput output = Everscale.SigningOutput.fromBuffer(signed);
return output.encoded;
}
result:
var data =
"te6ccgICAAQAAQAAAUoAAAPhiAHTB1Uvjerh0Tw4uwZOfH3sWlUBz/l/PF6gz1UmjK+GRhGLPQae5CBpkmxN+YuMpdAiHwYVzS9XfWuSNnplma1Z9fVp8eQ/Fbs5iYsHEk7jx6OvCi/HamAqFJiQJ2v2J6EAaXUlsUy/VG7gAAAAAHAAAwACAAEAaEIAYCUduyOdc1Ge+0Ux+ghMmxAxYzRJ8AMiyXinOzK3tb4h3NZQAAAAAAAAAAAAAAAAAAAAUAAAAABLqS2KpIIs9RVh0XO9boobPTIgF0wzH20xTuYEsWsHcGnE6X4A3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVA==";
var hash =
"89b5f22912ce05f0cb33944e6ed5ae4c6536c58b3d7e649f30cdf03108fb51d4";
var res = await client.sendTransaction(data, hash);
and i got graphql result:
89b5f22912ce05f0cb33944e6ed5ae4c6536c58b3d7e649f30cdf03108fb51d4
but i can not found it on blockchain. what is my problem?
how can i check my transaction right or wrong by myself?
При подключении пакета @tonclient/lib-react-native пытается скачать библиотеки в несуществующие папки и падает:
https://github.com/tonlabs/ton-client-js/blob/fd2f809b9fb64f2e046f02257cea1c42d4a83ef4/packages/lib-react-native/install.js#L119
create /ever-sdk-js
this problem comes while trying to call mint function in the smart contract & this error gets thrown
const mint_nft = async (provider) => {
const json = {
type: "Basic NFT",
name: "Sample Name",
description: "Hello world!",
preview: {
source:
"https://venom.network/static/media/bg-main.6b6f0965e7c3b3d9833b.jpg",
mimetype: "image/png",
},
files: [
{
source:
"https://venom.network/static/media/bg-main.6b6f0965e7c3b3d9833b.jpg",
mimetype: "image/jpg",
},
],
external_url: "https://venom.network",
};
const contr = new provider.Contract(
collectionAbi,
collection_address_testnet
);
const res = await contr.methods
.mintNft({ json: json })
.send({ from: new Address(signer_address) });
console.log(res);
};
Hello guys, it seems that eversdk/lib-node package https://www.npmjs.com/package/@eversdk/lib-node can't be installed with yarn/npm command. Could you please check the binaries? I am getting certificate error on my docker build.
os: Windows 10.0.19042.0
node: 15.11.0
npm: 7.6.3
tsc: 4.2.3
Steps to reproduce:
cd packages\tests-node
$env:USE_NODE_SE="true";$env:TON_NETWORK_ADDRESS="http://localhost";node run
Expected result:
1.10.0
✓ Test versions compatibility (1 / 0)
✓ crypto (2 / 0)
✓ encode_message (3 / 0)
✓ net (4 / 0)
✓ Block signatures (5 / 0)
✓ All Accounts (6 / 0)
✓ Ranges (7 / 0)
✓ Wait For (8 / 0)
✓ Subscribe for transactions with addresses (ABIv1) (9 / 0)
✓ Subscribe for transactions with addresses (ABIv2) (10 / 0)
✓ Subscribe for messages (ABI v1) (11 / 0)
✓ Subscribe for messages (ABI v2) (12 / 0)
✓ Transactions with addresses (13 / 0)
✓ Check shard_hashes greater then 0 (14 / 0)
---
success: 14
failure: 0
Actual result:
1.10.0
{ version: '1.10.0', passed: 0, failed: 0, finished: false }
Run frozen, but I catch transactions in the blockchain of Node SE
PS: I've tried to add console.log there https://github.com/tonlabs/ton-client-js/blob/c00b42e6705dfd9f2499173905c58db102e9ee0e/packages/tests-node/run.js#L19
node run
[TEST_START] {"name":"Test versions compatibility"}
1.10.0
[TEST_START] {"name":"crypto"}
[TEST_START] {"name":"encode_message"}
[TEST_START] {"name":"net"}
[TEST_START] {"name":"Block signatures"}
[TEST_START] {"name":"All Accounts"}
[TEST_START] {"name":"Message"}
[TEST_START] {"name":"Ranges"}
[TEST_START] {"name":"Wait For"}
[TEST_START] {"name":"Subscribe for transactions with addresses (ABIv1)"}
[TEST_START] {"name":"Subscribe for transactions with addresses (ABIv2)"}
[TEST_START] {"name":"Subscribe for messages (ABI v1)"}
[TEST_START] {"name":"Subscribe for messages (ABI v2)"}
[TEST_START] {"name":"Transactions with addresses"}
[TEST_START] {"name":"Subscribe for failed server"}
[TEST_START] {"name":"Check shard_hashes greater then 0"}
[TEST_START] {"name":"Subscribe for accounts"}
[TEST_START] {"name":"Long time subscription"}
>>> TypeError: results.forEach is not a function
{ version: '1.10.0', passed: 0, failed: 0, finished: false }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.