@@ -18,9 +18,17 @@ import (
18
18
const PaymentTokenContractAddress = "0x.."
19
19
const PaymentRecipientAddress = "0x.."
20
20
const PaymentSponsorPolicyId = ".."
21
- const SponsorAPIEndpoint = "https://open-platform.nodereal.io/{Your_API_key}/megafuel-testnet"
22
21
const UserPrivateKey = "..."
23
22
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
+
24
32
func main () {
25
33
receiver := common .HexToAddress (PaymentRecipientAddress )
26
34
payAmount := big .NewInt (1e17 )
@@ -31,7 +39,7 @@ func main() {
31
39
}
32
40
33
41
func paymentGatewaySetUpPolicyRules (receiver common.Address ) {
34
- sponsorClient , err := NewSponsorClient (SponsorAPIEndpoint )
42
+ sponsorClient , err := NewSponsorClient (sponsorAPIEndpoint )
35
43
if err != nil {
36
44
log .Fatal (err )
37
45
}
@@ -88,12 +96,12 @@ func paymentGatewaySetUpPolicyRules(receiver common.Address) {
88
96
89
97
func userDoGaslessPayment (receiver common.Address , amount * big.Int ) {
90
98
// 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 )
92
100
if err != nil {
93
101
log .Fatalf ("Failed to connect to the Ethereum network: %v" , err )
94
102
}
95
103
// Create a PaymasterClient (for transaction sending)
96
- paymasterClient , err := NewPaymasterClient ("https://bsc-megafuel-testnet.nodereal.io" )
104
+ paymasterClient , err := NewPaymasterClient (paymasterEndpoint )
97
105
if err != nil {
98
106
log .Fatalf ("Failed to create PaymasterClient: %v" , err )
99
107
}
0 commit comments