-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from okto-hq/zaje-patch
Update supported chains, SDK section structure
- Loading branch information
Showing
120 changed files
with
4,697 additions
and
1,243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: Estimate (Coming Soon) | ||
description: A complete guide to integrating Okto into your React applications. | ||
full: false | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
title: Execute UserOp | ||
description: Learn how to execute user operations using the Okto SDK. | ||
full: false | ||
--- | ||
|
||
import { TypeTable } from 'fumadocs-ui/components/type-table'; | ||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; | ||
import { Callout } from 'fumadocs-ui/components/callout'; | ||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; | ||
import { Icon as IIcon } from '@iconify/react'; | ||
|
||
The `executeUserOp()` method is available on the OktoClient instance and is used to submit signed user operations to the blockchain. This method is used to execute transactions after they have been signed. | ||
|
||
### Method Overview | ||
|
||
| Methods | Description | | ||
|---------|-------------| | ||
| <sub><i>async</i></sub> [`oktoClient.executeUserOp`](#execute-userop) | Execute a signed user operation | | ||
|
||
<div className="method-box"> | ||
|
||
## Execute UserOp | ||
|
||
<sub><i>async</i></sub> `oktoClient.executeUserOp(userop: UserOp)` executes a signed user operation on the blockchain. | ||
|
||
### Parameters | ||
|
||
| Parameter | Type | Description | | ||
|-----------|------|-------------| | ||
| `userop` | [`UserOp`](/docs/react-sdk/technical-reference#models) | The signed user operation to be executed | | ||
|
||
### Response | ||
|
||
<Callout title="Success Response"> | ||
|
||
| Field Name | Type | Description | | ||
|------------|------|-------------| | ||
| `result` | `Promise<string>` | Returns the transaction hash of the executed operation | | ||
|
||
</Callout> | ||
|
||
<Accordions> | ||
<Accordion title="Example"> | ||
<Tabs items={['TypeScript']}> | ||
<Tab value="TypeScript"> | ||
```typescript | ||
import { useOkto } from '@okto_web3/react-sdk'; | ||
|
||
function ExecuteOperation() { | ||
const oktoClient = useOkto(); | ||
|
||
async function handleExecuteOperation(signedUserOp) { | ||
try { | ||
const txHash = await oktoClient.executeUserOp(signedUserOp); | ||
console.log('Transaction hash:', txHash); | ||
return txHash; | ||
} catch (error:any) { | ||
console.error('Error executing operation:', error); | ||
} | ||
} | ||
|
||
return ( | ||
<button onClick={() => handleExecuteOperation(signedUserOp)}> | ||
Execute Operation | ||
</button> | ||
); | ||
} | ||
``` | ||
</Tab> | ||
</Tabs> | ||
</Accordion> | ||
</Accordions> | ||
|
||
</div> | ||
|
||
<Callout title="Note"> | ||
In case of errors, debug the error using the error code and refer to the [SDK errors and warnings](/docs/react-sdk/sdk-error-warnings) documentation for more details. | ||
</Callout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"title": "Account", | ||
"pages": [ | ||
"userop-learn", "estimate", "signUserOp" , "executeUserOp" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
title: Sign UserOp | ||
description: Learn how to sign user operations using the Okto SDK. | ||
full: false | ||
--- | ||
|
||
import { TypeTable } from 'fumadocs-ui/components/type-table'; | ||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; | ||
import { Callout } from 'fumadocs-ui/components/callout'; | ||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; | ||
import { Icon as IIcon } from '@iconify/react'; | ||
|
||
The `signUserOp()` method is available on the OktoClient instance and is used to sign user operations before they can be executed on the blockchain. This method is essential for preparing transactions in a secure manner. | ||
|
||
### Method Overview | ||
|
||
| Methods | Description | | ||
|---------|-------------| | ||
| <sub><i>async</i></sub> [`oktoClient.signUserOp`](#sign-userop) | Sign a user operation | | ||
|
||
<div className="method-box"> | ||
|
||
## Sign UserOp | ||
|
||
<sub><i>async</i></sub> `oktoClient.signUserOp(userop: UserOp)` signs a user operation with the user's credentials. | ||
|
||
### Parameters | ||
|
||
| Parameter | Type | Description | | ||
|-----------|------|-------------| | ||
| `userop` | [`UserOp`](/docs/react-sdk/technical-reference#models) | The user operation to be signed | | ||
|
||
### Response | ||
|
||
<Callout title="Success Response"> | ||
|
||
| Field Name | Type | Description | | ||
|------------|------|-------------| | ||
| `result` | [`Promise<UserOp>`](/docs/react-sdk/technical-reference#models) | Returns the signed user operation | | ||
|
||
</Callout> | ||
|
||
<Accordions> | ||
<Accordion title="Example"> | ||
<Tabs items={['TypeScript']}> | ||
<Tab value="TypeScript"> | ||
```typescript | ||
import { useOkto } from '@okto_web3/react-sdk'; | ||
|
||
function SignOperation() { | ||
const oktoClient = useOkto(); | ||
|
||
async function handleSignOperation(userOp) { | ||
try { | ||
const signedOp = await oktoClient.signUserOp(userOp); | ||
console.log('Signed operation:', signedOp); | ||
return signedOp; | ||
} catch (error:any) { | ||
console.error('Error signing operation:', error); | ||
} | ||
} | ||
|
||
return ( | ||
<button onClick={() => handleSignOperation(userOp)}> | ||
Sign Operation | ||
</button> | ||
); | ||
} | ||
``` | ||
</Tab> | ||
</Tabs> | ||
</Accordion> | ||
</Accordions> | ||
|
||
</div> | ||
|
||
<Callout title="Note"> | ||
In case of errors, debug the error using the error code and refer to the [SDK errors and warnings](/docs/react-sdk/sdk-error-warnings) documentation for more details. | ||
</Callout> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
title: Get Account | ||
description: Learn how to get the account of a user using the Okto SDK. | ||
full: false | ||
--- | ||
|
||
import { TypeTable } from 'fumadocs-ui/components/type-table'; | ||
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; | ||
import { Callout } from 'fumadocs-ui/components/callout'; | ||
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; | ||
import { Icon as IIcon } from '@iconify/react'; | ||
|
||
Okto SDK provides the `getAccount()` method to retrieve details of wallets connected to the current user's Okto account. This includes both embedded wallets created via Okto and external wallets connected by the user (e.g., MetaMask, Phantom). | ||
|
||
### Method Overview | ||
|
||
| Methods | Description | | ||
|------------------------------------------------------|--------------------------------------| | ||
| <sub><i>async</i></sub> [`getAccount`](#get-account) | Get the account of a user | | ||
|
||
<div className="method-box"> | ||
|
||
## Get Account | ||
|
||
<sub><i>async</i></sub> `getAccount()` retrieves the list of all wallets associated with the currently authenticated user. | ||
|
||
In Okto, an **account** represents the user's identity in the Okto ecosystem, encompassing both embedded wallets seamlessly created by Okto and external wallets users choose to connect. | ||
|
||
### Parameters | ||
|
||
| Parameter | Type | Description | | ||
|-------------|-----------------------------|----------------------------------------| | ||
| `oktoClient` | [`OktoClient`](/docs/react-sdk/technical-reference#models) | Okto client | | ||
|
||
### Response | ||
|
||
<Callout title="Success Response"> | ||
|
||
| Field Name | Type | Description | | ||
|------------|-----------------------|-----------------------------------------------| | ||
| `result` | [`Promise<Wallet[]>`](/docs/react-sdk/technical-reference#models) | Returns the list of wallet of the user | | ||
|
||
</Callout> | ||
|
||
### Example | ||
|
||
<Accordions> | ||
<Accordion title="Usage"> | ||
<Tabs items={['Typescript']}> | ||
<Tab value="Typescript"> | ||
```typescript | ||
import { useOkto } from '@okto_web3/react-sdk'; | ||
import { getAccount } from '@okto_web3/react-sdk'; | ||
|
||
function Account() { | ||
const oktoClient = useOkto(); | ||
|
||
async function fetchAccount() { | ||
try { | ||
const account = await getAccount(oktoClient); | ||
console.log('Account data:', account); | ||
} catch (error:any) { | ||
console.error('Error fetching user account:', error); | ||
} | ||
} | ||
|
||
return ( | ||
<button onClick={fetchAccount}> | ||
Fetch User Account | ||
</button> | ||
); | ||
} | ||
``` | ||
</Tab> | ||
</Tabs> | ||
</Accordion> | ||
|
||
<Accordion title="Success Response"> | ||
```json | ||
{ | ||
"status": "success", | ||
"data": [ | ||
{ | ||
"caip_id": "eip155:10", | ||
"network_name": "OPTIMISM", | ||
"address": "0x6698c56f99EaF4662cD70f974Cf787926e47781b", | ||
"network_id": "f0620691-ce05-3d5c-94c7-1f2cf275c781", | ||
"network_symbol": "OP" | ||
} | ||
] | ||
} | ||
``` | ||
</Accordion> | ||
</Accordions> | ||
|
||
</div> | ||
|
||
<Callout title="Note"> | ||
In case of errors, debug the error using the error code and refer to the [SDK errors and warnings](/docs/react-sdk/sdk-error-warnings) documentation for more details. | ||
</Callout> |
Oops, something went wrong.