Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For example, participant_list method of the elector contract: #40

Open
Khaterehnajafi opened this issue Nov 26, 2024 · 0 comments
Open

Comments

@Khaterehnajafi
Copy link

For example, participant_list method of the elector contract:

import { LiteClient, LiteRoundRobinEngine, LiteSingleEngine } from 'ton-lite-client';
import { Address } from '@ton/core';

const liteAddr = 'tcp://change-me';
const liteKey = 'some-key';

const client = new LiteClient({
    engine: new LiteRoundRobinEngine([
        new LiteSingleEngine({
            host: liteAddr,
            publicKey: Buffer.from(liteKey, 'base64'),
        }),
    ]),
});

const result = await client.runMethod(
    Address.parse('-1:3333333333333333333333333333333333333333333333333333333333333333'),
    'participant_list',
    [],
    (await client.getMasterchainInfo()).last,
);

console.log('result', result.exitCode, result.result);

Returns:

result -14 te6ccgEBAgEAEQABGAAAAQEAAAAAAAST7gEAAA==

Same method called with ton-http-api works fine:

curl -X POST https://toncenter.com/api/v2/runGetMethod -H "Content-Type: application/json" --data '{
  "address": "-1:3333333333333333333333333333333333333333333333333333333333333333", 
  "method": "participant_list", 
  "stack": []
}'

Outputs:

{
  "ok": true,
  "result": {
    "@type": "smc.runResult",
    "exit_code": 0,
    "gas_used": 321142,
    "stack": [
      [
        "list",
        {
          "@type": "tvm.list",
          "elements": [...]

Originally posted by @ingria in ton-core/ton-lite-client#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant