Skip to content

Paymaster#66

Open
WiseMrMusa wants to merge 11 commits intomainfrom
paymaster
Open

Paymaster#66
WiseMrMusa wants to merge 11 commits intomainfrom
paymaster

Conversation

@WiseMrMusa
Copy link
Collaborator

This creates all the paymaster client primitives and actions

solves the first task in #58

@WiseMrMusa WiseMrMusa linked an issue Mar 17, 2025 that may be closed by this pull request
6 tasks
"use client"

import { useState, useEffect } from 'react';
import { createPaymasterClient, createWalletClient, custom, http, Signature, WalletClient, withRetry } from 'starkweb';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import withRetry.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the unused import withRetry from the import statement on line 4. This will clean up the code and improve readability and maintainability without changing any existing functionality.

  • Locate the import statement on line 4.
  • Remove the withRetry import from the list of imports.
Suggested changeset 1
app/next/pages/paymaster.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/next/pages/paymaster.tsx b/app/next/pages/paymaster.tsx
--- a/app/next/pages/paymaster.tsx
+++ b/app/next/pages/paymaster.tsx
@@ -3,3 +3,3 @@
 import { useState, useEffect } from 'react';
-import { createPaymasterClient, createWalletClient, custom, http, Signature, WalletClient, withRetry } from 'starkweb';
+import { createPaymasterClient, createWalletClient, custom, http, Signature, WalletClient } from 'starkweb';
 import { mainnet, sepolia } from 'starkweb/chains';
EOF
@@ -3,3 +3,3 @@
import { useState, useEffect } from 'react';
import { createPaymasterClient, createWalletClient, custom, http, Signature, WalletClient, withRetry } from 'starkweb';
import { createPaymasterClient, createWalletClient, custom, http, Signature, WalletClient } from 'starkweb';
import { mainnet, sepolia } from 'starkweb/chains';
Copilot is powered by AI and may make mistakes. Always verify output.
/**
* StarkWeb Client - A client for interacting with Starknet
*/
import { createPaymasterClient, http, parseEther } from "starkweb"

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import parseEther.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the unused import parseEther from the import statement on line 1. This will clean up the code and eliminate the unnecessary import, improving readability and maintainability.

  • Remove parseEther from the import statement on line 1.
  • Ensure that the remaining imports are still correctly formatted and used in the code.
Suggested changeset 1
app/starkweb-client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/starkweb-client/src/index.ts b/app/starkweb-client/src/index.ts
--- a/app/starkweb-client/src/index.ts
+++ b/app/starkweb-client/src/index.ts
@@ -1,2 +1,2 @@
-import { createPaymasterClient, http, parseEther } from "starkweb"
+import { createPaymasterClient, http } from "starkweb"
 import { mainnet, sepolia } from "starkweb/chains"
EOF
@@ -1,2 +1,2 @@
import { createPaymasterClient, http, parseEther } from "starkweb"
import { createPaymasterClient, http } from "starkweb"
import { mainnet, sepolia } from "starkweb/chains"
Copilot is powered by AI and may make mistakes. Always verify output.
* StarkWeb Client - A client for interacting with Starknet
*/
import { createPaymasterClient, http, parseEther } from "starkweb"
import { mainnet, sepolia } from "starkweb/chains"

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import mainnet.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the unused import mainnet from the import statement on line 2. This will clean up the code and remove any confusion about the usage of mainnet.

  • Remove the mainnet import from the import statement on line 2.
  • Ensure that the remaining code functionality is not affected by this change.
Suggested changeset 1
app/starkweb-client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/starkweb-client/src/index.ts b/app/starkweb-client/src/index.ts
--- a/app/starkweb-client/src/index.ts
+++ b/app/starkweb-client/src/index.ts
@@ -1,3 +1,3 @@
 import { createPaymasterClient, http, parseEther } from "starkweb"
-import { mainnet, sepolia } from "starkweb/chains"
+import { sepolia } from "starkweb/chains"
 
EOF
@@ -1,3 +1,3 @@
import { createPaymasterClient, http, parseEther } from "starkweb"
import { mainnet, sepolia } from "starkweb/chains"
import { sepolia } from "starkweb/chains"

Copilot is powered by AI and may make mistakes. Always verify output.
type: 'paymasterClient',
})
// get paymaster status
const status = await paymasterClient.getPaymasterStatus()

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable status.

Copilot Autofix

AI 11 months ago

To fix the problem, we should remove the unused variable status and the corresponding line of code that assigns a value to it. This will clean up the code and eliminate any unnecessary computation.

  • Remove the line that assigns a value to the status variable.
  • Ensure that no other parts of the code depend on this variable.
Suggested changeset 1
app/starkweb-client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/starkweb-client/src/index.ts b/app/starkweb-client/src/index.ts
--- a/app/starkweb-client/src/index.ts
+++ b/app/starkweb-client/src/index.ts
@@ -9,3 +9,3 @@
 // get paymaster status
-const status = await paymasterClient.getPaymasterStatus()
+// const status = await paymasterClient.getPaymasterStatus()
 // console.log(status)
EOF
@@ -9,3 +9,3 @@
// get paymaster status
const status = await paymasterClient.getPaymasterStatus()
// const status = await paymasterClient.getPaymasterStatus()
// console.log(status)
Copilot is powered by AI and may make mistakes. Always verify output.
// ],
// })
// get gas token prices
const gasTokenPrices = await paymasterClient.getGasTokenPrices()

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable gasTokenPrices.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the unused variable gasTokenPrices and its associated assignment. This will clean up the code and eliminate any unnecessary computation. Specifically, we will remove lines 20 and 21 from the file app/starkweb-client/src/index.ts.

