wip
This commit is contained in:
parent
2236ac2647
commit
02d661d6d4
|
@ -1,5 +1,4 @@
|
|||
import { Flags } from "@oclif/core";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BaseCommand from "../BaseCommand";
|
||||
|
||||
export default class SandboxCommand extends BaseCommand {
|
||||
|
@ -71,21 +70,110 @@ export default class SandboxCommand extends BaseCommand {
|
|||
// console.log(byteArray.length);
|
||||
// console.log(`[${Uint8Array.from(historyKey.toBuffer()).toString()}]`);
|
||||
|
||||
const parseAddress = new PublicKey(
|
||||
"DpoK8Zz69APV9ntjuY9C4LZCxANYMV56M2cbXEdkjxME"
|
||||
);
|
||||
console.log(`parseAddress: [${Uint8Array.from(parseAddress.toBuffer())}]`);
|
||||
// const parseAddress = new PublicKey(
|
||||
// "DpoK8Zz69APV9ntjuY9C4LZCxANYMV56M2cbXEdkjxME"
|
||||
// );
|
||||
// console.log(`parseAddress: [${Uint8Array.from(parseAddress.toBuffer())}]`);
|
||||
|
||||
const accountInfo = await this.program.provider.connection.getAccountInfo(
|
||||
parseAddress
|
||||
);
|
||||
const byteArray = Uint8Array.from(accountInfo.data);
|
||||
console.log(`parseAddress Data [${byteArray.length}]: [${byteArray}]`);
|
||||
// const accountInfo = await this.program.provider.connection.getAccountInfo(
|
||||
// parseAddress
|
||||
// );
|
||||
// const byteArray = Uint8Array.from(accountInfo.data);
|
||||
// console.log(`parseAddress Data [${byteArray.length}]: [${byteArray}]`);
|
||||
|
||||
const owner = accountInfo.owner;
|
||||
console.log(`Owner: [${Uint8Array.from(owner.toBuffer())}]`);
|
||||
// const owner = accountInfo.owner;
|
||||
// console.log(`Owner: [${Uint8Array.from(owner.toBuffer())}]`);
|
||||
|
||||
console.log(accountInfo.lamports);
|
||||
// console.log(accountInfo.lamports);
|
||||
|
||||
// const jobData = Buffer.from(
|
||||
// OracleJob.encodeDelimited(
|
||||
// OracleJob.create({
|
||||
// tasks: [
|
||||
// OracleJob.Task.create({
|
||||
// httpTask: OracleJob.HttpTask.create({
|
||||
// url: "https://jsonplaceholder.typicode.com/todos/1",
|
||||
// }),
|
||||
// }),
|
||||
// ],
|
||||
// })
|
||||
// ).finish()
|
||||
// );
|
||||
|
||||
// const jobLen = jobData.length;
|
||||
// console.log(`JobData Len: ${jobLen}`);
|
||||
|
||||
// const bufferAccountSize =
|
||||
// this.program.account.bufferRelayerAccountData.size;
|
||||
// const bufferAccountSize = 2048;
|
||||
// const bufferRentExemption =
|
||||
// await this.program.provider.connection.getMinimumBalanceForRentExemption(
|
||||
// bufferAccountSize
|
||||
// );
|
||||
|
||||
// console.log(
|
||||
// chalkString(
|
||||
// "Buffer",
|
||||
// `${bufferRentExemption} lamports, ${
|
||||
// bufferRentExemption / LAMPORTS_PER_SOL
|
||||
// } SOL, ${bufferAccountSize} bytes`
|
||||
// )
|
||||
// );
|
||||
|
||||
// const escrowSize = spl.ACCOUNT_SIZE;
|
||||
// const escrowRentExemption =
|
||||
// await this.program.provider.connection.getMinimumBalanceForRentExemption(
|
||||
// escrowSize
|
||||
// );
|
||||
// console.log(
|
||||
// chalkString(
|
||||
// "Escrow",
|
||||
// `${escrowRentExemption} lamports, ${
|
||||
// escrowRentExemption / LAMPORTS_PER_SOL
|
||||
// } SOL, ${escrowSize} bytes`
|
||||
// )
|
||||
// );
|
||||
|
||||
// const jobAccountSize =
|
||||
// this.program.account.jobAccountData.size + jobData.length;
|
||||
// const jobRentExemption =
|
||||
// await this.program.provider.connection.getMinimumBalanceForRentExemption(
|
||||
// jobAccountSize
|
||||
// );
|
||||
|
||||
// console.log(
|
||||
// chalkString(
|
||||
// "Job",
|
||||
// `${jobRentExemption} lamports, ${
|
||||
// jobRentExemption / LAMPORTS_PER_SOL
|
||||
// } SOL, ${jobAccountSize} bytes`
|
||||
// )
|
||||
// );
|
||||
|
||||
// const permissionAccountSize =
|
||||
// this.program.account.permissionAccountData.size;
|
||||
// const permissionRentExemption =
|
||||
// await this.program.provider.connection.getMinimumBalanceForRentExemption(
|
||||
// permissionAccountSize
|
||||
// );
|
||||
// console.log(
|
||||
// chalkString(
|
||||
// "Permission",
|
||||
// `${permissionRentExemption} lamports, ${
|
||||
// permissionRentExemption / LAMPORTS_PER_SOL
|
||||
// } SOL, ${permissionAccountSize} bytes`
|
||||
// )
|
||||
// );
|
||||
|
||||
// const totalLamports =
|
||||
// bufferRentExemption +
|
||||
// escrowRentExemption +
|
||||
// jobRentExemption +
|
||||
// permissionRentExemption;
|
||||
|
||||
// console.log(chalkString("Total Lamports", totalLamports));
|
||||
|
||||
// console.log(chalkString("Total SOL", totalLamports / LAMPORTS_PER_SOL));
|
||||
}
|
||||
|
||||
async catch(error) {
|
||||
|
|
|
@ -246,6 +246,8 @@ message OracleJob {
|
|||
optional uint32 min_samples = 4;
|
||||
// Ending unix timestamp to collect values up to
|
||||
optional int32 ending_unix_timestamp = 5;
|
||||
// Execute the task to get the ending unix timestamp
|
||||
optional CronParseTask ending_unix_timestamp_task = 6;
|
||||
}
|
||||
|
||||
// Fetch the latest swap price on Serum's orderbook
|
||||
|
@ -435,6 +437,21 @@ message OracleJob {
|
|||
optional string pubkey = 1;
|
||||
}
|
||||
|
||||
// return a timestamp from a crontab instruction
|
||||
message CronParseTask {
|
||||
// the cron pattern to parse
|
||||
optional string cron_pattern = 1;
|
||||
// the timestamp offset
|
||||
// to calculate the next run
|
||||
optional int32 clock_offset = 2;
|
||||
// which type of clock to use
|
||||
enum ClockType {
|
||||
ORACLE = 0;
|
||||
SYSCLOCK = 1;
|
||||
}
|
||||
optional ClockType clock = 3;
|
||||
}
|
||||
|
||||
// Return the deserialized value from a stringified buffer.
|
||||
message BufferLayoutParseTask {
|
||||
// The buffer offset to start deserializing from.
|
||||
|
@ -518,6 +535,7 @@ message OracleJob {
|
|||
MarinadeStateTask marinade_state_task = 36;
|
||||
SolanaAccountDataFetchTask solana_account_data_fetch_task = 37;
|
||||
BufferLayoutParseTask buffer_layout_parse_task = 38;
|
||||
CronParseTask cron_parse_task = 39;
|
||||
}
|
||||
}
|
||||
// The chain of tasks to perform for this OracleJob.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@switchboard-xyz/switchboard-v2",
|
||||
"version": "0.0.123-beta",
|
||||
"version": "0.0.123-beta.4",
|
||||
"license": "MIT",
|
||||
"author": "mitch@switchboard.xyz",
|
||||
"description": "API wrapper for intergating with the Switchboardv2 program",
|
||||
|
|
|
@ -1929,6 +1929,9 @@ export namespace OracleJob {
|
|||
|
||||
/** TwapTask endingUnixTimestamp */
|
||||
endingUnixTimestamp?: (number|null);
|
||||
|
||||
/** TwapTask endingUnixTimestampTask */
|
||||
endingUnixTimestampTask?: (OracleJob.ICronParseTask|null);
|
||||
}
|
||||
|
||||
/** Represents a TwapTask. */
|
||||
|
@ -1955,6 +1958,9 @@ export namespace OracleJob {
|
|||
/** TwapTask endingUnixTimestamp. */
|
||||
public endingUnixTimestamp: number;
|
||||
|
||||
/** TwapTask endingUnixTimestampTask. */
|
||||
public endingUnixTimestampTask?: (OracleJob.ICronParseTask|null);
|
||||
|
||||
/**
|
||||
* Creates a new TwapTask instance using the specified properties.
|
||||
* @param [properties] Properties to set
|
||||
|
@ -4105,6 +4111,117 @@ export namespace OracleJob {
|
|||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
/** Properties of a CronParseTask. */
|
||||
interface ICronParseTask {
|
||||
|
||||
/** CronParseTask cronPattern */
|
||||
cronPattern?: (string|null);
|
||||
|
||||
/** CronParseTask clockOffset */
|
||||
clockOffset?: (number|null);
|
||||
|
||||
/** CronParseTask clock */
|
||||
clock?: (OracleJob.CronParseTask.ClockType|null);
|
||||
}
|
||||
|
||||
/** Represents a CronParseTask. */
|
||||
class CronParseTask implements ICronParseTask {
|
||||
|
||||
/**
|
||||
* Constructs a new CronParseTask.
|
||||
* @param [properties] Properties to set
|
||||
*/
|
||||
constructor(properties?: OracleJob.ICronParseTask);
|
||||
|
||||
/** CronParseTask cronPattern. */
|
||||
public cronPattern: string;
|
||||
|
||||
/** CronParseTask clockOffset. */
|
||||
public clockOffset: number;
|
||||
|
||||
/** CronParseTask clock. */
|
||||
public clock: OracleJob.CronParseTask.ClockType;
|
||||
|
||||
/**
|
||||
* Creates a new CronParseTask instance using the specified properties.
|
||||
* @param [properties] Properties to set
|
||||
* @returns CronParseTask instance
|
||||
*/
|
||||
public static create(properties?: OracleJob.ICronParseTask): OracleJob.CronParseTask;
|
||||
|
||||
/**
|
||||
* Encodes the specified CronParseTask message. Does not implicitly {@link OracleJob.CronParseTask.verify|verify} messages.
|
||||
* @param message CronParseTask message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encode(message: OracleJob.ICronParseTask, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Encodes the specified CronParseTask message, length delimited. Does not implicitly {@link OracleJob.CronParseTask.verify|verify} messages.
|
||||
* @param message CronParseTask message or plain object to encode
|
||||
* @param [writer] Writer to encode to
|
||||
* @returns Writer
|
||||
*/
|
||||
public static encodeDelimited(message: OracleJob.ICronParseTask, writer?: $protobuf.Writer): $protobuf.Writer;
|
||||
|
||||
/**
|
||||
* Decodes a CronParseTask message from the specified reader or buffer.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @param [length] Message length if known beforehand
|
||||
* @returns CronParseTask
|
||||
* @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.CronParseTask;
|
||||
|
||||
/**
|
||||
* Decodes a CronParseTask message from the specified reader or buffer, length delimited.
|
||||
* @param reader Reader or buffer to decode from
|
||||
* @returns CronParseTask
|
||||
* @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.CronParseTask;
|
||||
|
||||
/**
|
||||
* Verifies a CronParseTask 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 CronParseTask message from a plain object. Also converts values to their respective internal types.
|
||||
* @param object Plain object
|
||||
* @returns CronParseTask
|
||||
*/
|
||||
public static fromObject(object: { [k: string]: any }): OracleJob.CronParseTask;
|
||||
|
||||
/**
|
||||
* Creates a plain object from a CronParseTask message. Also converts values to other types if specified.
|
||||
* @param message CronParseTask
|
||||
* @param [options] Conversion options
|
||||
* @returns Plain object
|
||||
*/
|
||||
public static toObject(message: OracleJob.CronParseTask, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
|
||||
/**
|
||||
* Converts this CronParseTask to JSON.
|
||||
* @returns JSON object
|
||||
*/
|
||||
public toJSON(): { [k: string]: any };
|
||||
}
|
||||
|
||||
namespace CronParseTask {
|
||||
|
||||
/** ClockType enum. */
|
||||
enum ClockType {
|
||||
ORACLE = 0,
|
||||
SYSCLOCK = 1
|
||||
}
|
||||
}
|
||||
|
||||
/** Properties of a BufferLayoutParseTask. */
|
||||
interface IBufferLayoutParseTask {
|
||||
|
||||
|
@ -4347,6 +4464,9 @@ export namespace OracleJob {
|
|||
|
||||
/** Task bufferLayoutParseTask */
|
||||
bufferLayoutParseTask?: (OracleJob.IBufferLayoutParseTask|null);
|
||||
|
||||
/** Task cronParseTask */
|
||||
cronParseTask?: (OracleJob.ICronParseTask|null);
|
||||
}
|
||||
|
||||
/** Represents a Task. */
|
||||
|
@ -4469,8 +4589,11 @@ export namespace OracleJob {
|
|||
/** Task bufferLayoutParseTask. */
|
||||
public bufferLayoutParseTask?: (OracleJob.IBufferLayoutParseTask|null);
|
||||
|
||||
/** Task cronParseTask. */
|
||||
public cronParseTask?: (OracleJob.ICronParseTask|null);
|
||||
|
||||
/** Task Task. */
|
||||
public Task?: ("httpTask"|"jsonParseTask"|"medianTask"|"meanTask"|"websocketTask"|"divideTask"|"multiplyTask"|"lpTokenPriceTask"|"lpExchangeRateTask"|"conditionalTask"|"valueTask"|"maxTask"|"regexExtractTask"|"xstepPriceTask"|"addTask"|"subtractTask"|"twapTask"|"serumSwapTask"|"powTask"|"lendingRateTask"|"mangoPerpMarketTask"|"jupiterSwapTask"|"perpMarketTask"|"oracleTask"|"anchorFetchTask"|"defiKingdomsTask"|"tpsTask"|"splStakePoolTask"|"splTokenParseTask"|"uniswapExchangeRateTask"|"sushiswapExchangeRateTask"|"pancakeswapExchangeRateTask"|"cacheTask"|"sysclockOffsetTask"|"marinadeStateTask"|"solanaAccountDataFetchTask"|"bufferLayoutParseTask");
|
||||
public Task?: ("httpTask"|"jsonParseTask"|"medianTask"|"meanTask"|"websocketTask"|"divideTask"|"multiplyTask"|"lpTokenPriceTask"|"lpExchangeRateTask"|"conditionalTask"|"valueTask"|"maxTask"|"regexExtractTask"|"xstepPriceTask"|"addTask"|"subtractTask"|"twapTask"|"serumSwapTask"|"powTask"|"lendingRateTask"|"mangoPerpMarketTask"|"jupiterSwapTask"|"perpMarketTask"|"oracleTask"|"anchorFetchTask"|"defiKingdomsTask"|"tpsTask"|"splStakePoolTask"|"splTokenParseTask"|"uniswapExchangeRateTask"|"sushiswapExchangeRateTask"|"pancakeswapExchangeRateTask"|"cacheTask"|"sysclockOffsetTask"|"marinadeStateTask"|"solanaAccountDataFetchTask"|"bufferLayoutParseTask"|"cronParseTask");
|
||||
|
||||
/**
|
||||
* Creates a new Task instance using the specified properties.
|
||||
|
|
|
@ -4936,6 +4936,7 @@
|
|||
* @property {boolean|null} [weightByPropagationTime] TwapTask weightByPropagationTime
|
||||
* @property {number|null} [minSamples] TwapTask minSamples
|
||||
* @property {number|null} [endingUnixTimestamp] TwapTask endingUnixTimestamp
|
||||
* @property {OracleJob.ICronParseTask|null} [endingUnixTimestampTask] TwapTask endingUnixTimestampTask
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -4993,6 +4994,14 @@
|
|||
*/
|
||||
TwapTask.prototype.endingUnixTimestamp = 0;
|
||||
|
||||
/**
|
||||
* TwapTask endingUnixTimestampTask.
|
||||
* @member {OracleJob.ICronParseTask|null|undefined} endingUnixTimestampTask
|
||||
* @memberof OracleJob.TwapTask
|
||||
* @instance
|
||||
*/
|
||||
TwapTask.prototype.endingUnixTimestampTask = null;
|
||||
|
||||
/**
|
||||
* Creates a new TwapTask instance using the specified properties.
|
||||
* @function create
|
||||
|
@ -5027,6 +5036,8 @@
|
|||
writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.minSamples);
|
||||
if (message.endingUnixTimestamp != null && Object.hasOwnProperty.call(message, "endingUnixTimestamp"))
|
||||
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.endingUnixTimestamp);
|
||||
if (message.endingUnixTimestampTask != null && Object.hasOwnProperty.call(message, "endingUnixTimestampTask"))
|
||||
$root.OracleJob.CronParseTask.encode(message.endingUnixTimestampTask, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
|
@ -5076,6 +5087,9 @@
|
|||
case 5:
|
||||
message.endingUnixTimestamp = reader.int32();
|
||||
break;
|
||||
case 6:
|
||||
message.endingUnixTimestampTask = $root.OracleJob.CronParseTask.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
|
@ -5126,6 +5140,11 @@
|
|||
if (message.endingUnixTimestamp != null && message.hasOwnProperty("endingUnixTimestamp"))
|
||||
if (!$util.isInteger(message.endingUnixTimestamp))
|
||||
return "endingUnixTimestamp: integer expected";
|
||||
if (message.endingUnixTimestampTask != null && message.hasOwnProperty("endingUnixTimestampTask")) {
|
||||
var error = $root.OracleJob.CronParseTask.verify(message.endingUnixTimestampTask);
|
||||
if (error)
|
||||
return "endingUnixTimestampTask." + error;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -5151,6 +5170,11 @@
|
|||
message.minSamples = object.minSamples >>> 0;
|
||||
if (object.endingUnixTimestamp != null)
|
||||
message.endingUnixTimestamp = object.endingUnixTimestamp | 0;
|
||||
if (object.endingUnixTimestampTask != null) {
|
||||
if (typeof object.endingUnixTimestampTask !== "object")
|
||||
throw TypeError(".OracleJob.TwapTask.endingUnixTimestampTask: object expected");
|
||||
message.endingUnixTimestampTask = $root.OracleJob.CronParseTask.fromObject(object.endingUnixTimestampTask);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
|
@ -5173,6 +5197,7 @@
|
|||
object.weightByPropagationTime = false;
|
||||
object.minSamples = 0;
|
||||
object.endingUnixTimestamp = 0;
|
||||
object.endingUnixTimestampTask = null;
|
||||
}
|
||||
if (message.aggregatorPubkey != null && message.hasOwnProperty("aggregatorPubkey"))
|
||||
object.aggregatorPubkey = message.aggregatorPubkey;
|
||||
|
@ -5184,6 +5209,8 @@
|
|||
object.minSamples = message.minSamples;
|
||||
if (message.endingUnixTimestamp != null && message.hasOwnProperty("endingUnixTimestamp"))
|
||||
object.endingUnixTimestamp = message.endingUnixTimestamp;
|
||||
if (message.endingUnixTimestampTask != null && message.hasOwnProperty("endingUnixTimestampTask"))
|
||||
object.endingUnixTimestampTask = $root.OracleJob.CronParseTask.toObject(message.endingUnixTimestampTask, options);
|
||||
return object;
|
||||
};
|
||||
|
||||
|
@ -9900,6 +9927,265 @@
|
|||
return SolanaAccountDataFetchTask;
|
||||
})();
|
||||
|
||||
OracleJob.CronParseTask = (function() {
|
||||
|
||||
/**
|
||||
* Properties of a CronParseTask.
|
||||
* @memberof OracleJob
|
||||
* @interface ICronParseTask
|
||||
* @property {string|null} [cronPattern] CronParseTask cronPattern
|
||||
* @property {number|null} [clockOffset] CronParseTask clockOffset
|
||||
* @property {OracleJob.CronParseTask.ClockType|null} [clock] CronParseTask clock
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new CronParseTask.
|
||||
* @memberof OracleJob
|
||||
* @classdesc Represents a CronParseTask.
|
||||
* @implements ICronParseTask
|
||||
* @constructor
|
||||
* @param {OracleJob.ICronParseTask=} [properties] Properties to set
|
||||
*/
|
||||
function CronParseTask(properties) {
|
||||
if (properties)
|
||||
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||
if (properties[keys[i]] != null)
|
||||
this[keys[i]] = properties[keys[i]];
|
||||
}
|
||||
|
||||
/**
|
||||
* CronParseTask cronPattern.
|
||||
* @member {string} cronPattern
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @instance
|
||||
*/
|
||||
CronParseTask.prototype.cronPattern = "";
|
||||
|
||||
/**
|
||||
* CronParseTask clockOffset.
|
||||
* @member {number} clockOffset
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @instance
|
||||
*/
|
||||
CronParseTask.prototype.clockOffset = 0;
|
||||
|
||||
/**
|
||||
* CronParseTask clock.
|
||||
* @member {OracleJob.CronParseTask.ClockType} clock
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @instance
|
||||
*/
|
||||
CronParseTask.prototype.clock = 0;
|
||||
|
||||
/**
|
||||
* Creates a new CronParseTask instance using the specified properties.
|
||||
* @function create
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {OracleJob.ICronParseTask=} [properties] Properties to set
|
||||
* @returns {OracleJob.CronParseTask} CronParseTask instance
|
||||
*/
|
||||
CronParseTask.create = function create(properties) {
|
||||
return new CronParseTask(properties);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified CronParseTask message. Does not implicitly {@link OracleJob.CronParseTask.verify|verify} messages.
|
||||
* @function encode
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {OracleJob.ICronParseTask} message CronParseTask message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
CronParseTask.encode = function encode(message, writer) {
|
||||
if (!writer)
|
||||
writer = $Writer.create();
|
||||
if (message.cronPattern != null && Object.hasOwnProperty.call(message, "cronPattern"))
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.cronPattern);
|
||||
if (message.clockOffset != null && Object.hasOwnProperty.call(message, "clockOffset"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.clockOffset);
|
||||
if (message.clock != null && Object.hasOwnProperty.call(message, "clock"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.clock);
|
||||
return writer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes the specified CronParseTask message, length delimited. Does not implicitly {@link OracleJob.CronParseTask.verify|verify} messages.
|
||||
* @function encodeDelimited
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {OracleJob.ICronParseTask} message CronParseTask message or plain object to encode
|
||||
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||
* @returns {$protobuf.Writer} Writer
|
||||
*/
|
||||
CronParseTask.encodeDelimited = function encodeDelimited(message, writer) {
|
||||
return this.encode(message, writer).ldelim();
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a CronParseTask message from the specified reader or buffer.
|
||||
* @function decode
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @param {number} [length] Message length if known beforehand
|
||||
* @returns {OracleJob.CronParseTask} CronParseTask
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
CronParseTask.decode = function decode(reader, length) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = $Reader.create(reader);
|
||||
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.OracleJob.CronParseTask();
|
||||
while (reader.pos < end) {
|
||||
var tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.cronPattern = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.clockOffset = reader.int32();
|
||||
break;
|
||||
case 3:
|
||||
message.clock = reader.int32();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a CronParseTask message from the specified reader or buffer, length delimited.
|
||||
* @function decodeDelimited
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||
* @returns {OracleJob.CronParseTask} CronParseTask
|
||||
* @throws {Error} If the payload is not a reader or valid buffer
|
||||
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||
*/
|
||||
CronParseTask.decodeDelimited = function decodeDelimited(reader) {
|
||||
if (!(reader instanceof $Reader))
|
||||
reader = new $Reader(reader);
|
||||
return this.decode(reader, reader.uint32());
|
||||
};
|
||||
|
||||
/**
|
||||
* Verifies a CronParseTask message.
|
||||
* @function verify
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {Object.<string,*>} message Plain object to verify
|
||||
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||
*/
|
||||
CronParseTask.verify = function verify(message) {
|
||||
if (typeof message !== "object" || message === null)
|
||||
return "object expected";
|
||||
if (message.cronPattern != null && message.hasOwnProperty("cronPattern"))
|
||||
if (!$util.isString(message.cronPattern))
|
||||
return "cronPattern: string expected";
|
||||
if (message.clockOffset != null && message.hasOwnProperty("clockOffset"))
|
||||
if (!$util.isInteger(message.clockOffset))
|
||||
return "clockOffset: integer expected";
|
||||
if (message.clock != null && message.hasOwnProperty("clock"))
|
||||
switch (message.clock) {
|
||||
default:
|
||||
return "clock: enum value expected";
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a CronParseTask message from a plain object. Also converts values to their respective internal types.
|
||||
* @function fromObject
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {Object.<string,*>} object Plain object
|
||||
* @returns {OracleJob.CronParseTask} CronParseTask
|
||||
*/
|
||||
CronParseTask.fromObject = function fromObject(object) {
|
||||
if (object instanceof $root.OracleJob.CronParseTask)
|
||||
return object;
|
||||
var message = new $root.OracleJob.CronParseTask();
|
||||
if (object.cronPattern != null)
|
||||
message.cronPattern = String(object.cronPattern);
|
||||
if (object.clockOffset != null)
|
||||
message.clockOffset = object.clockOffset | 0;
|
||||
switch (object.clock) {
|
||||
case "ORACLE":
|
||||
case 0:
|
||||
message.clock = 0;
|
||||
break;
|
||||
case "SYSCLOCK":
|
||||
case 1:
|
||||
message.clock = 1;
|
||||
break;
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a plain object from a CronParseTask message. Also converts values to other types if specified.
|
||||
* @function toObject
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @static
|
||||
* @param {OracleJob.CronParseTask} message CronParseTask
|
||||
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||
* @returns {Object.<string,*>} Plain object
|
||||
*/
|
||||
CronParseTask.toObject = function toObject(message, options) {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults) {
|
||||
object.cronPattern = "";
|
||||
object.clockOffset = 0;
|
||||
object.clock = options.enums === String ? "ORACLE" : 0;
|
||||
}
|
||||
if (message.cronPattern != null && message.hasOwnProperty("cronPattern"))
|
||||
object.cronPattern = message.cronPattern;
|
||||
if (message.clockOffset != null && message.hasOwnProperty("clockOffset"))
|
||||
object.clockOffset = message.clockOffset;
|
||||
if (message.clock != null && message.hasOwnProperty("clock"))
|
||||
object.clock = options.enums === String ? $root.OracleJob.CronParseTask.ClockType[message.clock] : message.clock;
|
||||
return object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts this CronParseTask to JSON.
|
||||
* @function toJSON
|
||||
* @memberof OracleJob.CronParseTask
|
||||
* @instance
|
||||
* @returns {Object.<string,*>} JSON object
|
||||
*/
|
||||
CronParseTask.prototype.toJSON = function toJSON() {
|
||||
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||
};
|
||||
|
||||
/**
|
||||
* ClockType enum.
|
||||
* @name OracleJob.CronParseTask.ClockType
|
||||
* @enum {number}
|
||||
* @property {number} ORACLE=0 ORACLE value
|
||||
* @property {number} SYSCLOCK=1 SYSCLOCK value
|
||||
*/
|
||||
CronParseTask.ClockType = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
values[valuesById[0] = "ORACLE"] = 0;
|
||||
values[valuesById[1] = "SYSCLOCK"] = 1;
|
||||
return values;
|
||||
})();
|
||||
|
||||
return CronParseTask;
|
||||
})();
|
||||
|
||||
OracleJob.BufferLayoutParseTask = (function() {
|
||||
|
||||
/**
|
||||
|
@ -10313,6 +10599,7 @@
|
|||
* @property {OracleJob.IMarinadeStateTask|null} [marinadeStateTask] Task marinadeStateTask
|
||||
* @property {OracleJob.ISolanaAccountDataFetchTask|null} [solanaAccountDataFetchTask] Task solanaAccountDataFetchTask
|
||||
* @property {OracleJob.IBufferLayoutParseTask|null} [bufferLayoutParseTask] Task bufferLayoutParseTask
|
||||
* @property {OracleJob.ICronParseTask|null} [cronParseTask] Task cronParseTask
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -10626,17 +10913,25 @@
|
|||
*/
|
||||
Task.prototype.bufferLayoutParseTask = null;
|
||||
|
||||
/**
|
||||
* Task cronParseTask.
|
||||
* @member {OracleJob.ICronParseTask|null|undefined} cronParseTask
|
||||
* @memberof OracleJob.Task
|
||||
* @instance
|
||||
*/
|
||||
Task.prototype.cronParseTask = null;
|
||||
|
||||
// OneOf field names bound to virtual getters and setters
|
||||
var $oneOfFields;
|
||||
|
||||
/**
|
||||
* Task Task.
|
||||
* @member {"httpTask"|"jsonParseTask"|"medianTask"|"meanTask"|"websocketTask"|"divideTask"|"multiplyTask"|"lpTokenPriceTask"|"lpExchangeRateTask"|"conditionalTask"|"valueTask"|"maxTask"|"regexExtractTask"|"xstepPriceTask"|"addTask"|"subtractTask"|"twapTask"|"serumSwapTask"|"powTask"|"lendingRateTask"|"mangoPerpMarketTask"|"jupiterSwapTask"|"perpMarketTask"|"oracleTask"|"anchorFetchTask"|"defiKingdomsTask"|"tpsTask"|"splStakePoolTask"|"splTokenParseTask"|"uniswapExchangeRateTask"|"sushiswapExchangeRateTask"|"pancakeswapExchangeRateTask"|"cacheTask"|"sysclockOffsetTask"|"marinadeStateTask"|"solanaAccountDataFetchTask"|"bufferLayoutParseTask"|undefined} Task
|
||||
* @member {"httpTask"|"jsonParseTask"|"medianTask"|"meanTask"|"websocketTask"|"divideTask"|"multiplyTask"|"lpTokenPriceTask"|"lpExchangeRateTask"|"conditionalTask"|"valueTask"|"maxTask"|"regexExtractTask"|"xstepPriceTask"|"addTask"|"subtractTask"|"twapTask"|"serumSwapTask"|"powTask"|"lendingRateTask"|"mangoPerpMarketTask"|"jupiterSwapTask"|"perpMarketTask"|"oracleTask"|"anchorFetchTask"|"defiKingdomsTask"|"tpsTask"|"splStakePoolTask"|"splTokenParseTask"|"uniswapExchangeRateTask"|"sushiswapExchangeRateTask"|"pancakeswapExchangeRateTask"|"cacheTask"|"sysclockOffsetTask"|"marinadeStateTask"|"solanaAccountDataFetchTask"|"bufferLayoutParseTask"|"cronParseTask"|undefined} Task
|
||||
* @memberof OracleJob.Task
|
||||
* @instance
|
||||
*/
|
||||
Object.defineProperty(Task.prototype, "Task", {
|
||||
get: $util.oneOfGetter($oneOfFields = ["httpTask", "jsonParseTask", "medianTask", "meanTask", "websocketTask", "divideTask", "multiplyTask", "lpTokenPriceTask", "lpExchangeRateTask", "conditionalTask", "valueTask", "maxTask", "regexExtractTask", "xstepPriceTask", "addTask", "subtractTask", "twapTask", "serumSwapTask", "powTask", "lendingRateTask", "mangoPerpMarketTask", "jupiterSwapTask", "perpMarketTask", "oracleTask", "anchorFetchTask", "defiKingdomsTask", "tpsTask", "splStakePoolTask", "splTokenParseTask", "uniswapExchangeRateTask", "sushiswapExchangeRateTask", "pancakeswapExchangeRateTask", "cacheTask", "sysclockOffsetTask", "marinadeStateTask", "solanaAccountDataFetchTask", "bufferLayoutParseTask"]),
|
||||
get: $util.oneOfGetter($oneOfFields = ["httpTask", "jsonParseTask", "medianTask", "meanTask", "websocketTask", "divideTask", "multiplyTask", "lpTokenPriceTask", "lpExchangeRateTask", "conditionalTask", "valueTask", "maxTask", "regexExtractTask", "xstepPriceTask", "addTask", "subtractTask", "twapTask", "serumSwapTask", "powTask", "lendingRateTask", "mangoPerpMarketTask", "jupiterSwapTask", "perpMarketTask", "oracleTask", "anchorFetchTask", "defiKingdomsTask", "tpsTask", "splStakePoolTask", "splTokenParseTask", "uniswapExchangeRateTask", "sushiswapExchangeRateTask", "pancakeswapExchangeRateTask", "cacheTask", "sysclockOffsetTask", "marinadeStateTask", "solanaAccountDataFetchTask", "bufferLayoutParseTask", "cronParseTask"]),
|
||||
set: $util.oneOfSetter($oneOfFields)
|
||||
});
|
||||
|
||||
|
@ -10738,6 +11033,8 @@
|
|||
$root.OracleJob.SolanaAccountDataFetchTask.encode(message.solanaAccountDataFetchTask, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim();
|
||||
if (message.bufferLayoutParseTask != null && Object.hasOwnProperty.call(message, "bufferLayoutParseTask"))
|
||||
$root.OracleJob.BufferLayoutParseTask.encode(message.bufferLayoutParseTask, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim();
|
||||
if (message.cronParseTask != null && Object.hasOwnProperty.call(message, "cronParseTask"))
|
||||
$root.OracleJob.CronParseTask.encode(message.cronParseTask, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim();
|
||||
return writer;
|
||||
};
|
||||
|
||||
|
@ -10883,6 +11180,9 @@
|
|||
case 38:
|
||||
message.bufferLayoutParseTask = $root.OracleJob.BufferLayoutParseTask.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 39:
|
||||
message.cronParseTask = $root.OracleJob.CronParseTask.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
|
@ -11287,6 +11587,16 @@
|
|||
return "bufferLayoutParseTask." + error;
|
||||
}
|
||||
}
|
||||
if (message.cronParseTask != null && message.hasOwnProperty("cronParseTask")) {
|
||||
if (properties.Task === 1)
|
||||
return "Task: multiple values";
|
||||
properties.Task = 1;
|
||||
{
|
||||
var error = $root.OracleJob.CronParseTask.verify(message.cronParseTask);
|
||||
if (error)
|
||||
return "cronParseTask." + error;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -11487,6 +11797,11 @@
|
|||
throw TypeError(".OracleJob.Task.bufferLayoutParseTask: object expected");
|
||||
message.bufferLayoutParseTask = $root.OracleJob.BufferLayoutParseTask.fromObject(object.bufferLayoutParseTask);
|
||||
}
|
||||
if (object.cronParseTask != null) {
|
||||
if (typeof object.cronParseTask !== "object")
|
||||
throw TypeError(".OracleJob.Task.cronParseTask: object expected");
|
||||
message.cronParseTask = $root.OracleJob.CronParseTask.fromObject(object.cronParseTask);
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
|
@ -11688,6 +12003,11 @@
|
|||
if (options.oneofs)
|
||||
object.Task = "bufferLayoutParseTask";
|
||||
}
|
||||
if (message.cronParseTask != null && message.hasOwnProperty("cronParseTask")) {
|
||||
object.cronParseTask = $root.OracleJob.CronParseTask.toObject(message.cronParseTask, options);
|
||||
if (options.oneofs)
|
||||
object.Task = "cronParseTask";
|
||||
}
|
||||
return object;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ export const SBV2_MAINNET_PID = new PublicKey(
|
|||
);
|
||||
|
||||
export const GOVERNANCE_PID = new PublicKey(
|
||||
//"GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"
|
||||
"2iNnEMZuLk2TysefLvXtS6kyvCFC7CDUTLLeatVgRend"
|
||||
"GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw"
|
||||
// "2iNnEMZuLk2TysefLvXtS6kyvCFC7CDUTLLeatVgRend"
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["mocha", "node", "long"],
|
||||
"types": ["mocha", "node", "long", "big.js"],
|
||||
"allowJs": true,
|
||||
"checkJs": false,
|
||||
// strict
|
||||
|
|
Loading…
Reference in New Issue