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
4 changes: 2 additions & 2 deletions developers/tooling/sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ async fn proof_submission(signer: &PrivateKeySigner, rpc_url: Url) -> anyhow::Re
.timeout(300)
);

// Submit the request onchain.
let (request_id, expires_at) = client.submit_onchain(request).await?;
// Submit the request.
let (request_id, expires_at) = client.submit(request).await?;

let fulfillment = client
.wait_for_request_fulfillment(request_id, Duration::from_secs(10), expires_at)
Expand Down
4 changes: 2 additions & 2 deletions developers/tutorials/callbacks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ let request = client.new_request()
.ramp_up_period(100)
);

// Submit the request onchain
let (request_id, expires_at) = client.submit_onchain(request).await?;
// Submit the request
let (request_id, expires_at) = client.submit(request).await?;
```

Our Counter contract implements the `handleProof` function, which checks if we've already seen this proof, and if not, increments a counter and emits an event:
Expand Down
41 changes: 23 additions & 18 deletions developers/tutorials/request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ let client = Client::builder()
// Create a request using new_request
let request = client.new_request().with_program(ECHO_ELF).with_stdin(echo_message.as_bytes());

// Submit the request onchain, via a transaction
let (request_id, expires_at) = client.submit_onchain(request).await?;
// Submit the request
let (request_id, expires_at) = client.submit(request).await?;
```

### 4. Retrieve the Proof
Expand Down Expand Up @@ -214,8 +214,8 @@ or if we look back at the counter example, we can see that the inputs are includ
// Create a request using new_request
let request = client.new_request().with_program(ECHO_ELF).with_stdin(echo_message.as_bytes()); // [!code hl] // [!code focus]

// Submit the request directly
let (request_id, expires_at) = client.submit_onchain(request).await?;
// Submit the request
let (request_id, expires_at) = client.submit(request).await?;
```

In this example, inputs are included inline if they are small (e.g. less than 1 kB) or uploaded to a public URL first if they are large.
Expand Down Expand Up @@ -254,8 +254,8 @@ let echo_request = client
.with_stdin(echo_message.as_bytes())
.with_groth16_proof(); // [!code hl] // [!code focus]

// Submit the request onchain
let (request_id, expires_at) = client.submit_onchain(echo_request).await?;
// Submit the request
let (request_id, expires_at) = client.submit(echo_request).await?;
```

For a complete working example of requesting a Groth16 proof, see the [composition example](https://github.com/boundless-xyz/boundless/blob/main/examples/composition/apps/src/main.rs).
Expand All @@ -281,33 +281,38 @@ For more details on proof types and when to use each, see [Proof Types](/develop
### Onchain vs Offchain

The Boundless protocol allows you to submit requests both onchain and offchain.
The default approach attempts offchain submission first, falling back to onchain submission if needed:

```rust
// Create a request using new_request
let request = client.new_request().with_program(ECHO_ELF).with_stdin(echo_message.as_bytes());

// Submit the request (tries offchain first, falls back to onchain)
let (request_id, expires_at) = client.submit(request).await?; // [!code focus]
```

#### Onchain

To submit a request onchain, we use:
To submit onchain only, bypassing offchain submission:

```rust
// Create a request using new_request
let request = client.new_request().with_program(ECHO_ELF).with_stdin(echo_message.as_bytes());

// Submit the request directly
let (request_id, expires_at) = client.submit_onchain(request).await?; // [!code hl] // [!code focus]
// Submit onchain only
let (request_id, expires_at) = client.submit_onchain(request).await?; // [!code focus]
```

#### Offchain

<Note>
When using offchain requests, you are required to deposit funds into the Boundless market contract before you can make any proof requests. This can be done with the [Boundless CLI](/developers/tooling/cli#requestor).
</Note>

To submit a request offchain, we use:
To submit offchain only, without onchain fallback:

```rust
// Create a request using new_request
let request = client.new_request().with_program(ECHO_ELF).with_stdin(echo_message.as_bytes());

// Submit the request directly
let (request_id, expires_at) = client.submit_offchain(request).await?; // [!code hl] // [!code focus]
// Submit offchain only
let (request_id, expires_at) = client.submit_offchain(request).await?; // [!code focus]
```

### Offer
Expand Down Expand Up @@ -356,8 +361,8 @@ let request = client.new_request()
.ramp_up_period(100)
);

// Submit the request directly
let (request_id, expires_at) = client.submit_onchain(request).await?;
// Submit the request
let (request_id, expires_at) = client.submit(request).await?;
```

#### Client-Level Configuration with `config_offer_layer`
Expand Down
2 changes: 1 addition & 1 deletion developers/tutorials/tracking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let request = client.new_request()
.with_stdin(input)
.with_offer(offer_params);

let (request_id, expires_at) = client.submit_onchain(request).await?;
let (request_id, expires_at) = client.submit(request).await?;

// Wait for the request to be fulfilled
tracing::info!("Waiting for request {:x} to be fulfilled", request_id);
Expand Down
Loading