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
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func makeConfidentialRequest(config Config, runtime cre.Runtime) (Result, error)
}
```

<Aside type="note" title="Alphabetic secret ordering required">
When using multiple secrets, pass them into `VaultDonSecrets` in alphabetical order by key. The Vault DON processes
secrets in a canonical order to ensure consistent behavior across nodes during execution.
</Aside>

### Step 5: Wire it into your workflow

Call the request function from your trigger handler:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,35 @@ const onCronTrigger = (runtime: Runtime<Config>): TransactionResult => {
}

// 3. Parse and return the result
return json(response) as TransactionResult
}
```

<Aside type="note" title="Alphabetic secret ordering required">
When using multiple secrets, pass them into `vaultDonSecrets` in alphabetical order by key. The Vault DON processes
secrets in a canonical order to ensure consistent behavior across nodes during execution.
</Aside>

In your trigger handler, call `confHTTPClient.sendRequest()` with your fetch function and a consensus method:

```typescript
import {
CronCapability,
ConfidentialHTTPClient,
handler,
consensusIdenticalAggregation,
type Runtime,
Runner,
} from "@chainlink/cre-sdk"

const onCronTrigger = (runtime: Runtime<Config>): string => {
const confHTTPClient = new ConfidentialHTTPClient()

const result = confHTTPClient
.sendRequest(runtime, fetchTransaction, consensusIdenticalAggregation<TransactionResult>())(runtime.config)
.result()

=======
const result = json(response) as TransactionResult
runtime.log(`Transaction result: ${result.transactionId} — ${result.status}`)
return result
Expand Down
4 changes: 4 additions & 0 deletions src/content/cre/llms-full-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11383,6 +11383,10 @@ func makeConfidentialRequest(config Config, runtime cre.Runtime) (Result, error)
}
```

<Aside type="note" title="Alphabetic secret ordering required">
When using multiple secrets, pass them into `VaultDonSecrets` in alphabetical order by key. The Vault DON processes secrets in a canonical order to ensure consistent behavior across nodes during execution.
</Aside>

### Step 5: Wire it into your workflow

Call the request function from your trigger handler:
Expand Down
35 changes: 35 additions & 0 deletions src/content/cre/llms-full-ts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10413,6 +10413,41 @@ type TransactionResult = {
}
```

Create the function that will be passed to `sendRequest()`. This function receives a `ConfidentialHTTPSendRequester` and your config as parameters:

```typescript
import { type ConfidentialHTTPSendRequester, ok, json } from "@chainlink/cre-sdk"

const fetchTransaction = (sendRequester: ConfidentialHTTPSendRequester, config: Config): TransactionResult => {
// 1. Send the confidential request
const response = sendRequester
.sendRequest({
request: {
url: config.url,
method: "GET",
multiHeaders: {
Authorization: { values: ["Basic {{.myApiKey}}"] },
},
},
vaultDonSecrets: [{ key: "myApiKey", owner: config.owner }],
})
.result()

// 2. Check the response status
if (!ok(response)) {
throw new Error(`HTTP request failed with status: ${response.statusCode}`)
}

// 3. Parse and return the result
return json(response) as TransactionResult
}
```

<Aside type="note" title="Alphabetic secret ordering required">
When using multiple secrets, pass them into `vaultDonSecrets` in alphabetical order by key. The Vault DON processes secrets in a canonical order to ensure consistent behavior across nodes during execution.
</Aside>


### Step 4: Implement the request and wire it into your workflow

Unlike the regular HTTP client, the Confidential HTTP client takes a `Runtime` directly and does not require `runInNodeMode` wrapping:
Expand Down
Loading