Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ const PROVIDER_CHAINS = [
{ id: 'api-reference', name: 'API Reference' },
]
},
{
id: 'stellar',
name: 'Stellar',
icon: 'stellar',
pages: [
{ id: 'index', name: 'Overview', path: '' },
{ id: 'getting-started', name: 'Getting Started' },
{ id: 'signing', name: 'Signing' },
{ id: 'api-reference', name: 'API Reference' },
]
},
{
id: 'near',
name: 'NEAR',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default {
cardano: { display: 'hidden' },
algorand: { display: 'hidden' },
conflux: { display: 'hidden' },
stellar: { display: 'hidden' },
near: { display: 'hidden' },
nostr: { display: 'hidden' },
webln: { display: 'hidden' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ Build a wallet connection that feels native. The Provider API is OneKey’s unif
- **Solana**: SOL
- **Cosmos**: ATOM and Cosmos SDK chains
- **Move**: Aptos, Sui
- **Others**: TON, TRON, Polkadot, Cardano, Algorand, Conflux, NEAR, Nostr
- **Others**: Stellar, TON, TRON, Polkadot, Cardano, Algorand, Conflux, NEAR, Nostr

Select a chain from the sidebar to view detailed provider methods, signing flows, and examples.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
index: 'Overview',
'getting-started': 'Getting Started',
signing: 'Signing',
'api-reference': 'API Reference',
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: API Reference
description: OneKey Stellar provider API reference
---

# API Reference

Complete reference for methods and basic types on `window.$onekey.stellar`.

---

## Methods

| Method | Description |
|------|------|
| `getAddress(params?)` | Request permission (connect) and return the current Stellar address |
| `getNetwork()` | Get current network information |
| `signTransaction(xdr, opts?)` | Sign a Stellar transaction XDR |
| `signAuthEntry(authEntry, opts?)` | Sign a Stellar auth entry (authorization entry XDR) |
| `signMessage(message, opts?)` | Sign an arbitrary message |

---

## Properties

| Property | Type | Description |
|------|------|------|
| `isOneKey` | `boolean` | OneKey identifier |

---

## Types

```ts
export type StellarGetAddressParams = { path?: string }
export type StellarGetAddressResponse = { address: string }

export type StellarNetworkInfo = {
network: string
networkPassphrase: string
}

export type StellarSignTransactionOpts = {
networkPassphrase?: string
address?: string
path?: string
submit?: boolean
submitUrl?: string
}
export type StellarSignTransactionResponse = {
signedTxXdr: string
signerAddress?: string
}

export type StellarSignAuthEntryOpts = {
networkPassphrase?: string
address?: string
path?: string
}
export type StellarSignAuthEntryResponse = {
signedAuthEntry: string
signerAddress: string
}

export type StellarSignMessageOpts = {
networkPassphrase?: string
address?: string
path?: string
}
export type StellarSignMessageResponse = {
signedMessage: string
signerAddress: string
}
```

---

## Basic Type (for reference)

```ts
export type OneKeyStellarProvider = {
isOneKey: boolean

// Align with Stellar Wallets Kit (KitActions)
getAddress: (params?: StellarGetAddressParams) => Promise<StellarGetAddressResponse>
getNetwork: () => Promise<StellarNetworkInfo>
signTransaction: (
xdr: string,
opts?: StellarSignTransactionOpts
) => Promise<StellarSignTransactionResponse>
signAuthEntry: (
authEntry: string,
opts?: StellarSignAuthEntryOpts
) => Promise<StellarSignAuthEntryResponse>
signMessage: (
message: string,
opts?: StellarSignMessageOpts
) => Promise<StellarSignMessageResponse>
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Getting Started
description: Detect and use OneKey's Stellar provider
---

import { Callout } from 'nextra/components'

# Getting Started

Learn how to detect OneKey's Stellar provider and request a Stellar address.

<Callout type="warning">
Stellar signing typically depends on the correct network passphrase (e.g. Public or Testnet). Make sure you pass the right one when signing.
</Callout>

---

## Provider Detection

```ts
const stellar = window.$onekey?.stellar

if (!stellar?.isOneKey) {
throw new Error('OneKey Stellar provider not detected')
}
```

---

## Get Address (Connect)

```ts
// Triggers wallet permission / connect flow and returns the address (G...)
const { address } = await stellar.getAddress()
console.log('Address:', address)
```

---

## Get Network

```ts
const { network, networkPassphrase } = await stellar.getNetwork()
console.log({ network, networkPassphrase })
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Stellar
description: Stellar integration via OneKey's Stellar provider
---

import { Callout } from 'nextra/components'

# Stellar

Integrate Stellar using OneKey's Stellar provider. Access via `window.$onekey.stellar`.

<Callout type="info">
This provider is designed to match the Stellar Wallets Kit <code>KitActions</code> shape: <code>getAddress</code>, <code>signTransaction</code>, <code>signAuthEntry</code>, <code>signMessage</code>, <code>getNetwork</code>.
</Callout>

## Quick Links

- [Getting Started](getting-started)
- [Signing](signing)
- [API Reference](api-reference)

## Minimal Example

```ts
const stellar = window.$onekey?.stellar
if (!stellar?.isOneKey) throw new Error('OneKey Stellar provider not detected')

const { address } = await stellar.getAddress()
const network = await stellar.getNetwork()

console.log({ address, network })
```

## Common Errors

- `4001`: User rejected the request
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Signing
description: Sign Stellar transactions, auth entries, and messages with OneKey
---

# Signing

Examples for signing with `window.$onekey.stellar`.

---

## Sign Transaction (XDR)

```ts
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()

const { signedTxXdr, signerAddress } = await stellar.signTransaction(unsignedXdr, {
networkPassphrase,
address,
// submit: false,
// submitUrl: 'https://horizon.stellar.org/transactions',
})

console.log({ signedTxXdr, signerAddress })
```

---

## Sign Auth Entry (Soroban / Authorization Entry)

```ts
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()

const { signedAuthEntry, signerAddress } = await stellar.signAuthEntry(authEntryXdr, {
networkPassphrase,
address,
})

console.log({ signedAuthEntry, signerAddress })
```

---

## Sign Message

```ts
const { address } = await stellar.getAddress()
const { networkPassphrase } = await stellar.getNetwork()

const { signedMessage, signerAddress } = await stellar.signMessage('hello stellar', {
networkPassphrase,
address,
})

console.log({ signedMessage, signerAddress })
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default {
cardano: { display: 'hidden' },
algorand: { display: 'hidden' },
conflux: { display: 'hidden' },
stellar: { display: 'hidden' },
near: { display: 'hidden' },
nostr: { display: 'hidden' },
webln: { display: 'hidden' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ title: Provider API
- **Solana**:SOL
- **Cosmos**:ATOM 与 Cosmos SDK 链
- **Move**:Aptos、Sui
- **其他**:TON、TRON、Polkadot、Cardano、Algorand、Conflux、NEAR、Nostr
- **其他**:Stellar、TON、TRON、Polkadot、Cardano、Algorand、Conflux、NEAR、Nostr

请从侧边栏选择链,查看具体方法、签名流程与示例。
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
index: '概览',
'getting-started': '快速开始',
signing: '签名',
'api-reference': 'API 参考',
};

Loading
Loading