Skip to content

Commit 09c095a

Browse files
committed
update mainnet info
1 parent 794ea4c commit 09c095a

File tree

14 files changed

+74
-28
lines changed

14 files changed

+74
-28
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
./wallet-user/js-example/node_modules/
1+
./wallet-user/js-example/node_modules/*
22
./wallet-user/js-example/npm-debug.log
33
./wallet-user/js-example/yarn-error.log
44
./wallet-user/js-example/yarn-debug.log
55
./wallet-user/js-example/.pnpm-debug.log
6-
./payment-gateway/js-example/node_modules/
6+
./payment-gateway/js-example/node_modules/*
77
./payment-gateway/js-example/npm-debug.log
88
./payment-gateway/js-example/yarn-error.log
99
./payment-gateway/js-example/yarn-debug.log
1010
./payment-gateway/js-example/.pnpm-debug.log
11-
./cex/js-example/node_modules/
11+
./cex/js-example/node_modules/*
1212
./cex/js-example/npm-debug.log
1313
./cex/js-example/yarn-error.log
1414
./cex/js-example/yarn-debug.log

cex/go-example/main.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,24 @@ import (
1818
const TokenContractAddress = "0x.."
1919
const WithdrawRecipientAddress = "0x.."
2020
const SponsorPolicyId = ".."
21-
const SponsorAPIEndpoint = "https://open-platform.nodereal.io/{YOUR_API_KEY}/megafuel-testnet"
2221
const HotwalletPrivateKey = ".."
2322

23+
const sponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel"
24+
const web3ProviderEndpoint = "https://bsc-dataseed.bnbchain.org"
25+
const paymasterEndpoint = "https://bsc-megafuel.nodereal.io"
26+
27+
// testnet endpoint
28+
// const sponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel-testnet"
29+
// const web3ProviderEndpoint = "https://bsc-testnet-dataseed.bnbchain.org"
30+
// const paymasterEndpoint = "https://bsc-megafuel-testnet.nodereal.io'"
31+
2432
func main() {
2533
sponsorSetUpPolicyRules()
2634
cexDoGaslessWithdrawl()
2735
}
2836

2937
func sponsorSetUpPolicyRules() {
30-
sponsorClient, err := NewSponsorClient(SponsorAPIEndpoint)
38+
sponsorClient, err := NewSponsorClient(sponsorAPIEndpoint)
3139
if err != nil {
3240
log.Fatal(err)
3341
}
@@ -57,12 +65,12 @@ func sponsorSetUpPolicyRules() {
5765
func cexDoGaslessWithdrawl() {
5866
withdrawAmount := big.NewInt(1e17)
5967
// Connect to an Ethereum node (for transaction assembly)
60-
client, err := ethclient.Dial("https://bsc-testnet-dataseed.bnbchain.org")
68+
client, err := ethclient.Dial(web3ProviderEndpoint)
6169
if err != nil {
6270
log.Fatalf("Failed to connect to the Ethereum network: %v", err)
6371
}
6472
// Create a PaymasterClient (for transaction sending)
65-
paymasterClient, err := NewPaymasterClient("https://bsc-megafuel-testnet.nodereal.io")
73+
paymasterClient, err := NewPaymasterClient(paymasterEndpoint)
6674
if err != nil {
6775
log.Fatalf("Failed to create PaymasterClient: %v", err)
6876
}

cex/go-example/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains a Go application demonstrating:
55

66
## Quick Start
77

8-
The example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
8+
If the example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
99
from the official faucet)
1010

1111
1. Install dependencies

cex/js-example/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ const hotwalletPrivateKey = 'HOT_WALLET_PRIVATE_KEY';
66
const userWithdrawAddress = 'USER_WITHDRAW_ADDRESS';
77
// ERC20 token contract address (replace with the address of the token you want to send)
88
const erc20TokenAddress = 'TOKEN_CONTRACT_ADDRESS';
9-
const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel-testnet';
109
const policyID = 'SPONSOR_POLICY_ID'
1110

11+
const web3ProviderEndpoint = 'https://bsc-dataseed.bnbchain.org';
12+
const paymasterEndpoint = 'https://bsc-megafuel.nodereal.io';
13+
const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel';
14+
15+
// testnet endpoint
16+
// const web3ProviderEndpoint = 'https://bsc-testnet-dataseed.bnbchain.org';
17+
// const paymasterEndpoint = 'https://bsc-megafuel-testnet.nodereal.io';
18+
// const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel-testnet';
19+
1220

1321
class SponsorProvider extends ethers.providers.JsonRpcProvider {
1422
constructor(url) {
@@ -53,10 +61,10 @@ class PaymasterProvider extends ethers.providers.JsonRpcProvider {
5361
async function cexDoGaslessWithdrawTx() {
5462

5563
// Provider for assembling the transaction (e.g., mainnet)
56-
const assemblyProvider = new ethers.providers.JsonRpcProvider('https://bsc-testnet-dataseed.bnbchain.org');
64+
const assemblyProvider = new ethers.providers.JsonRpcProvider(web3ProviderEndpoint);
5765

5866
// Provider for sending the transaction (e.g., could be a different network or provider)
59-
const paymasterProvider = new PaymasterProvider('https://bsc-megafuel-testnet.nodereal.io');
67+
const paymasterProvider = new PaymasterProvider(paymasterEndpoint);
6068

6169
const wallet = new ethers.Wallet(hotwalletPrivateKey, assemblyProvider);
6270
// ERC20 token ABI (only including the transfer function)

cex/js-example/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains a Js application demonstrating:
55

66
## Quick Start
77

8-
The example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
8+
If the example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
99
from the official faucet)
1010

1111
1. Install the dependency.

payment-gateway/go-example/main.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ import (
1818
const PaymentTokenContractAddress = "0x.."
1919
const PaymentRecipientAddress = "0x.."
2020
const PaymentSponsorPolicyId = ".."
21-
const SponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel-testnet"
2221
const UserPrivateKey = "..."
2322

23+
const sponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel"
24+
const web3ProviderEndpoint = "https://bsc-dataseed.bnbchain.org"
25+
const paymasterEndpoint = "https://bsc-megafuel.nodereal.io"
26+
27+
// testnet endpoint
28+
// const sponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel-testnet"
29+
// const web3ProviderEndpoint = "https://bsc-testnet-dataseed.bnbchain.org"
30+
// const paymasterEndpoint = "https://bsc-megafuel-testnet.nodereal.io'"
31+
2432
func main() {
2533
receiver := common.HexToAddress(PaymentRecipientAddress)
2634
payAmount := big.NewInt(1e17)
@@ -31,7 +39,7 @@ func main() {
3139
}
3240

3341
func paymentGatewaySetUpPolicyRules(receiver common.Address) {
34-
sponsorClient, err := NewSponsorClient(SponsorAPIEndpoint)
42+
sponsorClient, err := NewSponsorClient(sponsorAPIEndpoint)
3543
if err != nil {
3644
log.Fatal(err)
3745
}
@@ -88,12 +96,12 @@ func paymentGatewaySetUpPolicyRules(receiver common.Address) {
8896

8997
func userDoGaslessPayment(receiver common.Address, amount *big.Int) {
9098
// Connect to an Ethereum node (for transaction assembly)
91-
client, err := ethclient.Dial("https://bsc-testnet-dataseed.bnbchain.org")
99+
client, err := ethclient.Dial(web3ProviderEndpoint)
92100
if err != nil {
93101
log.Fatalf("Failed to connect to the Ethereum network: %v", err)
94102
}
95103
// Create a PaymasterClient (for transaction sending)
96-
paymasterClient, err := NewPaymasterClient("https://bsc-megafuel-testnet.nodereal.io")
104+
paymasterClient, err := NewPaymasterClient(paymasterEndpoint)
97105
if err != nil {
98106
log.Fatalf("Failed to create PaymasterClient: %v", err)
99107
}

payment-gateway/go-example/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains a Go application demonstrating:
55

66
## Quick Start
77

8-
The example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
8+
If the example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
99
from the official faucet)
1010

1111
1. Install dependencies

payment-gateway/js-example/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ const userPrivateKey = 'USER_PRIVATE_KEY';
66
const paymentReceiverAddress = 'PAYMENT_RECIPIENT_ADDRESS';
77
// ERC20 token contract address (replace with the address of the token you want to send)
88
const erc20TokenAddress = 'TOKEN_CONTRACT_ADDRESS';
9-
const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel-testnet';
109
const policyID = 'SPONSOR_POLICY_ID'
1110

11+
const web3ProviderEndpoint = 'https://bsc-dataseed.bnbchain.org';
12+
const paymasterEndpoint = 'https://bsc-megafuel.nodereal.io';
13+
const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel';
14+
15+
// testnet endpoint
16+
// const web3ProviderEndpoint = 'https://bsc-testnet-dataseed.bnbchain.org';
17+
// const paymasterEndpoint = 'https://bsc-megafuel-testnet.nodereal.io';
18+
// const sponsorEndpoint = 'https://open-platform.nodereal.io/{SPONSOR_API_KEY}/megafuel-testnet';
1219

1320
class SponsorProvider extends ethers.providers.JsonRpcProvider {
1421
constructor(url) {
@@ -53,10 +60,10 @@ class PaymasterProvider extends ethers.providers.JsonRpcProvider {
5360
async function userDoGaslessPayment() {
5461

5562
// Provider for assembling the transaction (e.g., mainnet)
56-
const assemblyProvider = new ethers.providers.JsonRpcProvider('https://bsc-testnet-dataseed.bnbchain.org');
63+
const assemblyProvider = new ethers.providers.JsonRpcProvider(web3ProviderEndpoint);
5764

5865
// Provider for sending the transaction (e.g., could be a different network or provider)
59-
const paymasterProvider = new PaymasterProvider('https://bsc-megafuel-testnet.nodereal.io');
66+
const paymasterProvider = new PaymasterProvider(paymasterEndpoint);
6067

6168
const wallet = new ethers.Wallet(userPrivateKey, assemblyProvider);
6269
// ERC20 token ABI (only including the transfer function)

payment-gateway/js-example/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains a Js application demonstrating:
55

66
## Quick Start
77

8-
The example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
8+
If the example is performed on BSC testnet, please ensure you have some test ERC20 on BSC testnet. (You can get some
99
from the official faucet)
1010

1111
1. Install the dependency.

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fees, using MegaFuel to manage the sponsorship policy.
1414

1515

1616
## Network Endpoint
17+
BSC mainet: https://bsc-megafuel.nodereal.io
1718
BSC testnet: https://bsc-megafuel-testnet.nodereal.io
1819

1920
## Quick Start

0 commit comments

Comments
 (0)