diff --git a/docs/astro.config.ts b/docs/astro.config.ts index 23d2d053f0..ebe2b5c409 100644 --- a/docs/astro.config.ts +++ b/docs/astro.config.ts @@ -117,16 +117,6 @@ export default defineConfig({ } ] }, - { - label: "SDKs", - items: [ - { - label: "TypeScript", - link: "/sdks/typescript", - badge: { variant: "note", text: "new" } - } - ] - }, { label: "Integrations", items: [ @@ -134,9 +124,14 @@ export default defineConfig({ label: "Getting Started", link: "/integrations/getting-started" }, + { + label: "TypeScript SDK", + link: "/integrations/typescript", + badge: { variant: "note", text: "new" } + }, { label: "API", - collapsed: false, + collapsed: true, autogenerate: { directory: "/integrations/api" } diff --git a/docs/src/content/docs/SDKs/index.mdx b/docs/src/content/docs/SDKs/index.mdx deleted file mode 100644 index af558f7617..0000000000 --- a/docs/src/content/docs/SDKs/index.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: SDKs -description: 'Union SDKs to help you integrate and build atop Union' ---- diff --git a/docs/src/content/docs/SDKs/typescript/_data/demo-files.ts b/docs/src/content/docs/integrations/typescript/_data/demo-files.ts similarity index 100% rename from docs/src/content/docs/SDKs/typescript/_data/demo-files.ts rename to docs/src/content/docs/integrations/typescript/_data/demo-files.ts diff --git a/docs/src/content/docs/SDKs/typescript/index.mdx b/docs/src/content/docs/integrations/typescript/index.mdx similarity index 75% rename from docs/src/content/docs/SDKs/typescript/index.mdx rename to docs/src/content/docs/integrations/typescript/index.mdx index b370f68572..a36335a55d 100644 --- a/docs/src/content/docs/SDKs/typescript/index.mdx +++ b/docs/src/content/docs/integrations/typescript/index.mdx @@ -1,9 +1,6 @@ --- title: "TypeScript SDK" --- -import Code from '#/components/Code.astro' -import { demoFiles } from './_data/demo-files.ts' -import Terminal from '#/components/Terminal.astro' import { PackageManagers } from 'starlight-package-managers' import { Tabs, TabItem } from '@astrojs/starlight/components' @@ -26,51 +23,6 @@ If you need testnet tokens for testing, visit https://app.union.build/faucet and ::: -## Quick Example - -End-to-end example to transfer assets between EVM and Cosmos SDK chains. You can run this example in the cli - more later. - -We will transfer 1 `HONEY` from _**Berachain bArtio**_ (`80084`) to _**Stride Testnet**_ (`stride-internal-1`). - -```ts -import { privateKeyToAccount } from "viem/accounts" -import { createUnionClient, http } from "@unionlabs/client" - -const client = createUnionClient({ - chainId: "80084", - transport: http("https://bartio.rpc.berachain.com"), - account: privateKeyToAccount(process.env["PRIVATE_KEY"]), -}) - -const HONEY_ADDRESS = "0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03" - -const transfer = await client.transferAsset({ - amount: 1n, - autoApprove: true, - denomAddress: HONEY_ADDRESS, - destinationChainId: "stride-internal-1", - receiver: "stride17ttpfu2xsmfxu6shl756mmxyqu33l5ljegnwps" -}) - -if (transfer.isErr()) { - console.error(transfer.error) - process.exit(1) -} - -console.info(transfer.value) -``` - -Run the above example - -```bash frame="none" -PRIVATE_KEY= npm_config_yes=true npx tsx main.ts -``` - -## Breakdown - -To transfer assets cross-chain, you start by initializing a client, then use the client to create a transfer. -You have the option to trigger the approval transaction manually by setting `autoApprove` to `false` then calling `.approveTransaction` before calling `.transferAsset`. - ### Client Initialization @@ -142,9 +94,12 @@ const clients = createMultiUnionClient([ - ### Transferring Assets +We will transfer 1 [`HONEY`](https://bartio.beratrail.io/token/0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03) from [**Berachain bArtio**](https://www.berachain.com) to [**Stride Testnet**](https://stride.zone). + +You have the option to trigger the approval transaction manually by setting `autoApprove` to `false` then calling `.approveTransaction` before calling `.transferAsset`. + ```ts