Skip to content

Commit

Permalink
fix: network (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: BarryTong65 <[email protected]>
  • Loading branch information
BarryTong98 and BarryTong65 authored Oct 18, 2024
1 parent 04bb407 commit e18bf2f
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions dist/tsc/paymasterclient.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/tsc/paymasterclient.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/tsc/sponsorclient.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/tsc/sponsorclient.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/paymasterclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class PaymasterClient extends ethers.JsonRpcProvider {
network?: Networkish,
options?: JsonRpcApiProviderOptions
): PaymasterClient {
return new PaymasterClient(url, network, options)
return new PaymasterClient(url, network, {batchMaxCount: 1})
}

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

async chainID(): Promise<string> {
Expand Down
2 changes: 1 addition & 1 deletion src/sponsorclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type PolicySpendData = {

export class SponsorClient extends ethers.JsonRpcProvider {
constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions) {
super(url, network, options)
super(url, network, {batchMaxCount: 1})
}

async addToWhitelist(params: WhitelistArgs): Promise<boolean> {
Expand Down
2 changes: 1 addition & 1 deletion tests/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dotenv.config({

// testnet env
export const OPEN_PLATFORM_PRIVATE_KEY = process.env.OPEN_PLATFORM_PRIVATE_KEY
export const SPONSOR_URL = `https://open-platform-ap.nodereal.io/${OPEN_PLATFORM_PRIVATE_KEY}/megafuel-testnet`
export const SPONSOR_URL = `https://open-platform-ap.nodereal.io/${OPEN_PLATFORM_PRIVATE_KEY}/megafuel-testnet/97`
export const CHAIN_ID = '97'
export const CHAIN_URL = `https://bsc-testnet.nodereal.io/v1/${OPEN_PLATFORM_PRIVATE_KEY}`
export const PAYMASTER_URL = 'https://bsc-megafuel-testnet.nodereal.io/97'
Expand Down
6 changes: 3 additions & 3 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {CHAIN_ID, SPONSOR_URL, CHAIN_URL, PAYMASTER_URL, PRIVATE_KEY, TOKEN_CONT
import {ethers} from 'ethers'


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

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

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

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

0 comments on commit e18bf2f

Please sign in to comment.