Skip to content

docs(solana): fix types and account instantiation pattern#77

Open
ihsraham wants to merge 1 commit intotetherto:developfrom
ihsraham:fix/solana-wallet-audit
Open

docs(solana): fix types and account instantiation pattern#77
ihsraham wants to merge 1 commit intotetherto:developfrom
ihsraham:fix/solana-wallet-audit

Conversation

@ihsraham
Copy link
Contributor

Summary

Fixes documentation inaccuracies found during verification against actual SDK TypeScript types.


Files Changed

1. sdk/wallet-modules/wallet-solana/configuration.md

Issue: Direct WalletAccountSolana constructor example fails at runtime.

Fix: Replace with WalletManagerSolana.getAccount() pattern.

-import { WalletAccountSolana } from '@tetherto/wdk-wallet-solana'
-const account = new WalletAccountSolana(seedPhrase, "0'/0/0", accountConfig)
+import WalletManagerSolana from '@tetherto/wdk-wallet-solana'
+const wallet = new WalletManagerSolana(seedPhrase, accountConfig)
+const account = await wallet.getAccount(0)

2. sdk/wallet-modules/wallet-solana/api-reference.md

Issue: Return types documented as number but SDK returns bigint.

Fix: Update all method signatures to use correct types.

Method Before After
getFeeRates() {normal: number, fast: number} {normal: bigint, fast: bigint}
getBalance() Promise<number> Promise<bigint>
getTokenBalance() Promise<number> Promise<bigint>
sendTransaction() {hash: string, fee: number} {hash: string, fee: bigint}
transfer() {hash: string, fee: number} {hash: string, fee: bigint}
quoteSendTransaction() {fee: number} {fee: bigint}
quoteTransfer() {fee: number} {fee: bigint}

3. sdk/wallet-modules/wallet-solana/usage.md

Issue 1: Code examples used result.signature but SDK returns result.hash.

-console.log('Transaction signature:', result.signature)
+console.log('Transaction hash:', result.hash)

Issue 2: Quick Start used invalid placeholder seed phrase, fails when snippet copied and pasted.

-const seedPhrase = 'your twelve word seed phrase here'
+const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'

Verification

Test Result
API type verification ✅ Passed
Blind copy-paste tests (4 snippets) ✅ Passed
TypeScript compilation ✅ Passed

Related Task

[WDK] Solana: Audit sdk/wallet-modules/wallet-solana/*

- Replace direct WalletAccountSolana constructor with getAccount() pattern
- Fix return types: number → bigint for balances and fees
- Correct result.hash references (SDK uses hash, not signature)
- Use valid BIP-39 test mnemonic in Quick Start example

Verified: 13/13 API tests passed, all blind copy-paste tests passed
@ihsraham ihsraham changed the base branch from main to develop January 30, 2026 09:56

// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'your twelve word seed phrase here' // Replace with actual seed generation
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why abandon* about?

Copy link
Contributor Author

@ihsraham ihsraham Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's more like Lorem Ipsum. Abandon is at index zero of BIP39 english wordlist. And the last word has to be index 3(about) to keep checksum valid (checksum of all other being at index 0)
So it's like the simplest 12 word mnemonic

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.

2 participants