Skip to content

Commit 31f66b9

Browse files
authored
Merge pull request #6 from node-real/dev
fix: readme (#5)
2 parents 4b0cf6c + 35c2871 commit 31f66b9

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Bundle Go SDK
22

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

115
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:

example/example.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ func main() {
5454

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

57+
// bundle price
58+
/*
59+
Unlike sorting in the tx pool based on tx gas prices, the acceptance of a bundle is determined by its overall gas price,
60+
not the gas price of a single transaction. If the overall bundle price is too low, it will be rejected by the network.
61+
The rules for calculating the bundle price are as follows:
62+
bundlePrice = sum(gasFee of each transaction) / sum(gas used of each transaction)
63+
Developers should ensure that the bundlePrice always exceeds the value returned by the eth_bundlePrice API endpoint.
64+
*/
65+
bundlePrice, err := bundleCli.BundlePrice(context.Background())
66+
if err != nil {
67+
panic(err)
68+
}
69+
fmt.Println("bundle price: ", bundlePrice)
70+
71+
if bundlePrice == nil {
72+
// set default
73+
bundlePrice = big.NewInt(5e9)
74+
}
75+
5776
bundle := types.SendBundleArgs{
5877
Txs: make([]hexutil.Bytes, 0),
5978
MaxBlockNumber: 0,
@@ -67,7 +86,7 @@ func main() {
6786
To: &address,
6887
Value: big.NewInt(params.GWei),
6988
Gas: uint64(5000000),
70-
GasPrice: big.NewInt(5e9),
89+
GasPrice: bundlePrice,
7190
Data: nil,
7291
}
7392

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

103-
// bundle price
104-
bundlePrice, err := bundleCli.BundlePrice(context.Background())
105-
if err != nil {
106-
panic(err)
107-
}
108-
fmt.Println("bundle price: ", bundlePrice)
109-
110122
// builders
111123
builders, err := bundleCli.Builders(context.Background())
112124
if err != nil {

0 commit comments

Comments
 (0)