Skip to main content

@switchboard-xyz/common

Contains the OracleJob protobufs and other types and utilities shared across chains.

NPM Badge

DiscordTwitter

Npm: npmjs.com/package/@switchboard-xyz/common

Typedocs: docs.switchboard.xyz/api/common

Install

npm i --save @switchboard-xyz/common

Usage

Create an OracleJob

import { OracleJob, serializeOracleJob } from "@switchboard-xyz/common";

const oracleJob: OracleJob = serializeOracleJob({
tasks: [
{
httpTask: {
url: "https://www.binance.com/api/v3/ticker/price?symbol=BTCUSDT",
},
},
{
jsonParseTask: {
path: "$.price",
},
},
{
multiplyTask: {
/* Mainnet USDT/USD Feed */
aggregatorPubkey: "ETAaeeuQBwsh9mC2gCov9WdhJENZuffRMXY2HgjCcSL9",
},
},
],
});

Simulate an OracleJob

import { simulateOracleJobs } from "@switchboard-xyz/common";

const result = await simulateOracleJobs([oracleJob]);
console.log(result);

Index

Properties

IOracleJob

IOracleJob: any

References

ITask

Renames and re-exports IOracleJob

OracleJob

Renames and re-exports IOracleJob

Task

Renames and re-exports IOracleJob

getSupportedChain

getSupportedEvmChain

getSupportedEvmChainId

isSupportedChain

Re-exports isSupportedChain

isSupportedChainId

isSupportedEvmChain

networks

Renames and re-exports SWITCHBOARD_NETWORKS

Type Aliases

ChainConfig

ChainConfigs

ChainConfigs: EvmChainConfigs & { aptos: IChainConfig; near: IChainConfig; solana: ISolanaConfig; sui: IChainConfig }

ChainType

ChainType: typeof SWITCHBOARD_CHAINS[number]

The current chains Switchboard is currently deployed on.

EvmChainConfigs

EvmChainConfigs: { arbitrum: IChainConfig; aurora: IChainConfig; base: IChainConfig; coredao: IChainConfig; ethereum: IChainConfig; optimism: IChainConfig }

Type declaration

EvmChainIds

EvmChainIds: typeof SUPPORTED_EVM_CHAIN_IDS[number]

EvmChainType

EvmChainType: typeof SWITCHBOARD_EVM_CHAINS[number]

The current EVM chains Switchboard is currently deployed on.

EvmNetworkType

EvmNetworkType: typeof EVM_SUPPPORTED_NETWORKS[number]

IChainConfig

IChainConfig: { mainnet: IChainNetworkConfig; testnet: IChainNetworkConfig }

Type declaration

IChainNetworkConfig

IChainNetworkConfig: IBaseNetworkConfig & { attestationQueues: ISwitchboardAttestationQueueConfig[]; attestationService?: string; queues: ISwitchboardQueueConfig[] }

IEvmNetworkConfig

IEvmNetworkConfig: IBaseNetworkConfig & { attestationQueues: ISwitchboardAttestationQueueConfig[]; chainId: number; queues: ISwitchboardQueueConfig[]; sbPushOracle: string }

IMoveNetworkConfig

IMoveNetworkConfig: IChainNetworkConfig & { switchboardStdLib: string }

INetworkConfig

ISolanaConfig

ISolanaConfig: Rename<IChainConfig, testnet, devnet>

ISolanaNetworkConfig

ISolanaNetworkConfig: IChainNetworkConfig & { attestationIdlAddress: string; attestationService: string; idlAddress: string }

NetworkType

NetworkType: typeof SUPPPORTED_NETWORKS[number]

RawBuffer

RawBuffer: string | Buffer | Uint8Array | number[]

SwitchboardEvmNetworks

SwitchboardEvmNetworks: { [ K in EvmChainType ]: EvmChainConfigs[K] }

SwitchboardNetworks

SwitchboardNetworks: SwitchboardEvmNetworks & { [ K in ChainType ]: ChainConfigs[K] }

Variables

constSUPPORTED_EVM_CHAIN_IDS

SUPPORTED_EVM_CHAIN_IDS: readonly [42161, 421613, 8453, 84531, 1116, 1115, 1, 5, 10, 420, 1313161554, 1313161555] = ...

constSWITCHBOARD_CHAINS

SWITCHBOARD_CHAINS: readonly [aptos, near, solana, sui, arbitrum, base, coredao, ethereum, optimism, aurora] = ...

The current chains Switchboard is currently deployed on.

constSWITCHBOARD_EVM_CHAINS

SWITCHBOARD_EVM_CHAINS: readonly [arbitrum, base, coredao, ethereum, optimism, aurora] = ...

The current EVM chains Switchboard is currently deployed on.