Merge pull request #15 from switchboard-xyz/cache-task

Added CacheTask
This commit is contained in:
gallynaut 2022-06-15 20:38:06 -06:00 committed by GitHub
commit 7336a1bf38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1507 additions and 1510 deletions

View File

@ -57,8 +57,7 @@ message OracleJob {
optional AggregationMethod aggregation_method = 2;
}
// Returns the median of all the results returned by the provided subtasks and subjobs. Nested
// tasks must return a Number.
// Returns the median of all the results returned by the provided subtasks and subjobs. Nested tasks must return a Number.
message MedianTask {
// A list of subtasks to process and produce a list of result values.
repeated Task tasks = 1;
@ -90,6 +89,8 @@ message OracleJob {
double value = 1;
// Specifies an aggregatorr to pull the value of.
string aggregator_pubkey = 2;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 3;
}
}
@ -126,11 +127,12 @@ message OracleJob {
string aggregator_pubkey = 2;
// A job whose result is computed before dividing our numerical input by that result.
OracleJob job = 3;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 4;
}
}
// This task will multiply a numerical input by a scalar value or by another
// aggregate.
// This task will multiply a numerical input by a scalar value or by another aggregator.
message MultiplyTask {
oneof Multiple {
// Specifies a scalar to multiply by.
@ -139,6 +141,8 @@ message OracleJob {
string aggregator_pubkey = 2;
// A job whose result is computed before multiplying our numerical input by that result.
OracleJob job = 3;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 4;
}
}
@ -152,6 +156,8 @@ message OracleJob {
string aggregator_pubkey = 2;
// A job whose result is computed before adding our numerical input by that result.
OracleJob job = 3;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 4;
}
}
@ -165,6 +171,8 @@ message OracleJob {
string aggregator_pubkey = 2;
// A job whose result is computed before subtracting our numerical input by that result.
OracleJob job = 3;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 4;
}
}
@ -250,6 +258,8 @@ message OracleJob {
double scalar = 1;
// Take the working value to the exponent of the aggregators value.
string aggregator_pubkey = 2;
// A stringified big.js. `Accepts variable expansion syntax.`
string big = 3;
}
}
@ -274,13 +284,17 @@ message OracleJob {
optional string perp_market_address = 1;
}
// Fetch the simulated price for a swap on JupiterSwap.
message JupiterSwapTask {
// The input token address.
optional string in_token_address = 1;
// The output token address.
optional string out_token_address = 2;
// The amount of tokens to swap.
optional double base_amount = 3;
}
// Fetch the current price of a perpetual market
// Fetch the current price of a perpetual market.
message PerpMarketTask {
oneof MarketAddress {
// Market address for a mango perpetual market. A full list can be found here: https://github.com/blockworks-foundation/mango-client-v3/blob/main/src/ids.json
@ -294,14 +308,14 @@ message OracleJob {
}
}
// Fetch the current price of a Solana oracle protocol
// Fetch the current price of a Solana oracle protocol.
message OracleTask {
oneof AggregatorAddress {
// Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer
string switchboard_address = 1;
// Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/
string pyth_address = 2;
// Devnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana
// Mainnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana
string chainlink_address = 3;
}
// Value (as a percentage) that the lower bound confidence interval is of the actual value.
@ -317,94 +331,148 @@ message OracleJob {
optional string account_address = 2;
}
message DefiKingdomsTask {
message Token {
optional string address = 1;
optional int32 decimals = 2;
}
optional string provider = 1;
optional Token in_token = 2;
optional Token out_token = 3;
}
// Fetch the current transactions per second.
message TpsTask {}
// Fetch the JSON representation of an SPL Stake Pool account.
message SplStakePoolTask {
// The pubkey of the SPL Stake Pool.``
// The pubkey of the SPL Stake Pool.
optional string pubkey = 1;
}
// Fetch the JSON representation of an SPL token mint.
message SplTokenParseTask {
oneof AccountAddress {
// The publicKey of a token account to fetch the mintInfo for.
string token_account_address = 1;
// The publicKey of the token mint address.
string mint_address = 2;
}
}
message UniswapExchangeRateTask {
optional string in_token_address = 1;
optional string out_token_address = 2;
optional double in_token_amount = 3;
optional double slippage = 4;
optional string provider = 5;
}
message SushiswapExchangeRateTask {
optional string in_token_address = 1;
optional string out_token_address = 2;
optional double in_token_amount = 3;
optional double slippage = 4;
optional string provider = 5;
}
message PancakeswapExchangeRateTask {
optional string in_token_address = 1;
optional string out_token_address = 2;
optional double in_token_amount = 3;
optional double slippage = 4;
optional string provider = 5;
}
message CacheTask {
optional string name = 1;
enum Method {
METHOD_GET = 0;
METHOD_SET = 1;
// Fetch the swap price from DefiKingdoms.
message DefiKingdomsTask {
message Token {
// The address of the token.
optional string address = 1;
// The number of decimal places for a token.
optional int32 decimals = 2;
}
optional Method method = 2;
// The RPC provider to use for the swap.
optional string provider = 1;
// The input token of the swap.
optional Token in_token = 2;
// The output token of the swap.
optional Token out_token = 3;
}
// Fetch the swap price from UniSwap.
message UniswapExchangeRateTask {
// The input token address.
optional string in_token_address = 1;
// The output token address.
optional string out_token_address = 2;
// The amount of tokens to swap.
optional double in_token_amount = 3;
// The allowable slippage in percent for the swap.
optional double slippage = 4;
// The RPC provider to use for the swap.
optional string provider = 5;
}
// Fetch the swap price from SushiSwap.
message SushiswapExchangeRateTask {
// The input token address.
optional string in_token_address = 1;
// The output token address.
optional string out_token_address = 2;
// The amount of tokens to swap.
optional double in_token_amount = 3;
// The allowable slippage in percent for the swap.
optional double slippage = 4;
// The RPC provider to use for the swap.
optional string provider = 5;
}
// Fetch the swap price from PancakeSwap.
message PancakeswapExchangeRateTask {
// The input token address.
optional string in_token_address = 1;
// The output token address.
optional string out_token_address = 2;
// The amount of tokens to swap.
optional double in_token_amount = 3;
// The allowable slippage in percent for the swap.
optional double slippage = 4;
// The RPC provider to use for the swap.
optional string provider = 5;
}
// Execute a job and store the result in a variable to reference later.
message CacheTask {
message CacheItem {
// The name of the variable to store in cache to reference later with `${VARIABLE_NAME}`.
optional string variable_name = 1;
// The OracleJob to execute to yield the value to store in cache.
optional OracleJob job = 2;
}
// A list of cached variables to reference in the job with `${VARIABLE_NAME}`.
repeated CacheItem cache_items = 1;
}
// Return the difference between an oracle's clock and the current timestamp at `SYSVAR_CLOCK_PUBKEY`.
message SysclockOffsetTask {}
message MarinadeStateTask {}
// Fetch the account data in a stringified buffer format.
message SolanaAccountDataFetchTask {
// The on-chain account to fetch the account data from.
optional string pubkey = 1;
}
// Return the deserialized value from a stringified buffer.
message BufferLayoutParseTask {
// The buffer offset to start deserializing from.
optional uint32 offset = 1;
enum Endian {
LITTLE_ENDIAN = 0;
BIG_ENDIAN = 1;
}
// The endianness of the stored value.
optional Endian endian = 2;
enum BufferParseType {
// A public key.
pubkey = 1;
// A boolean.
bool = 2;
// An 8-bit unsigned value.
u8 = 3;
// An 8-bit signed value.
i8 = 4;
// A 16-bit unsigned value.
u16 = 5;
// A 16-bit signed value.
i16 = 6;
// A 32-bit unsigned value.
u32 = 7;
// A 32-bit signed value.
i32 = 8;
// A 32-bit IEEE floating point value.
f32 = 9;
// A 64-bit unsigned value.
u64 = 10;
// A 64-bit signed value.
i64 = 11;
// A 64-bit IEEE floating point value.
f64 = 12;
// A 128-bit unsigned value.
u128 = 13;
// A 128-bit signed value.
i128 = 14;
}
// The type of value to deserialize.
optional BufferParseType type = 3;
}

View File

@ -1,6 +1,6 @@
{
"name": "@switchboard-xyz/switchboard-v2",
"version": "0.0.110",
"version": "0.0.111-beta.0",
"license": "MIT",
"author": "mitch@switchboard.xyz",
"description": "API wrapper for intergating with the Switchboardv2 program",

View File

@ -714,6 +714,9 @@ export namespace OracleJob {
/** ValueTask aggregatorPubkey */
aggregatorPubkey?: (string|null);
/** ValueTask big */
big?: (string|null);
}
/** Represents a ValueTask. */
@ -731,8 +734,11 @@ export namespace OracleJob {
/** ValueTask aggregatorPubkey. */
public aggregatorPubkey?: (string|null);
/** ValueTask big. */
public big?: (string|null);
/** ValueTask Value. */
public Value?: ("value"|"aggregatorPubkey");
public Value?: ("value"|"aggregatorPubkey"|"big");
/**
* Creates a new ValueTask instance using the specified properties.
@ -1020,6 +1026,9 @@ export namespace OracleJob {
/** DivideTask job */
job?: (IOracleJob|null);
/** DivideTask big */
big?: (string|null);
}
/** Represents a DivideTask. */
@ -1040,8 +1049,11 @@ export namespace OracleJob {
/** DivideTask job. */
public job?: (IOracleJob|null);
/** DivideTask big. */
public big?: (string|null);
/** DivideTask Denominator. */
public Denominator?: ("scalar"|"aggregatorPubkey"|"job");
public Denominator?: ("scalar"|"aggregatorPubkey"|"job"|"big");
/**
* Creates a new DivideTask instance using the specified properties.
@ -1125,6 +1137,9 @@ export namespace OracleJob {
/** MultiplyTask job */
job?: (IOracleJob|null);
/** MultiplyTask big */
big?: (string|null);
}
/** Represents a MultiplyTask. */
@ -1145,8 +1160,11 @@ export namespace OracleJob {
/** MultiplyTask job. */
public job?: (IOracleJob|null);
/** MultiplyTask big. */
public big?: (string|null);
/** MultiplyTask Multiple. */
public Multiple?: ("scalar"|"aggregatorPubkey"|"job");
public Multiple?: ("scalar"|"aggregatorPubkey"|"job"|"big");
/**
* Creates a new MultiplyTask instance using the specified properties.
@ -1230,6 +1248,9 @@ export namespace OracleJob {
/** AddTask job */
job?: (IOracleJob|null);
/** AddTask big */
big?: (string|null);
}
/** Represents an AddTask. */
@ -1250,8 +1271,11 @@ export namespace OracleJob {
/** AddTask job. */
public job?: (IOracleJob|null);
/** AddTask big. */
public big?: (string|null);
/** AddTask Addition. */
public Addition?: ("scalar"|"aggregatorPubkey"|"job");
public Addition?: ("scalar"|"aggregatorPubkey"|"job"|"big");
/**
* Creates a new AddTask instance using the specified properties.
@ -1335,6 +1359,9 @@ export namespace OracleJob {
/** SubtractTask job */
job?: (IOracleJob|null);
/** SubtractTask big */
big?: (string|null);
}
/** Represents a SubtractTask. */
@ -1355,8 +1382,11 @@ export namespace OracleJob {
/** SubtractTask job. */
public job?: (IOracleJob|null);
/** SubtractTask big. */
public big?: (string|null);
/** SubtractTask Subtraction. */
public Subtraction?: ("scalar"|"aggregatorPubkey"|"job");
public Subtraction?: ("scalar"|"aggregatorPubkey"|"job"|"big");
/**
* Creates a new SubtractTask instance using the specified properties.
@ -2088,6 +2118,9 @@ export namespace OracleJob {
/** PowTask aggregatorPubkey */
aggregatorPubkey?: (string|null);
/** PowTask big */
big?: (string|null);
}
/** Represents a PowTask. */
@ -2105,8 +2138,11 @@ export namespace OracleJob {
/** PowTask aggregatorPubkey. */
public aggregatorPubkey?: (string|null);
/** PowTask big. */
public big?: (string|null);
/** PowTask Exponent. */
public Exponent?: ("scalar"|"aggregatorPubkey");
public Exponent?: ("scalar"|"aggregatorPubkey"|"big");
/**
* Creates a new PowTask instance using the specified properties.
@ -2800,207 +2836,6 @@ export namespace OracleJob {
public toJSON(): { [k: string]: any };
}
/** Properties of a DefiKingdomsTask. */
interface IDefiKingdomsTask {
/** DefiKingdomsTask provider */
provider?: (string|null);
/** DefiKingdomsTask inToken */
inToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/** DefiKingdomsTask outToken */
outToken?: (OracleJob.DefiKingdomsTask.IToken|null);
}
/** Represents a DefiKingdomsTask. */
class DefiKingdomsTask implements IDefiKingdomsTask {
/**
* Constructs a new DefiKingdomsTask.
* @param [properties] Properties to set
*/
constructor(properties?: OracleJob.IDefiKingdomsTask);
/** DefiKingdomsTask provider. */
public provider: string;
/** DefiKingdomsTask inToken. */
public inToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/** DefiKingdomsTask outToken. */
public outToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/**
* Creates a new DefiKingdomsTask instance using the specified properties.
* @param [properties] Properties to set
* @returns DefiKingdomsTask instance
*/
public static create(properties?: OracleJob.IDefiKingdomsTask): OracleJob.DefiKingdomsTask;
/**
* Encodes the specified DefiKingdomsTask message. Does not implicitly {@link OracleJob.DefiKingdomsTask.verify|verify} messages.
* @param message DefiKingdomsTask message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: OracleJob.IDefiKingdomsTask, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified DefiKingdomsTask message, length delimited. Does not implicitly {@link OracleJob.DefiKingdomsTask.verify|verify} messages.
* @param message DefiKingdomsTask message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: OracleJob.IDefiKingdomsTask, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a DefiKingdomsTask message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns DefiKingdomsTask
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): OracleJob.DefiKingdomsTask;
/**
* Decodes a DefiKingdomsTask message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns DefiKingdomsTask
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): OracleJob.DefiKingdomsTask;
/**
* Verifies a DefiKingdomsTask message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a DefiKingdomsTask message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns DefiKingdomsTask
*/
public static fromObject(object: { [k: string]: any }): OracleJob.DefiKingdomsTask;
/**
* Creates a plain object from a DefiKingdomsTask message. Also converts values to other types if specified.
* @param message DefiKingdomsTask
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: OracleJob.DefiKingdomsTask, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this DefiKingdomsTask to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
namespace DefiKingdomsTask {
/** Properties of a Token. */
interface IToken {
/** Token address */
address?: (string|null);
/** Token decimals */
decimals?: (number|null);
}
/** Represents a Token. */
class Token implements IToken {
/**
* Constructs a new Token.
* @param [properties] Properties to set
*/
constructor(properties?: OracleJob.DefiKingdomsTask.IToken);
/** Token address. */
public address: string;
/** Token decimals. */
public decimals: number;
/**
* Creates a new Token instance using the specified properties.
* @param [properties] Properties to set
* @returns Token instance
*/
public static create(properties?: OracleJob.DefiKingdomsTask.IToken): OracleJob.DefiKingdomsTask.Token;
/**
* Encodes the specified Token message. Does not implicitly {@link OracleJob.DefiKingdomsTask.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: OracleJob.DefiKingdomsTask.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Token message, length delimited. Does not implicitly {@link OracleJob.DefiKingdomsTask.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: OracleJob.DefiKingdomsTask.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Token message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): OracleJob.DefiKingdomsTask.Token;
/**
* Decodes a Token message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): OracleJob.DefiKingdomsTask.Token;
/**
* Verifies a Token message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Token message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Token
*/
public static fromObject(object: { [k: string]: any }): OracleJob.DefiKingdomsTask.Token;
/**
* Creates a plain object from a Token message. Also converts values to other types if specified.
* @param message Token
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: OracleJob.DefiKingdomsTask.Token, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Token to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
}
/** Properties of a TpsTask. */
interface ITpsTask {
}
@ -3274,6 +3109,207 @@ export namespace OracleJob {
public toJSON(): { [k: string]: any };
}
/** Properties of a DefiKingdomsTask. */
interface IDefiKingdomsTask {
/** DefiKingdomsTask provider */
provider?: (string|null);
/** DefiKingdomsTask inToken */
inToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/** DefiKingdomsTask outToken */
outToken?: (OracleJob.DefiKingdomsTask.IToken|null);
}
/** Represents a DefiKingdomsTask. */
class DefiKingdomsTask implements IDefiKingdomsTask {
/**
* Constructs a new DefiKingdomsTask.
* @param [properties] Properties to set
*/
constructor(properties?: OracleJob.IDefiKingdomsTask);
/** DefiKingdomsTask provider. */
public provider: string;
/** DefiKingdomsTask inToken. */
public inToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/** DefiKingdomsTask outToken. */
public outToken?: (OracleJob.DefiKingdomsTask.IToken|null);
/**
* Creates a new DefiKingdomsTask instance using the specified properties.
* @param [properties] Properties to set
* @returns DefiKingdomsTask instance
*/
public static create(properties?: OracleJob.IDefiKingdomsTask): OracleJob.DefiKingdomsTask;
/**
* Encodes the specified DefiKingdomsTask message. Does not implicitly {@link OracleJob.DefiKingdomsTask.verify|verify} messages.
* @param message DefiKingdomsTask message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: OracleJob.IDefiKingdomsTask, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified DefiKingdomsTask message, length delimited. Does not implicitly {@link OracleJob.DefiKingdomsTask.verify|verify} messages.
* @param message DefiKingdomsTask message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: OracleJob.IDefiKingdomsTask, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a DefiKingdomsTask message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns DefiKingdomsTask
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): OracleJob.DefiKingdomsTask;
/**
* Decodes a DefiKingdomsTask message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns DefiKingdomsTask
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): OracleJob.DefiKingdomsTask;
/**
* Verifies a DefiKingdomsTask message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a DefiKingdomsTask message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns DefiKingdomsTask
*/
public static fromObject(object: { [k: string]: any }): OracleJob.DefiKingdomsTask;
/**
* Creates a plain object from a DefiKingdomsTask message. Also converts values to other types if specified.
* @param message DefiKingdomsTask
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: OracleJob.DefiKingdomsTask, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this DefiKingdomsTask to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
namespace DefiKingdomsTask {
/** Properties of a Token. */
interface IToken {
/** Token address */
address?: (string|null);
/** Token decimals */
decimals?: (number|null);
}
/** Represents a Token. */
class Token implements IToken {
/**
* Constructs a new Token.
* @param [properties] Properties to set
*/
constructor(properties?: OracleJob.DefiKingdomsTask.IToken);
/** Token address. */
public address: string;
/** Token decimals. */
public decimals: number;
/**
* Creates a new Token instance using the specified properties.
* @param [properties] Properties to set
* @returns Token instance
*/
public static create(properties?: OracleJob.DefiKingdomsTask.IToken): OracleJob.DefiKingdomsTask.Token;
/**
* Encodes the specified Token message. Does not implicitly {@link OracleJob.DefiKingdomsTask.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: OracleJob.DefiKingdomsTask.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Token message, length delimited. Does not implicitly {@link OracleJob.DefiKingdomsTask.Token.verify|verify} messages.
* @param message Token message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: OracleJob.DefiKingdomsTask.IToken, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Token message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): OracleJob.DefiKingdomsTask.Token;
/**
* Decodes a Token message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Token
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): OracleJob.DefiKingdomsTask.Token;
/**
* Verifies a Token message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a Token message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Token
*/
public static fromObject(object: { [k: string]: any }): OracleJob.DefiKingdomsTask.Token;
/**
* Creates a plain object from a Token message. Also converts values to other types if specified.
* @param message Token
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: OracleJob.DefiKingdomsTask.Token, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Token to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
}
/** Properties of an UniswapExchangeRateTask. */
interface IUniswapExchangeRateTask {
@ -3619,11 +3655,8 @@ export namespace OracleJob {
/** Properties of a CacheTask. */
interface ICacheTask {
/** CacheTask name */
name?: (string|null);
/** CacheTask method */
method?: (OracleJob.CacheTask.Method|null);
/** CacheTask cacheItems */
cacheItems?: (OracleJob.CacheTask.ICacheItem[]|null);
}
/** Represents a CacheTask. */
@ -3635,11 +3668,8 @@ export namespace OracleJob {
*/
constructor(properties?: OracleJob.ICacheTask);
/** CacheTask name. */
public name: string;
/** CacheTask method. */
public method: OracleJob.CacheTask.Method;
/** CacheTask cacheItems. */
public cacheItems: OracleJob.CacheTask.ICacheItem[];
/**
* Creates a new CacheTask instance using the specified properties.
@ -3714,10 +3744,100 @@ export namespace OracleJob {
namespace CacheTask {
/** Method enum. */
enum Method {
METHOD_GET = 0,
METHOD_SET = 1
/** Properties of a CacheItem. */
interface ICacheItem {
/** CacheItem variableName */
variableName?: (string|null);
/** CacheItem job */
job?: (IOracleJob|null);
}
/** Represents a CacheItem. */
class CacheItem implements ICacheItem {
/**
* Constructs a new CacheItem.
* @param [properties] Properties to set
*/
constructor(properties?: OracleJob.CacheTask.ICacheItem);
/** CacheItem variableName. */
public variableName: string;
/** CacheItem job. */
public job?: (IOracleJob|null);
/**
* Creates a new CacheItem instance using the specified properties.
* @param [properties] Properties to set
* @returns CacheItem instance
*/
public static create(properties?: OracleJob.CacheTask.ICacheItem): OracleJob.CacheTask.CacheItem;
/**
* Encodes the specified CacheItem message. Does not implicitly {@link OracleJob.CacheTask.CacheItem.verify|verify} messages.
* @param message CacheItem message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: OracleJob.CacheTask.ICacheItem, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified CacheItem message, length delimited. Does not implicitly {@link OracleJob.CacheTask.CacheItem.verify|verify} messages.
* @param message CacheItem message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: OracleJob.CacheTask.ICacheItem, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a CacheItem message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns CacheItem
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): OracleJob.CacheTask.CacheItem;
/**
* Decodes a CacheItem message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns CacheItem
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): OracleJob.CacheTask.CacheItem;
/**
* Verifies a CacheItem message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a CacheItem message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns CacheItem
*/
public static fromObject(object: { [k: string]: any }): OracleJob.CacheTask.CacheItem;
/**
* Creates a plain object from a CacheItem message. Also converts values to other types if specified.
* @param message CacheItem
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: OracleJob.CacheTask.CacheItem, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this CacheItem to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,12 @@
## Table of Contents
- [job_schemas.proto](#job_schemas.proto)
- [JobPosting](#.JobPosting)
- [JobResult](#.JobResult)
- [OracleJob](#.OracleJob)
- [OracleJob.AddTask](#.OracleJob.AddTask)
- [OracleJob.AnchorFetchTask](#.OracleJob.AnchorFetchTask)
- [OracleJob.BufferLayoutParseTask](#.OracleJob.BufferLayoutParseTask)
- [OracleJob.CacheTask](#.OracleJob.CacheTask)
- [OracleJob.CacheTask.CacheItem](#.OracleJob.CacheTask.CacheItem)
- [OracleJob.ConditionalTask](#.OracleJob.ConditionalTask)
- [OracleJob.DefiKingdomsTask](#.OracleJob.DefiKingdomsTask)
- [OracleJob.DefiKingdomsTask.Token](#.OracleJob.DefiKingdomsTask.Token)
@ -22,6 +22,7 @@
- [OracleJob.LpExchangeRateTask](#.OracleJob.LpExchangeRateTask)
- [OracleJob.LpTokenPriceTask](#.OracleJob.LpTokenPriceTask)
- [OracleJob.MangoPerpMarketTask](#.OracleJob.MangoPerpMarketTask)
- [OracleJob.MarinadeStateTask](#.OracleJob.MarinadeStateTask)
- [OracleJob.MaxTask](#.OracleJob.MaxTask)
- [OracleJob.MeanTask](#.OracleJob.MeanTask)
- [OracleJob.MedianTask](#.OracleJob.MedianTask)
@ -32,6 +33,7 @@
- [OracleJob.PowTask](#.OracleJob.PowTask)
- [OracleJob.RegexExtractTask](#.OracleJob.RegexExtractTask)
- [OracleJob.SerumSwapTask](#.OracleJob.SerumSwapTask)
- [OracleJob.SolanaAccountDataFetchTask](#.OracleJob.SolanaAccountDataFetchTask)
- [OracleJob.SplStakePoolTask](#.OracleJob.SplStakePoolTask)
- [OracleJob.SplTokenParseTask](#.OracleJob.SplTokenParseTask)
- [OracleJob.SubtractTask](#.OracleJob.SubtractTask)
@ -45,7 +47,8 @@
- [OracleJob.WebsocketTask](#.OracleJob.WebsocketTask)
- [OracleJob.XStepPriceTask](#.OracleJob.XStepPriceTask)
- [OracleJob.CacheTask.Method](#.OracleJob.CacheTask.Method)
- [OracleJob.BufferLayoutParseTask.BufferParseType](#.OracleJob.BufferLayoutParseTask.BufferParseType)
- [OracleJob.BufferLayoutParseTask.Endian](#.OracleJob.BufferLayoutParseTask.Endian)
- [OracleJob.HttpTask.Method](#.OracleJob.HttpTask.Method)
- [OracleJob.JsonParseTask.AggregationMethod](#.OracleJob.JsonParseTask.AggregationMethod)
- [OracleJob.LendingRateTask.Field](#.OracleJob.LendingRateTask.Field)
@ -61,40 +64,6 @@
<a name=".JobPosting"></a>
### JobPosting
The schema Oracle nodes receive when they are notified to fulfill a job.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| aggregator_state_pubkey | [bytes](#bytes) | optional | Pubkey of the aggregator to fulfill the job for. |
| node_pubkeys | [bytes](#bytes) | repeated | The pubkey of the nodes this job is assigned to. |
| slot | [uint64](#uint64) | optional | Slot number of the job posting. |
<a name=".JobResult"></a>
### JobResult
This schema Oracle nodes respond with when fulfilling a job.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| node_pubkey | [bytes](#bytes) | optional | The public key of the responding node. |
| result | [double](#double) | optional | The median value of the jobs the node has fulfilled successfully. |
| error | [bool](#bool) | optional | True if the node failed to decide on an answer to the job. |
<a name=".OracleJob"></a>
### OracleJob
@ -122,6 +91,7 @@ aggregate.
| scalar | [double](#double) | optional | Specifies a scalar to add by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to add by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before adding our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -144,16 +114,48 @@ Load a parse an Anchor based solana account.
<a name=".OracleJob.BufferLayoutParseTask"></a>
### OracleJob.BufferLayoutParseTask
Return the deserialized value from a stringified buffer.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| offset | [uint32](#uint32) | optional | The buffer offset to start deserializing from. |
| endian | [OracleJob.BufferLayoutParseTask.Endian](#OracleJob.BufferLayoutParseTask.Endian) | optional | The endianness of the stored value. |
| type | [OracleJob.BufferLayoutParseTask.BufferParseType](#OracleJob.BufferLayoutParseTask.BufferParseType) | optional | The type of value to deserialize. |
<a name=".OracleJob.CacheTask"></a>
### OracleJob.CacheTask
Execute a job and store the result in a variable to reference later.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| cache_items | [OracleJob.CacheTask.CacheItem](#OracleJob.CacheTask.CacheItem) | repeated | A list of cached variables to reference in the job with `${VARIABLE_NAME}`. |
<a name=".OracleJob.CacheTask.CacheItem"></a>
### OracleJob.CacheTask.CacheItem
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) | optional | |
| method | [OracleJob.CacheTask.Method](#OracleJob.CacheTask.Method) | optional | |
| variable_name | [string](#string) | optional | The name of the variable to store in cache to reference later with `${VARIABLE_NAME}`. |
| job | [OracleJob](#OracleJob) | optional | The OracleJob to execute to yield the value to store in cache. |
@ -180,14 +182,14 @@ This task will run the `attempt` subtasks in an effort to produce a valid numeri
<a name=".OracleJob.DefiKingdomsTask"></a>
### OracleJob.DefiKingdomsTask
Fetch the swap price from DefiKingdoms.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| provider | [string](#string) | optional | |
| in_token | [OracleJob.DefiKingdomsTask.Token](#OracleJob.DefiKingdomsTask.Token) | optional | |
| out_token | [OracleJob.DefiKingdomsTask.Token](#OracleJob.DefiKingdomsTask.Token) | optional | |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
| in_token | [OracleJob.DefiKingdomsTask.Token](#OracleJob.DefiKingdomsTask.Token) | optional | The input token of the swap. |
| out_token | [OracleJob.DefiKingdomsTask.Token](#OracleJob.DefiKingdomsTask.Token) | optional | The output token of the swap. |
@ -202,8 +204,8 @@ This task will run the `attempt` subtasks in an effort to produce a valid numeri
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| address | [string](#string) | optional | |
| decimals | [int32](#int32) | optional | |
| address | [string](#string) | optional | The address of the token. |
| decimals | [int32](#int32) | optional | The number of decimal places for a token. |
@ -222,6 +224,7 @@ aggregate.
| scalar | [double](#double) | optional | Specifies a basic scalar denominator to divide by. |
| aggregator_pubkey | [string](#string) | optional | Specifies another aggregator resut to divide by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before dividing our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -285,14 +288,14 @@ response.
<a name=".OracleJob.JupiterSwapTask"></a>
### OracleJob.JupiterSwapTask
Fetch the simulated price for a swap on JupiterSwap.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| in_token_address | [string](#string) | optional | |
| out_token_address | [string](#string) | optional | |
| base_amount | [double](#double) | optional | |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| base_amount | [double](#double) | optional | The amount of tokens to swap. |
@ -372,6 +375,16 @@ Fetch the current price for a Mango perpetual market
<a name=".OracleJob.MarinadeStateTask"></a>
### OracleJob.MarinadeStateTask
<a name=".OracleJob.MaxTask"></a>
### OracleJob.MaxTask
@ -407,8 +420,7 @@ Returns the mean of all the results returned by the provided subtasks and subjob
<a name=".OracleJob.MedianTask"></a>
### OracleJob.MedianTask
Returns the median of all the results returned by the provided subtasks and subjobs. Nested
tasks must return a Number.
Returns the median of all the results returned by the provided subtasks and subjobs. Nested tasks must return a Number.
| Field | Type | Label | Description |
@ -425,8 +437,7 @@ tasks must return a Number.
<a name=".OracleJob.MultiplyTask"></a>
### OracleJob.MultiplyTask
This task will multiply a numerical input by a scalar value or by another
aggregate.
This task will multiply a numerical input by a scalar value or by another aggregator.
| Field | Type | Label | Description |
@ -434,6 +445,7 @@ aggregate.
| scalar | [double](#double) | optional | Specifies a scalar to multiply by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to multiply by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before multiplying our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -443,14 +455,14 @@ aggregate.
<a name=".OracleJob.OracleTask"></a>
### OracleJob.OracleTask
Fetch the current price of a Solana oracle protocol
Fetch the current price of a Solana oracle protocol.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| switchboard_address | [string](#string) | optional | Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer |
| pyth_address | [string](#string) | optional | Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/ |
| chainlink_address | [string](#string) | optional | Devnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
| chainlink_address | [string](#string) | optional | Mainnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
| pyth_allowed_confidence_interval | [double](#double) | optional | Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this treshold are rejected. |
@ -461,16 +473,16 @@ Fetch the current price of a Solana oracle protocol
<a name=".OracleJob.PancakeswapExchangeRateTask"></a>
### OracleJob.PancakeswapExchangeRateTask
Fetch the swap price from PancakeSwap.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| in_token_address | [string](#string) | optional | |
| out_token_address | [string](#string) | optional | |
| in_token_amount | [double](#double) | optional | |
| slippage | [double](#double) | optional | |
| provider | [string](#string) | optional | |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
@ -480,7 +492,7 @@ Fetch the current price of a Solana oracle protocol
<a name=".OracleJob.PerpMarketTask"></a>
### OracleJob.PerpMarketTask
Fetch the current price of a perpetual market
Fetch the current price of a perpetual market.
| Field | Type | Label | Description |
@ -505,6 +517,7 @@ Take the power of the working value.
| ----- | ---- | ----- | ----------- |
| scalar | [double](#double) | optional | Take the working value to the exponent of value. |
| aggregator_pubkey | [string](#string) | optional | Take the working value to the exponent of the aggregators value. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -542,15 +555,30 @@ Fetch the latest swap price on Serum&#39;s orderbook
<a name=".OracleJob.SplStakePoolTask"></a>
### OracleJob.SplStakePoolTask
<a name=".OracleJob.SolanaAccountDataFetchTask"></a>
### OracleJob.SolanaAccountDataFetchTask
Fetch the account data in a stringified buffer format.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| pubkey | [string](#string) | optional | The pubkey of the SPL Stake Pool.`` |
| pubkey | [string](#string) | optional | The on-chain account to fetch the account data from. |
<a name=".OracleJob.SplStakePoolTask"></a>
### OracleJob.SplStakePoolTask
Fetch the JSON representation of an SPL Stake Pool account.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| pubkey | [string](#string) | optional | The pubkey of the SPL Stake Pool. |
@ -560,13 +588,13 @@ Fetch the latest swap price on Serum&#39;s orderbook
<a name=".OracleJob.SplTokenParseTask"></a>
### OracleJob.SplTokenParseTask
Fetch the JSON representation of an SPL token mint.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| token_account_address | [string](#string) | optional | |
| mint_address | [string](#string) | optional | |
| token_account_address | [string](#string) | optional | The publicKey of a token account to fetch the mintInfo for. |
| mint_address | [string](#string) | optional | The publicKey of the token mint address. |
@ -585,6 +613,7 @@ aggregate.
| scalar | [double](#double) | optional | Specifies a scalar to subtract by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to subtract by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before subtracting our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -594,16 +623,16 @@ aggregate.
<a name=".OracleJob.SushiswapExchangeRateTask"></a>
### OracleJob.SushiswapExchangeRateTask
Fetch the swap price from SushiSwap.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| in_token_address | [string](#string) | optional | |
| out_token_address | [string](#string) | optional | |
| in_token_amount | [double](#double) | optional | |
| slippage | [double](#double) | optional | |
| provider | [string](#string) | optional | |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
@ -613,7 +642,7 @@ aggregate.
<a name=".OracleJob.SysclockOffsetTask"></a>
### OracleJob.SysclockOffsetTask
Return the difference between an oracle&#39;s clock and the current timestamp at `SYSVAR_CLOCK_PUBKEY`.
@ -662,6 +691,9 @@ aggregate.
| pancakeswap_exchange_rate_task | [OracleJob.PancakeswapExchangeRateTask](#OracleJob.PancakeswapExchangeRateTask) | optional | |
| cache_task | [OracleJob.CacheTask](#OracleJob.CacheTask) | optional | |
| sysclock_offset_task | [OracleJob.SysclockOffsetTask](#OracleJob.SysclockOffsetTask) | optional | |
| marinade_state_task | [OracleJob.MarinadeStateTask](#OracleJob.MarinadeStateTask) | optional | |
| solana_account_data_fetch_task | [OracleJob.SolanaAccountDataFetchTask](#OracleJob.SolanaAccountDataFetchTask) | optional | |
| buffer_layout_parse_task | [OracleJob.BufferLayoutParseTask](#OracleJob.BufferLayoutParseTask) | optional | |
@ -671,7 +703,7 @@ aggregate.
<a name=".OracleJob.TpsTask"></a>
### OracleJob.TpsTask
Fetch the current transactions per second.
@ -700,16 +732,16 @@ Takes a twap over a set period for a certain aggregator.
<a name=".OracleJob.UniswapExchangeRateTask"></a>
### OracleJob.UniswapExchangeRateTask
Fetch the swap price from UniSwap.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| in_token_address | [string](#string) | optional | |
| out_token_address | [string](#string) | optional | |
| in_token_amount | [double](#double) | optional | |
| slippage | [double](#double) | optional | |
| provider | [string](#string) | optional | |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
@ -726,6 +758,7 @@ Returns a specified value.
| ----- | ---- | ----- | ----------- |
| value | [double](#double) | optional | The value that will be returned from this task. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregatorr to pull the value of. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
@ -768,15 +801,39 @@ Opens and maintains a websocket for light speed data retrieval.
<a name=".OracleJob.CacheTask.Method"></a>
<a name=".OracleJob.BufferLayoutParseTask.BufferParseType"></a>
### OracleJob.CacheTask.Method
### OracleJob.BufferLayoutParseTask.BufferParseType
| Name | Number | Description |
| ---- | ------ | ----------- |
| METHOD_GET | 0 | |
| METHOD_SET | 1 | |
| pubkey | 1 | A public key. |
| bool | 2 | A boolean. |
| u8 | 3 | An 8-bit unsigned value. |
| i8 | 4 | An 8-bit signed value. |
| u16 | 5 | A 16-bit unsigned value. |
| i16 | 6 | A 16-bit signed value. |
| u32 | 7 | A 32-bit unsigned value. |
| i32 | 8 | A 32-bit signed value. |
| f32 | 9 | A 32-bit IEEE floating point value. |
| u64 | 10 | A 64-bit unsigned value. |
| i64 | 11 | A 64-bit signed value. |
| f64 | 12 | A 64-bit IEEE floating point value. |
| u128 | 13 | A 128-bit unsigned value. |
| i128 | 14 | A 128-bit signed value. |
<a name=".OracleJob.BufferLayoutParseTask.Endian"></a>
### OracleJob.BufferLayoutParseTask.Endian
| Name | Number | Description |
| ---- | ------ | ----------- |
| LITTLE_ENDIAN | 0 | |
| BIG_ENDIAN | 1 | |

View File

@ -10,9 +10,9 @@ title: switchboard-tasks
Switchboard oracles read on-chain job accounts to determine how to fetch and respond to update request. An OracleJob is a collection of tasks that are chained together to arrive at a single numerical value.
| Field | Type | Label | Description |
| ----- | -------------------------------- | -------- | ------------------------------------------------- |
| tasks | [OracleJob.Task](#oraclejobtask) | repeated | The chain of tasks to perform for this OracleJob. |
| Field | Type | Label | Description |
| ----- | ---- | -------- | ------------------------------------------------- |
| tasks | Task | repeated | The chain of tasks to perform for this OracleJob. |
Switchboard tasks can be divided into the following categories:
@ -32,16 +32,14 @@ Check out the [**Job Directory**](/feed/directory) for examples!
### 🛠HttpTask
The adapter will report the text body of a successful HTTP request to the specified url,
or return an error if the response status code is greater than or equal to 400.
@return string representation of it&#39;s output.
The adapter will report the text body of a successful HTTP request to the specified url, or return an error if the response status code is greater than or equal to 400. @return string representation of it&#39;s output.
| Field | Type | Label | Description |
| ------- | ------------------------------------ | -------- | ----------------------------------------------------------- |
| url | string | optional | A string containing the URL to direct this HTTP request to. |
| method | [OracleJob.HttpTask.Method](#Method) | optional | The type of HTTP request to make. |
| headers | [OracleJob.HttpTask.Header](#Header) | repeated | A list of headers to add to this HttpTask. |
| body | string | optional | A stringified body (if any) to add to this HttpTask. |
| Field | Type | Label | Description |
| ------- | ----------------- | -------- | ----------------------------------------------------------- |
| url | [string](#string) | optional | A string containing the URL to direct this HTTP request to. |
| method | [Method](#method) | optional | The type of HTTP request to make. |
| headers | [Header](#header) | repeated | A list of headers to add to this HttpTask. |
| body | [string](#string) | optional | A stringified body (if any) to add to this HttpTask. |
#### Header
@ -56,22 +54,22 @@ An object that represents a header to add to an HTTP request.
An enumeration representing the types of HTTP requests available to make.
| Name | Number | Description |
| -------------- | ------ | -------------------------------------------- |
| METHOD_UNKNOWN | 0 | Unset HTTP method will default to METHOD_GET |
| METHOD_GET | 1 | Perform an HTTP &#39;GET&#39; request. |
| METHOD_POST | 2 | Perform an HTTP &#39;POST&#39; request. |
| Name | Number | Description |
| ------------- | ------ | -------------------------------------------- |
| METHOD_UNKOWN | 0 | Unset HTTP method will default to METHOD_GET |
| METHOD_GET | 1 | Perform an HTTP &#39;GET&#39; request. |
| METHOD_POST | 2 | Perform an HTTP &#39;POST&#39; request. |
### 🛠WebsocketTask
Opens and maintains a websocket for light speed data retrieval.
| Field | Type | Label | Description |
| -------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| url | string | optional | The websocket url. |
| subscription | string | optional | The websocket message to notify of a new subscription. |
| max_data_age_seconds | int32 | optional | Minimum amount of time required between when the horses are taking out. |
| filter | string | optional | Incoming message JSONPath filter. Example: &#34;$[?(@.channel == &#39;ticker&#39; &amp;&amp; @.market == &#39;BTC/USD&#39;)]&#34; |
| Field | Type | Label | Description |
| -------------------- | ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| url | [string](#string) | optional | The websocket url. |
| subscription | [string](#string) | optional | The websocket message to notify of a new subscription. |
| max_data_age_seconds | [int32](#int32) | optional | Minimum amount of time required between when the horses are taking out. |
| filter | [string](#string) | optional | Incoming message JSONPath filter. Example: &#34;$[?(@.channel == &#39;ticker&#39; &amp;&amp; @.market == &#39;BTC/USD&#39;)]&#34; |
## 📦Web3 Fetch
@ -79,74 +77,100 @@ Opens and maintains a websocket for light speed data retrieval.
Load a parse an Anchor based solana account.
| Field | Type | Label | Description |
| --------------- | ------ | -------- | --------------------------------------- |
| program_id | string | optional | Owning program of the account to parse. |
| account_address | string | optional | The account to parse. |
| Field | Type | Label | Description |
| --------------- | ----------------- | -------- | --------------------------------------- |
| program_id | [string](#string) | optional | Owning program of the account to parse. |
| account_address | [string](#string) | optional | The account to parse. |
### 🛠OracleTask
Fetch the current price of a Solana oracle protocol
Fetch the current price of a Solana oracle protocol.
| Field | Type | Label | Description |
| -------------------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| switchboard_address | string | optional | Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer |
| pyth_address | string | optional | Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/ |
| chainlink_address | string | optional | Devnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
| pyth_allowed_confidence_interval | double | optional | Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this threshold are rejected. |
| Field | Type | Label | Description |
| -------------------------------- | ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| switchboard_address | [string](#string) | optional | Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer |
| pyth_address | [string](#string) | optional | Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/ |
| chainlink_address | [string](#string) | optional | Mainnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
| pyth_allowed_confidence_interval | [double](#double) | optional | Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this treshold are rejected. |
### 🛠SolanaAccountDataFetchTask
Fetch the account data in a stringified buffer format.
| Field | Type | Label | Description |
| ------ | ----------------- | -------- | ---------------------------------------------------- |
| pubkey | [string](#string) | optional | The on-chain account to fetch the account data from. |
### 🛠JupiterSwapTask
Fetch the Jupiter swap price for a given input and output token.
Fetch the simulated price for a swap on JupiterSwap.
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ----------------------------------------- |
| in_token_address | string | optional | The input token mint address. |
| out_token_address | string | optional | The output token mint address. |
| base_amount | double | optional | The base token input amount for the swap. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ----------------------------- |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| base_amount | [double](#double) | optional | The amount of tokens to swap. |
### 🛠SerumSwapTask
Fetch the latest swap price on Serum&#39;s orderbook
| Field | Type | Label | Description |
| ------------------ | ------ | -------- | -------------------------------------- |
| serum_pool_address | string | optional | The serum pool to fetch swap price for |
| Field | Type | Label | Description |
| ------------------ | ----------------- | -------- | -------------------------------------- |
| serum_pool_address | [string](#string) | optional | The serum pool to fetch swap price for |
### 🛠UniswapExchangeRateTask
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ----------- |
| in_token_address | string | optional | |
| out_token_address | string | optional | |
| in_token_amount | uint32 | optional | |
| slippage | double | optional | |
| provider | string | optional | |
Fetch the swap price from UniSwap.
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ----------------------------------------------- |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
### 🛠SushiSwapExchangeRateTask
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ----------- |
| in_token_address | string | optional | |
| out_token_address | string | optional | |
| in_token_amount | uint32 | optional | |
| slippage | double | optional | |
| provider | string | optional | |
Fetch the swap price from SushiSwap.
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ----------------------------------------------- |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
### 🛠PancakeswapExchangeRateTask
Fetch the swap price from PancakeSwap.
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ----------------------------------------------- |
| in_token_address | [string](#string) | optional | The input token address. |
| out_token_address | [string](#string) | optional | The output token address. |
| in_token_amount | [double](#double) | optional | The amount of tokens to swap. |
| slippage | [double](#double) | optional | The allowable slippage in percent for the swap. |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
### 🛠DefiKingdomsTask
| Field | Type | Label | Description |
| --------- | ------------------------------------------ | -------- | ----------- |
| provider | string | optional | |
| in_token | [OracleJob.DefiKingdomsTask.Token](#Token) | optional | |
| out_token | [OracleJob.DefiKingdomsTask.Token](#Token) | optional | |
Fetch the swap price from DefiKingdoms.
| Field | Type | Label | Description |
| --------- | ----------------- | -------- | ------------------------------------- |
| provider | [string](#string) | optional | The RPC provider to use for the swap. |
| in_token | [Token](#token) | optional | The input token of the swap. |
| out_token | [Token](#token) | optional | The output token of the swap. |
#### Token
| Field | Type | Label | Description |
| -------- | ------ | -------- | ----------- |
| address | string | optional | |
| decimals | int32 | optional | |
| Field | Type | Label | Description |
| -------- | ----------------- | -------- | ----------------------------------------- |
| address | [string](#string) | optional | The address of the token. |
| decimals | [int32](#int32) | optional | The number of decimal places for a token. |
### 🛠MangoPerpTask
@ -160,11 +184,11 @@ Fetch the current price for a Mango perpetual market
Fetch the lending rates for various Solana protocols
| Field | Type | Label | Description |
| ---------- | ----------------------------------------- | -------- | ------------------------------------------------------------- |
| protocol | string | optional | 01, apricot, francium, jet, larix, mango, port, solend, tulip |
| asset_mint | string | optional | A token mint address supported by the chosen protocol |
| field | [OracleJob.LendingRateTask.Field](#Field) | optional | |
| Field | Type | Label | Description |
| ---------- | ----------------- | -------- | ------------------------------------------------------------- |
| protocol | [string](#string) | optional | 01, apricot, francium, jet, larix, mango, port, solend, tulip |
| asset_mint | [string](#string) | optional | A token mint address supported by the chosen protocol |
| field | [Field](#field) | optional | |
#### Field
@ -175,50 +199,54 @@ Fetch the lending rates for various Solana protocols
### 🛠XStepPriceTask
| Field | Type | Label | Description |
| ---------------------- | ----------------------------------- | -------- | ---------------------------------------------------------------------- |
| step_job | [OracleJob.MedianTask](#MedianTask) | optional | median task containing the job definitions to fetch the STEP/USD price |
| step_aggregator_pubkey | string | optional | existing aggregator pubkey for STEP/USD |
| Field | Type | Label | Description |
| ---------------------- | ------------------------- | -------- | ---------------------------------------------------------------------- |
| step_job | [MedianTask](#mediantask) | optional | median task containing the job definitions to fetch the STEP/USD price |
| step_aggregator_pubkey | string | optional | existing aggregator pubkey for STEP/USD |
### 🛠SplTokenParseTask
| Field | Type | Label | Description |
| --------------------- | ------ | -------- | ----------- |
| token_account_address | string | optional | |
| mint_address | string | optional | |
Fetch the JSON representation of an SPL token mint.
| Field | Type | Label | Description |
| --------------------- | ----------------- | -------- | ----------------------------------------------------------- |
| token_account_address | [string](#string) | optional | The publicKey of a token account to fetch the mintInfo for. |
| mint_address | [string](#string) | optional | The publicKey of the token mint address. |
### 🛠SplStakePoolTask
| Field | Type | Label | Description |
| ------ | ------ | -------- | --------------------------------- |
| pubkey | string | optional | The pubkey of the SPL Stake Pool. |
Fetch the JSON representation of an SPL Stake Pool account.
| Field | Type | Label | Description |
| ------ | ----------------- | -------- | --------------------------------- |
| pubkey | [string](#string) | optional | The pubkey of the SPL Stake Pool. |
### 🛠LpExchangeRateTask
Fetch the current swap price for a given liquidity pool
| Field | Type | Label | Description |
| ---------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| in_token_address | string | optional | Not Used |
| out_token_address | string | optional | Not Used |
| mercurial_pool_address | string | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | string | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_token_mint_address | string | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | string | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
| Field | Type | Label | Description |
| ---------------------------- | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| in_token_address | [string](#string) | optional | Not Used |
| out_token_address | [string](#string) | optional | Not Used |
| mercurial_pool_address | [string](#string) | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | [string](#string) | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_token_mint_address | [string](#string) | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | [string](#string) | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
### 🛠LpTokenPriceTask
Fetch LP token price info from a number of supported exchanges.
| Field | Type | Label | Description |
| ---------------------- | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| mercurial_pool_address | string | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | string | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_address | string | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | string | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
| price_feed_addresses | string | repeated | A list of Switchboard aggregator accounts used to calculate the fair LP price. This ensures the price is based on the previous round to mitigate flash loan price manipulation. |
| price_feed_jobs | [OracleJob](#OracleJob) | repeated | |
| use_fair_price | [bool](#bool) | optional | If enabled and price_feed_addresses provided, the oracle will calculate the fair LP price based on the liquidity pool reserves. See our blog post for more information: https://switchboardxyz.medium.com/fair-lp-token-oracles-94a457c50239 |
| Field | Type | Label | Description |
| ---------------------- | ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| mercurial_pool_address | [string](#string) | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | [string](#string) | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_address | [string](#string) | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | [string](#string) | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
| price_feed_addresses | [string](#string) | repeated | A list of Switchboard aggregator accounts used to calculate the fair LP price. This ensures the price is based on the previous round to mitigate flash loan price manipulation. |
| price_feed_jobs | [OracleJob](#) | repeated | |
| use_fair_price | [bool](#bool) | optional | If enabled and price_feed_addresses provided, the oracle will calculate the fair LP price based on the liquidity pool reserves. See our blog post for more information: https://switchboardxyz.medium.com/fair-lp-token-oracles-94a457c50239 |
## 📦Parse
@ -228,10 +256,10 @@ The adapter walks the path specified and returns the value found at that result.
JSON data from the HttpGet or HttpPost adapters, you must use this adapter to parse the
response.
| Field | Type | Label | Description |
| ------------------ | --------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| path | string | optional | JSONPath formatted path to the element. https://t.ly/uLtw https://www.npmjs.com/package/jsonpath-plus |
| aggregation_method | [OracleJob.JsonParseTask.AggregationMethod](#AggregationMethod) | optional | The technique that will be used to aggregate the results if walking the specified path returns multiple numerical results. |
| Field | Type | Label | Description |
| ------------------ | --------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| path | string | optional | JSONPath formatted path to the element. https://t.ly/uLtw https://www.npmjs.com/package/jsonpath-plus |
| aggregation_method | [AggregationMethod](#aggregationmethod) | optional | The technique that will be used to aggregate the results if walking the specified path returns multiple numerical results. |
#### AggregationMethod
@ -253,6 +281,42 @@ Find a pattern within a string of a previous task and extract a group number.
| pattern | string | optional | Regex pattern to find. |
| group_number | int32 | optional | Group number to extract. |
### 🛠BufferLayoutParseTask
Return the deserialized value from a stringified buffer.
| Field | Type | Label | Description |
| ------ | ----------------------------------- | -------- | ---------------------------------------------- |
| offset | [uint32](#uint32) | optional | The buffer offset to start deserializing from. |
| endian | [Endian](#endian) | optional | The endianness of the stored value. |
| type | [BufferParseType](#bufferparsetype) | optional | The type of value to deserialize. |
#### BufferParseType
| Name | Number | Description |
| ------ | ------ | ----------------------------------- |
| pubkey | 1 | A public key. |
| bool | 2 | A boolean. |
| u8 | 3 | An 8-bit unsigned value. |
| i8 | 4 | An 8-bit signed value. |
| u16 | 5 | A 16-bit unsigned value. |
| i16 | 6 | A 16-bit signed value. |
| u32 | 7 | A 32-bit unsigned value. |
| i32 | 8 | A 32-bit signed value. |
| f32 | 9 | A 32-bit IEEE floating point value. |
| u64 | 10 | A 64-bit unsigned value. |
| i64 | 11 | A 64-bit signed value. |
| f64 | 12 | A 64-bit IEEE floating point value. |
| u128 | 13 | A 128-bit unsigned value. |
| i128 | 14 | A 128-bit signed value. |
#### Endian
| Name | Number | Description |
| ------------- | ------ | ----------- |
| LITTLE_ENDIAN | 0 | |
| BIG_ENDIAN | 1 | |
## 📦Logic
### 🛠ConditionalTask
@ -260,10 +324,35 @@ Find a pattern within a string of a previous task and extract a group number.
This task will run the `attempt` subtasks in an effort to produce a valid numerical result. If
`attempt` fails to produce an acceptable result, `on_failure` subtasks will be run instead.
| Field | Type | Label | Description |
| ---------- | --------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
| attempt | [OracleJob.Task](#OracleJob.Task) | repeated | A list of subtasks to process in an attempt to produce a valid numerical result. |
| on_failure | [OracleJob.Task](#OracleJob.Task) | repeated | A list of subtasks that will be run if `attempt` subtasks are unable to produce an acceptable result. |
| Field | Type | Label | Description |
| ---------- | ---- | -------- | ----------------------------------------------------------------------------------------------------- |
| attempt | Task | repeated | A list of subtasks to process in an attempt to produce a valid numerical result. |
| on_failure | Task | repeated | A list of subtasks that will be run if `attempt` subtasks are unable to produce an acceptable result. |
## 📦Utils
### 🛠CacheTask
Execute a job and store the result in a variable to reference later.
| Field | Type | Label | Description |
| ----------- | ----------------------- | -------- | --------------------------------------------------------------------------- |
| cache_items | [CacheItem](#cacheitem) | repeated | A list of cached variables to reference in the job with `${VARIABLE_NAME}`. |
#### CacheItem
| Field | Type | Label | Description |
| ------------- | ----------------- | -------- | -------------------------------------------------------------------------------------- |
| variable_name | [string](#string) | optional | The name of the variable to store in cache to reference later with `${VARIABLE_NAME}`. |
| job | [OracleJob](#) | optional | The OracleJob to execute to yield the value to store in cache. |
### 🛠SysclockOffsetTask
Return the difference between an oracle&#39;s clock and the current timestamp at `SYSVAR_CLOCK_PUBKEY`.
### 🛠TpsTask
Fetch the current transactions per second.
## 📦Math
@ -271,407 +360,105 @@ This task will run the `attempt` subtasks in an effort to produce a valid numeri
Takes a twap over a set period for a certain aggregator.
| Field | Type | Label | Description |
| -------------------------- | ------------- | -------- | -------------------------------------------------------------------- |
| aggregator_pubkey | string | optional | The target aggregator for the TWAP. |
| period | int32 | optional | Period, in seconds, the twap should account for |
| weight_by_propagation_time | [bool](#bool) | optional | Weight samples by their propagation time |
| min_samples | uint32 | optional | Minimum number of samples in the history to calculate a valid result |
| ending_unix_timestamp | int32 | optional | Ending unix timestamp to collect values up to |
| Field | Type | Label | Description |
| -------------------------- | ----------------- | -------- | -------------------------------------------------------------------- |
| aggregator_pubkey | [string](#string) | optional | The target aggregator for the TWAP. |
| period | [int32](#int32) | optional | Period, in seconds, the twap should account for |
| weight_by_propagation_time | [bool](#bool) | optional | Weight samples by their propagation time |
| min_samples | [uint32](#uint32) | optional | Minimum number of samples in the history to calculate a valid result |
| ending_unix_timestamp | [int32](#int32) | optional | Ending unix timestamp to collect values up to |
### 🛠MaxTask
Returns the maximum value of all the results returned by the provided subtasks and subjobs.
| Field | Type | Label | Description |
| ----- | --------------------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#OracleJob.Task) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#OracleJob) | repeated | A list of subjobs to process and produce a list of result values. |
| Field | Type | Label | Description |
| ----- | -------------- | -------- | ------------------------------------------------------------------ |
| tasks | Task | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#) | repeated | A list of subjobs to process and produce a list of result values. |
### 🛠MeanTask
Returns the mean of all the results returned by the provided subtasks and subjobs.
| Field | Type | Label | Description |
| ----- | --------------------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#OracleJob.Task) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#OracleJob) | repeated | A list of subjobs to process and produce a list of result values. |
| Field | Type | Label | Description |
| ----- | -------------- | -------- | ------------------------------------------------------------------ |
| tasks | Task | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#) | repeated | A list of subjobs to process and produce a list of result values. |
### 🛠MedianTask
Returns the median of all the results returned by the provided subtasks and subjobs. Nested
tasks must return a Number.
Returns the median of all the results returned by the provided subtasks and subjobs. Nested tasks must return a Number.
| Field | Type | Label | Description |
| ----------------------- | --------------------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#OracleJob.Task) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#OracleJob) | repeated | A list of subjobs to process and produce a list of result values. |
| min_successful_required | int32 | optional | |
| Field | Type | Label | Description |
| ----------------------- | --------------- | -------- | ------------------------------------------------------------------ |
| tasks | Task | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#) | repeated | A list of subjobs to process and produce a list of result values. |
| min_successful_required | [int32](#int32) | optional | |
### 🛠AddTask
This task will add a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | -------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to add by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to add by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before adding our numerical input by that result. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | -------------------------------------------------------------------------------- |
| scalar | [double](#double) | optional | Specifies a scalar to add by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to add by. |
| job | [OracleJob](#) | optional | A job whose result is computed before adding our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
### 🛠SubtractTask
This task will subtract a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to subtract by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to subtract by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before subtracting our numerical input by that result. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | [double](#double) | optional | Specifies a scalar to subtract by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to subtract by. |
| job | [OracleJob](#) | optional | A job whose result is computed before subtracting our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
### 🛠MultiplyTask
This task will multiply a numerical input by a scalar value or by another
aggregate.
This task will multiply a numerical input by a scalar value or by another aggregator.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to multiply by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to multiply by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before multiplying our numerical input by that result. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | [double](#double) | optional | Specifies a scalar to multiply by. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregator to multiply by. |
| job | [OracleJob](#) | optional | A job whose result is computed before multiplying our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
### 🛠DivideTask
This task will divide a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ---------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a basic scalar denominator to divide by. |
| aggregator_pubkey | string | optional | Specifies another aggregator result to divide by. |
| job | [OracleJob](#OracleJob) | optional | A job whose result is computed before dividing our numerical input by that result. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ---------------------------------------------------------------------------------- |
| scalar | [double](#double) | optional | Specifies a basic scalar denominator to divide by. |
| aggregator_pubkey | [string](#string) | optional | Specifies another aggregator resut to divide by. |
| job | [OracleJob](#) | optional | A job whose result is computed before dividing our numerical input by that result. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
### 🛠PowTask
Take the power of the working value.
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ---------------------------------------------------------------- |
| scalar | double | optional | Take the working value to the exponent of value. |
| aggregator_pubkey | string | optional | Take the working value to the exponent of the aggregators value. |
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ---------------------------------------------------------------- |
| scalar | [double](#double) | optional | Take the working value to the exponent of value. |
| aggregator_pubkey | [string](#string) | optional | Take the working value to the exponent of the aggregators value. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |
### 🛠ValueTask
Returns a specified value.
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ----------------------------------------------- |
| value | double | optional | The value that will be returned from this task. |
| aggregator_pubkey | string | optional | Specifies an aggregator to pull the value of. |
<!-- ## 📦OracleJob.Task
| Field | Type | Label | Description |
| ---------------------------- | --------------------------------------------------------------------------- | -------- | ----------- |
| http_task | [OracleJob.HttpTask](#OracleJob.HttpTask) | optional | |
| json_parse_task | [OracleJob.JsonParseTask](#OracleJob.JsonParseTask) | optional | |
| median_task | [OracleJob.MedianTask](#OracleJob.MedianTask) | optional | |
| mean_task | [OracleJob.MeanTask](#OracleJob.MeanTask) | optional | |
| websocket_task | [OracleJob.WebsocketTask](#OracleJob.WebsocketTask) | optional | |
| divide_task | [OracleJob.DivideTask](#OracleJob.DivideTask) | optional | |
| multiply_task | [OracleJob.MultiplyTask](#OracleJob.MultiplyTask) | optional | |
| lp_token_price_task | [OracleJob.LpTokenPriceTask](#OracleJob.LpTokenPriceTask) | optional | |
| lp_exchange_rate_task | [OracleJob.LpExchangeRateTask](#OracleJob.LpExchangeRateTask) | optional | |
| conditional_task | [OracleJob.ConditionalTask](#OracleJob.ConditionalTask) | optional | |
| value_task | [OracleJob.ValueTask](#OracleJob.ValueTask) | optional | |
| max_task | [OracleJob.MaxTask](#OracleJob.MaxTask) | optional | |
| regex_extract_task | [OracleJob.RegexExtractTask](#OracleJob.RegexExtractTask) | optional | |
| xstep_price_task | [OracleJob.XStepPriceTask](#OracleJob.XStepPriceTask) | optional | |
| add_task | [OracleJob.AddTask](#OracleJob.AddTask) | optional | |
| subtract_task | [OracleJob.SubtractTask](#OracleJob.SubtractTask) | optional | |
| twap_task | [OracleJob.TwapTask](#OracleJob.TwapTask) | optional | |
| serum_swap_task | [OracleJob.SerumSwapTask](#OracleJob.SerumSwapTask) | optional | |
| pow_task | [OracleJob.PowTask](#OracleJob.PowTask) | optional | |
| lending_rate_task | [OracleJob.LendingRateTask](#OracleJob.LendingRateTask) | optional | |
| mango_perp_market_task | [OracleJob.MangoPerpMarketTask](#OracleJob.MangoPerpMarketTask) | optional | |
| jupiter_swap_task | [OracleJob.JupiterSwapTask](#OracleJob.JupiterSwapTask) | optional | |
| perp_market_task | [OracleJob.PerpMarketTask](#OracleJob.PerpMarketTask) | optional | |
| oracle_task | [OracleJob.OracleTask](#OracleJob.OracleTask) | optional | |
| anchor_fetch_task | [OracleJob.AnchorFetchTask](#OracleJob.AnchorFetchTask) | optional | |
| defi_kingdoms_task | [OracleJob.DefiKingdomsTask](#OracleJob.DefiKingdomsTask) | optional | |
| tps_task | [OracleJob.TpsTask](#OracleJob.TpsTask) | optional | |
| spl_stake_pool_task | [OracleJob.SplStakePoolTask](#OracleJob.SplStakePoolTask) | optional | |
| spl_token_parse_task | [OracleJob.SplTokenParseTask](#OracleJob.SplTokenParseTask) | optional | |
| uniswap_exchange_rate_task | [OracleJob.UniswapExchangeRateTask](#OracleJob.UniswapExchangeRateTask) | optional | |
| sushiswap_exchange_rate_task | [OracleJob.SushiswapExchangeRateTask](#OracleJob.SushiswapExchangeRateTask) | optional | | -->
<!--
## 🛠HttpTask
The adapter will report the text body of a successful HTTP request to the specified url,
or return an error if the response status code is greater than or equal to 400.
@return string representation of it&#39;s output.
| Field | Type | Label | Description |
| ------- | ------------------------------------ | -------- | ----------------------------------------------------------- |
| url | string | optional | A string containing the URL to direct this HTTP request to. |
| method | [OracleJob.HttpTask.Method](#method) | optional | The type of HTTP request to make. |
| headers | [OracleJob.HttpTask.Header](#header) | repeated | A list of headers to add to this HttpTask. |
| body | string | optional | A stringified body (if any) to add to this HttpTask. |
### Header
An object that represents a header to add to an HTTP request.
| Field | Type | Label | Description |
| ----- | ------ | -------- | ----------- |
| key | string | optional | |
| value | string | optional | |
### Method
An enumeration representing the types of HTTP requests available to make.
| Name | Number | Description |
| -------------- | ------ | -------------------------------------------- |
| METHOD_UNKNOWN | 0 | Unset HTTP method will default to METHOD_GET |
| METHOD_GET | 1 | Perform an HTTP &#39;GET&#39; request. |
| METHOD_POST | 2 | Perform an HTTP &#39;POST&#39; request. |
## 🛠WebsocketTask
Opens and maintains a websocket for light speed data retrieval.
| Field | Type | Label | Description |
| -------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| url | string | optional | The websocket url. |
| subscription | string | optional | The websocket message to notify of a new subscription. |
| max_data_age_seconds | int32 | optional | Minimum amount of time required between when the horses are taking out. |
| filter | string | optional | Incoming message JSONPath filter. Example: &#34;$[?(@.channel == &#39;ticker&#39; &amp;&amp; @.market == &#39;BTC/USD&#39;)]&#34; |
## 🛠AnchorFetchTask
Load a parse an Anchor based solana account.
| Field | Type | Label | Description |
| --------------- | ------ | -------- | --------------------------------------- |
| program_id | string | optional | Owning program of the account to parse. |
| account_address | string | optional | The account to parse. |
## 🛠OracleTask
Fetch the current price of a Solana oracle protocol
| Field | Type | Label | Description |
| -------------------------------- | ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| switchboard_address | string | optional | Mainnet address of a Switchboard V2 feed. Switchboard is decentralized and allows anyone to build their own feed. A small subset of feeds is available here: https://switchboard.xyz/explorer |
| pyth_address | string | optional | Mainnet address for a Pyth feed. A full list can be found here: https://pyth.network/markets/ |
| chainlink_address | string | optional | Devnet address for a Chainlink feed. A full list can be found here: https://docs.chain.link/docs/solana/data-feeds-solana |
| pyth_allowed_confidence_interval | [double](#double) | optional | Value (as a percentage) that the lower bound confidence interval is of the actual value. Confidence intervals that are larger that this threshold are rejected. |
## 🛠JsonParseTask
The adapter walks the path specified and returns the value found at that result. If returning JSON data from the HttpGet or HttpPost adapters, you must use this adapter to parse the response.
| Field | Type | Label | Description |
| ------------------ | --------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| path | string | optional | JSONPath formatted path to the element. https://t.ly/uLtw https://www.npmjs.com/package/jsonpath-plus |
| aggregation_method | [AggregationMethod](#aggregationmethod) | optional | The technique that will be used to aggregate the results if walking the specified path returns multiple numerical results. |
### AggregationMethod
The methods of combining a list of numerical results.
| Name | Number | Description |
| ---- | ------ | -------------------------------------- |
| NONE | 0 | |
| MIN | 1 | Grab the minimum value of the results. |
| MAX | 2 | Grab the maximum value of the results. |
| SUM | 3 | Sum up all of the results. |
## 🛠RegexExtractTask
Find a pattern within a string of a previous task and extract a group number.
| Field | Type | Label | Description |
| ------------ | ------ | -------- | ------------------------ |
| pattern | string | optional | Regex pattern to find. |
| group_number | int32 | optional | Group number to extract. |
## 🛠ConditionalTask
This task will run the `attempt` subtasks in an effort to produce a valid numerical result. If
`attempt` fails to produce an acceptable result, `on_failure` subtasks will be run instead.
| Field | Type | Label | Description |
| ---------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
| attempt | [OracleJob.Task](#) | repeated | A list of subtasks to process in an attempt to produce a valid numerical result. |
| on_failure | [OracleJob.Task](#) | repeated | A list of subtasks that will be run if `attempt` subtasks are unable to produce an acceptable result. |
## 🛠LendingRateTask
| Field | Type | Label | Description |
| ---------- | ------------------------------- | -------- | ------------------------------------------------------------- |
| protocol | string | optional | 01, apricot, francium, jet, larix, mango, port, solend, tulip |
| asset_mint | string | optional | A token mint address supported by the chosen protocol. |
| field | [LendingRateTask.Field](#field) | optional | |
### Field
| Name | Number | Description |
| ------------------ | ------ | ----------- |
| FIELD_DEPOSIT_RATE | 0 | |
| FIELD_BORROW_RATE | 1 | |
## 🛠MangoPerpMarketTask
| Field | Type | Label | Description |
| ------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| perp_market_address | string | optional | Mainnet address for a mango perpetual market. A full list can be found here: https://github.com/blockworks-foundation/mango-client-v3/blob/main/src/ids.json |
## 🛠LpExchangeRateTask
| Field | Type | Label | Description |
| ---------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| in_token_address | string | optional | Not Used. |
| out_token_address | string | optional | Not Used. |
| mercurial_pool_address | string | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | string | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_token_mint_address | string | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | string | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
## 🛠LpTokenPriceTask
Fetch LP token price info from a number of supported exchanges.
| Field | Type | Label | Description |
| ---------------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| mercurial_pool_address | string | optional | Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js |
| saber_pool_address | string | optional | Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist |
| orca_pool_address | string | optional | Orca pool address. A full list can be found here: https://www.orca.so/pools |
| raydium_pool_address | string | optional | The Raydium liquidity pool ammId. A full list can be found here: https://sdk.raydium.io/liquidity/mainnet.json |
| use_fair_price | boolean | optional | If enabled and price_feed_addresses provided, the oracle will calculate the fair LP price based on the liquidity pool reserves. See our blog post for more information: https://switchboardxyz.medium.com/fair-lp-token-oracles-94a457c50239 |
| price_feed_addresses | string[] | repeated | A list of Switchboard aggregator accounts used to calculate the fair LP price. This ensures the price is based on the previous round to mitigate flash loan price manipulation. |
## 🛠SerumSwapTask
Fetch the latest swap price on Serum&#39;s orderbook
| Field | Type | Label | Description |
| ------------------ | ------ | -------- | -------------------------------------- |
| serum_pool_address | string | optional | The serum pool to fetch swap price for |
## 🛠JupiterSwapTask
Fetch the Jupiter swap price for a given input and output token.
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ------------------------------ |
| in_token_address | string | optional | The input token mint address. |
| out_token_address | string | optional | The output token mint address. |
## 🛠DefiKingdomTask
| Field | Type | Label | Description |
| --------- | ------------------------------------------ | -------- | ----------- |
| provider | string | optional | |
| in_token | [OracleJob.DefiKingdomsTask.Token](#token) | optional | |
| out_token | [OracleJob.DefiKingdomsTask.Token](#token) | optional | |
### Token
| Field | Type | Label | Description |
| -------- | --------------- | -------- | ----------- |
| address | string | optional | |
| decimals | [int32](#int32) | optional | |
## 🛠MaxTask
Returns the maximum value of all the results returned by the provided subtasks and subjobs.
| Field | Type | Label | Description |
| ----- | ----------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#oraclejob) | repeated | A list of subjobs to process and produce a list of result values. |
## 🛠MeanTask
Returns the mean of all the results returned by the provided subtasks and subjobs.
| Field | Type | Label | Description |
| ----- | ----------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#oraclejob) | repeated | A list of subjobs to process and produce a list of result values. |
## 🛠MedianTask
Returns the median of all the results returned by the provided subtasks and subjobs. Nested
tasks must return a Number.
| Field | Type | Label | Description |
| ----- | ----------------------- | -------- | ------------------------------------------------------------------ |
| tasks | [OracleJob.Task](#) | repeated | A list of subtasks to process and produce a list of result values. |
| jobs | [OracleJob](#oraclejob) | repeated | A list of subjobs to process and produce a list of result values. |
## 🛠MultiplyTask
This task will multiply a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to multiply by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to multiply by. |
| job | [OracleJob](#oraclejob) | optional | A job whose result is computed before multiplying our numerical input by that result. |
## 🛠DivideTask
This task will divide a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ---------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a basic scalar denominator to divide by. |
| aggregator_pubkey | string | optional | Specifies another aggregator result to divide by. |
| job | [OracleJob](#oraclejob) | optional | A job whose result is computed before dividing our numerical input by that result. |
## 🛠AddTask
This task will add a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | -------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to add by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to add by. |
| job | [OracleJob](#oraclejob) | optional | A job whose result is computed before adding our numerical input by that result. |
## 🛠SubtractTask
This task will subtract a numerical input by a scalar value or by another
aggregate.
| Field | Type | Label | Description |
| ----------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------- |
| scalar | double | optional | Specifies a scalar to subtract by. |
| aggregator_pubkey | string | optional | Specifies an aggregator to subtract by. |
| job | [OracleJob](#oraclejob) | optional | A job whose result is computed before subtracting our numerical input by that result. |
## 🛠TwapTask
Takes a twap over a set period for a certain aggregator.
| Field | Type | Label | Description |
| ----------------- | ------ | -------- | ----------------------------------------------- |
| aggregator_pubkey | string | optional | The target aggregator for the TWAP. |
| period | int32 | optional | Period, in seconds, the twap should account for |
## 🛠ValueTask
Returns a specified value.
| Field | Type | Label | Description |
| ----- | ------ | -------- | ----------------------------------------------- |
| value | double | optional | The value that will be returned from this task. | -->
| Field | Type | Label | Description |
| ----------------- | ----------------- | -------- | ---------------------------------------------------------- |
| value | [double](#double) | optional | The value that will be returned from this task. |
| aggregator_pubkey | [string](#string) | optional | Specifies an aggregatorr to pull the value of. |
| big | [string](#string) | optional | A stringified big.js. `Accepts variable expansion syntax.` |

View File

@ -21,7 +21,7 @@
"serve": "docusaurus serve --dir public",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"update:tasks": "protoc --proto_path=../tasks/v2-task-library/protos --doc_out=api --doc_opt=markdown,_tasks.md ../tasks/v2-task-library/protos/job_schemas.proto",
"update:tasks": "protoc --proto_path=../libraries/protos --doc_out=api --doc_opt=markdown,_tasks.md ../libraries/protos/job_schemas.proto",
"spellcheck": "cspell --config ./cSpell.json \"**/*.md*\"",
"typecheck": "tsc",
"test": "echo \"No test script for website\" && exit 0"