Skip to content

[TEST] Added autogenerated packages docs with sdk ones #1332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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: 1 addition & 1 deletion docs/tools/clients/fcl-js/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ The discovery feature can be used via API allowing you to customize your own UI

## 🛠 Want to Use the Flow SDK Directly?

If you prefer to interact with Flow at a **lower level** without using FCL, you can use the [Flow JavaScript SDK](sdk-guidelines.md) directly. The SDK provides raw access to Flow's API for sending transactions, executing scripts, and managing accounts.
If you prefer to interact with Flow at a **lower level** without using FCL, you can use the [Flow JavaScript SDK](./packages-docs/sdk/index.md) directly. The SDK provides raw access to Flow's API for sending transactions, executing scripts, and managing accounts.

FCL is built **on top of the Flow SDK**, making it easier to handle authentication, wallet interactions, and dapp connectivity. Choose the approach that best fits your use case.

Expand Down
17 changes: 17 additions & 0 deletions docs/tools/clients/fcl-js/packages-docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Packages Docs
description: Packages documentation.
---

<!-- THIS DOCUMENT IS AUTO-GENERATED FROM [onflow/fcl-js](https://github.com/onflow/fcl-js). DO NOT EDIT MANUALLY -->

# Packages Docs

A list of all packages available inside Flow Client Library (FCL) with functions and type definitions.

- [@onflow/sdk](./sdk/index.md) - Low-level JavaScript/TypeScript SDK for interacting with the Flow blockchain.
- [Type Definitions](./types/index.md) - Utilities to transform javascript values into Cadence understandable values

- [Type Definitions](./types/index.md) - Type definitions for the Flow Client Library (FCL) packages.

---
105 changes: 105 additions & 0 deletions docs/tools/clients/fcl-js/packages-docs/sdk/account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
sidebar_position: 1
title: "account"
description: "account function documentation."
---

<!-- THIS DOCUMENT IS AUTO-GENERATED FROM [onflow/sdk/src/account/account.ts](https://github.com/onflow/fcl-js/tree/master/packages/sdk/src/account/account.ts). DO NOT EDIT MANUALLY -->

# account

Retrieve any account from Flow network's latest block or from a specified block height.

Account address is a unique account identifier. Be mindful about the '0x' prefix, you should use the prefix as a default representation but be careful and safely handle user inputs without the prefix.

An account includes the following data:
- Address: the account address.
- Balance: balance of the account.
- Contracts: list of contracts deployed to the account.
- Keys: list of keys associated with the account.

## Import

You can import the entire package and access the function:

```typescript
import * as sdk from "@onflow/sdk"

sdk.account(address, options, opts)
```

Or import directly the specific function:

```typescript
import { account } from "@onflow/sdk"

account(address, options, opts)
```

## Usage

```typescript
import * as fcl from "@onflow/fcl";

// Get account from latest block height
const account = await fcl.account("0x1d007d755706c469");
console.log("Address:", account.address);
console.log("Balance:", account.balance);
console.log("Keys:", account.keys);
console.log("Contracts:", Object.keys(account.contracts));

// Get account at a specific block height
const historicalAccount = await fcl.account("0x1d007d755706c469", {
height: 12345
});

// Get account at a specific block ID
const accountAtBlock = await fcl.account("0x1d007d755706c469", {
id: "9dda5f281897389b99f103a1c6b180eec9dac870de846449a302103ce38453f3"
});

// Get account from sealed block
const sealedAccount = await fcl.account("0x1d007d755706c469", {
isSealed: true
});

// Alternative using builder pattern
fcl.send([
fcl.getAccount("0x1d007d755706c469"),
fcl.atBlockHeight(123)
]).then(fcl.decode);
```

## Parameters

### `address`

- Type: `string`
- Description: Address of the account


### `options` (optional)

- Type: `AccountQueryOptions`

```typescript
interface AccountQueryOptions {
height?: number
id?: string
isSealed?: boolean
}
```

### `opts` (optional)

- Type: `object`
- Description: Optional parameters



## Returns

[`Promise<Account>`](../types#account)


---
79 changes: 79 additions & 0 deletions docs/tools/clients/fcl-js/packages-docs/sdk/arg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
sidebar_position: 1
title: "arg"
description: "arg function documentation."
---

<!-- THIS DOCUMENT IS AUTO-GENERATED FROM [onflow/sdk/src/build/build-arguments.ts](https://github.com/onflow/fcl-js/tree/master/packages/sdk/src/build/build-arguments.ts). DO NOT EDIT MANUALLY -->

# arg

A utility builder to be used with fcl.args[...] to create FCL supported arguments for interactions.

Arguments are used to pass data to Cadence scripts and transactions. The arguments must match the number and order declared in the Cadence script.

## Import

You can import the entire package and access the function:

```typescript
import * as sdk from "@onflow/sdk"

sdk.arg(value, xform)
```

Or import directly the specific function:

```typescript
import { arg } from "@onflow/sdk"

arg(value, xform)
```

## Usage

```typescript
import * as fcl from "@onflow/fcl"

const result = await fcl.query({
cadence: `
access(all) fun main(a: Int, b: Int, addr: Address): Int {
log(addr)
return a + b
}
`,
args: (arg, t) => [
arg(7, t.Int), // a: Int
arg(6, t.Int), // b: Int
arg("0xba1132bc08f82fe2", t.Address), // addr: Address
],
});
```

## Parameters

### `value`

- Type: `TypeDescriptorInput`
- Description: The value of the argument


### `xform`

- Type: `T`
- Description: A function to transform the value (type descriptor)



## Returns

`CadenceArgument`

```typescript
type CadenceArgument<T extends TypeDescriptor<any, any>> = {
value: TypeDescriptorInput<T>
xform: T
}
```

---
78 changes: 78 additions & 0 deletions docs/tools/clients/fcl-js/packages-docs/sdk/args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
sidebar_position: 1
title: "args"
description: "args function documentation."
---

<!-- THIS DOCUMENT IS AUTO-GENERATED FROM [onflow/sdk/src/build/build-arguments.ts](https://github.com/onflow/fcl-js/tree/master/packages/sdk/src/build/build-arguments.ts). DO NOT EDIT MANUALLY -->

# args

A utility builder to be used with other builders to pass in arguments with a value and supported type.

A transaction can accept zero or more arguments that are passed into the Cadence script. The arguments on the transaction must match the number and order declared in the Cadence script.

## Import

You can import the entire package and access the function:

```typescript
import * as sdk from "@onflow/sdk"

sdk.args(ax)
```

Or import directly the specific function:

```typescript
import { args } from "@onflow/sdk"

args(ax)
```

## Usage

```typescript
import * as fcl from "@onflow/fcl"

await fcl.mutate({
cadence: `
transaction(amount: UFix64, to: Address) {
prepare(signer: AuthAccount) {
// transaction logic
}
}
`,
args: (arg, t) => [
arg("10.0", t.UFix64), // Will be the first argument `amount: UFix64`
arg("0xba1132bc08f82fe2", t.Address), // Will be the second argument `to: Address`
],
})
```

## Parameters

### `ax`

- Type: `CadenceArgument`
- Description: An array of arguments

```typescript
type CadenceArgument<T extends TypeDescriptor<any, any>> = {
value: TypeDescriptorInput<T>
xform: T
}
```


## Returns

`InteractionBuilderFn`

```typescript
export type InteractionBuilderFn = (
ix: Interaction
) => Interaction | Promise<Interaction>
```

---
79 changes: 79 additions & 0 deletions docs/tools/clients/fcl-js/packages-docs/sdk/atBlockHeight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
sidebar_position: 1
title: "atBlockHeight"
description: "atBlockHeight function documentation."
---

<!-- THIS DOCUMENT IS AUTO-GENERATED FROM [onflow/sdk/src/build/build-at-block-height.ts](https://github.com/onflow/fcl-js/tree/master/packages/sdk/src/build/build-at-block-height.ts). DO NOT EDIT MANUALLY -->

# atBlockHeight

A builder function that returns a partial interaction to a block at a specific height.

Use with other interactions like 'fcl.getBlock()' to get a full interaction at the specified block height.

Block height expresses the height of the block on the chain. The latest block height increases by one for every valid block produced.

## Import

You can import the entire package and access the function:

```typescript
import * as sdk from "@onflow/sdk"

sdk.atBlockHeight(height)
```

Or import directly the specific function:

```typescript
import { atBlockHeight } from "@onflow/sdk"

atBlockHeight(height)
```

## Usage

```typescript
import * as fcl from "@onflow/fcl";

// Get block at specific height
await fcl.send([fcl.getBlock(), fcl.atBlockHeight(123)]).then(fcl.decode);

// Get account at specific block height
await fcl.send([
fcl.getAccount("0x1d007d755706c469"),
fcl.atBlockHeight(12345)
]).then(fcl.decode);

// Execute script at specific block height
await fcl.send([
fcl.script`
access(all) fun main(): UFix64 {
return getCurrentBlock().height
}
`,
fcl.atBlockHeight(100)
]).then(fcl.decode);
```

## Parameters

### `height`

- Type: `number`
- Description: The height of the block to execute the interaction at



## Returns

`InteractionBuilderFn`

```typescript
export type InteractionBuilderFn = (
ix: Interaction
) => Interaction | Promise<Interaction>
```

---
Loading