Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _redirects
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/sdk/wallet-btc/* /sdk/wallet-modules/wallet-btc/:splat 301
/sdk/wallet-solana /sdk/wallet-modules/wallet-solana 301
/sdk/wallet-solana/* /sdk/wallet-modules/wallet-solana/:splat 301
/sdk/wallet-solana-gasless /sdk/wallet-modules/wallet-solana-gasless 301
/sdk/wallet-solana-gasless/* /sdk/wallet-modules/wallet-solana-gasless/:splat 301
/sdk/wallet-ton /sdk/wallet-modules/wallet-ton 301
/sdk/wallet-ton/* /sdk/wallet-modules/wallet-ton/:splat 301
/sdk/wallet-ton-gasless /sdk/wallet-modules/wallet-ton-gasless 301
Expand Down
1 change: 1 addition & 0 deletions content/docs/sdk/all-modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Wallet modules provide blockchain-specific wallet functionality for managing add
| [`@tetherto/wdk-wallet-tron`](https://github.com/tetherto/wdk-wallet-tron) | TRON | TRON blockchain wallet | [Docs](/sdk/wallet-modules/wallet-tron/) |
| [`@tetherto/wdk-wallet-tron-gasfree`](https://github.com/tetherto/wdk-wallet-tron-gasfree) | TRON | Gas-free transactions on TRON | [Docs](/sdk/wallet-modules/wallet-tron-gasfree/) |
| [`@tetherto/wdk-wallet-solana`](https://github.com/tetherto/wdk-wallet-solana) | Solana | Solana blockchain wallet | [Docs](/sdk/wallet-modules/wallet-solana/) |
| [`@tetherto/wdk-wallet-solana-gasless`](https://github.com/tetherto/wdk-wallet-solana-gasless) | Solana | Gasless Solana transactions through a Kora-compatible paymaster | [Docs](/sdk/wallet-modules/wallet-solana-gasless/) |
| [`@tetherto/wdk-wallet-spark`](https://github.com/tetherto/wdk-wallet-spark) | Spark | Spark/Lightning Bitcoin L2 wallet | [Docs](/sdk/wallet-modules/wallet-spark/) |

## Swidge Interface
Expand Down
4 changes: 4 additions & 0 deletions content/docs/sdk/wallet-modules/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ TON Mainnet
<ImageCard title="Solana" image="/assets/logos/solana-logo.png" href="/sdk/wallet-modules/wallet-solana">
Solana Mainnet
</ImageCard>
<ImageCard title="Solana Gasless" image="/assets/logos/solana-logo.png" href="/sdk/wallet-modules/wallet-solana-gasless">
Solana with paymaster-funded transactions
</ImageCard>
<ImageCard title="Spark" imageLight="/assets/logos/spark-logo-light.png" imageDark="/assets/logos/spark-logo-dark.png" image="/assets/logos/spark-logo-light.png" href="/sdk/wallet-modules/wallet-spark">
Spark Mainnet
</ImageCard>
Expand Down Expand Up @@ -65,6 +68,7 @@ Wallet implementations that support [Account Abstraction](/resources/concepts#ac
| [`@tetherto/wdk-wallet-evm-7702-gasless`](https://github.com/tetherto/wdk-wallet-evm-7702-gasless) | EVM | ✅ Ready | [Documentation](/sdk/wallet-modules/wallet-evm-7702-gasless) |
| [`@tetherto/wdk-wallet-ton-gasless`](https://github.com/tetherto/wdk-wallet-ton-gasless) | TON | ✅ Ready | [Documentation](/sdk/wallet-modules/wallet-ton-gasless) |
| [`@tetherto/wdk-wallet-tron-gasfree`](https://github.com/tetherto/wdk-wallet-tron-gasfree) | TRON | ✅ Ready | [Documentation](/sdk/wallet-modules/wallet-tron-gasfree) |
| [`@tetherto/wdk-wallet-solana-gasless`](https://github.com/tetherto/wdk-wallet-solana-gasless) | Solana | ✅ Ready | [Documentation](/sdk/wallet-modules/wallet-solana-gasless) |
| `@tetherto/wdk-wallet-solana-jupiterz` | Solana | In progress | - |

## Community Wallet Modules
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
---
title: Configuration
description: Configuration options for @tetherto/wdk-wallet-solana-gasless.
docType: reference
schemaType: TechArticle
icon: Settings
---

## Wallet Configuration

`WalletManagerSolanaGasless` accepts a seed phrase or seed bytes plus a Solana gasless wallet configuration:

```javascript title="Create a gasless Solana wallet"
import WalletManagerSolanaGasless from '@tetherto/wdk-wallet-solana-gasless'

const config = {
provider: 'https://api.devnet.solana.com',
commitment: 'confirmed',
paymasterUrl: 'https://your-kora-paymaster.example',
paymasterAddress: 'Paymaster111111111111111111111111111111111',
paymasterToken: {
address: 'TokenMint111111111111111111111111111111111'
},
transferMaxFee: 1000000n
}

const wallet = new WalletManagerSolanaGasless(seedPhrase, config)
const account = await wallet.getAccount(0)
```

## Account Configuration

You can also construct an owned or read-only account directly:

```javascript title="Create accounts directly"
import {
WalletAccountReadOnlySolanaGasless,
WalletAccountSolanaGasless
} from '@tetherto/wdk-wallet-solana-gasless'

const account = new WalletAccountSolanaGasless(seedPhrase, "0'/0'", config)

const readOnlyAccount = new WalletAccountReadOnlySolanaGasless('SolanaAddress...', {
provider: 'https://api.devnet.solana.com',
commitment: 'confirmed',
paymasterUrl: 'https://your-kora-paymaster.example',
paymasterAddress: 'Paymaster111111111111111111111111111111111',
paymasterToken: {
address: 'TokenMint111111111111111111111111111111111'
}
})
```

Read-only accounts do not accept `transferMaxFee` in their public type because they cannot send transfers.

## Configuration Options

### provider

Solana RPC endpoint, or an ordered list of RPC endpoints for failover. This is required for balance reads, blockhash lookup, quotes, signing transactions, sending transactions, and transfers.

**Type:** `string | string[]`

**Example:**

```javascript
const config = {
provider: [
'https://api.devnet.solana.com',
'https://backup-solana-rpc.example'
]
}
```

### rpcUrl

Deprecated alias for `provider`, inherited from the base Solana wallet module. New code should use `provider`.

**Type:** `string | string[]`

### commitment

Solana commitment level used for RPC reads such as balances, blockhashes, and receipts.

**Type:** `'processed' | 'confirmed' | 'finalized'`

### paymasterUrl

Kora-compatible paymaster RPC endpoint, Kora client options object, or ordered failover list.

**Type:** `string | KoraClientOptions | Array<string | KoraClientOptions>`

**Required:** Yes

**Example:**

```javascript
const config = {
paymasterUrl: [
'https://primary-paymaster.example',
{ rpcUrl: 'https://backup-paymaster.example' }
]
}
```

An empty `paymasterUrl` array throws an error.

### paymasterAddress

Solana address used as the transaction fee payer. For prebuilt `TransactionMessage` inputs, an explicit `feePayer` must be absent or equal to this address.

**Type:** `string`

**Required:** Yes

### paymasterToken

Token used by the paymaster to quote and charge fees.

**Type:**

```typescript
type PaymasterTokenConfig = {
address: string
}
```

**Required:** Yes

The module passes `paymasterToken.address` to the paymaster as the fee token and returns fees in that token's base units.

### retries

Additional retry attempts used by failover providers when `provider` or `paymasterUrl` is an ordered list.

**Type:** `number`

**Default:** `3`

### transferMaxFee

Maximum allowed paymaster fee for `transfer()` calls, in the configured paymaster token's base units. `transfer()` throws when the quoted fee is greater than or equal to this cap.

**Type:** `number | bigint`

**Required:** No

**Example:**

```javascript
const result = await account.transfer({
token: 'TokenMint111111111111111111111111111111111',
recipient: 'Recipient1111111111111111111111111111111',
amount: 1000000n
}, {
transferMaxFee: 500000n
})
```

## Paymaster Overrides

Quote, send, sign, and transfer methods accept a second configuration object for per-call paymaster overrides:

```javascript title="Override paymaster token for one call"
const quote = await account.quoteTransfer({
token: 'TokenMint111111111111111111111111111111111',
recipient: 'Recipient1111111111111111111111111111111',
amount: 1000000n
}, {
paymasterToken: {
address: 'AlternateFeeMint11111111111111111111111111'
},
transferMaxFee: 500000n
})
```

The current merged module applies `transferMaxFee` to `transfer()` only. `sendTransaction()` and `signTransaction()` do not enforce a separate transaction fee cap in the merged release.

## Security Considerations

- Use HTTPS Solana RPC and paymaster endpoints.
- Use RPC endpoints that serve the same Solana network when enabling failover.
- Keep paymaster tokens funded for the accounts that need sponsored transactions.
- Set `transferMaxFee` for token transfers when your application needs fee protection.
- Validate the paymaster address and paymaster token address before using them in production configuration.
- Call `dispose()` on owned accounts and wallet managers when private keys are no longer needed.

<Cards>
<Card title="Get Started" href="/sdk/wallet-modules/wallet-solana-gasless/guides/get-started">
Create a gasless Solana account.
</Card>
<Card title="Usage" href="/sdk/wallet-modules/wallet-solana-gasless/usage">
Choose a guide for common gasless Solana flows.
</Card>
<Card title="API Reference" href="/sdk/wallet-modules/wallet-solana-gasless/api-reference">
Review methods and config types.
</Card>
</Cards>

***

## Need Help?

<SupportCards />
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Check Balances
description: Query SOL, SPL token, and paymaster token balances with the Solana gasless wallet.
docType: how-to
schemaType: TechArticle
---

This guide explains how to check native SOL, SPL token, batch SPL token, and paymaster token balances.

## Native SOL Balance

Use `getBalance()` to read the native SOL balance in lamports:

```javascript title="Get SOL balance"
const balance = await account.getBalance()
console.log('SOL balance:', balance, 'lamports')
```

## SPL Token Balance

Use `getTokenBalance(tokenAddress)` to read one SPL token balance:

```javascript title="Get SPL token balance"
const tokenBalance = await account.getTokenBalance('TokenMint111111111111111111111111111111111')
console.log('Token balance:', tokenBalance)
```

Balances are returned in the token's base units.

## Batch SPL Token Balances

Use `getTokenBalances(tokenAddresses)` to read multiple SPL balances:

```javascript title="Get batch token balances"
const balances = await account.getTokenBalances([
'TokenMint111111111111111111111111111111111',
'OtherMint1111111111111111111111111111111111'
])

console.log(balances)
```

Missing associated token accounts return `0n`.

## Paymaster Token Balance

Use `getPaymasterTokenBalance()` to read the balance of the configured paymaster fee token:

```javascript title="Get paymaster token balance"
const feeTokenBalance = await account.getPaymasterTokenBalance()
console.log('Paymaster token balance:', feeTokenBalance)
```

The method reads `paymasterToken.address` from the account configuration and delegates to `getTokenBalance()`.

## Read-Only Balances

Read-only accounts support the same balance methods:

```javascript title="Read-only balance checks"
const readOnlyAccount = await account.toReadOnlyAccount()

console.log(await readOnlyAccount.getBalance())
console.log(await readOnlyAccount.getPaymasterTokenBalance())
```

## Next Steps

With balances in place, learn how to [send transactions](/sdk/wallet-modules/wallet-solana-gasless/guides/send-transactions).
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Get Started
description: Install @tetherto/wdk-wallet-solana-gasless and create a paymaster-funded Solana account.
docType: how-to
schemaType: TechArticle
---

This guide creates a gasless Solana account, reads its address, and checks the configured paymaster token balance.

## Install

```bash title="Install @tetherto/wdk-wallet-solana-gasless"
npm install @tetherto/wdk-wallet-solana-gasless
```

## Create a Wallet

```javascript title="Create a gasless Solana wallet"
import WalletManagerSolanaGasless from '@tetherto/wdk-wallet-solana-gasless'

const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'

const wallet = new WalletManagerSolanaGasless(seedPhrase, {
provider: 'https://api.devnet.solana.com',
commitment: 'confirmed',
paymasterUrl: 'https://your-kora-paymaster.example',
paymasterAddress: 'Paymaster111111111111111111111111111111111',
paymasterToken: {
address: 'TokenMint111111111111111111111111111111111'
},
transferMaxFee: 1000000n
})

const account = await wallet.getAccount(0)
console.log('Address:', await account.getAddress())
console.log('Paymaster token balance:', await account.getPaymasterTokenBalance())
```

## Clean Up

Call `dispose()` when you no longer need the account or wallet manager:

```javascript title="Dispose sensitive data"
account.dispose()
wallet.dispose()
```

## Next Steps

- Review [configuration](/sdk/wallet-modules/wallet-solana-gasless/configuration) for paymaster and failover options.
- Learn how to [send transactions](/sdk/wallet-modules/wallet-solana-gasless/guides/send-transactions).
- Learn how to [transfer SPL tokens](/sdk/wallet-modules/wallet-solana-gasless/guides/transfer-tokens).
Loading