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 tron assetTransaction example #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/coins/tron.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,28 @@ const param1 = {
const v = await wallet.validSignedTransaction(param1)
```


asset transfer transaction
```typescript
const latestBlockNumber = new BN(43376730)
const latestBlockHash = base.fromHex("000000000295e05aa866246a779650fe41d6c2a80b8a610c343ecaa2c43c2d1c")
const refBlockBytes = latestBlockNumber.toBuffer('be', 8)

const timeStamp = Date.parse(new Date().toString())
const t = assetTransfer({
fromAddress: "TGXQHj3fXhEtCmooRgGemCZyHBEQAv6ct8",
refBlockBytes: base.toHex(refBlockBytes.slice(6, 8)),
refBlockHash: base.toHex(latestBlockHash.slice(8, 16)),
expiration: timeStamp + 3600 * 1000,
timeStamp: timeStamp,
feeLimit: 0,
toAddress: "TTczxNWoJJ8mZjj9w2eegiSZqTCTfhjd4g",
amount: "10000000",
assetName: "TestToken"
}, "bdd80f4421968142b3a4a6c27a1d84a3623384d085a04a895f109fd8d49cef0a")
console.info(t)
```

sign message
```typescript
import { TrxWallet } from "@okxweb3/coin-tron";
Expand Down
24 changes: 23 additions & 1 deletion packages/coin-tron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sign transaction
parameter
* `fromAddress` address, TRX token的转出地址
* `refBlockBytes` 引用的区块字节,指向相关的区块。
* `refBlockHash`
* `refBlockHash`
* `expiration`
* `timeStamp`
* `toAddress`
Expand Down Expand Up @@ -99,6 +99,28 @@ const param1 = {
const v = await wallet.validSignedTransaction(param1)
```


asset transfer transaction
```typescript
const latestBlockNumber = new BN(43376730)
const latestBlockHash = base.fromHex("000000000295e05aa866246a779650fe41d6c2a80b8a610c343ecaa2c43c2d1c")
const refBlockBytes = latestBlockNumber.toBuffer('be', 8)

const timeStamp = Date.parse(new Date().toString())
const t = assetTransfer({
fromAddress: "TGXQHj3fXhEtCmooRgGemCZyHBEQAv6ct8",
refBlockBytes: base.toHex(refBlockBytes.slice(6, 8)),
refBlockHash: base.toHex(latestBlockHash.slice(8, 16)),
expiration: timeStamp + 3600 * 1000,
timeStamp: timeStamp,
feeLimit: 0,
toAddress: "TTczxNWoJJ8mZjj9w2eegiSZqTCTfhjd4g",
amount: "10000000",
assetName: "TestToken"
}, "bdd80f4421968142b3a4a6c27a1d84a3623384d085a04a895f109fd8d49cef0a")
console.info(t)
```

sign message
```typescript
import { TrxWallet } from "@okxweb3/coin-tron";
Expand Down