Skip to content

Commit 29deb6c

Browse files
committed
fix: HttpClient import and nonces ABI
1 parent d09edd8 commit 29deb6c

File tree

3 files changed

+13
-13
lines changed
  • src/content/tutorial/7-gasless-transfers

3 files changed

+13
-13
lines changed

src/content/tutorial/7-gasless-transfers/4-static-relay/_solution/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TypedRequestData } from '@opengsn/common/dist/EIP712/TypedRequestData.js'
2-
import { getHttpClient } from '@opengsn/common/dist/HttpClient.js'
2+
import { HttpClient, HttpWrapper } from '@opengsn/common'
33
import { ethers } from 'ethers'
44

55
// 🔐 Paste your private key from Lesson 1 here!
@@ -23,7 +23,7 @@ const USDT_ABI = [
2323
'function balanceOf(address) view returns (uint256)',
2424
'function transfer(address, uint256) returns (bool)',
2525
'function executeMetaTransaction(address from, bytes functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV) payable returns (bytes)',
26-
'function getNonce(address) view returns (uint256)',
26+
'function nonces(address) view returns (uint256)',
2727
]
2828

2929
const TRANSFER_ABI = [
@@ -43,7 +43,7 @@ async function main() {
4343

4444
// Step 1: Get USDT nonce
4545
const usdt = new ethers.Contract(USDT_ADDRESS, USDT_ABI, provider)
46-
const usdtNonce = await usdt.getNonce(wallet.address)
46+
const usdtNonce = await usdt.nonces(wallet.address)
4747

4848
console.log('\n📝 USDT Nonce:', usdtNonce.toString())
4949

@@ -171,7 +171,7 @@ async function main() {
171171
// Step 10: Submit to relay
172172
console.log('\n📡 Submitting to relay...')
173173

174-
const httpClient = getHttpClient()
174+
const httpClient = new HttpClient(new HttpWrapper(), console)
175175
const relayResponse = await httpClient.relayTransaction(RELAY_URL, {
176176
relayRequest,
177177
metadata: {

src/content/tutorial/7-gasless-transfers/5-relay-discovery/_solution/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TypedRequestData } from '@opengsn/common/dist/EIP712/TypedRequestData.js'
2-
import { getHttpClient } from '@opengsn/common/dist/HttpClient.js'
3-
import { ethers } from 'ethers'
2+
import { HttpClient, HttpWrapper } from '@opengsn/common'
3+
import { ethers} from 'ethers'
44

55
// 🔐 Paste your private key from Lesson 1 here!
66
const PRIVATE_KEY = '0xPASTE_YOUR_PRIVATE_KEY_HERE_FROM_LESSON_1'
@@ -18,7 +18,7 @@ const STATIC_FEE_USDT = '0.01'
1818
// ABIs
1919
const USDT_ABI = [
2020
'function balanceOf(address) view returns (uint256)',
21-
'function getNonce(address) view returns (uint256)',
21+
'function nonces(address) view returns (uint256)',
2222
]
2323

2424
const TRANSFER_ABI = [
@@ -173,7 +173,7 @@ async function main() {
173173

174174
// Rest of the gasless transaction logic (same as lesson 4)
175175
const usdt = new ethers.Contract(USDT_ADDRESS, USDT_ABI, provider)
176-
const usdtNonce = await usdt.getNonce(wallet.address)
176+
const usdtNonce = await usdt.nonces(wallet.address)
177177

178178
const transferAmount = ethers.utils.parseUnits(TRANSFER_AMOUNT_USDT, 6)
179179
const feeAmount = ethers.utils.parseUnits(STATIC_FEE_USDT, 6)
@@ -269,7 +269,7 @@ async function main() {
269269
console.log('\n📡 Submitting to relay...')
270270
const relayNonce = await provider.getTransactionCount(relay.relayWorkerAddress)
271271

272-
const httpClient = getHttpClient()
272+
const httpClient = new HttpClient(new HttpWrapper(), console)
273273
const relayResponse = await httpClient.relayTransaction(relay.url, {
274274
relayRequest,
275275
metadata: {

src/content/tutorial/7-gasless-transfers/6-optimized-fees/_solution/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TypedRequestData } from '@opengsn/common/dist/EIP712/TypedRequestData.js'
2-
import { getHttpClient } from '@opengsn/common/dist/HttpClient.js'
2+
import { HttpClient, HttpWrapper } from '@opengsn/common'
33
import { ethers } from 'ethers'
44

55
// 🔐 Paste your private key from Lesson 1 here!
@@ -25,7 +25,7 @@ const GAS_LIMITS = {
2525
// ABIs
2626
const USDT_ABI = [
2727
'function balanceOf(address) view returns (uint256)',
28-
'function getNonce(address) view returns (uint256)',
28+
'function nonces(address) view returns (uint256)',
2929
]
3030

3131
const TRANSFER_ABI = [
@@ -218,7 +218,7 @@ async function main() {
218218

219219
// Build transaction with calculated fee
220220
const usdt = new ethers.Contract(USDT_ADDRESS, USDT_ABI, provider)
221-
const usdtNonce = await usdt.getNonce(wallet.address)
221+
const usdtNonce = await usdt.nonces(wallet.address)
222222

223223
const transferAmount = ethers.utils.parseUnits(TRANSFER_AMOUNT_USDT, 6)
224224
const feeAmount = relay.feeData.usdtFee // Use optimized fee
@@ -318,7 +318,7 @@ async function main() {
318318
console.log('\n📡 Submitting to relay...')
319319
const relayNonce = await provider.getTransactionCount(relay.relayWorkerAddress)
320320

321-
const httpClient = getHttpClient()
321+
const httpClient = new HttpClient(new HttpWrapper(), console)
322322
const relayResponse = await httpClient.relayTransaction(relay.url, {
323323
relayRequest,
324324
metadata: {

0 commit comments

Comments
 (0)