-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Bug Description
When trying to create a subaccount with my wallet, I receive an error despite having sufficient SOL balance. I have attached a screenshot of my code for reference. Please review and assist in resolving the issue.
Screenshots
not able to add screenshots,
consoled everything:
πΉ Checking Wallet Connection...
newDrift.js:269 β
Wallet Ready. Initializing Drift Client...
newDrift.js:161 β
Wallet connected: 6jtiTE5RavgbU11YaR7Yfyy17uKVoAfZZ2FqoSUUNLWL
newDrift.js:183 β
Drift Client Initialized
newDrift.js:245 π° SOL Balance: 1 SOL
newDrift.js:191 πΉ Checking for existing user accounts...
newDrift.js:197 π No accounts found, initializing user account...
newDrift.js:215 β
Wallet connected. Initializing user account...
getting this error:
newDrift.js:234 β Error initializing user account: TypeError: Cannot read properties of undefined (reading 'slice')
at sign (index.browser.esm.js:145:121)
at VersionedTransaction.sign (index.browser.esm.js:2176:38)
at RetryTxSender.sendVersionedTransaction (baseTxSender.js:73:16)
at DriftClient.sendTransaction (driftClient.js:4906:34)
at DriftClient.initializeUserAccount (driftClient.js:574:38)
at async initializeUserAccount (newDrift.js:230:40)
at async initDriftClient (newDrift.js:199:9)
at async handleSubscribe (newDrift.js:270:5)
here the code :
try {
console.log("β
Wallet connected. Initializing user account...");
// Ensure driftClient is initialized
if (!client) {
console.error("β Drift Client is not initialized!");
return;
}
// Debugging: Check signTransaction function
if (!signTransaction) {
console.error("β signTransaction function is missing!");
return;
}
// Initialize user account
const [txSig, userPublicKey] = await client.initializeUserAccount(0, "TestAccount");
console.log("β
User initialized:", userPublicKey.toBase58(), "Tx:", txSig);
} catch (error) {
console.error("β Error initializing user account:", error);
}
};
Browser (please complete the following information):
- Browser [ chrome]
Last upstream Slate commit (run git log --author="\(Robert Lord\)\|\(Matthew Peveler\)\|\(Mike Ralphson\)" | head -n 1):
Put the commit hash here
