Skip to content

Commit

Permalink
Merge pull request #6 from node-real/dev
Browse files Browse the repository at this point in the history
fix: readme (#5)
  • Loading branch information
rekyyang authored May 28, 2024
2 parents 4b0cf6c + 35c2871 commit 31f66b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Bundle Go SDK


## Disclaimer
**The software and related documentation are under active development, all subject to potential future change without
notification and not ready for production use. The code and security audit have not been fully completed and not ready
for any bug bounty. We advise you to be careful and experiment on the network at your own risk. Stay safe out there.**

## Instruction

The BUNDLE-GO-SDK provides enhanced transaction privacy and atomicity for the BNB Smart Chain (BSC) network. By implementing the BEP322 standard, the following capabilities are provided:
Expand Down
28 changes: 20 additions & 8 deletions example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ func main() {

fmt.Println("latest block number: ", latestBlock.Number(), "nonce: ", nonce)

// bundle price
/*
Unlike sorting in the tx pool based on tx gas prices, the acceptance of a bundle is determined by its overall gas price,
not the gas price of a single transaction. If the overall bundle price is too low, it will be rejected by the network.
The rules for calculating the bundle price are as follows:
bundlePrice = sum(gasFee of each transaction) / sum(gas used of each transaction)
Developers should ensure that the bundlePrice always exceeds the value returned by the eth_bundlePrice API endpoint.
*/
bundlePrice, err := bundleCli.BundlePrice(context.Background())
if err != nil {
panic(err)
}
fmt.Println("bundle price: ", bundlePrice)

if bundlePrice == nil {
// set default
bundlePrice = big.NewInt(5e9)
}

bundle := types.SendBundleArgs{
Txs: make([]hexutil.Bytes, 0),
MaxBlockNumber: 0,
Expand All @@ -67,7 +86,7 @@ func main() {
To: &address,
Value: big.NewInt(params.GWei),
Gas: uint64(5000000),
GasPrice: big.NewInt(5e9),
GasPrice: bundlePrice,
Data: nil,
}

Expand Down Expand Up @@ -100,13 +119,6 @@ func main() {
bundleJson, _ := jsoniter.Marshal(bundleQuery)
fmt.Println("bundle queried: ", string(bundleJson))

// bundle price
bundlePrice, err := bundleCli.BundlePrice(context.Background())
if err != nil {
panic(err)
}
fmt.Println("bundle price: ", bundlePrice)

// builders
builders, err := bundleCli.Builders(context.Background())
if err != nil {
Expand Down

0 comments on commit 31f66b9

Please sign in to comment.