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
@@ -1,5 +1,5 @@
import { create, fromJson } from '@bufbuild/protobuf'
import { type Any, AnySchema, anyPack, type Empty, EmptySchema } from '@bufbuild/protobuf/wkt'
import { type Any, AnySchema, anyPack } from '@bufbuild/protobuf/wkt'
import {
type BalanceAtReply,
BalanceAtReplySchema,
Expand Down Expand Up @@ -44,12 +44,6 @@ import {
HeaderByNumberRequestSchema,
type Log,
LogSchema,
type RegisterLogTrackingRequest,
type RegisterLogTrackingRequestJson,
RegisterLogTrackingRequestSchema,
type UnregisterLogTrackingRequest,
type UnregisterLogTrackingRequestJson,
UnregisterLogTrackingRequestSchema,
type WriteReportReply,
WriteReportReplySchema,
type WriteReportRequest,
Expand Down Expand Up @@ -134,13 +128,17 @@ export class ClientCapability {
'binance_smart_chain-testnet-opbnb-1': 13274425992935471758n,
'ethereum-mainnet': 5009297550715157269n,
'ethereum-mainnet-arbitrum-1': 4949039107694359620n,
'ethereum-mainnet-base-1': 15971525489660198786n,
'ethereum-mainnet-optimism-1': 3734403246176062136n,
'ethereum-mainnet-zksync-1': 1562403441176082196n,
'ethereum-testnet-sepolia': 16015286601757825753n,
'ethereum-testnet-sepolia-arbitrum-1': 3478487238524512106n,
'ethereum-testnet-sepolia-base-1': 10344971235874465080n,
'ethereum-testnet-sepolia-optimism-1': 5224473277236331295n,
'ethereum-testnet-sepolia-zksync-1': 6898391096552792247n,
'polygon-mainnet': 4051577828743386545n,
'polygon-testnet-amoy': 16281711391670634445n,
'private-testnet-andesite': 6915682381028791124n,
} as const

constructor(private readonly ChainSelector: bigint) {}
Expand Down Expand Up @@ -402,79 +400,6 @@ export class ClientCapability {
}
}

registerLogTracking(
runtime: Runtime<unknown>,
input: RegisterLogTrackingRequest | RegisterLogTrackingRequestJson,
): { result: () => Empty } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: RegisterLogTrackingRequest

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

// 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<RegisterLogTrackingRequest, Empty>({
capabilityId,
method: 'RegisterLogTracking',
payload,
inputSchema: RegisterLogTrackingRequestSchema,
outputSchema: EmptySchema,
})

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

return result
},
}
}

unregisterLogTracking(
runtime: Runtime<unknown>,
input: UnregisterLogTrackingRequest | UnregisterLogTrackingRequestJson,
): { result: () => Empty } {
// Handle input conversion - unwrap if it's a wrapped type, convert from JSON if needed
let payload: UnregisterLogTrackingRequest

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

// 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<UnregisterLogTrackingRequest, Empty>({
capabilityId,
method: 'UnregisterLogTracking',
payload,
inputSchema: UnregisterLogTrackingRequestSchema,
outputSchema: EmptySchema,
})

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

return result
},
}
}

logTrigger(config: FilterLogTriggerRequestJson): ClientLogTrigger {
// Include all labels in capability ID for routing when specified
const capabilityId = `${ClientCapability.CAPABILITY_NAME}:ChainSelector:${this.ChainSelector}@${ClientCapability.CAPABILITY_VERSION}`
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// @generated by protoc-gen-es v2.6.3 with parameter "target=ts,import_extension=none,json_types=true,keep_empty_files=false"
// @generated from file capabilities/internal/consensus/v1beta/consensus.proto (package capabilities.internal.consensus.v1, syntax proto3)
/* eslint-disable */

import type { GenFile, GenService } from '@bufbuild/protobuf/codegenv2'
import { fileDesc, serviceDesc } from '@bufbuild/protobuf/codegenv2'
import type {
ReportRequestSchema,
ReportResponseSchema,
SimpleConsensusInputsSchema,
} from '../../../../sdk/v1beta/sdk_pb'
import { file_sdk_v1beta_sdk } from '../../../../sdk/v1beta/sdk_pb'
import { file_tools_generator_v1beta_cre_metadata } from '../../../../tools/generator/v1beta/cre_metadata_pb'
import type { ValueSchema } from '../../../../values/v1/values_pb'
import { file_values_v1_values } from '../../../../values/v1/values_pb'

/**
* Describes the file capabilities/internal/consensus/v1beta/consensus.proto.
*/
export const file_capabilities_internal_consensus_v1beta_consensus: GenFile =
/*@__PURE__*/
fileDesc(
'CjZjYXBhYmlsaXRpZXMvaW50ZXJuYWwvY29uc2Vuc3VzL3YxYmV0YS9jb25zZW5zdXMucHJvdG8SImNhcGFiaWxpdGllcy5pbnRlcm5hbC5jb25zZW5zdXMudjEymAEKCUNvbnNlbnN1cxI5CgZTaW1wbGUSHS5zZGsudjEuU2ltcGxlQ29uc2Vuc3VzSW5wdXRzGhAudmFsdWVzLnYxLlZhbHVlEjcKBlJlcG9ydBIVLnNkay52MS5SZXBvcnRSZXF1ZXN0GhYuc2RrLnYxLlJlcG9ydFJlc3BvbnNlGheStRgTCAESD2NvbnNlbnN1c0AxLjAuMELjAQomY29tLmNhcGFiaWxpdGllcy5pbnRlcm5hbC5jb25zZW5zdXMudjFCDkNvbnNlbnN1c1Byb3RvUAGiAgNDSUOqAiJDYXBhYmlsaXRpZXMuSW50ZXJuYWwuQ29uc2Vuc3VzLlYxygIiQ2FwYWJpbGl0aWVzXEludGVybmFsXENvbnNlbnN1c1xWMeICLkNhcGFiaWxpdGllc1xJbnRlcm5hbFxDb25zZW5zdXNcVjFcR1BCTWV0YWRhdGHqAiVDYXBhYmlsaXRpZXM6OkludGVybmFsOjpDb25zZW5zdXM6OlYxYgZwcm90bzM',
[file_sdk_v1beta_sdk, file_tools_generator_v1beta_cre_metadata, file_values_v1_values],
)

/**
* @generated from service capabilities.internal.consensus.v1.Consensus
*/
export const Consensus: GenService<{
/**
* @generated from rpc capabilities.internal.consensus.v1.Consensus.Simple
*/
simple: {
methodKind: 'unary'
input: typeof SimpleConsensusInputsSchema
output: typeof ValueSchema
}
/**
* @generated from rpc capabilities.internal.consensus.v1.Consensus.Report
*/
report: {
methodKind: 'unary'
input: typeof ReportRequestSchema
output: typeof ReportResponseSchema
}
}> = /*@__PURE__*/ serviceDesc(file_capabilities_internal_consensus_v1beta_consensus, 0)
Loading