-switchboardpy
+switchboardpy
-The Switchboard Python v2 Wrapper.
-The Switchboard Python v2 Wrapper.
View Source
-"""The Switchboard Python v2 Wrapper.""" +++View Source
++- +"""The Switchboard Python v2 Wrapper.""" from switchboardpy.aggregator import ( AggregatorAccount, @@ -910,24 +2322,24 @@ switchboardpy "VaultTransferParams", "SwitchboardDecimal" ] -
View Source
-@dataclass +++View Source
++- +@dataclass class AccountParams: """program referencing the Switchboard program and IDL.""" @@ -941,77 +2353,83 @@ switchboardpy """Keypair of the account being referenced. This may not always be populated.""" keypair: Keypair = None -
program referencing the Switchboard program and IDL.
-program referencing the Switchboard program and IDL.
++ Public key of the account being referenced. This will always be + populated within the account wrapper. +
++ Keypair of the account being referenced. This may not always be + populated. +
+Public key of the account being referenced. This will always be populated -within the account wrapper.
-Keypair of the account being referenced. This may not always be populated.
-View Source
-class AggregatorAccount: +++View Source
++- +class AggregatorAccount: """AggregatorAccount is the wrapper for an Aggregator, the structure for that keeps aggregated feed data / metadata. Attributes: @@ -1595,29 +3013,40 @@ within the account wrapper. remaining_accounts=[{"is_signer": False, "is_writable": True, "pubkey": pubkey} for pubkey in remaining_accounts] ) ) -
AggregatorAccount is the wrapper for an Aggregator, the structure for that keeps aggregated feed data / metadata.
++ AggregatorAccount is the wrapper for an Aggregator, the structure + for that keeps aggregated feed data / metadata. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This aggregator's public key - keypair (Keypair | None): this aggregator's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This aggregator's public key keypair + (Keypair | None): this aggregator's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -1625,84 +3054,89 @@ within the account wrapper. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Get name of an aggregator.
-Returns: name string of the aggregator
+Get name of an aggregator.
- -Args: - aggregator (Any): Anchor-loaded aggregator
- -Returns: - name string of the aggregator
-View Source
-@staticmethod ++++@staticmethod def get_name(aggregator: Any) -> str: return ''.join(map(chr, *aggregator.name)).decode("utf-8").replace(u"\u0000", "*").encode("utf-8") -
View Source
-async def load_data(self): ++++async def load_data(self): aggregator = await self.program.account["AggregatorAccountData"].fetch(self.public_key) aggregator.ebuf = None return aggregator -
View Source
-async def load_history(self, aggregator: Any = None) -> Any: ++++async def load_history(self, aggregator: Any = None) -> Any: # if aggregator data passed in - use that, else load this aggregator aggregator = aggregator if aggregator else await self.load_data() @@ -1740,70 +3174,85 @@ within the account wrapper. else: front.append(row) return front.extend(tail) -
View Source
-async def get_latest_value(self, aggregator: Optional[Any] = None) -> Decimal: ++++async def get_latest_value(self, aggregator: Optional[Any] = None) -> Decimal: aggregator = aggregator if aggregator else await self.load_data() if hasattr(aggregator, 'latest_confirmed_round') and aggregator.latest_confirmed_round.num_success == 0: raise ValueError('Aggregator currently holds no value.') return SwitchboardDecimal.sbd_to_decimal(aggregator.latest_confirmed_round.result) -
View Source
-async def get_latest_feed_timestamp(self, aggregator: Optional[Any] = None) -> Decimal: ++++async def get_latest_feed_timestamp(self, aggregator: Optional[Any] = None) -> Decimal: aggregator = aggregator if aggregator else await self.load_data() if hasattr(aggregator, 'latest_confirmed_round') and aggregator.latest_confirmed_round.num_success == 0: raise ValueError('Aggregator currently holds no value.') return aggregator.latest_confirmed_round.round_open_timestamp -
View Source
-@staticmethod ++++@staticmethod def should_report_value(value: Decimal, aggregator: Optional[Any] = None) -> bool: if aggregator.latestConfirmedRound and aggregator.latest_confirmed_round.num_success == 0: return True @@ -1821,24 +3270,33 @@ within the account wrapper. if value > latest_result + variance_threshold: return True return False -
View Source
-async def get_confirmed_round_results(self, aggregator: Optional[Any] = None) -> Decimal: ++++async def get_confirmed_round_results(self, aggregator: Optional[Any] = None) -> Decimal: aggregator = aggregator if aggregator else await self.load_data() if hasattr(aggregator, 'latest_confirmed_round') and aggregator.latest_confirmed_round.num_success == 0: @@ -1851,25 +3309,30 @@ within the account wrapper. "value": SwitchboardDecimal.sbd_to_decimal(aggregator.latest_confirmed_round.medians_data[i]) }) return results -
View Source
-@staticmethod ++++@staticmethod def produce_job_hash(jobs: list[OracleJob]): hash = hashlib.sha256() for job in jobs: @@ -1877,24 +3340,28 @@ within the account wrapper. job_hasher.update(job.SerializeToString()) hash.update(job_hasher.digest()) return hash -
View Source
-async def load_jobs(self, aggregator: Optional[Any] = None) -> Decimal: ++++async def load_jobs(self, aggregator: Optional[Any] = None) -> Decimal: coder = anchorpy.AccountsCoder(self.program.idl) aggregator = aggregator if aggregator else await self.load_data() job_accounts_raw = await anchorpy.utils.rpc.get_multiple_accounts(self.program.provider, aggregator.job_pubkeys_data)[:aggregator.job_pubkeys_size] @@ -1903,24 +3370,28 @@ within the account wrapper. # Deserialize OracleJob objects from each decoded JobAccountData return [OracleJob.ParseFromString(coder.decode(job)) for job in job_accounts_raw] -
View Source
-async def load_hashes(self, aggregator: Optional[Any] = None) -> Decimal: ++++async def load_hashes(self, aggregator: Optional[Any] = None) -> Decimal: coder = anchorpy.AccountsCoder(self.program.idl) aggregator = aggregator if aggregator else await self.loadData() job_accounts_raw = await anchorpy.utils.rpc.get_multiple_accounts(self.program.provider, aggregator.job_pubkeys_data)[:aggregator.job_pubkeys_size] @@ -1929,47 +3400,52 @@ within the account wrapper. # get hashes from each decoded JobAccountData return [coder.decode(job).hash for job in job_accounts_raw] -
View Source
-def size(self): ++++def size(self): return self.program.account["AggregatorAccountData"].size -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, aggregator_init_params: AggregatorInitParams): aggregator_account = aggregator_init_params.keypair or Keypair.generate() authority = aggregator_init_params.authority or aggregator_account.public_key @@ -2017,27 +3493,31 @@ within the account wrapper. ) ) return AggregatorAccount(AccountParams(program=program, keypair=aggregator_account)) -
View Source
-async def set_history_buffer(self, params: AggregatorSetHistoryBufferParams): ++++async def set_history_buffer(self, params: AggregatorSetHistoryBufferParams): buffer = Keypair.generate() program = self.program authority = params.authority or self.keypair @@ -2068,28 +3548,30 @@ within the account wrapper. ] ) ) -
View Source
-async def add_job(self, job: JobAccount, authority: Optional[Keypair] = None) -> TransactionSignature: ++++async def add_job(self, job: JobAccount, authority: Optional[Keypair] = None) -> TransactionSignature: authority = authority or self.keypair return await self.program.rpc['aggregator_add_job']( @@ -2105,27 +3587,29 @@ within the account wrapper. signers=[authority] ) ) -
View Source
-async def lock(self, authority: Optional[Keypair] = None) -> TransactionSignature: ++++async def lock(self, authority: Optional[Keypair] = None) -> TransactionSignature: authority = authority or self.keypair return await self.program.rpc['aggregator_lock']( ctx=anchorpy.Context( @@ -2136,28 +3620,29 @@ within the account wrapper. signers=[authority] ) ) -
View Source
-async def remove_job(self, aggregator: Any, oracle_account: OracleAccount, params: AggregatorSaveResultParams) -> TransactionSignature: ++++async def remove_job(self, aggregator: Any, oracle_account: OracleAccount, params: AggregatorSaveResultParams) -> TransactionSignature: return await self.program.provider.send( tx=( await self.save_result_txn( @@ -2201,52 +3690,58 @@ within the account wrapper. ) ) ) -
View Source
-async def get_oracle_index(self, oracle_pubkey: PublicKey): ++++async def get_oracle_index(self, oracle_pubkey: PublicKey): aggregator = await self.load_data() for i, curr_oracle_pubkey in enumerate(aggregator.current_round.oracle_pubkeys_data): if curr_oracle_pubkey == oracle_pubkey: return i return -1 -
View Source
-async def save_result_txn(self, aggregator: Any, oracle_account: OracleAccount, params: AggregatorSaveResultParams): ++++async def save_result_txn(self, aggregator: Any, oracle_account: OracleAccount, params: AggregatorSaveResultParams): payer_keypair = Keypair.from_secret_key(self.program.provider.wallet.payer.secret_key) remaining_accounts: list[PublicKey] = [] for i in range(aggregator.oracle_request_batch_size): @@ -2308,27 +3803,25 @@ within the account wrapper. remaining_accounts=[{"is_signer": False, "is_writable": True, "pubkey": pubkey} for pubkey in remaining_accounts] ) ) -
View Source
-@dataclass +++View Source
++- +@dataclass class AggregatorHistoryRow: """AggregatorHistoryRow is a wrapper for the row structure of elements in the aggregator history buffer. @@ -2356,59 +3849,75 @@ within the account wrapper. decimal = SwitchboardDecimal.sbd_to_decimal({"mantissa": mantissa, "scale": scale}) res = AggregatorHistoryRow(timestamp, decimal) return res -
AggregatorHistoryRow is a wrapper for the row structure of elements in the aggregator history buffer.
++ AggregatorHistoryRow is a wrapper for the row structure of elements + in the aggregator history buffer. +
-Attributes: - timestamp (int): timestamp of the aggregator result - value (Decimal): Aggregator value at the timestamp
-+ Attributes: timestamp (int): timestamp of the aggregator result + value (Decimal): Aggregator value at the timestamp +
++ Generate an AggregatorHistoryRow from a retrieved buffer + representation +
-+ Args: buf (list): Anchor-loaded buffer representation of + AggregatorHistoryRow +
- value: decimal.Decimal -Returns: AggregatorHistoryRow
+Generate an AggregatorHistoryRow from a retrieved buffer representation
- -Args: - buf (list): Anchor-loaded buffer representation of AggregatorHistoryRow
- -Returns: - AggregatorHistoryRow
-View Source
-@staticmethod ++++@staticmethod def from_buffer(buf: bytes): timestamp: int = struct.unpack_from("<L", buf[:8])[0] mantissa: int = struct.unpack_from("<L", buf[8:24])[0] @@ -2416,27 +3925,25 @@ within the account wrapper. decimal = SwitchboardDecimal.sbd_to_decimal({"mantissa": mantissa, "scale": scale}) res = AggregatorHistoryRow(timestamp, decimal) return res -
View Source
-@dataclass +++View Source
++- +@dataclass class AggregatorInitParams: """Number of oracles to request on aggregator update.""" batch_size: int @@ -2497,226 +4004,298 @@ within the account wrapper. the aggregator keypair. """ authority: PublicKey = None -
Number of oracles to request on aggregator update.
-Number of oracles to request on aggregator update.
++ Minimum number of oracle responses required before a round is + validated. +
+Minimum number of seconds required between aggregator rounds.
+Minimum number of oracle responses required before a round is validated.
-Minimum number of seconds required between aggregator rounds.
+The queue to which this aggregator will be linked
+Minimum number of seconds required between aggregator rounds.
-Name of the aggregator to store on-chain.
+Metadata of the aggregator to store on-chain.
+Minimum number of seconds required between aggregator rounds.
-unix_timestamp for which no feed update will occur before.
++ Change percentage required between a previous round and the + current round. If variance percentage is not met, reject new + oracle responses. +
+The queue to which this aggregator will be linked
-+ Number of seconds for which, even if the variance threshold is not + passed, accept new responses from oracles. +
++ unix_timestamp after which funds may be withdrawn from the + aggregator. null/undefined/0 means the feed has no expiration. +
++ An optional wallet for receiving kickbacks from job usage in + feeds. Defaults to token vault. +
+Change percentage required between a previous round and the current round. -If variance percentage is not met, reject new oracle responses.
-Number of seconds for which, even if the variance threshold is not passed, -accept new responses from oracles.
-unix_timestamp after which funds may be withdrawn from the aggregator. -null/undefined/0 means the feed has no expiration.
-An optional wallet for receiving kickbacks from job usage in feeds. -Defaults to token vault.
-An optional wallet for receiving kickbacks from job usage in feeds. -Defaults to token vault.
-View Source
-@dataclass +++View Source
++- +@dataclass class AggregatorOpenRoundParams: """The oracle queue from which oracles are assigned this update.""" @@ -2724,54 +4303,72 @@ the aggregator keypair. """The token wallet which will receive rewards for calling update on this feed.""" payout_wallet: PublicKey -
The oracle queue from which oracles are assigned this update.
-The oracle queue from which oracles are assigned this update.
++ The token wallet which will receive rewards for calling update on + this feed. +
+The token wallet which will receive rewards for calling update on this feed.
-View Source
-@dataclass +++View Source
++- +@dataclass class AggregatorSaveResultParams: """Index in the list of oracles in the aggregator assigned to this round update.""" @@ -2806,147 +4403,175 @@ the aggregator keypair. """List of parsed oracles""" oracles: list[Any] -
Index in the list of oracles in the aggregator assigned to this round update.
-+ Index in the list of oracles in the aggregator assigned to this + round update. +
++ Reports that an error occured and the oracle could not send a + value. +
+Value the oracle is responding with for this update.
+Reports that an error occured and the oracle could not send a value.
-+ The minimum value this oracle has seen this round for the jobs + listed in the aggregator. +
++ The maximum value this oracle has seen this round for the jobs + listed in the aggregator. +
+Value the oracle is responding with for this update.
-List of OracleJobs that were performed to produce this result
+Authority of the queue the aggregator is attached to
+List of parsed oracles
The maximum value this oracle has seen this round for the jobs listed in the -aggregator.
-List of OracleJobs that were performed to produce this result
-Authority of the queue the aggregator is attached to
-List of parsed oracles
-View Source
-@dataclass +++View Source
++- +@dataclass class AggregatorSetHistoryBufferParams: """Number of elements for the history buffer to fit""" @@ -2954,60 +4579,67 @@ aggregator. """Authority keypair for the aggregator""" authority: Keypair = None -
Number of elements for the history buffer to fit
-Number of elements for the history buffer to fit
+View Source
-class CrankAccount: +++View Source
++- +class CrankAccount: """ A Switchboard account representing a crank of aggregators ordered by next update time. Attributes: @@ -3298,29 +4930,38 @@ aggregator. pq_data: list[CrankRow] = crank.pq_data[:crank.pq_size] pq_data.sort(key=lambda crank_row: crank_row.next_timestamp) return [item.pubkey for item in pq_data[:n]] -
A Switchboard account representing a crank of aggregators ordered by next update time.
++ A Switchboard account representing a crank of aggregators ordered by + next update time. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This crank's public key - keypair (Keypair | None): this crank's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This crank's public key keypair + (Keypair | None): this crank's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -3328,85 +4969,83 @@ aggregator. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Get the size of an CrankAccount on chain
-Returns: int: size of the CrankAccount type on chain
+Get the size of an CrankAccount on chain
- -Args:
- -Returns: - int: size of the CrankAccount type on chain
-View Source
-def size(self): ++++def size(self): return self.program.account["CrankAccountData"].size -
View Source
-async def load_data(self): ++++async def load_data(self): crank = await self.program.account["CrankAccountData"].fetch(self.public_key) crank.ebuf = None return crank -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: CrankInitParams): crank_account = Keypair.generate() buffer = Keypair.generate() @@ -3445,24 +5084,27 @@ aggregator. ) return CrankAccount(AccountParams(program=program, keypair=crank_account)) -
View Source
-async def push(self, params: CrankPushParams): ++++async def push(self, params: CrankPushParams): aggregator_account: AggregatorAccount = params.aggregator_account crank = await self.load_data() queue_account = OracleQueueAccount(AccountParams(program=self.program, public_key=crank.queue_pubkey)) @@ -3504,24 +5146,26 @@ aggregator. } ) ) -
View Source
-async def pop_txn(self, params: CrankPopParams): ++++async def pop_txn(self, params: CrankPopParams): fail_open_on_account_mismatch = params.fail_open_on_mismatch or False next = params.ready_pubkeys or await self.peak_next_ready(5) if len(next) == 0: @@ -3586,45 +5230,48 @@ aggregator. signers=[payer_keypair] ) ) -
View Source
-async def pop(self, params: CrankPopParams): ++++async def pop(self, params: CrankPopParams): payer_keypair = Keypair.from_secret_key(self.program.provider.wallet.payer.secret_key) txn = await self.pop_txn(params) return await self.program.provider.connection.send_transaction(txn, [payer_keypair]) -
View Source
-async def peak_next_with_time(self, n: int): ++++async def peak_next_with_time(self, n: int): crank = await self.load_data() # get list slice of length pq_size @@ -3635,72 +5282,72 @@ aggregator. # return items return pq_data[:n] -
View Source
-async def peak_next_ready(self, n: Optional[int] = None): ++++async def peak_next_ready(self, n: Optional[int] = None): now = math.floor(time.time()) crank = await self.load_data() pq_data: list[CrankRow] = crank.pq_data[:crank.pq_size] key = lambda crank_row: crank_row.next_timestamp return [item.pubkey for item in list(filter(lambda item: now >= item.next_timestamp, pq_data)).sort(key=key)[:(n or len(pq_data))]] -
View Source
-async def peak_next(self, n: int): ++++async def peak_next(self, n: int): crank = await self.load_data() pq_data: list[CrankRow] = crank.pq_data[:crank.pq_size] pq_data.sort(key=lambda crank_row: crank_row.next_timestamp) return [item.pubkey for item in pq_data[:n]] -
View Source
-@dataclass +++View Source
++- +@dataclass class CrankPopParams: """Specifies the wallet to reward for turning the crank.""" @@ -3730,154 +5377,157 @@ aggregator. """Nonce to allow consecutive crank pops with the same blockhash.""" nonce: int = None fail_open_on_mismatch: bool = None -
Specifies the wallet to reward for turning the crank.
-Specifies the wallet to reward for turning the crank.
+The pubkey of the linked oracle queue.
+The pubkey of the linked oracle queue authority.
+QueueAccount data
Token mint pubkey
+ Array of pubkeys to attempt to pop. If discluded, this will be + loaded from the crank upon calling. +
++ Nonce to allow consecutive crank pops with the same blockhash. +
+Token mint pubkey
-Array of pubkeys to attempt to pop. If discluded, this will be loaded -from the crank upon calling.
-Nonce to allow consecutive crank pops with the same blockhash.
-View Source
-@dataclass +++View Source
++- +@dataclass class CrankInitParams: """OracleQueueAccount for which this crank is associated""" @@ -3891,125 +5541,137 @@ from the crank upon calling. """Optional max number of rows""" max_rows: int = None -
OracleQueueAccount for which this crank is associated
-OracleQueueAccount for which this crank is associated
+Buffer specifying crank name
Buffer specifying crank metadata
Optional max number of rows
Optional max number of rows
-View Source
-@dataclass +++View Source
++- +@dataclass class CrankPushParams: aggregator_account: AggregatorAccount -
CrankPushParams(aggregator_account: switchboardpy.AggregatorAccount)
-+ CrankPushParams(aggregator_account: + switchboardpy.AggregatorAccount) +
+View Source
-@dataclass +++View Source
++- +@dataclass class CrankRow: """Aggregator account pubkey""" @@ -4021,71 +5683,68 @@ from the crank upon calling. @staticmethod def from_bytes(buf: bytes): pass -
Aggregator account pubkey
-Aggregator account pubkey
Next aggregator update timestamp to order the crank by
+Next aggregator update timestamp to order the crank by
-View Source
-@staticmethod ++++@staticmethod def from_bytes(buf: bytes): pass -
View Source
-class JobAccount: +++View Source
++- +class JobAccount: """ A Switchboard account representing a job for an oracle to perform, stored as a protocol buffer. @@ -4201,30 +5860,38 @@ from the crank upon calling. ) ) return JobAccount(AccountParams(program=program, keypair=job_account)) -
A Switchboard account representing a job for an oracle to perform, stored as - a protocol buffer.
++ A Switchboard account representing a job for an oracle to perform, + stored as a protocol buffer. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This aggregator's public key - keypair (Keypair | None): this aggregator's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This aggregator's public key keypair + (Keypair | None): this aggregator's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -4232,113 +5899,115 @@ from the crank upon calling. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Load and parse JobAccount state based on the program IDL.
-+ Returns: name (JobAccount): data parsed in accordance with the + Switchboard IDL. +
- keypair -Args:
- -Load and parse JobAccount state based on the program IDL.
++ Raises: AccountDoesNotExistError: If the account doesn't exist. + AccountInvalidDiscriminator: If the discriminator doesn't match + the IDL. +
+Returns: - name (JobAccount): data parsed in accordance with the - Switchboard IDL.
- -Args:
- -Raises: - AccountDoesNotExistError: If the account doesn't exist. - AccountInvalidDiscriminator: If the discriminator doesn't match the IDL.
-View Source
-async def load_data(self): ++++async def load_data(self): job = await self.program.account["JobAccountData"].fetch(self.public_key) job.ebuf = None return job -
View Source
-async def load_job(self): ++++async def load_job(self): job = await self.load_job() return OracleJob.ParseFromString(job.data) -
View Source
-@staticmethod ++++@staticmethod def decode(program: anchorpy.Program, buf: bytes): coder = anchorpy.Coder(program.idl) return coder.accounts.decode(buf) -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: JobInitParams): job_account = params.keypair or Keypair.generate() @@ -4376,27 +6045,25 @@ from the crank upon calling. ) ) return JobAccount(AccountParams(program=program, keypair=job_account)) -
View Source
-@dataclass +++View Source
++- +@dataclass class JobInitParams: """A serialized protocol buffer holding the schema of the job.""" @@ -4419,116 +6086,122 @@ from the crank upon calling. Defaults to token vault. """ author_wallet: PublicKey = None -
A serialized protocol buffer holding the schema of the job.
-A serialized protocol buffer holding the schema of the job.
+An optional name to apply to the job account.
++ unix_timestamp of when funds can be withdrawn from this account. +
+A required variables oracles must fill to complete the job.
+A pre-generated keypair to use.
unix_timestamp of when funds can be withdrawn from this account.
-+ An optional wallet for receiving kickbacks from job usage in + feeds. Defaults to token vault. +
+A required variables oracles must fill to complete the job.
-A pre-generated keypair to use.
-An optional wallet for receiving kickbacks from job usage in feeds. -Defaults to token vault.
-View Source
-class LeaseAccount: +++View Source
++- +class LeaseAccount: """ A Switchboard account representing a lease for managing funds for oracle payouts for fulfilling feed updates. @@ -4736,30 +6409,38 @@ Defaults to token vault. signers=[params.withdraw_authority] ) ) -
A Switchboard account representing a lease for managing funds for oracle payouts -for fulfilling feed updates.
++ A Switchboard account representing a lease for managing funds for + oracle payouts for fulfilling feed updates. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This lease's public key - keypair (Keypair | None): this lease's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This lease's public key keypair + (Keypair | None): this lease's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -4767,86 +6448,87 @@ for fulfilling feed updates. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Get the size of an LeaseAccount on chain
-Returns: int: size of the LeaseAccount type on chain
+Get the size of an LeaseAccount on chain
- -Args:
- -Returns: - int: size of the LeaseAccount type on chain
-View Source
-def size(self): ++++def size(self): return self.program.account["LeaseAccountData"].size -
View Source
-async def load_data(self): ++++async def load_data(self): lease = await self.program.account["LeaseAccountData"].fetch(self.public_key) lease.ebuf = None return lease -
View Source
-@staticmethod ++++@staticmethod def from_seed(program: anchorpy.Program, queue_account: OracleQueueAccount, aggregator_account: AggregatorAccount): pubkey, bump = publickey.PublicKey.find_program_address( [ @@ -4858,28 +6540,29 @@ for fulfilling feed updates. ) return LeaseAccount(AccountParams(program=program, public_key=pubkey)), bump -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: LeaseInitParams): program_state_account, state_bump = ProgramStateAccount.from_seed(program) switch_token_mint = await program_state_account.get_token_mint() @@ -4914,24 +6597,27 @@ for fulfilling feed updates. ) ) return LeaseAccount(AccountParams(program=program, public_key=lease_account.public_key)) -
View Source
-async def extend(self, params: LeaseExtendParams): ++++async def extend(self, params: LeaseExtendParams): program = self.program lease = await self.load_data() escrow = lease.escrow @@ -4964,24 +6650,28 @@ for fulfilling feed updates. signers=[params.funder_authority] ) ) -
View Source
-async def withdraw(self, params: LeaseWithdrawParams): ++++async def withdraw(self, params: LeaseWithdrawParams): program = self.program lease = await self.load_data() escrow = lease.escrow @@ -5013,27 +6703,25 @@ for fulfilling feed updates. signers=[params.withdraw_authority] ) ) -
View Source
-@dataclass +++View Source
++- +@dataclass class LeaseExtendParams: """Token amount to load into the lease escrow""" @@ -5044,67 +6732,68 @@ for fulfilling feed updates. """The authority of the funding wallet""" funder_authority: Keypair -
Token amount to load into the lease escrow
-Token amount to load into the lease escrow
+The funding wallet of the lease
The authority of the funding wallet
+The authority of the funding wallet
-View Source
-@dataclass +++View Source
++- +@dataclass class LeaseInitParams: """Token amount to load into the lease escrow""" @@ -5124,116 +6813,137 @@ for fulfilling feed updates. """This authority will be permitted to withdraw funds from this lease""" withdraw_authority: PublicKey = None -
Token amount to load into the lease escrow
-Token amount to load into the lease escrow
+The funding wallet of the lease
The authority of the funding wallet
+The feed which the lease grants permission
+The authority of the funding wallet
-+ This authority will be permitted to withdraw funds from this lease +
+The feed which the lease grants permission
-This authority will be permitted to withdraw funds from this lease
-View Source
-@dataclass +++View Source
++- +@dataclass class LeaseWithdrawParams: """Token amount to withdraw from the lease escrow""" @@ -5244,66 +6954,66 @@ for fulfilling feed updates. """The withdraw authority of the lease""" withdraw_authority: Keypair -
Token amount to withdraw from the lease escrow
-Token amount to withdraw from the lease escrow
+The wallet of to withdraw to
The withdraw authority of the lease
+The withdraw authority of the lease
-View Source
-class OracleAccount: +++View Source
++- +class OracleAccount: """ A Switchboard account representing an oracle account and its associated queue and escrow account. @@ -5525,30 +7235,40 @@ for fulfilling feed updates. signers=[params.oracle_authority] ) ) -
A Switchboard account representing an oracle account and its associated queue -and escrow account.
++ A Switchboard account representing an oracle account and its + associated queue and escrow account. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This aggregator's public key - keypair (Keypair | None): this aggregator's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This aggregator's public key keypair + (Keypair | None): this aggregator's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -5556,86 +7276,85 @@ and escrow account. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Get the size of an OracleAccount on chain
-Returns: int: size of the OracleAccount type on chain
+Get the size of an OracleAccount on chain
- -Args:
- -Returns: - int: size of the OracleAccount type on chain
-View Source
-def size(self): ++++def size(self): return self.program.account["OracleAccountData"].size -
View Source
-async def load_data(self): ++++async def load_data(self): oracle = await self.program.account["OracleAccountData"].fetch(self.public_key) oracle.ebuf = None return oracle -
View Source
-@staticmethod ++++@staticmethod def from_seed(program: anchorpy.Program, queue_account: OracleQueueAccount, wallet: PublicKey): oracle_pubkey, bump = PublicKey.find_program_address( [ @@ -5647,28 +7366,29 @@ and escrow account. ) return OracleAccount(AccountParams(program=program, public_key=oracle_pubkey)), bump -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: OracleInitParams): payer_keypair = Keypair.from_secret_key(program.provider.wallet.payer.secret_key) program_state_account, state_bump = ProgramStateAccount.from_seed(program) @@ -5707,24 +7427,25 @@ and escrow account. ) ) return OracleAccount(AccountParams(program=program, public_key=oracle_account.public_key)) -
View Source
-async def heartbeat(self): ++++async def heartbeat(self): payer_keypair = Keypair.from_secret_key(self.program.provider.wallet.payer.secret_key) oracle = await self.load_data() queue_account = OracleQueueAccount(AccountParams(program=self.program,public_key=oracle.queue_pubkey)) @@ -5760,24 +7481,30 @@ and escrow account. signers=[self.keypair] ) ) -
View Source
-async def withdraw(self, params: OracleWithdrawParams): ++++async def withdraw(self, params: OracleWithdrawParams): payer_keypair = Keypair.from_secret_key(self.program.provider.wallet.payer.secret_key) oracle = await self.load_data() queue_pubkey = oracle.queue_pubkey @@ -5813,27 +7540,25 @@ and escrow account. signers=[params.oracle_authority] ) ) -
View Source
-@dataclass +++View Source
++- +@dataclass class OracleInitParams: """Specifies the oracle queue to associate with this OracleAccount.""" @@ -5844,77 +7569,83 @@ and escrow account. """Buffer specifying oralce metadata""" metadata: bytes = None -
Specifies the oracle queue to associate with this OracleAccount.
-+ Specifies the oracle queue to associate with this OracleAccount. +
+Buffer specifying orace name
Buffer specifying oralce metadata
Buffer specifying oralce metadata
-View Source
-@dataclass +++View Source
++- +@dataclass class OracleWithdrawParams: """Amount to withdraw""" @@ -5925,66 +7656,63 @@ and escrow account. """Oracle authority keypair""" oracle_authority: Keypair -
Amount to withdraw
-Amount to withdraw
Token Account to withdraw to
Oracle authority keypair
Oracle authority keypair
-View Source
-class OracleQueueAccount: +++View Source
++- +class OracleQueueAccount: """A Switchboard account representing a queue for distributing oracles to permitted data feeds. @@ -6089,30 +7817,40 @@ and escrow account. ) ) return OracleQueueAccount(AccountParams(program=program, keypair=oracle_queue_account)); -
A Switchboard account representing a queue for distributing oracles to -permitted data feeds.
++ A Switchboard account representing a queue for distributing oracles + to permitted data feeds. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This OracleQueueAccount's public key - keypair (Keypair | None): this OracleQueueAccount's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This OracleQueueAccount's public key + keypair (Keypair | None): this OracleQueueAccount's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -6120,85 +7858,91 @@ permitted data feeds. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
Get the size of an OracleQueueAccount on chain
-Returns: int: size of the OracleQueueAccount type on chain
+Get the size of an OracleQueueAccount on chain
- -Args:
- -Returns: - int: size of the OracleQueueAccount type on chain
-View Source
-def size(self): ++++def size(self): return self.program.account["OracleQueueAccountData"].size -
View Source
-async def load_data(self): ++++async def load_data(self): queue = await self.program.account["OracleQueueAccountData"].fetch(self.public_key) queue.ebuf = None return queue -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: OracleQueueInitParams): oracle_queue_account = Keypair.generate() buffer = Keypair.generate() @@ -6246,27 +7990,25 @@ permitted data feeds. ) ) return OracleQueueAccount(AccountParams(program=program, keypair=oracle_queue_account)); -
View Source
-@dataclass +++View Source
++- +@dataclass class OracleQueueInitParams: """Rewards to provide oracles and round openers on this queue.""" @@ -6326,1315 +8068,2639 @@ permitted data feeds. """Buffer for queue metadata.""" metadata: bytes = None -
Rewards to provide oracles and round openers on this queue.
-The minimum amount of stake oracles must present to remain on the queue.
-The account to delegate authority to for creating permissions targeted -at the queue.
-The tolerated variance amount oracle results can have from the -accepted round result before being slashed. -slashBound = varianceToleranceMultiplier * stdDeviation -Default: 2
-Consecutive failure limit for a feed before feed permission is revoked.
-Consecutive failure limit for an oracle before oracle permission is revoked.
-the minimum update delay time for Aggregators
-Optionally set the size of the queue.
-Enabling this setting means data feeds do not need explicit permission -to join the queue.
-Whether slashing is enabled on this queue
-After a feed lease is funded or re-funded, it must consecutively succeed -N amount of times or its authorization to use the queue is auto-revoked.
-A name to assign to this OracleQueue.
-Buffer for queue metadata.
-A ProtocolMessage
-Field OracleJob.tasks
-Inherited Members
--
-
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions - +
- google.protobuf.pyext._message.CMessage +
- CMessage +
- MergeFrom +
- CopyFrom +
- Clear +
- SetInParent +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- ListFields +
- HasField +
- ClearField +
- WhichOneof +
- HasExtension +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- ByteSize +
- FromString +
- + RegisterExtension + +
- + FindInitializationErrors + +
- Extensions
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.HttpTask -
- DESCRIPTOR -
- Header -
- url -
- method -
- headers -
- body -
- Method -
- METHOD_UNKOWN -
- METHOD_GET -
- METHOD_POST - +
- job_schemas_pb2.HttpTask +
- + DESCRIPTOR + +
- Header +
- url +
- method +
- headers +
- body +
- Method +
- + METHOD_UNKNOWN + +
- + METHOD_GET + +
- + METHOD_POST +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.JsonParseTask -
- DESCRIPTOR -
- path -
- aggregation_method -
- AggregationMethod -
- NONE -
- MIN -
- MAX -
- SUM - +
- job_schemas_pb2.JsonParseTask +
- + DESCRIPTOR + +
- path +
- + aggregation_method + +
- + AggregationMethod + +
- NONE +
- MIN +
- MAX +
- SUM
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.MedianTask -
- DESCRIPTOR -
- tasks -
- jobs - +
- job_schemas_pb2.MedianTask +
- + DESCRIPTOR + +
- tasks +
- jobs
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.MeanTask -
- DESCRIPTOR -
- tasks -
- jobs - +
- job_schemas_pb2.MeanTask +
- + DESCRIPTOR + +
- tasks +
- jobs
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- CMessage +
- + MergeFrom + +
- CopyFrom +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- HasField +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- ByteSize +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.MaxTask -
- DESCRIPTOR -
- tasks -
- jobs - +
- job_schemas_pb2.MaxTask +
- + DESCRIPTOR + +
- tasks +
- jobs
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.ValueTask -
- DESCRIPTOR -
- value - +
- job_schemas_pb2.ValueTask +
- + DESCRIPTOR + +
- value
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.WebsocketTask -
- DESCRIPTOR -
- url -
- subscription -
- max_data_age_seconds -
- filter - +
- job_schemas_pb2.WebsocketTask +
- + DESCRIPTOR + +
- url +
- + subscription + +
- + max_data_age_seconds + +
- + filter +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- + Clear + +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.ConditionalTask -
- DESCRIPTOR -
- attempt -
- on_failure - +
- job_schemas_pb2.ConditionalTask +
- + DESCRIPTOR + +
- + attempt + +
- + on_failure +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.DivideTask -
- DESCRIPTOR -
- scalar -
- aggregator_pubkey -
- job - +
- job_schemas_pb2.DivideTask +
- + DESCRIPTOR + +
- scalar +
- + aggregator_pubkey + +
- job
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.MultiplyTask -
- DESCRIPTOR -
- scalar -
- aggregator_pubkey -
- job - +
- job_schemas_pb2.MultiplyTask +
- + DESCRIPTOR + +
- + scalar + +
- + aggregator_pubkey + +
- job
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- CMessage +
- + MergeFrom + +
- CopyFrom +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- HasField +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- ByteSize +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.AddTask -
- DESCRIPTOR -
- scalar -
- aggregator_pubkey -
- job - +
- job_schemas_pb2.AddTask +
- + DESCRIPTOR + +
- scalar +
- + aggregator_pubkey + +
- job
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.SubtractTask -
- DESCRIPTOR -
- scalar -
- aggregator_pubkey -
- job - +
- job_schemas_pb2.SubtractTask +
- + DESCRIPTOR + +
- + scalar + +
- + aggregator_pubkey + +
- job
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- + Clear + +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.LpTokenPriceTask -
- DESCRIPTOR -
- mercurial_pool_address -
- saber_pool_address -
- orca_pool_address - +
- job_schemas_pb2.LpTokenPriceTask +
- + DESCRIPTOR + +
- + mercurial_pool_address + +
- + saber_pool_address + +
- + orca_pool_address +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- + Clear + +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.LpExchangeRateTask -
- DESCRIPTOR -
- in_token_address -
- out_token_address -
- mercurial_pool_address -
- saber_pool_address -
- orca_pool_token_mint_address - +
- job_schemas_pb2.LpExchangeRateTask +
- + DESCRIPTOR + +
- + in_token_address + +
- + out_token_address + +
- + mercurial_pool_address + +
- + saber_pool_address + +
- + orca_pool_token_mint_address +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- + Clear + +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.RegexExtractTask -
- DESCRIPTOR -
- pattern -
- group_number - +
- job_schemas_pb2.RegexExtractTask +
- + DESCRIPTOR + +
- + pattern + +
- + group_number +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- + Clear + +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.XStepPriceTask -
- DESCRIPTOR - +
- job_schemas_pb2.XStepPriceTask +
- + DESCRIPTOR +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.TwapTask -
- DESCRIPTOR -
- aggregator_pubkey -
- period - +
- job_schemas_pb2.TwapTask +
- + DESCRIPTOR + +
- + aggregator_pubkey + +
- period
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- + CMessage + +
- + MergeFrom + +
- + CopyFrom + +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- + HasField + +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- + ByteSize + +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.SerumSwapTask -
- DESCRIPTOR -
- serum_pool_address - +
- job_schemas_pb2.SerumSwapTask +
- + DESCRIPTOR + +
- + serum_pool_address +
- google.protobuf.pyext._message.CMessage -
- CMessage -
- MergeFrom -
- CopyFrom -
- Clear -
- SetInParent -
- IsInitialized -
- MergeFromString -
- ParseFromString -
- SerializeToString -
- SerializePartialToString -
- ListFields -
- HasField -
- ClearField -
- WhichOneof -
- HasExtension -
- ClearExtension -
- UnknownFields -
- DiscardUnknownFields -
- ByteSize -
- FromString -
- RegisterExtension -
- FindInitializationErrors -
- Extensions +
- google.protobuf.pyext._message.CMessage +
- CMessage +
- MergeFrom +
- CopyFrom +
- Clear +
- + SetInParent + +
- + IsInitialized + +
- + MergeFromString + +
- + ParseFromString + +
- + SerializeToString + +
- + SerializePartialToString + +
- + ListFields + +
- HasField +
- + ClearField + +
- + WhichOneof + +
- + HasExtension + +
- + ClearExtension + +
- + UnknownFields + +
- + DiscardUnknownFields + +
- ByteSize +
- + FromString + +
- + RegisterExtension + +
- + FindInitializationErrors + +
- + Extensions +
- job_schemas_pb2.Task -
- DESCRIPTOR -
- http_task -
- json_parse_task -
- median_task -
- mean_task -
- websocket_task -
- divide_task -
- multiply_task -
- lp_token_price_task -
- lp_exchange_rate_task -
- conditional_task -
- value_task -
- max_task -
- regex_extract_task -
- xstep_price_task -
- add_task -
- subtract_task -
- twap_task -
- serum_swap_task - +
- job_schemas_pb2.Task +
- + DESCRIPTOR + +
- http_task +
- + json_parse_task + +
- + median_task + +
- mean_task +
- + websocket_task + +
- + divide_task + +
- + multiply_task + +
- + lp_token_price_task + +
- + lp_exchange_rate_task + +
- + conditional_task + +
- + value_task + +
- max_task +
- + regex_extract_task + +
- + xstep_price_task + +
- add_task +
- + subtract_task + +
- twap_task +
- + serum_swap_task +
Rewards to provide oracles and round openers on this queue.
++ The minimum amount of stake oracles must present to remain on the + queue. +
++ The account to delegate authority to for creating permissions + targeted at the queue. +
++ The tolerated variance amount oracle results can have from the + accepted round result before being slashed. slashBound = + varianceToleranceMultiplier * stdDeviation Default: 2 +
++ Consecutive failure limit for a feed before feed permission is + revoked. +
++ Consecutive failure limit for an oracle before oracle permission + is revoked. +
+the minimum update delay time for Aggregators
+Optionally set the size of the queue.
++ Enabling this setting means data feeds do not need explicit + permission to join the queue. +
+Whether slashing is enabled on this queue
++ After a feed lease is funded or re-funded, it must consecutively + succeed N amount of times or its authorization to use the queue is + auto-revoked. +
+A name to assign to this OracleQueue.
+Buffer for queue metadata.
A ProtocolMessage
Field OracleJob.tasks
+Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
A ProtocolMessage
-Inherited Members
--
-
A ProtocolMessage
Inherited Members
+-
+
View Source
-class PermissionAccount: +++View Source
++- +class PermissionAccount: """A Switchboard account representing a permission or privilege granted by one account signer to another account. @@ -7781,30 +10847,40 @@ N amount of times or its authorization to use the queue is auto-revoked. signers=[params.authority] ) ) -
A Switchboard account representing a permission or privilege granted by one -account signer to another account.
++ A Switchboard account representing a permission or privilege granted + by one account signer to another account. +
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This permission's public key - keypair (Keypair | None): this permission's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This permission's public key keypair + (Keypair | None): this permission's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -7812,110 +10888,121 @@ account signer to another account. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
+ Check if a specific permission is enabled on this permission + account +
-Returns: bool: whether or not the permission is enabled
+Check if a specific permission is enabled on this permission account
- -Args: - permission (SwitchboardPermissionValue)
- -Returns: - bool: whether or not the permission is enabled
-View Source
-async def is_permission_enabled(self, permission: SwitchboardPermissionValue): ++++async def is_permission_enabled(self, permission: SwitchboardPermissionValue): perm_data = await self.load_data() permissions = perm_data.permissions return (permissions & permission) != 0 -
View Source
-async def load_data(self): ++++async def load_data(self): permission = await self.program.account["PermissionAccountData"].fetch(self.public_key) permission.ebuf = None return permission -
View Source
-def size(self): ++++def size(self): return self.program.account["PermissionAccountData"].size -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: PermissionInitParams): permission_account, permission_bump = PermissionAccount.from_seed( program, @@ -7940,30 +11027,31 @@ account signer to another account. ) ) return permission_account -
View Source
-@staticmethod ++++@staticmethod def from_seed(program: anchorpy.Program, authority: PublicKey, granter: PublicKey, grantee: PublicKey): pubkey, bump = PublicKey.find_program_address( [ @@ -7976,24 +11064,28 @@ account signer to another account. ) return PermissionAccount(AccountParams(program=program, public_key=pubkey)), bump -
View Source
-async def set(self, params: PermissionSetParams): ++++async def set(self, params: PermissionSetParams): self.program.rpc["permission_set"]( { "permission": self.program.type["SwitchboardPermission"][params.permission](), @@ -8007,27 +11099,25 @@ account signer to another account. signers=[params.authority] ) ) -
View Source
-@dataclass +++View Source
++- +@dataclass class PermissionInitParams: """Pubkey of the account granting the permission""" @@ -8038,67 +11128,73 @@ account signer to another account. """The authority that is allowed to set permissions for this account""" authority: PublicKey -
Pubkey of the account granting the permission
-Pubkey of the account granting the permission
+The receiving amount of a permission
++ The authority that is allowed to set permissions for this account +
+The authority that is allowed to set permissions for this account
-View Source
-@dataclass +++View Source
++- +@dataclass class PermissionSetParams: """The permission to set""" @@ -8109,66 +11205,68 @@ account signer to another account. """Specifies whether to enable or disable the permission""" enable: bool -
The permission to set
-The permission to set
The authority controlling this permission
+View Source
-class ProgramStateAccount: +++View Source
++- +class ProgramStateAccount: """Account type representing Switchboard global program state. Attributes: @@ -8329,29 +11427,37 @@ account signer to another account. signers=[authority] ) ) -
Account type representing Switchboard global program state.
+Account type representing Switchboard global program state.
-Attributes: - program (anchor.Program): The anchor program ref - public_key (PublicKey | None): This program's public key - keypair (Keypair | None): this program's keypair
-+ Attributes: program (anchor.Program): The anchor program ref + public_key (PublicKey | None): This program's public key keypair + (Keypair | None): this program's keypair +
+View Source
-def __init__(self, params: AccountParams): ++++def __init__(self, params: AccountParams): if params.public_key is None and params.keypair is None: raise ValueError('User must provide either a publicKey or keypair for account use.') if params.keypair and params.public_key and params.keypair.public_key != params.public_key: @@ -8359,130 +11465,143 @@ account signer to another account. self.program = params.program self.public_key = params.keypair.public_key if params.keypair else params.public_key self.keypair = params.keypair -
+ Constructs ProgramStateAccount from the static seed from which it + was generated. +
-Returns: ProgramStateAccount and PDA bump tuple.
+Constructs ProgramStateAccount from the static seed from which it was generated.
- -Args: - program (anchorpy.Program): Anchor-loaded aggregator
- -Returns: - ProgramStateAccount and PDA bump tuple.
-View Source
-@staticmethod ++++@staticmethod def from_seed(program: anchorpy.Program): state_pubkey, state_bump = publickey.PublicKey.find_program_address(['STATE'.encode()], program.program_id) return ProgramStateAccount(AccountParams(program=program, public_key=state_pubkey)), state_bump -
View Source
-async def load_data(self): ++++async def load_data(self): state = await self.program.account["SbState"].fetch(self.public_key) state.ebuf = None return state -
View Source
-async def get_token_mint(self) -> AsyncToken: ++++async def get_token_mint(self) -> AsyncToken: payer_keypair = Keypair.from_secret_key(self.program.provider.wallet.payer.secret_key) state = await self.load_data() switch_token_mint = AsyncToken(self.program.provider.connection, state.token_mint, TOKEN_PROGRAM_ID, payer_keypair) return switch_token_mint -
View Source
-def size(self): ++++def size(self): return self.program.account["SbState"].size -
View Source
-@staticmethod ++++@staticmethod async def create(program: anchorpy.Program, params: ProgramInitParams): payer_keypair = Keypair.from_secret_key(program.provider.wallet.payer.secret_key) state_account, state_bump = ProgramStateAccount.from_seed(program) @@ -8527,29 +11646,32 @@ account signer to another account. }, ) ) -
View Source
-async def vault_transfer(self, to: PublicKey, authority: Keypair, params: VaultTransferParams): ++++async def vault_transfer(self, to: PublicKey, authority: Keypair, params: VaultTransferParams): state_pubkey, state_bump = ProgramStateAccount.from_seed(self.program) state = await self.load_data() vault = state.token_vault @@ -8569,111 +11691,108 @@ account signer to another account. signers=[authority] ) ) -
View Source
-@dataclass +++View Source
++- +@dataclass class ProgramInitParams: """Optional token mint""" mint: PublicKey = None -
Optional token mint
-Optional token mint
View Source
-@dataclass +++View Source
++- +@dataclass class VaultTransferParams: """Amount being transferred""" amount: Decimal -
Amount being transferred
-Amount being transferred
View Source
-@dataclass +++View Source
++- +@dataclass class SwitchboardDecimal: mantissa: int scale: int @@ -8720,154 +11839,165 @@ account signer to another account. if not (hasattr(__o, 'mantissa') and hasattr(__o, 'scale')): return False return self.mantissa == __o.mantissa and self.scale == __o.scale -
SwitchboardDecimal(mantissa: int, scale: int)
-SwitchboardDecimal(mantissa: int, scale: int)
+Convert BN.js style num and return SwitchboardDecimal
-+ Args: obj (Any): Object with integer fields scale and mantissa + (hex val) +
- scale: int -Returns: sbd (SwitchboardDecimal): SwitchboardDecimal
+Convert BN.js style num and return SwitchboardDecimal
- -Args: - obj (Any): Object with integer fields scale and mantissa (hex val)
- -Returns: - sbd (SwitchboardDecimal): SwitchboardDecimal
-View Source
-@staticmethod ++++@staticmethod def fromObj(obj: Any): return SwitchboardDecimal( mantissa=obj.mantissa, scale=obj.scale ) -
View Source
-def to_decimal(self, sbd: object): ++++def to_decimal(self, sbd: object): mantissa = Decimal(sbd.mantissa) scale = sbd.scale return mantissa / Decimal(10 ** scale) -
View Source
-@staticmethod ++++@staticmethod def from_decimal(dec: Decimal): _, digits, exponent = dec.as_tuple() integer = reduce(lambda rst, x: rst * 10 + x, digits) return SwitchboardDecimal(integer, exponent) -
View Source
-@staticmethod ++++@staticmethod def sbd_to_decimal(sbd: object) -> Decimal: mantissa = Decimal(sbd.mantissa) scale = sbd.scale return mantissa / Decimal(10 ** scale) -
View Source
-def as_proper_sbd(self, program: anchorpy.Program): ++- - - - - -def as_proper_sbd(self, program: anchorpy.Program): return program.type['SwitchboardDecimal'](self.mantissa, self.scale) -