Suggested changeset 1
app/starkweb-client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/starkweb-client/src/index.ts b/app/starkweb-client/src/index.ts
--- a/app/starkweb-client/src/index.ts
+++ b/app/starkweb-client/src/index.ts
@@ -19,4 +19,3 @@
 // get gas token prices
-const gasTokenPrices = await paymasterClient.getGasTokenPrices()
-// console.log(gasTokenPrices)
+// Removed unused variable gasTokenPrices
 
EOF
@@ -19,4 +19,3 @@
// get gas token prices
const gasTokenPrices = await paymasterClient.getGasTokenPrices()
// console.log(gasTokenPrices)
// Removed unused variable gasTokenPrices

Copilot is powered by AI and may make mistakes. Always verify output.
// console.log(gasTokenPrices)

// get account rewards
const accountRewards = await paymasterClient.getAccountRewards({

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable accountRewards.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the unused variable accountRewards and its associated code. This involves deleting lines 24-27, which declare and assign the variable, as well as the commented-out console.log statement. This will improve code readability and performance by eliminating unnecessary code.

Suggested changeset 1
app/starkweb-client/src/index.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/app/starkweb-client/src/index.ts b/app/starkweb-client/src/index.ts
--- a/app/starkweb-client/src/index.ts
+++ b/app/starkweb-client/src/index.ts
@@ -22,7 +22,3 @@
 
-// get account rewards 
-const accountRewards = await paymasterClient.getAccountRewards({
-  accountAddress: "0x005c475b6089156c0CD4Fc9d64De149992431c442AF882d6332e7c736c99DE91",
-})
-// console.log(accountRewards)
+
 
EOF
@@ -22,7 +22,3 @@

// get account rewards
const accountRewards = await paymasterClient.getAccountRewards({
accountAddress: "0x005c475b6089156c0CD4Fc9d64De149992431c442AF882d6332e7c736c99DE91",
})
// console.log(accountRewards)


Copilot is powered by AI and may make mistakes. Always verify output.
setCompatibility(compatibility);
setError(compatibilityError);

const { rewards, error: rewardsError } = await fetchAccountRewards(network, accountAddress);

Check failure

Code scanning / CodeQL

Invocation of non-function Error

Callee is not a function: it has type undefined.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to ensure that fetchAccountRewards is correctly imported and defined as a function. This involves checking the import statement and the module from which fetchAccountRewards is being imported. If the function is not properly exported from its module, we need to correct the export statement in that module.

  • Verify that fetchAccountRewards is correctly exported from ../../core/exports/actions.js.
  • Ensure that the import statement on line 4 correctly imports fetchAccountRewards as a function.
  • If necessary, update the export statement in the module to properly export fetchAccountRewards.
Suggested changeset 1
packages/starkweb/src/react/hooks/usePaymaster.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/starkweb/src/react/hooks/usePaymaster.ts b/packages/starkweb/src/react/hooks/usePaymaster.ts
--- a/packages/starkweb/src/react/hooks/usePaymaster.ts
+++ b/packages/starkweb/src/react/hooks/usePaymaster.ts
@@ -3,3 +3,3 @@
 import {
-  fetchAccountRewards,
+  fetchAccountRewards as fetchAccountRewards,
   checkAccountCompatibility,
EOF
@@ -3,3 +3,3 @@
import {
fetchAccountRewards,
fetchAccountRewards as fetchAccountRewards,
checkAccountCompatibility,
Copilot is powered by AI and may make mistakes. Always verify output.
refetch: {
fetchPaymasterStatus: () => handleAsyncRequest(() => fetchPaymasterStatus(network), setStatus),
checkAccountCompatibility: () => handleAsyncRequest(() => checkAccountCompatibility(network, accountAddress!), setCompatibility),
fetchAccountRewards: () => handleAsyncRequest(() => fetchAccountRewards(network, accountAddress!), setRewards),

Check failure

Code scanning / CodeQL

Invocation of non-function Error

Callee is not a function: it has type undefined.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to ensure that fetchAccountRewards is correctly defined and imported. The best way to fix this issue without changing existing functionality is to verify the import statement and ensure that fetchAccountRewards is indeed being imported from the correct module.

  • Check the import statement on lines 3-10 to ensure fetchAccountRewards is imported correctly.
  • If fetchAccountRewards is not defined in the imported module, define it or correct the import path.
Suggested changeset 1
packages/starkweb/src/react/hooks/usePaymaster.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/starkweb/src/react/hooks/usePaymaster.ts b/packages/starkweb/src/react/hooks/usePaymaster.ts
--- a/packages/starkweb/src/react/hooks/usePaymaster.ts
+++ b/packages/starkweb/src/react/hooks/usePaymaster.ts
@@ -9,3 +9,3 @@
   executeTransaction,
-} from "../../core/exports/actions.js";
+} from "../../actions/paymaster/actions.js";
 import type {
EOF
@@ -9,3 +9,3 @@
executeTransaction,
} from "../../core/exports/actions.js";
} from "../../actions/paymaster/actions.js";
import type {
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: integrate paymaster

2 participants