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

Add referrer field for TON staking tx #12

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Add referrer field for TON staking tx #12

merged 1 commit into from
Dec 10, 2024

Conversation

welldan97
Copy link
Collaborator

Adding referrer for TON tx for tracking.

To parse those fields from transactions, you can use:

const txStatus = await this.getTxStatus({
  address: 'kQDeHoxmpJ6dzzl7KyHDQuOSkwvEnXMcs-8gMCJOSo-IpTrj',
  txHash: '37fd26a86aafd6fb05953655a0ecbe7ba5f1955002f105127359555f5151e733'
})

const body = txStatus.receipt?.outMessages.get(0)?.body.beginParse()
const op = body.loadUint(32)
const queryId = body.loadUint(64)
const gas = body.loadCoins()
const referrer = body.loadStringTail()
console.log({
  op,
  queryId,
  gas,
  referrer
})

Output:

{
  op: 2077040623,
  queryId: 4090730133165079,
  gas: 100000n,
  referrer: 'Hello TON!!!'
}

Tx:

https://testnet.tonviewer.com/transaction/37fd26a86aafd6fb05953655a0ecbe7ba5f1955002f105127359555f5151e733?section=trace

Copy link
Contributor

@mkaczanowski mkaczanowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@welldan97 welldan97 merged commit 3029d89 into main Dec 10, 2024
3 checks passed
@welldan97 welldan97 deleted the ton-referrer branch December 10, 2024 17:04
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

Successfully merging this pull request may close these issues.

2 participants