Skip to content

Commit e18bf2f

Browse files
fix: network (#8)
Co-authored-by: BarryTong65 <[email protected]>
1 parent 04bb407 commit e18bf2f

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

dist/tsc/paymasterclient.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tsc/paymasterclient.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tsc/sponsorclient.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tsc/sponsorclient.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/paymasterclient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class PaymasterClient extends ethers.JsonRpcProvider {
7171
network?: Networkish,
7272
options?: JsonRpcApiProviderOptions
7373
): PaymasterClient {
74-
return new PaymasterClient(url, network, options)
74+
return new PaymasterClient(url, network, {batchMaxCount: 1})
7575
}
7676

7777
// Static method to create a new PaymasterClient with private policy
@@ -81,7 +81,7 @@ export class PaymasterClient extends ethers.JsonRpcProvider {
8181
network?: Networkish,
8282
options?: JsonRpcApiProviderOptions
8383
): PaymasterClient {
84-
return new PaymasterClient(url, network, options, privatePolicyUUID)
84+
return new PaymasterClient(url, network, {batchMaxCount: 1}, privatePolicyUUID)
8585
}
8686

8787
async chainID(): Promise<string> {

src/sponsorclient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type PolicySpendData = {
4444

4545
export class SponsorClient extends ethers.JsonRpcProvider {
4646
constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions) {
47-
super(url, network, options)
47+
super(url, network, {batchMaxCount: 1})
4848
}
4949

5050
async addToWhitelist(params: WhitelistArgs): Promise<boolean> {

tests/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dotenv.config({
66

77
// testnet env
88
export const OPEN_PLATFORM_PRIVATE_KEY = process.env.OPEN_PLATFORM_PRIVATE_KEY
9-
export const SPONSOR_URL = `https://open-platform-ap.nodereal.io/${OPEN_PLATFORM_PRIVATE_KEY}/megafuel-testnet`
9+
export const SPONSOR_URL = `https://open-platform-ap.nodereal.io/${OPEN_PLATFORM_PRIVATE_KEY}/megafuel-testnet/97`
1010
export const CHAIN_ID = '97'
1111
export const CHAIN_URL = `https://bsc-testnet.nodereal.io/v1/${OPEN_PLATFORM_PRIVATE_KEY}`
1212
export const PAYMASTER_URL = 'https://bsc-megafuel-testnet.nodereal.io/97'

tests/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import {CHAIN_ID, SPONSOR_URL, CHAIN_URL, PAYMASTER_URL, PRIVATE_KEY, TOKEN_CONT
1111
import {ethers} from 'ethers'
1212

1313

14-
export const sponsorClient = new SponsorClient(SPONSOR_URL+"/"+CHAIN_ID, undefined, {staticNetwork: ethers.Network.from(Number(CHAIN_ID))})
14+
export const sponsorClient = new SponsorClient(SPONSOR_URL)
1515

1616
// Provider for assembling the transaction (e.g., testnet)
1717
export const assemblyProvider = new ethers.JsonRpcProvider(CHAIN_URL)
1818

1919
// Provider for sending the transaction (e.g., could be a different network or provider)
20-
export const paymasterClient = PaymasterClient.new(PAYMASTER_URL, undefined, {staticNetwork: ethers.Network.from(Number(CHAIN_ID))})
21-
export const privatePaymasterClient = PaymasterClient.newPrivatePaymaster(SPONSOR_URL+"/"+CHAIN_ID, PRIVATE_POLICY_UUID, undefined, {staticNetwork: ethers.Network.from(Number(CHAIN_ID))})
20+
export const paymasterClient = PaymasterClient.new(PAYMASTER_URL)
21+
export const privatePaymasterClient = PaymasterClient.newPrivatePaymaster(SPONSOR_URL, PRIVATE_POLICY_UUID)
2222

2323
export const wallet = new ethers.Wallet(PRIVATE_KEY, assemblyProvider)
2424
// ERC20 token ABI (only including the transfer function)

0 commit comments

Comments
 (0)