Closed smakosh closed 3 weeks ago
Can you provide the following information:
Also try to console.log
all bigint values and see if anything looks suspcious.
Can you provide the following information:
- a stack trace
- which wallet you are using
Also try to
console.log
all bigint values and see if anything looks suspcious.
I'm using Argent X.
Can you assign this to me?
for more details @fracek
Imports
import {
useAccount,
useConnect,
useContract,
useProvider,
useTransactionReceipt,
} from '@starknet-react/core'
import { uint256 } from 'starknet'
import { useStarknetkitConnectModal } from 'starknetkit'
const { connect, connectors } = useConnect()
const { starknetkitConnectModal } = useStarknetkitConnectModal({
connectors: connectors as any,
})
const connectWallet = async () => {
const { connector } = await starknetkitConnectModal()
if (connector) {
connect({ connector })
}
}
'use client'
import { sepolia } from '@starknet-react/chains'
import { publicProvider, StarknetConfig, starkscan } from '@starknet-react/core'
import { constants } from 'starknet'
import {
ArgentMobileConnector,
isInArgentMobileAppBrowser,
} from 'starknetkit/argentMobile'
import { InjectedConnector } from 'starknetkit/injected'
import { WebWalletConnector } from 'starknetkit/webwallet'
const chains = [sepolia]
export const availableConnectors = isInArgentMobileAppBrowser()
? [
ArgentMobileConnector.init({
options: {
url: typeof window !== 'undefined' ? window.location.href : '',
dappName: 'Company name',
chainId: constants.NetworkName.SN_SEPOLIA,
},
}),
]
: [
new InjectedConnector({ options: { id: 'argentX' } }),
new InjectedConnector({ options: { id: 'braavos' } }),
ArgentMobileConnector.init({
options: {
url: typeof window !== 'undefined' ? window.location.href : '',
dappName: 'Company name',
chainId: constants.NetworkName.SN_SEPOLIA,
},
}),
new WebWalletConnector({ url: process.env.NEXT_PUBLIC_WEB_WALLET_URL }),
]
export function StarknetProvider({ children }: { children: React.ReactNode }) {
return (
<StarknetConfig
chains={chains}
provider={publicProvider()}
connectors={availableConnectors}
explorer={starkscan}
autoConnect
>
{children}
</StarknetConfig>
)
}
Hello @smakosh can i please be assigned this task?
Hello @smakosh can i please be assigned this task?
I'm not the owner/maintainer of the repo, cannot assign issues here
@fracek This is the trace stack - and is only occurring when attempting to use account.execute() Not sure if related - but the account signer pk is 0
Looks like the Signer
object Which delegates to @scure/starknet
(which in turn uses noble-curves
) checks that the private key is in range (defined as [1, N)
) and the key being 0 doesn't pass this check.
Can you check if the following demo works for you using ArgentX?
following demo
Unable to connect the wallet, account address loads forever
Does it print any log? Can you download this repo and run the demo locally and try to see what's happening?
Does it print any log? Can you download this repo and run the demo locally and try to see what's happening?
Ran it locally, here's what I get on the log
Uncaught TypeError: Cannot read properties of undefined (reading 'id')
Also this demo doesn't use the account.execute() method
I noticed you're using starknetkit. Are you using the latest release (or prerelease) that is compatible with starknet react v3? V3 switches to the new wallet API to execute transactions.
This is using "starknetkit": "^2.3.2" (latest)
That's strange because it's the same version we use in the demo.
Last thing that could differ is the browser/OS you use and the argent version. Also did you test it with Braavos? Does it work with it?
the demo doesn't use account.execute()
which the initial issue is related to. This started occurring right after integrating starknetkit and upgrading it along with starknet-react
"starknet-react: 3.0.0"
and "starknetkit": "^2.3.0"
for now.Had the same error as op happen once after upgrading
- "starknet-react: 3.0.0",
+ "starknet-react: 3.0.1",
- "starknetkit": "^2.3.0",
+ "starknetkit": "^2.3.2",
Using starknet-react hooks to get the account and provider to use in the following code results in the error below:
const contract = new Contract(ABI, address, provider).typedv2(ABI);
console.log(contract); // logs correctly
const tx = contract.populateTransaction.fn(params);
return account.execute(tx); // will throw
LibraryError: RPC: starknet_getNonce with params {
"contract_address": "0x68f5ed041a0fad85ad85d8f7b6653abd806ebe6e80b92faf501a883589347b7",
"block_id": "pending"
}
20: Contract not found: undefined
at RpcChannel2.errorHandler (index.mjs:4134:13)
at RpcChannel2.fetchEndpoint (index.mjs:4151:12)
at async Account.execute (index.mjs:6464:45)
I resolved my issue by moving away from account.execute()
to useSendTransaction
Example:
const { sendAsync: doSomething } = useSendTransaction({
calls: undefined,
})
const onSubmit = async () => {
try {
const { transaction_hash } = await doSomething([
{
contractAddress,
entrypoint: 'some_function_name',
calldata: [
somedata,
otherdata
],
},
{
contractAddress,
entrypoint: 'some_other_function_name',
calldata: [
somedata,
otherdata
],
},
])
// Do something with `transaction_hash`
} catch (e) {}
}
Does account
come from useAccount
? Because that object is from starknet.js so it may be a bug in that library.
Does
account
come fromuseAccount
? Because that object is from starknet.js so it may be a bug in that library.
useAccount
is imported from starknet-react
Yes, but the account
object returned is WalletAccount
from starknet.js.
Closing this for now, see https://github.com/apibara/starknet-react/issues/510#issuecomment-2407675745 if you want to solve this
After upgrading to
3.0.1-beta.0
we started getting the following error: "Expected valid bigint: 0 < bigint < curve.n"Here's the code responsible for that error: