42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
import asyncio
|
|
from pytest import fixture, mark
|
|
|
|
from switchboardpy import (
|
|
SBV2_DEVNET_PID,
|
|
AccountParams,
|
|
OracleAccount,
|
|
OracleInitParams,
|
|
OracleWithdrawParams,
|
|
)
|
|
|
|
from contextlib import contextmanager
|
|
from decimal import Decimal
|
|
from solana.keypair import Keypair
|
|
from solana.publickey import PublicKey
|
|
from solana.rpc.async_api import AsyncClient
|
|
from anchorpy import Program, Provider, Wallet
|
|
|
|
class SwitchboardProgram(object):
|
|
|
|
async def __aenter__(self):
|
|
client = AsyncClient("https://api.devnet.solana.com/")
|
|
provider = Provider(client, Wallet(Keypair()))
|
|
self.program = await Program.at(
|
|
SBV2_DEVNET_PID, provider
|
|
)
|
|
return self.program
|
|
|
|
async def __aexit__(self, exc_t, exc_v, exc_tb):
|
|
await self.program.close()
|
|
|
|
@mark.asyncio
|
|
async def test_load_data():
|
|
async with SwitchboardProgram() as program:
|
|
|
|
#oracle = OracleAccount(AccountParams(program=program, public_key=PublicKey("88FX4tBstuwBPNhQU4EEBoPX35neSu4Le9zDSwtPRRQz")))
|
|
|
|
# getting aggregator data
|
|
#data = await oracle.load_data()
|
|
print('Need Oracle')
|
|
|