Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9f2a54b
Update protos submodule to point to cap-dev branch (#218)
amit-momin Mar 31, 2026
9ef047d
Adding solana and aptos sdks
yashnevatia Apr 9, 2026
37b24ae
adding support for list type
yashnevatia Apr 9, 2026
4b22daa
Merge pull request #230 from smartcontractkit/update-with-sdks
yashnevatia Apr 9, 2026
99a6780
Add a TEE runtime
nolag Apr 2, 2026
fecc39d
Chore sync with main (#235)
yashnevatia Apr 15, 2026
d2a10d9
Updated validate-submodule CI to use branch filter (#239)
amit-momin Apr 16, 2026
8bbbaf3
sync with main 2
yashnevatia Apr 20, 2026
4805b9b
Merge branch 'main' of github.com:smartcontractkit/cre-sdk-typescript…
ernest-nowacki Apr 20, 2026
55f12ba
Add regions to tee
nolag Apr 22, 2026
eeaa2da
Merge pull request #241 from smartcontractkit/chore-sync-with-main-2
karen-stepanyan Apr 23, 2026
a8d7fdd
add emitMetric global fn
karen-stepanyan Apr 13, 2026
8fd76f8
update the common ref
karen-stepanyan Apr 13, 2026
03f110a
add emitMetric to SDK
karen-stepanyan Apr 23, 2026
0a16c19
Merge pull request #244 from smartcontractkit/main
karen-stepanyan Apr 28, 2026
6e7bc0b
Update to use the subscribe method for the TEE info
nolag Apr 28, 2026
b81d060
trigger build
karen-stepanyan Apr 29, 2026
eed181d
Merge pull request #231 from smartcontractkit/DF-23782
karen-stepanyan Apr 30, 2026
f74399a
Update protos to allow regions for any tee
nolag May 1, 2026
13bdc7b
Update proto for unspecified tee type
nolag May 4, 2026
a81b91e
Syncing with main
yashnevatia May 12, 2026
72496d7
javy
yashnevatia May 12, 2026
45d8429
Merge pull request #256 from smartcontractkit/chore-sync-with-main-12-05
yashnevatia May 12, 2026
55fb8c3
Better regions
nolag Jun 3, 2026
cf41a30
CRE-4368: Add mtls auth to typescript SDK
cedric-cordenier Jun 5, 2026
27c9d2e
Merge pull request #265 from smartcontractkit/CRE-4368-mtls-auth-type…
cedric-cordenier Jun 15, 2026
baf7045
Merge branch 'capabilities-development' into rtinianov_teeRuntime
nolag Jun 19, 2026
3c80449
Merge commit '054929daf9732f9a76f175f5a9a389fac0f0981f' into rtiniano…
nolag Jun 19, 2026
b5d601e
Rerun full-checks
nolag Jun 19, 2026
abb8543
Regenerate chain-selectors for pinned 116ebbc
nolag Jun 19, 2026
c26b561
Merge pull request #275 from smartcontractkit/rtinianov_errorsMergeCa…
nolag Jun 19, 2026
a7c7cff
Merge branch 'capabilities-development' into rtinianov_teeRuntime
nolag Jun 19, 2026
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
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "submodules/chainlink-protos"]
path = submodules/chainlink-protos
url = https://github.com/smartcontractkit/chainlink-protos.git
branch = capabilities-development
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ unsafe extern "C" {
fn random_seed(mode: i32) -> i64;

fn now(result_timestamp: *mut u8) -> i32;

fn emit_metric(data_ptr: *const u8, data_len: i32) -> i32;
}

import_namespace!("javy_chainlink_sdk");
Expand Down Expand Up @@ -225,6 +227,16 @@ pub fn modify_runtime(runtime: Runtime) -> Runtime {
}),
);

extend_wasm_exports(
&ctx,
"emitMetric",
Func::from(|_ctx: Ctx<'_>, data: ArgBytes| {
let bytes = data.0;
let rc = unsafe { emit_metric(bytes.as_ptr(), bytes.len() as i32) };
Ok::<i32, Error>(rc)
}),
);

