Calculating the Balance for Near Address 35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near

75 Views Asked by At

I tried calculating the balance for address 35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near.

As shown in the explorers the balance for the above address is 3.50036 Ⓝ. But when I see the transactions the deposit is 0 for all the transactions. Url from explorer: https://nearblocks.io/address/35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near# https://explorer.near.org/accounts/35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near

Even when I try the below curl queries for the transaction hash and the address I don't get the amount transferred to this address.

Please let me know how is the balance for this address calculated and how can I get them.

And also how can I get the lockeup balance as shown in the below screen shot.

Transaction Hash: GMnNyCRhFZvWThSs6sCurzh3AL4HJ4kAnEQprSm2QPQ2
curl --location 'https://archival-rpc.mainnet.near.org' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "tx",
  "params": ["GMnNyCRhFZvWThSs6sCurzh3AL4HJ4kAnEQprSm2QPQ2",
    "35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near"]
}'

Transaction Hash: C651EP3V6yojcKf5uQyvhLqi2Q8iKFtFHxE8aJz8f14q
curl --location 'https://archival-rpc.mainnet.near.org' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "tx",
  "params": ["C651EP3V6yojcKf5uQyvhLqi2Q8iKFtFHxE8aJz8f14q",
    "35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near"]
}'

Transaction Hash: 93u2H6FGbYM6mYk5RXSbGyyLRAvdYjyz4amwsTnhiWKW
curl --location 'https://archival-rpc.mainnet.near.org' \
--header 'Content-Type: application/json' \
--data '{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "tx",
  "params": ["93u2H6FGbYM6mYk5RXSbGyyLRAvdYjyz4amwsTnhiWKW",
    "35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near"]
}'

URL: https://wallet.near.org/profile/rw3f1.near https://wallet.near.org/profile/rw3f1.near

3

There are 3 best solutions below

1
On

The balance for the lockups could be unintuitive. I guess your question is about these 3.5 NEAR, why you don't have access to this amount. They are blocked by the lockup contract: https://github.com/near/core-contracts/blob/master/lockup/src/lib.rs#L31-L33

So, until the contract is active, you have no access to this amount. But, this amount still belongs to the account. Be careful, different wallets may show this information in different ways.

8
On

The balance of 35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near is currently delegated to figment.poolv1.near staking pool contract.

enter image description here

But when I see the transactions the deposit is 0 for all the transactions.

The transactions were initiated by the lockup contract owner account, and did not attach any tokens to it, but the lockup contract then makes a cross-contract call to the staking pool contract with NEAR tokens attached (unfortunately, Explorer does not show that in the UI).

0
On

@Vlad Frolov :
Could not get much help from the actual code. Can we get anything from the below code but it throws error while I run it. Anything specific to pass through the method name


const axios = require('axios');
async function getLockupBalance(accountId) {

  try {

    const rpcEndpoint = 'https://rpc.mainnet.near.org'; // Replace with the appropriate endpoint
    const response = await axios.post(rpcEndpoint, {
      jsonrpc: '2.0',
      id: '1',
      method: 'query',
      params: {
        request_type: 'call_function',
        finality: 'final',
        account_id: '35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near',
        method_name: 'get_account', // Replace with the actual view function name
        args_base64: ''
      }
    });

    const lockupBalance = response.data.result;
    console.log('Lockup balance:', lockupBalance);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Usage example

const accountId = '35b2e85e2e7add13abcd8ae62998cbfad9bad5bf.lockup.near'; // Replace with the NEAR account ID you want to query
getLockupBalance(accountId);