ton-core / ton Goto Github PK
View Code? Open in Web Editor NEWMost popular TON Typescript Library
License: MIT License
Most popular TON Typescript Library
License: MIT License
Transaction does not contain its own hash, only hash of previous transaction. It’s quite inconvenient, e.g in scenarios when one wants to persist transactions in database. Also toncenter’s response has it, though it’s not encoded in “data” field. Could you please add it?
callGetMethod
(or change TonClient to runMethod
), if there's no good reason for them to be different.I'm getting following error, when I am using get methods in the contracts in Vue.js app:
Uncaught (in promise) TypeError: Cannot read private member from an object whose class did not declare it
at __classPrivateFieldGet (TonClient.js:17:94)
at Proxy.runMethod (TonClient.js:53:25)
at Proxy.callGetMethod (TonClient.js:68:21)
at Object.get (TonClient.js:329:39)
at DSocialNetworkMaster.getGetBlogsCount (tact_DSocialNetworkMaster.ts:1750:38)
at Proxy.<anonymous> (openContract.js:38:47)
at getLastBlogAddress (CreateBlog.vue:87:52)
at goToNewBlogAddress (CreateBlog.vue:72:25)
at callWithErrorHandling (runtime-core.esm-bundler.js:158:18)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:166:17)
Possibly, it also can be the case in other frameworks, but as far as I know Vue and JS private hash fields (TonClient.#api
) have difficult relationships because of Proxies used by Vue. It might resolve the error, if we replace all hash fields with just private TS properties.
Something like
["tuple", {"@type": "tvm.tuple", "elements": [{ "@type": "tvm.stackEntryNumber", "number": { "@type": "tvm.numberDecimal", "number": "1" }}]}]
or
[ 'list', { '@type': 'tvm.list', elements: [] } ]
is not supported currently.
Line 298 in 4fc089d
It would be useful if the status repo changed.
This can be stronger redirection in contrast to readme.
I see some who made a mistake
It would be greate to have an option to make secretKey
is optional for createTransfer
for wallet contracts to have an option to create unsigned transfers for estimations.
The feature will use in OpenMask and Tonkeeper web
Line with bug:
https://github.com/ton-org/ton/blob/master/src/client/TonClient.ts#L346
Fix: add .bytes
to be Cell.fromBase64(s.cell.bytes)
.
I have a getter which looks like this:
[cell, cell] get_foo() method_id {...}
And it always fails with error stack:
TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object
at Function.from (node:buffer:324:9)
at Function.fromBase64 (/node_modules/@ton/core/dist/boc/Cell.js:41:42)
at parseStackEntry (/node_modules/@ton/ton/dist/client/TonClient.js:277:54)
at Array.map (<anonymous>)
at parseStackItem (/node_modules/@ton/ton/dist/client/TonClient.js:313:34)
at parseStack (/node_modules/@ton/ton/dist/client/TonClient.js:323:20)
at TonClient.runMethod (/node_modules/@ton/ton/dist/client/TonClient.js:44:49)
Hello,
I am trying to exec callGetMethod from the browser and am getting this error:
Access to XMLHttpRequest at 'https://testnet.toncenter.com/api/v2/jsonRPC' from origin '...' has been blocked by CORS policy: Request header field x-ton-client-version is not allowed by Access-Control-Allow-Headers in preflight response.
I'm using apiKey for TonClient() function
Hello,
I would like to retrieve my transaction Hash after sending a Cell to the network using
TonClient.send(...)
I saw something in Ton Cookbook using getTransaction
and a retry mechanism but TonClient.send(...) returns a void promise so I don't know how they got their example to work.
Ideally, it would be easier to know how the transaction Hash is calculated knowing the Cell we are sending
Which repository will be developed and supported in the long run https://github.com/ton-core/ton or https://github.com/ton-org/ton-core?
I see that on both of these are commits that are missing on the other. I think we should at least put a deprecation notice on one of them
Also do we now when ton-core/ton-core#33 will be released to npm?
I attempted to retrieve the USDT balance from the TON mainnet using the master contract address EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
. I confirmed that I obtained the correct jetton wallet address. However, I encountered the following error:
async getBalance(provider: ContractProvider) {
const { stack } = await provider.get("get_wallet_data", []);
console.log(stack);
return fromNano(stack.readBigNumber());
}
When using the same method to connect to the testnet wallet and the testnet token address, I can successfully retrieve the balance without any errors.
The balance should be successfully retrieved from the TON mainnet without any errors, similar to how it works with the testnet.
An error occurs when attempting to retrieve the balance from the TON mainnet.
EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs
Please let me know if you need any additional information or have any suggestions for troubleshooting this issue.
Description:
I got an error when trying to get jetton data with this function:
async getJettonData(provider: ContractProvider) {
let res = await provider.get('get_jetton_data', []);
let totalSupply = res.stack.readBigNumber();
let mintable = res.stack.readBoolean();
let adminAddress = res.stack.readAddress();
let content = res.stack.readCell();
let walletCode = res.stack.readCell();
return {
totalSupply,
mintable,
adminAddress,
content,
walletCode
};
}
The problem is that the proxy ton (EQCM3B12QK1e4yZSf8GtBRT0aLMNyEsBc_DhVfRRtOEffLez) does not have an admin address, so I encounter the error:
Error: Invalid address: 0
Steps to Reproduce:
Call the function with the jetton address EQCM3B12QK1e4yZSf8GtBRT0aLMNyEsBc_DhVfRRtOEffLez.
Solution:
Use let adminAddress = res.stack.readAddressOpt();
instead.
(To match TonClient)
Is there any plan to support "injecting" different network adapter to the TonClient constructer
as it seems it's not implemented
adapter?: AxiosAdapter; - is never used
Description:
I am encountering an issue with the ton package when building my Angular Dapp for production with build optimization enabled. The package works perfectly in the development environment, but the following error occurs during the production build:
Cell.js:107 Uncaught TypeError: Cannot read properties of undefined (reading 'Ordinary')
at new ie (Cell.js:107:40)
at 9786 (Cell.js:207:14)
at r (bootstrap:19:1)
at 121 (Builder.js:12:16)
at r (bootstrap:19:1)
at 1665 (contractAddress.js:11:19)
at r (bootstrap:19:1)
at 5230 (index.js:33:25)
at r (bootstrap:19:1)
at 2971 (index.js:25:14)
Steps to Reproduce:
Integrate the ton package into an Angular project.
Ensure everything works correctly in the development environment.
Build the project for production with build optimization enabled using the Angular CLI command: ng build --prod --optimization.
Expected Behavior:
The project should build successfully without any errors and work as expected in the production environment.
Actual Behavior:
The build process fails with the above-mentioned error, indicating an issue related to undefined properties in Cell.js.
Environment:
Angular version: 14.2.12
ton package version: 13.11.1
Node.js version: 18
OS: MacOs
Additional Information:
Any other relevant information or configurations that might help in diagnosing the issue.
Request:
I would appreciate any guidance or fixes to resolve this issue so that the ton package works seamlessly with Angular's production build optimizations.
Thank you!
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.