extend_wasm_exports(
&ctx,
"sendResponse",
Expand Down
6 changes: 6 additions & 0 deletions packages/cre-sdk/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ inputs:
- ../../submodules/chainlink-protos/cre/sdk/v1alpha
- ../../submodules/chainlink-protos/cre/tools/generator/v1alpha
- ../../submodules/chainlink-protos/cre/values/v1
- directory: ../../submodules/chainlink-protos/workflows
# Allowlist of workflow protos exposed in the SDK (e.g. user metrics).
paths:
- ../../submodules/chainlink-protos/workflows/workflows/v2/workflow_user_metric.proto
- ../../submodules/chainlink-protos/workflows/workflows/v2/cre_info.proto
- ../../submodules/chainlink-protos/workflows/workflows/v2/workflow_key.proto

plugins:
# Modern @bufbuild/protoc-gen-es plugin
Expand Down
6 changes: 6 additions & 0 deletions packages/cre-sdk/scripts/src/generate-sdks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { rmSync } from 'node:fs'
import { file_capabilities_blockchain_aptos_v1alpha_client } from '@cre/generated/capabilities/blockchain/aptos/v1alpha/client_pb'
import { file_capabilities_blockchain_evm_v1alpha_client } from '@cre/generated/capabilities/blockchain/evm/v1alpha/client_pb'
import { file_capabilities_blockchain_solana_v1alpha_client } from '@cre/generated/capabilities/blockchain/solana/v1alpha/client_pb'
import { file_capabilities_internal_actionandtrigger_v1_action_and_trigger } from '@cre/generated/capabilities/internal/actionandtrigger/v1/action_and_trigger_pb'
Expand Down Expand Up @@ -64,6 +65,11 @@ export const main = () => {
...generateMocks(file_capabilities_blockchain_evm_v1alpha_client, TEST_GENERATED_DIR),
)

generateSdk(file_capabilities_blockchain_aptos_v1alpha_client, './src/generated-sdk')
allMockExports.push(
...generateMocks(file_capabilities_blockchain_aptos_v1alpha_client, TEST_GENERATED_DIR),
)

generateSdk(file_capabilities_blockchain_solana_v1alpha_client, './src/generated-sdk')
allMockExports.push(
...generateMocks(file_capabilities_blockchain_solana_v1alpha_client, TEST_GENERATED_DIR),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
import { create, fromJson } from '@bufbuild/protobuf'
import {
type AccountAPTBalanceReply,
AccountAPTBalanceReplySchema,
type AccountAPTBalanceRequest,
type AccountAPTBalanceRequestJson,
AccountAPTBalanceRequestSchema,
type AccountTransactionsReply,
AccountTransactionsReplySchema,
type AccountTransactionsRequest,
type AccountTransactionsRequestJson,
AccountTransactionsRequestSchema,
type GasConfig,
type GasConfigJson,
GasConfigSchema,
type TransactionByHashReply,
TransactionByHashReplySchema,
type TransactionByHashRequest,
type TransactionByHashRequestJson,
TransactionByHashRequestSchema,
type ViewReply,
ViewReplySchema,
type ViewRequest,
type ViewRequestJson,
ViewRequestSchema,
type WriteReportReply,
WriteReportReplySchema,
type WriteReportRequest,
type WriteReportRequestJson,
WriteReportRequestSchema,
} from '@cre/generated/capabilities/blockchain/aptos/v1alpha/client_pb'
import {
type ReportResponse,
type ReportResponseJson,
ReportResponseSchema,
} from '@cre/generated/sdk/v1alpha/sdk_pb'
import type { Runtime } from '@cre/sdk'
import { Report } from '@cre/sdk/report'
import { hexToBytes } from '@cre/sdk/utils/hex-utils'
import type { CapabilityInput } from '@cre/sdk/utils/types/no-excess'

export type WriteCreReportRequest = {
receiver: Uint8Array
gasConfig?: GasConfig
report?: Report
$report: true
}

export type WriteCreReportRequestJson = {
receiver: string
gasConfig?: GasConfigJson
report?: Report
}

export function x_generatedCodeOnly_wrap_WriteCreReportRequest(
input: WriteReportRequest,
): WriteCreReportRequest {
return {
receiver: input.receiver,
gasConfig: input.gasConfig,
report: input.report !== undefined ? new Report(input.report) : undefined,
$report: true,
}
}

export function createWriteCreReportRequest(
input: WriteCreReportRequestJson,
): WriteCreReportRequest {
return {
receiver: hexToBytes(input.receiver),
gasConfig:
input.gasConfig !== undefined ? fromJson(GasConfigSchema, input.gasConfig) : undefined,
report: input.report,
$report: true,
}
}

export function x_generatedCodeOnly_unwrap_WriteCreReportRequest(
input: WriteCreReportRequest,
): WriteReportRequest {
return create(WriteReportRequestSchema, {
receiver: input.receiver,
gasConfig: input.gasConfig,
report: input.report !== undefined ? input.report.x_generatedCodeOnly_unwrap() : undefined,
})
}

/**
* Client Capability
*
* Capability ID: aptos@1.0.0
* Capability Name: aptos
* Capability Version: 1.0.0
*/
export class ClientCapability {
/** The capability ID for this service */
static readonly CAPABILITY_ID = 'aptos@1.0.0'

static readonly CAPABILITY_NAME = 'aptos'
static readonly CAPABILITY_VERSION = '1.0.0'

/** Available ChainSelector values */
static readonly SUPPORTED_CHAIN_SELECTORS = {
'aptos-mainnet': 4741433654826277614n,
'aptos-testnet': 743186221051783445n,
} as const

constructor(private readonly ChainSelector: bigint) {}

accountAPTBalance<TInput>(
runtime: Runtime<unknown>,
input: CapabilityInput<TInput, AccountAPTBalanceRequest, AccountAPTBalanceRequestJson>,
): { result: () => AccountAPTBalanceReply }
accountAPTBalance(
runtime: Runtime<unknown>,
input: AccountAPTBalanceRequest | AccountAPTBalanceRequestJson,
): { result: () => AccountAPTBalanceReply } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: AccountAPTBalanceRequest

if ((input as unknown as { $typeName?: string }).$typeName) {
// It's the original protobuf type
payload = input as AccountAPTBalanceRequest
} else {
// It's regular JSON, convert using fromJson
payload = fromJson(AccountAPTBalanceRequestSchema, input as AccountAPTBalanceRequestJson)
}

// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`

const capabilityResponse = runtime.callCapability<
AccountAPTBalanceRequest,
AccountAPTBalanceReply
>({
capabilityId,
method: 'AccountAPTBalance',
payload,
inputSchema: AccountAPTBalanceRequestSchema,
outputSchema: AccountAPTBalanceReplySchema,
})

return {
result: () => {
const result = capabilityResponse.result()

return result
},
}
}

view<TInput>(
runtime: Runtime<unknown>,
input: CapabilityInput<TInput, ViewRequest, ViewRequestJson>,
): { result: () => ViewReply }
view(
runtime: Runtime<unknown>,
input: ViewRequest | ViewRequestJson,
): { result: () => ViewReply } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: ViewRequest

if ((input as unknown as { $typeName?: string }).$typeName) {
// It's the original protobuf type
payload = input as ViewRequest
} else {
// It's regular JSON, convert using fromJson
payload = fromJson(ViewRequestSchema, input as ViewRequestJson)
}

// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`

const capabilityResponse = runtime.callCapability<ViewRequest, ViewReply>({
capabilityId,
method: 'View',
payload,
inputSchema: ViewRequestSchema,
outputSchema: ViewReplySchema,
})

return {
result: () => {
const result = capabilityResponse.result()

return result
},
}
}

transactionByHash<TInput>(
runtime: Runtime<unknown>,
input: CapabilityInput<TInput, TransactionByHashRequest, TransactionByHashRequestJson>,
): { result: () => TransactionByHashReply }
transactionByHash(
runtime: Runtime<unknown>,
input: TransactionByHashRequest | TransactionByHashRequestJson,
): { result: () => TransactionByHashReply } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: TransactionByHashRequest

if ((input as unknown as { $typeName?: string }).$typeName) {
// It's the original protobuf type
payload = input as TransactionByHashRequest
} else {
// It's regular JSON, convert using fromJson
payload = fromJson(TransactionByHashRequestSchema, input as TransactionByHashRequestJson)
}

// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`

const capabilityResponse = runtime.callCapability<
TransactionByHashRequest,
TransactionByHashReply
>({
capabilityId,
method: 'TransactionByHash',
payload,
inputSchema: TransactionByHashRequestSchema,
outputSchema: TransactionByHashReplySchema,
})

return {
result: () => {
const result = capabilityResponse.result()

return result
},
}
}

