Skip to content

Commit

Permalink
Merge pull request #286 from permaweb/twilson63/feat-sdk-for-message-285
Browse files Browse the repository at this point in the history
feat: update readme to show support for data #285
  • Loading branch information
twilson63 authored Jan 8, 2024
2 parents 51bfd42 + 604975a commit 56ada95
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `ao` SDK

The `ao` SDK provides an abstraction for spawning, evaluating, and
interacting with `ao` Processes.
The `ao` SDK provides an abstraction for spawning, evaluating, and interacting
with `ao` Processes.

This sdk will run in a browser or server environment.

Expand Down Expand Up @@ -33,7 +33,7 @@ This module can be used on the server, as well as the browser:
#### ESM (Node & Browser) aka type: `module`

```js
import { spawn, message, result } from "@permaweb/ao-sdk";
import { message, result, spawn } from "@permaweb/ao-sdk";
```

#### CJS (Node) type: `commonjs`
Expand All @@ -55,7 +55,7 @@ import { result } from "@permaweb/ao-sdk";

let { messages, spawns, output, error } = await result({
message: "l3hbt-rIJ_dr9at-eQ3EVajHWMnxPNm9eBtXpzsFWZc",
process: "5SGJUlPwlenkyuG9-xWh0Rcf0azm8XEd5RBTiutgWAg"
process: "5SGJUlPwlenkyuG9-xWh0Rcf0azm8XEd5RBTiutgWAg",
});
```

Expand All @@ -71,11 +71,11 @@ const messageId = await message({
signer: createDataItemSigner(wallet),
anchor,
tags,
data,
});
```

> You can pass a 32 byte `anchor` to `message` which will be set on the
> DataItem
> You can pass a 32 byte `anchor` to `message` which will be set on the DataItem
#### `spawn`

Expand All @@ -89,13 +89,15 @@ const processId = await spawn({
scheduler,
signer: createDataItemSigner(wallet),
tags,
data,
});
```

#### `connect`

If you would like the sdk to use ao components other than the defaults, you can
specify those components by providing their urls to `connect`. You can currently specify
specify those components by providing their urls to `connect`. You can currently
specify

- The GATEWAY_URL
- The Messenger Unit URL
Expand All @@ -107,7 +109,7 @@ import { connect } from "@permaweb/ao-sdk";
const { spawn, message, result } = connect({
GATEWAY_URL: "...",
MU_URL: "...",
CU_URL: "..."
CU_URL: "...",
});
```

Expand All @@ -129,12 +131,11 @@ connect() == { spawn, message, result }

#### `createDataItemSigner`

`message` and `spawn` both require signing a DataItem with a
wallet.
`message` and `spawn` both require signing a DataItem with a wallet.

`createDataItemSigner` is a convenience api that, given a wallet, returns a
function that can be passed to both `message` and `spawn` in order
to properly sign DataItems.
function that can be passed to both `message` and `spawn` in order to properly
sign DataItems.

The SDK provides a browser compatible and node compatible version that you can
use OOTB.
Expand Down

0 comments on commit 56ada95

Please sign in to comment.