Giter Club home page Giter Club logo

ton's People

Contributors

dvlkv avatar ex3ndr avatar gusarich avatar howardpen9 avatar irgc avatar krigga avatar rustairov avatar shaharyakir avatar slavafomin avatar talkol avatar ton-gambling avatar vzhovnitsky avatar xssnick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ton's Issues

Проблемы с getSeqNo()

Всем привет. Создаю кошелёк, получается. Делаю wallet.wallet.getSeqNo() - вываливается в такую ошибку:

(node:22645) UnhandledPromiseRejectionWarning: Error: Mailformed response: Expecting one of:
    number
    string
at balance but instead got: undefined, Expecting { @type: "ton.blockIdExt", workchain: number, shard: string, seqno: number, root_hash: string, file_hash: string } at block_id but instead got: undefined, Expecting string at code but instead got: 500, Expecting string at data but instead got: undefined, Expecting { @type: "internal.transactionId", lt: string, hash: string } at last_transaction_id but instead got: undefined, Expecting number at sync_utime but instead got: undefined
    at HttpApi.doCall (/tonwhales/node_modules/ton/dist/client/api/HttpApi.js:259:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at TonClient.getContractState (/tonwhales/node_modules/ton/dist/client/TonClient.js:216:20)
    at TonClient.isContractDeployed (/tonwhales/node_modules/ton/dist/client/TonClient.js:209:17)
    at Function.findActiveBySecretKey (/tonwhales/node_modules/ton/dist/client/Wallet.js:116:28)
    at Function.findBestBySecretKey (/tonwhales/node_modules/ton/dist/client/Wallet.js:126:25)
    at a (/tonwhales/index.ts:33:19)

В чём может быть проблема? Как бороться?

Supporting wallet v4

Some wallets already deploy wallet V4 which is not supported by the library yet

Equal cells aren't equal after Cell.fromBoc

I create some cells and want to compare them.
It works if we use constructors like this:

const cell = new Cell().withData("0101");
const cell2 = new Cell().withData("0101");
console.log(cell.equals(cell2)); // true

But it doesn't work if we use Cell.fromBoc:

const cell = new Cell().withData("0101");
const cellboc = Cell.fromBoc(cell.toBoc())[0];
console.log(cell.equals(cellboc)); // false, but expected true

The problem is that the comparison fails on bits.equals, because cellboc has only 8 bits (cellboc.bits.length), while the first cell has 1023.

axios adapter configuration

Hey guys!
Thank you for your great work!

Here I see that axios adapter can be passed from the client configuration, but it doesn't seem to be used anywhere in HttpApi.

This creates a problem, when in project you have multiple axios versions, and it's impossible to configure axios instance which is being used in the client.
Like in this example:

import axios from 'axios';
import axiosThrottle from 'axios-request-throttle';
axiosThrottle.use(axios, { requestsPerSecond: 0.5 });

axios used in axiosThrottle configuration is not the same as the one used by HttpApi, hence throttling is not applying.

I'd recommend to either actually use the adapter or move axios from here to peerDependencies

Pool problem with my IP

Hello, im blocked via cloudflare says lolminer, i think reason is lolminer 1.39 reconnect to much, Please help me
my ip is 109.42.113.**

x-ton-client-version is not allowed by Access-Control-Allow-Headers in preflight response

Hi, I'm facing this issue when I'm trying to send requests to https://testnet.toncenter.com/api/v2/jsonRPC in my react app.

Error message:

Access to XMLHttpRequest at 'https://testnet.toncenter.com/api/v2/jsonRPC' from origin
 'http://localhost:3000' 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 changed the node module file of ton package and deleted one line, and then requests were working well.

PS:
Maybe making this header to be optional is better.

crc32c is not calculated correctly

probably it's related to the way js represents numbers. it seems the results of bitwise operations are overflowing

examples

-46 ^ 0x82f63b78 = 2097792170

0 ^ 0xffffffff  = -1

Add V4 contracts

There is no support for v4 contracts in the libraries, I think it's worth adding.

How get an empty dictionary?

Hi, help please with ton^13
callGetMethod return an error "Unsupported stack item type: list" when dictionary is empty.
How can I read data with empty dictionary correctly?

p.s. ton^12 doesn't have this problem

Recovered Address

Hey guys!
Thank you for your great work!

I'm new to ton.

I'm trying to retrieve the public address that personal sign, but I can't find any function or information in ton's sdk.
In ethereum it would be something like

          const msgHash = ethers.utils.hashMessage(msg);
          const msgHashBytes = ethers.utils.arrayify(msgHash);
          const recoveredPubKey = ethers.utils.recoverPublicKey(msgHashBytes, signature); 
          const recoveredAddress = ethers.utils.recoverAddress(msgHashBytes, signature);
          console.log("publickey",recoveredPubKey) 
          console.log("redover address", recoveredAddress)

What would be the equivalent in Ton? or where I can get information, I have searched but I can't find anything about it
Regards

Wrong handling of Binary comments (BinaryMessage.ts)

In: https://github.com/tonwhales/ton/blob/master/src/messages/BinaryMessage.ts
binary comments are not handled according to guidelines: https://ton.org/docs/#/howto/smart-contract-guidelines

If op is zero, then the message is a "simple transfer message with comment". The comment is contained in the remainder of the message body (without any query_id field, i.e., starting from the fifth byte). If it does not begin with the byte 0xff, the comment is a text one; ... On the other hand, if the comment begins with the byte 0xff, the remainder is a "binary comment"

In other words, need bytes 0x00000000FF before writing buffer

Suggested fix:

writeTo(cell: Cell) {
    cell.bits.writeUint(0, 32);
    cell.bits.writeUint(0xFF, 8);
    cell.bits.writeBuffer(this.payload);
}

Another issue is handling big binary comments which don't into one cell.
The case of big messages is handled in for text comments in CommentMessage.ts, but not for binary comments.

Transaction fee estimation

Hello!

Is there a way to calculate transaction fee using this library?

What would be the recommended way to check if account has enough funds to carry on the funds transfer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.