accountTransactions<TInput>(
runtime: Runtime<unknown>,
input: CapabilityInput<TInput, AccountTransactionsRequest, AccountTransactionsRequestJson>,
): { result: () => AccountTransactionsReply }
accountTransactions(
runtime: Runtime<unknown>,
input: AccountTransactionsRequest | AccountTransactionsRequestJson,
): { result: () => AccountTransactionsReply } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: AccountTransactionsRequest

if ((input as unknown as { $typeName?: string }).$typeName) {
// It's the original protobuf type
payload = input as AccountTransactionsRequest
} else {
// It's regular JSON, convert using fromJson
payload = fromJson(AccountTransactionsRequestSchema, input as AccountTransactionsRequestJson)
}

// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`

const capabilityResponse = runtime.callCapability<
AccountTransactionsRequest,
AccountTransactionsReply
>({
capabilityId,
method: 'AccountTransactions',
payload,
inputSchema: AccountTransactionsRequestSchema,
outputSchema: AccountTransactionsReplySchema,
})

return {
result: () => {
const result = capabilityResponse.result()

return result
},
}
}

writeReport<TInput>(
runtime: Runtime<unknown>,
input: CapabilityInput<TInput, WriteCreReportRequest, WriteCreReportRequestJson>,
): { result: () => WriteReportReply }
writeReport(
runtime: Runtime<unknown>,
input: WriteCreReportRequest | WriteCreReportRequestJson,
): { result: () => WriteReportReply } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: WriteReportRequest

// Check if it's a wrapped type by looking for the $report property
if ((input as unknown as { $report?: boolean }).$report) {
// It's a wrapped type, unwrap it
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(input as WriteCreReportRequest)
} else {
// It's wrapped JSON, convert using create function
payload = x_generatedCodeOnly_unwrap_WriteCreReportRequest(
createWriteCreReportRequest(input as WriteCreReportRequestJson),
)
}

// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`

const capabilityResponse = runtime.callCapability<WriteReportRequest, WriteReportReply>({
capabilityId,
method: 'WriteReport',
payload,
inputSchema: WriteReportRequestSchema,
outputSchema: WriteReportReplySchema,
})

return {
result: () => {
const result = capabilityResponse.result()

return result
},
}
}
}
Loading
Loading