Remove anchor dummy type workaround (#53)

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-05-18 17:16:14 +02:00 committed by GitHub
parent 6daa66f2bf
commit 717b72857d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 984 additions and 2795 deletions

View File

@ -4,7 +4,7 @@
# RUSTSEC-2020-0071 and RUSTSEC-2020-0159 are low severity vulnerable upstream Solana crates. Ignored for now.
[advisories]
ignore = ["RUSTSEC-2020-0071","RUSTSEC-2020-0159"] # advisory IDs to ignore e.g. ["RUSTSEC-2019-0001", ...]
ignore = ["RUSTSEC-2020-0016", "RUSTSEC-2020-0036", "RUSTSEC-2020-0056", "RUSTSEC-2020-0071", "RUSTSEC-2020-0159", "RUSTSEC-2021-0078", "RUSTSEC-2021-0079"] # advisory IDs to ignore e.g. ["RUSTSEC-2019-0001", ...]
informational_warnings = ["unmaintained"] # warn for categories of informational advisories
severity_threshold = "medium" # CVSS severity ("none", "low", "medium", "high", "critical")

View File

@ -21,10 +21,12 @@ jobs:
lint:
name: Lint
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Linux dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:

3041
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
### Development
- rust version 1.59.0 (9d1b2106e 2022-02-23)
- solana-cli 1.9.5
- anchor-cli 0.22.0
- solana-cli 1.9.13
- anchor-cli 0.24.2
- npm 8.1.2
- node v16.13.1

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# all actions should be idempotent
# create group
# register a bunch of tokens
# create a bunch of serum3 markets
# create a bunch of perp markets
# doc on how to find above metadata

View File

@ -7,6 +7,8 @@ for pair_str in \
"TokenIndex u16" \
"Serum3MarketIndex u16" \
"PerpMarketIndex u16" \
"usize u64" \
"NodeHandle u32" \
; do
pair=( $pair_str );
perl -0777 -pi -e "s/\{\s*\"defined\":\s*\"${pair[0]}\"\s*\}/\"${pair[1]}\"/g" \

View File

@ -6,8 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anchor-client = "0.22.0"
anchor-lang = "0.22.0"
anchor-client = "0.24.2"
anchor-lang = "0.24.2"
anyhow = "1.0"
clap = { version = "3.1.8", features = ["derive", "env"] }
dotenv = "0.15.0"
@ -15,13 +15,9 @@ env_logger = "0.8.4"
futures = "0.3.21"
log = "0.4.0"
mango-v4 = { path = "../programs/mango-v4" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shellexpand = "2.1"
solana-account-decoder = "1.9.5"
solana-client = "1.9.5"
solana-program = "1.9.5"
solana-rpc = "1.9.5"
solana-sdk = "1.9.5"
solana-transaction-status = "1.9.5"
tokio = { version = "1.17", features = ["rt-multi-thread", "time", "macros", "sync"] }
# serde = { version = "1.0", features = ["derive"] }
# serde_json = "1.0"
# shellexpand = "2.1"
solana-client = "~1.9.13"
solana-sdk = "~1.9.13"
tokio = { version = "1.18.2", features = ["rt-multi-thread", "time", "macros", "sync"] }

View File

@ -20,15 +20,15 @@ test-bpf = []
[dependencies]
# todo: when to fix, when to use caret? need a regular chore to bump dependencies
# note: possibly need init-if-needed feature
anchor-lang = { version = "0.22.0", features = [] }
anchor-spl = { version = "0.22.0", features = [] }
anchor-lang = { version = "0.24.2", features = [] }
anchor-spl = { version = "0.24.2", features = [] }
bytemuck = "^1.7.2"
# todo: higher versions don't work
fixed = { version = "=1.11.0", features = ["serde", "borsh"] }
fixed-macro = "^1.1.1"
pyth-client = {version = "0.5.0", features = ["no-entrypoint"]}
pyth-sdk-solana = "0.1.0"
serde = "^1.0"
solana-program = "1.9.5"
solana-program = "~1.9.13"
static_assertions = "1.1"
serum_dex = { version = "0.4.0", git = "https://github.com/blockworks-foundation/serum-dex.git", default-features=false, features = ["no-entrypoint", "program"] }
checked_math = { path = "../../lib/checked_math" }
@ -38,9 +38,9 @@ bincode = "1.3.3"
mango-macro = { path = "../../mango-macro" }
[dev-dependencies]
solana-sdk = { version = "1.9.5", default-features = false }
solana-program-test = "1.9.5"
solana-logger = "1.9.5"
solana-sdk = { version = "~1.9.13", default-features = false }
solana-program-test = "~1.9.13"
solana-logger = "~1.9.13"
spl-token = { version = "^3.0.0", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "^1.0.3", features = ["no-entrypoint"] }
bincode = "^1.3.1"

View File

@ -2,10 +2,9 @@ use anchor_lang::prelude::*;
use bytemuck::cast_ref;
use crate::error::MangoError;
use crate::state::EventQueue;
use crate::{
state::{
EventQueueHeader, EventType, FillEvent, Group, MangoAccount, OutEvent, PerpMarket, Queue,
},
state::{EventType, FillEvent, Group, MangoAccount, OutEvent, PerpMarket},
util::LoadZeroCopy,
};
@ -20,7 +19,7 @@ pub struct PerpConsumeEvents<'info> {
pub perp_market: AccountLoader<'info, PerpMarket>,
#[account(mut)]
pub event_queue: AccountLoader<'info, Queue<EventQueueHeader>>,
pub event_queue: AccountLoader<'info, EventQueue>,
}
pub fn perp_consume_events(ctx: Context<PerpConsumeEvents>, limit: usize) -> Result<()> {

View File

@ -2,7 +2,7 @@ use anchor_lang::prelude::*;
use crate::error::*;
use crate::state::{
oracle_price, Book, EventQueueHeader, Group, MangoAccount, OrderType, PerpMarket, Queue, Side,
oracle_price, Book, EventQueue, Group, MangoAccount, OrderType, PerpMarket, Side,
};
#[derive(Accounts)]
@ -30,7 +30,7 @@ pub struct PerpPlaceOrder<'info> {
#[account(mut)]
pub bids: UncheckedAccount<'info>,
#[account(mut)]
pub event_queue: AccountLoader<'info, Queue<EventQueueHeader>>,
pub event_queue: AccountLoader<'info, EventQueue>,
pub oracle: UncheckedAccount<'info>,

View File

@ -2,6 +2,7 @@ use anchor_lang::prelude::*;
use checked_math as cm;
use fixed::types::I80F48;
use static_assertions::const_assert_eq;
use std::cmp::Ordering;
use std::mem::size_of;
use crate::error::*;
@ -374,12 +375,18 @@ impl PerpAccount {
/// Move unrealized funding payments into the quote_position
pub fn settle_funding(&mut self, perp_market: &PerpMarket) {
if self.base_position_lots > 0 {
self.quote_position_native -= (perp_market.long_funding - self.long_settled_funding)
* I80F48::from_num(self.base_position_lots);
} else if self.base_position_lots < 0 {
self.quote_position_native -= (perp_market.short_funding - self.short_settled_funding)
* I80F48::from_num(self.base_position_lots);
match self.base_position_lots.cmp(&0) {
Ordering::Greater => {
self.quote_position_native -= (perp_market.long_funding
- self.long_settled_funding)
* I80F48::from_num(self.base_position_lots);
}
Ordering::Less => {
self.quote_position_native -= (perp_market.short_funding
- self.short_settled_funding)
* I80F48::from_num(self.base_position_lots);
}
Ordering::Equal => (),
}
self.long_settled_funding = perp_market.long_funding;
self.short_settled_funding = perp_market.short_funding;

View File

@ -26,7 +26,7 @@ const_assert_eq!(size_of::<StubOracle>(), 32 + 32 + 16 + 8 + 8);
const_assert_eq!(size_of::<StubOracle>() % 8, 0);
pub fn determine_oracle_type(data: &[u8]) -> Result<OracleType> {
if u32::from_le_bytes(data[0..4].try_into().unwrap()) == pyth_client::MAGIC {
if u32::from_le_bytes(data[0..4].try_into().unwrap()) == pyth_sdk_solana::state::MAGIC {
return Ok(OracleType::Pyth);
} else if data[0..8] == StubOracle::discriminator() {
return Ok(OracleType::Stub);
@ -42,8 +42,8 @@ pub fn oracle_price(acc_info: &AccountInfo) -> Result<I80F48> {
Ok(match oracle_type {
OracleType::Stub => acc_info.load::<StubOracle>()?.price,
OracleType::Pyth => {
let price_struct = pyth_client::load_price(data).unwrap();
I80F48::from_num(price_struct.agg.price)
let price_struct = pyth_sdk_solana::load_price(data).unwrap();
I80F48::from_num(price_struct.price)
}
})
}
@ -51,7 +51,6 @@ pub fn oracle_price(acc_info: &AccountInfo) -> Result<I80F48> {
#[cfg(test)]
mod tests {
use super::*;
use pyth_client::load_price;
use solana_program_test::{find_file, read_file};
use std::path::PathBuf;
@ -67,9 +66,8 @@ mod tests {
let pyth_price_data = read_file(find_file(filename).unwrap());
assert!(determine_oracle_type(&pyth_price_data).unwrap() == OracleType::Pyth);
let price = load_price(pyth_price_data.as_slice()).unwrap();
assert_eq!(price.valid_slot, 64338667);
assert_eq!(price.agg.price, 32112500000);
let price = pyth_sdk_solana::load_price(pyth_price_data.as_slice()).unwrap();
assert_eq!(price.price, 32112500000);
Ok(())
}

View File

@ -410,7 +410,7 @@ impl<'a> Book<'a> {
.remove_order(leaf_node.owner_slot as usize, leaf_node.quantity)?
};
limit = limit - 1;
limit -= 1;
if limit == 0 {
break;
}

View File

@ -161,13 +161,14 @@ pub struct FreeNode {
pub(crate) reserve: [u8; NODE_SIZE - 8],
}
#[derive(Copy, Clone, Pod)]
#[repr(C)]
#[zero_copy]
#[derive(Pod)]
pub struct AnyNode {
pub tag: u32,
pub data: [u8; NODE_SIZE - 4],
pub data: [u8; 84], // note: anchor can't parse the struct for IDL when it includes non numbers, NODE_SIZE == 88, 84 == 88 - 4
}
const_assert_eq!(size_of::<AnyNode>(), NODE_SIZE);
const_assert_eq!(size_of::<AnyNode>(), size_of::<InnerNode>());
const_assert_eq!(size_of::<AnyNode>(), size_of::<LeafNode>());
const_assert_eq!(size_of::<AnyNode>(), size_of::<FreeNode>());

View File

@ -23,12 +23,12 @@ pub trait QueueHeader: bytemuck::Pod {
}
#[account(zero_copy)]
pub struct Queue<H: QueueHeader> {
pub header: H,
pub buf: [H::Item; MAX_NUM_EVENTS],
pub struct EventQueue {
pub header: EventQueueHeader,
pub buf: [AnyEvent; MAX_NUM_EVENTS],
}
impl<'a, H: QueueHeader> Queue<H> {
impl EventQueue {
pub fn len(&self) -> usize {
self.header.count()
}
@ -45,7 +45,7 @@ impl<'a, H: QueueHeader> Queue<H> {
self.header.count() == 0
}
pub fn push_back(&mut self, value: H::Item) -> std::result::Result<(), H::Item> {
pub fn push_back(&mut self, value: AnyEvent) -> std::result::Result<(), AnyEvent> {
if self.full() {
return Err(value);
}
@ -59,21 +59,21 @@ impl<'a, H: QueueHeader> Queue<H> {
Ok(())
}
pub fn peek_front(&self) -> Option<&H::Item> {
pub fn peek_front(&self) -> Option<&AnyEvent> {
if self.empty() {
return None;
}
Some(&self.buf[self.header.head()])
}
pub fn peek_front_mut(&mut self) -> Option<&mut H::Item> {
pub fn peek_front_mut(&mut self) -> Option<&mut AnyEvent> {
if self.empty() {
return None;
}
Some(&mut self.buf[self.header.head()])
}
pub fn pop_front(&mut self) -> Result<H::Item> {
pub fn pop_front(&mut self) -> Result<AnyEvent> {
require!(!self.empty(), MangoError::SomeError);
let value = self.buf[self.header.head()];
@ -95,21 +95,21 @@ impl<'a, H: QueueHeader> Queue<H> {
Ok(())
}
pub fn iter(&self) -> impl Iterator<Item = &H::Item> {
QueueIterator {
pub fn iter(&self) -> impl Iterator<Item = &AnyEvent> {
EventQueueIterator {
queue: self,
index: 0,
}
}
}
struct QueueIterator<'a, H: QueueHeader> {
queue: &'a Queue<H>,
struct EventQueueIterator<'a> {
queue: &'a EventQueue,
index: usize,
}
impl<'a, H: QueueHeader> Iterator for QueueIterator<'a, H> {
type Item = &'a H::Item;
impl<'a> Iterator for EventQueueIterator<'a> {
type Item = &'a AnyEvent;
fn next(&mut self) -> Option<Self::Item> {
if self.index == self.queue.len() {
None
@ -122,7 +122,8 @@ impl<'a, H: QueueHeader> Iterator for QueueIterator<'a, H> {
}
}
#[account(zero_copy)]
#[zero_copy]
#[derive(Pod)]
pub struct EventQueueHeader {
head: usize,
count: usize,
@ -152,18 +153,19 @@ impl QueueHeader for EventQueueHeader {
}
}
pub type EventQueue = Queue<EventQueueHeader>;
const_assert_eq!(std::mem::size_of::<EventQueue>(), 8 * 3 + 512 * 200);
const_assert_eq!(std::mem::size_of::<EventQueue>() % 8, 0);
const EVENT_SIZE: usize = 200;
#[derive(Copy, Clone, Debug, Pod)]
#[repr(C)]
#[zero_copy]
#[derive(Debug, Pod)]
pub struct AnyEvent {
pub event_type: u8,
pub padding: [u8; EVENT_SIZE - 1],
pub padding: [u8; 199], // note: anchor can't parse the struct for IDL when it includes non numbers, EVENT_SIZE == 200, 199 == 200 - 1
}
const_assert_eq!(size_of::<AnyEvent>(), EVENT_SIZE);
#[derive(Copy, Clone, IntoPrimitive, TryFromPrimitive, Eq, PartialEq)]
#[repr(u8)]
pub enum EventType {

View File

@ -9,9 +9,9 @@ use mango_v4::instructions::{
InterestRateParams, Serum3OrderType, Serum3SelfTradeBehavior, Serum3Side,
};
use solana_program::instruction::Instruction;
use solana_program_test::BanksClientError;
use solana_sdk::instruction;
use solana_sdk::signature::{Keypair, Signer};
use solana_sdk::transport::TransportError;
use std::str::FromStr;
@ -38,7 +38,7 @@ impl ClientAccountLoader for &SolanaCookie {
pub async fn send_tx<CI: ClientInstruction>(
solana: &SolanaCookie,
ix: CI,
) -> std::result::Result<CI::Accounts, BanksClientError> {
) -> std::result::Result<CI::Accounts, TransportError> {
let (accounts, instruction) = ix.to_instruction(solana).await;
let signers = ix.signers();
let instructions = vec![instruction];

View File

@ -5,6 +5,7 @@ use anchor_lang::AccountDeserialize;
use anchor_spl::token::TokenAccount;
use solana_program::{program_pack::Pack, rent::*, system_instruction};
use solana_program_test::*;
use solana_sdk::transport::TransportError;
use solana_sdk::{
account::ReadableAccount,
instruction::Instruction,
@ -26,7 +27,7 @@ impl SolanaCookie {
&self,
instructions: &[Instruction],
signers: Option<&[&Keypair]>,
) -> Result<(), BanksClientError> {
) -> Result<(), TransportError> {
self.program_log.write().unwrap().clear();
let mut context = self.context.borrow_mut();

View File

@ -2,7 +2,7 @@
use fixed::types::I80F48;
use solana_program_test::*;
use solana_sdk::{signature::Keypair, signature::Signer};
use solana_sdk::{signature::Keypair, signature::Signer, transport::TransportError};
use mango_v4::state::*;
use program_test::*;
@ -12,7 +12,7 @@ mod program_test;
// This is an unspecific happy-case test that just runs a few instructions to check
// that they work in principle. It should be split up / renamed.
#[tokio::test]
async fn test_basic() -> Result<(), BanksClientError> {
async fn test_basic() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -2,11 +2,12 @@
use program_test::*;
use solana_program_test::*;
use solana_sdk::transport::TransportError;
mod program_test;
#[tokio::test]
async fn test_benchmark() -> Result<(), BanksClientError> {
async fn test_benchmark() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -1,7 +1,7 @@
#![cfg(feature = "test-bpf")]
use solana_program_test::*;
use solana_sdk::signature::Keypair;
use solana_sdk::{signature::Keypair, transport::TransportError};
use program_test::*;
@ -9,7 +9,7 @@ mod program_test;
// Try to reach compute limits in health checks by having many different tokens in an account
#[tokio::test]
async fn test_health_compute_tokens() -> Result<(), BanksClientError> {
async fn test_health_compute_tokens() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();
@ -72,7 +72,7 @@ async fn test_health_compute_tokens() -> Result<(), BanksClientError> {
// Try to reach compute limits in health checks by having many serum markets in an account
#[tokio::test]
async fn test_health_compute_serum() -> Result<(), BanksClientError> {
async fn test_health_compute_serum() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -2,7 +2,7 @@
use fixed::types::I80F48;
use solana_program_test::*;
use solana_sdk::signature::Keypair;
use solana_sdk::{signature::Keypair, transport::TransportError};
use mango_v4::{
instructions::{Serum3OrderType, Serum3SelfTradeBehavior, Serum3Side},
@ -13,7 +13,7 @@ use program_test::*;
mod program_test;
#[tokio::test]
async fn test_liq_tokens_force_cancel() -> Result<(), BanksClientError> {
async fn test_liq_tokens_force_cancel() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();
@ -216,7 +216,7 @@ async fn test_liq_tokens_force_cancel() -> Result<(), BanksClientError> {
}
#[tokio::test]
async fn test_liq_tokens_with_token() -> Result<(), BanksClientError> {
async fn test_liq_tokens_with_token() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -5,12 +5,12 @@ use fixed_macro::types::I80F48;
use mango_v4::state::*;
use program_test::*;
use solana_program_test::*;
use solana_sdk::signature::Keypair;
use solana_sdk::{signature::Keypair, transport::TransportError};
mod program_test;
#[tokio::test]
async fn test_perp() -> Result<(), BanksClientError> {
async fn test_perp() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -1,7 +1,7 @@
#![cfg(feature = "test-bpf")]
use solana_program_test::*;
use solana_sdk::signature::Keypair;
use solana_sdk::{signature::Keypair, transport::TransportError};
use mango_v4::{
instructions::{Serum3OrderType, Serum3SelfTradeBehavior, Serum3Side},
@ -12,7 +12,7 @@ use program_test::*;
mod program_test;
#[tokio::test]
async fn test_serum() -> Result<(), BanksClientError> {
async fn test_serum() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -2,14 +2,14 @@
use mango_v4::state::Bank;
use solana_program_test::*;
use solana_sdk::signature::Keypair;
use solana_sdk::{signature::Keypair, transport::TransportError};
use program_test::*;
mod program_test;
#[tokio::test]
async fn test_update_index() -> Result<(), BanksClientError> {
async fn test_update_index() -> Result<(), TransportError> {
let context = TestContext::new().await;
let solana = &context.solana.clone();

View File

@ -18,6 +18,6 @@ default = []
test-bpf = []
[dependencies]
anchor-lang = { version = "0.22.0", features = [] }
anchor-spl = "0.22.0"
solana-program = "1.9.5"
anchor-lang = { version = "0.24.2", features = [] }
anchor-spl = "0.24.2"
solana-program = "1.9.13"

View File

@ -15,6 +15,8 @@ anchor build --skip-lint
# update types in ts client package
cp -v ./target/types/mango_v4.ts ./ts/client/src/mango_v4.ts
(cd ./ts/client && tsc)
if [[ -z "${NO_DEPLOY}" ]]; then
# publish program
solana --url https://mango.devnet.rpcpool.com program deploy --program-id $PROGRAM_ID \

View File

@ -44,8 +44,8 @@
"trailingComma": "all"
},
"dependencies": {
"@project-serum/anchor": "^0.22.0",
"@project-serum/serum": "^0.13.62",
"@project-serum/anchor": "^0.24.2",
"@project-serum/serum": "^0.13.65",
"@solana/spl-token": "^0.2.0",
"@types/bs58": "^4.0.1",
"big.js": "^6.1.1",

View File

@ -1,4 +1,4 @@
import { BN, Program, Provider } from '@project-serum/anchor';
import { AnchorProvider, BN, Program, Provider } from '@project-serum/anchor';
import { getFeeRates, getFeeTier, Market } from '@project-serum/serum';
import { Order } from '@project-serum/serum/lib/market';
import * as spl from '@solana/spl-token';
@ -38,7 +38,7 @@ export class MangoClient {
// Group
public async createGroup(): Promise<TransactionSignature> {
const adminPk = this.program.provider.wallet.publicKey;
const adminPk = (this.program.provider as AnchorProvider).wallet.publicKey;
return await this.program.methods
.createGroup()
.accounts({
@ -108,10 +108,10 @@ export class MangoClient {
)
.accounts({
group: group.publicKey,
admin: this.program.provider.wallet.publicKey,
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
mint: mintPk,
oracle: oraclePk,
payer: this.program.provider.wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
rent: SYSVAR_RENT_PUBKEY,
})
.rpc();
@ -141,9 +141,9 @@ export class MangoClient {
.createStubOracle({ val: I80F48.fromNumber(price).getData() })
.accounts({
group: group.publicKey,
admin: this.program.provider.wallet.publicKey,
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
tokenMint: mintPk,
payer: this.program.provider.wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -157,9 +157,9 @@ export class MangoClient {
.setStubOracle({ val: I80F48.fromNumber(price).getData() })
.accounts({
group: group.publicKey,
admin: this.program.provider.wallet.publicKey,
tokenMint: mintPk,
payer: this.program.provider.wallet.publicKey,
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
oracle: mintPk,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -212,8 +212,8 @@ export class MangoClient {
.createAccount(accountNumber, name ?? '')
.accounts({
group: group.publicKey,
owner: this.program.provider.wallet.publicKey,
payer: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -256,8 +256,9 @@ export class MangoClient {
.closeAccount()
.accounts({
account: mangoAccount.publicKey,
owner: this.program.provider.wallet.publicKey,
solDestination: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
solDestination: (this.program.provider as AnchorProvider).wallet
.publicKey,
})
.rpc();
}
@ -286,7 +287,8 @@ export class MangoClient {
bank: bank.publicKey,
vault: bank.vault,
tokenAccount: tokenAccountPk,
tokenAuthority: this.program.provider.wallet.publicKey,
tokenAuthority: (this.program.provider as AnchorProvider).wallet
.publicKey,
})
.remainingAccounts(
healthRemainingAccounts.map(
@ -322,7 +324,6 @@ export class MangoClient {
bank: bank.publicKey,
vault: bank.vault,
tokenAccount: tokenAccountPk,
tokenAuthority: this.program.provider.wallet.publicKey,
})
.remainingAccounts(
healthRemainingAccounts.map(
@ -348,12 +349,12 @@ export class MangoClient {
.serum3RegisterMarket(marketIndex, name)
.accounts({
group: group.publicKey,
admin: this.program.provider.wallet.publicKey,
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
serumProgram: serum3ProgramId,
serumMarketExternal: serum3MarketExternalPk,
baseBank: baseBank.publicKey,
quoteBank: quoteBank.publicKey,
payer: this.program.provider.wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -417,8 +418,8 @@ export class MangoClient {
serumMarket: serum3Market.publicKey,
serumProgram: serum3Market.serumProgram,
serumMarketExternal: serum3Market.serumMarketExternal,
owner: this.program.provider.wallet.publicKey,
payer: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -493,7 +494,7 @@ export class MangoClient {
.accounts({
group: group.publicKey,
account: mangoAccount.publicKey,
owner: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
openOrders: mangoAccount.findSerum3Account(serum3Market.marketIndex)
?.openOrders,
serumMarket: serum3Market.publicKey,
@ -555,7 +556,7 @@ export class MangoClient {
.accounts({
group: group.publicKey,
account: mangoAccount.publicKey,
owner: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
openOrders: mangoAccount.findSerum3Account(serum3Market.marketIndex)
?.openOrders,
serumMarket: serum3Market.publicKey,
@ -650,7 +651,9 @@ export class MangoClient {
const asks = new Keypair();
const eventQueue = new Keypair();
console.log(this.program.provider.wallet.publicKey.toBase58());
console.log(
(this.program.provider as AnchorProvider).wallet.publicKey.toBase58(),
);
return await this.program.methods
.perpCreateMarket(
@ -673,12 +676,12 @@ export class MangoClient {
)
.accounts({
group: group.publicKey,
admin: this.program.provider.wallet.publicKey,
admin: (this.program.provider as AnchorProvider).wallet.publicKey,
oracle: oraclePk,
bids: bids.publicKey,
asks: asks.publicKey,
eventQueue: eventQueue.publicKey,
payer: this.program.provider.wallet.publicKey,
payer: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.preInstructions([
SystemProgram.createAccount({
@ -688,7 +691,8 @@ export class MangoClient {
await this.program.provider.connection.getMinimumBalanceForRentExemption(
90160,
),
fromPubkey: this.program.provider.wallet.publicKey,
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,
newAccountPubkey: bids.publicKey,
}),
SystemProgram.createAccount({
@ -698,7 +702,8 @@ export class MangoClient {
await this.program.provider.connection.getMinimumBalanceForRentExemption(
90160,
),
fromPubkey: this.program.provider.wallet.publicKey,
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,
newAccountPubkey: asks.publicKey,
}),
SystemProgram.createAccount({
@ -708,7 +713,8 @@ export class MangoClient {
await this.program.provider.connection.getMinimumBalanceForRentExemption(
102432,
),
fromPubkey: this.program.provider.wallet.publicKey,
fromPubkey: (this.program.provider as AnchorProvider).wallet
.publicKey,
newAccountPubkey: eventQueue.publicKey,
}),
])
@ -794,7 +800,7 @@ export class MangoClient {
bids: perpMarket.bids,
eventQueue: perpMarket.eventQueue,
oracle: perpMarket.oracle,
owner: this.program.provider.wallet.publicKey,
owner: (this.program.provider as AnchorProvider).wallet.publicKey,
})
.rpc();
}
@ -810,30 +816,6 @@ export class MangoClient {
// const idl = await Program.fetchIdl(MANGO_V4_ID, provider);
let idl = IDL;
// TODO: remove...
// Temporarily add missing (dummy) type definitions, so we can do new Program(...) below
// without anchor throwing errors. These types come from part of the code we don't yet care about
// in the client.
function addDummyType(idl: MangoV4, typeName: string) {
if (idl.types.find((type) => type.name === typeName)) {
return;
}
(idl.types as any).push({
name: typeName,
type: {
kind: 'struct',
fields: [],
},
});
}
addDummyType(idl, 'usize');
addDummyType(idl, 'AnyNode');
addDummyType(idl, 'EventQueueHeader');
addDummyType(idl, 'AnyEvent');
addDummyType(idl, 'H');
addDummyType(idl, 'H::Item');
addDummyType(idl, 'NodeHandle');
return new MangoClient(
new Program<MangoV4>(idl as MangoV4, MANGO_V4_ID, provider),
devnet,

View File

@ -519,9 +519,7 @@ export type MangoV4 = {
"args": [
{
"name": "banksLen",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "cpiData",
@ -1522,9 +1520,7 @@ export type MangoV4 = {
"args": [
{
"name": "limit",
"type": {
"defined": "usize"
}
"type": "u64"
}
]
},
@ -1917,33 +1913,23 @@ export type MangoV4 = {
},
{
"name": "bumpIndex",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "freeListLen",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "freeListHead",
"type": {
"defined": "NodeHandle"
}
"type": "u32"
},
{
"name": "rootNode",
"type": {
"defined": "NodeHandle"
}
"type": "u32"
},
{
"name": "leafCount",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "nodes",
@ -1960,14 +1946,14 @@ export type MangoV4 = {
}
},
{
"name": "queue",
"name": "eventQueue",
"type": {
"kind": "struct",
"fields": [
{
"name": "header",
"type": {
"defined": "H"
"defined": "EventQueueHeader"
}
},
{
@ -1975,7 +1961,7 @@ export type MangoV4 = {
"type": {
"array": [
{
"defined": "H::Item"
"defined": "AnyEvent"
},
512
]
@ -1984,32 +1970,6 @@ export type MangoV4 = {
]
}
},
{
"name": "eventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": {
"defined": "usize"
}
},
{
"name": "count",
"type": {
"defined": "usize"
}
},
{
"name": "seqNum",
"type": {
"defined": "usize"
}
}
]
}
},
{
"name": "perpMarket",
"type": {
@ -2470,6 +2430,68 @@ export type MangoV4 = {
]
}
},
{
"name": "AnyNode",
"type": {
"kind": "struct",
"fields": [
{
"name": "tag",
"type": "u32"
},
{
"name": "data",
"type": {
"array": [
"u8",
84
]
}
}
]
}
},
{
"name": "EventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": "u64"
},
{
"name": "count",
"type": "u64"
},
{
"name": "seqNum",
"type": "u64"
}
]
}
},
{
"name": "AnyEvent",
"type": {
"kind": "struct",
"fields": [
{
"name": "eventType",
"type": "u8"
},
{
"name": "padding",
"type": {
"array": [
"u8",
199
]
}
}
]
}
},
{
"name": "TokenIndex",
"type": {
@ -3337,9 +3359,7 @@ export const IDL: MangoV4 = {
"args": [
{
"name": "banksLen",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "cpiData",
@ -4340,9 +4360,7 @@ export const IDL: MangoV4 = {
"args": [
{
"name": "limit",
"type": {
"defined": "usize"
}
"type": "u64"
}
]
},
@ -4735,33 +4753,23 @@ export const IDL: MangoV4 = {
},
{
"name": "bumpIndex",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "freeListLen",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "freeListHead",
"type": {
"defined": "NodeHandle"
}
"type": "u32"
},
{
"name": "rootNode",
"type": {
"defined": "NodeHandle"
}
"type": "u32"
},
{
"name": "leafCount",
"type": {
"defined": "usize"
}
"type": "u64"
},
{
"name": "nodes",
@ -4778,14 +4786,14 @@ export const IDL: MangoV4 = {
}
},
{
"name": "queue",
"name": "eventQueue",
"type": {
"kind": "struct",
"fields": [
{
"name": "header",
"type": {
"defined": "H"
"defined": "EventQueueHeader"
}
},
{
@ -4793,7 +4801,7 @@ export const IDL: MangoV4 = {
"type": {
"array": [
{
"defined": "H::Item"
"defined": "AnyEvent"
},
512
]
@ -4802,32 +4810,6 @@ export const IDL: MangoV4 = {
]
}
},
{
"name": "eventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": {
"defined": "usize"
}
},
{
"name": "count",
"type": {
"defined": "usize"
}
},
{
"name": "seqNum",
"type": {
"defined": "usize"
}
}
]
}
},
{
"name": "perpMarket",
"type": {
@ -5288,6 +5270,68 @@ export const IDL: MangoV4 = {
]
}
},
{
"name": "AnyNode",
"type": {
"kind": "struct",
"fields": [
{
"name": "tag",
"type": "u32"
},
{
"name": "data",
"type": {
"array": [
"u8",
84
]
}
}
]
}
},
{
"name": "EventQueueHeader",
"type": {
"kind": "struct",
"fields": [
{
"name": "head",
"type": "u64"
},
{
"name": "count",
"type": "u64"
},
{
"name": "seqNum",
"type": "u64"
}
]
}
},
{
"name": "AnyEvent",
"type": {
"kind": "struct",
"fields": [
{
"name": "eventType",
"type": "u8"
},
{
"name": "padding",
"type": {
"array": [
"u8",
199
]
}
}
]
}
},
{
"name": "TokenIndex",
"type": {

View File

@ -1,4 +1,4 @@
import { Provider, Wallet } from '@project-serum/anchor';
import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
import fs from 'fs';
import { MangoClient } from '../client';
@ -25,7 +25,7 @@ const DEVNET_ORACLES = new Map([
// * solana airdrop 1 -k ~/.config/solana/admin.json
//
async function main() {
const options = Provider.defaultOptions();
const options = AnchorProvider.defaultOptions();
const connection = new Connection(
'https://mango.devnet.rpcpool.com',
options,
@ -38,7 +38,7 @@ async function main() {
);
const adminWallet = new Wallet(admin);
console.log(`Admin ${adminWallet.publicKey.toBase58()}`);
const adminProvider = new Provider(connection, adminWallet, options);
const adminProvider = new AnchorProvider(connection, adminWallet, options);
const client = await MangoClient.connect(adminProvider, true);
// group

View File

@ -1,4 +1,4 @@
import { Provider, Wallet } from '@project-serum/anchor';
import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { Connection, Keypair } from '@solana/web3.js';
import fs from 'fs';
import { OrderType, Side } from '../accounts/perp';
@ -17,7 +17,7 @@ import { DEVNET_SERUM3_PROGRAM_ID } from '../constants';
// process.env.ADMIN_KEYPAIR - group admin keypair path (useful for automatically finding the group)
//
async function main() {
const options = Provider.defaultOptions();
const options = AnchorProvider.defaultOptions();
const connection = new Connection(
'https://mango.devnet.rpcpool.com',
options,
@ -29,7 +29,7 @@ async function main() {
),
);
const userWallet = new Wallet(user);
const userProvider = new Provider(connection, userWallet, options);
const userProvider = new AnchorProvider(connection, userWallet, options);
const client = await MangoClient.connect(userProvider, true);
console.log(`User ${userWallet.publicKey.toBase58()}`);

View File

@ -23,17 +23,10 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/runtime@^7.10.5":
version "7.17.8"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.8.tgz#3e56e4aff81befa55ac3ac6a0967349fd1c5bca2"
integrity sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5":
version "7.17.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941"
integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw==
"@babel/runtime@^7.10.5", "@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2":
version "7.17.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.9.tgz#d19fbf802d01a8cb6cf053a64e472d42c434ba72"
integrity sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg==
dependencies:
regenerator-runtime "^0.13.4"
@ -52,25 +45,25 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@ethersproject/bytes@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c"
integrity sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==
"@ethersproject/bytes@^5.6.0":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7"
integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g==
dependencies:
"@ethersproject/logger" "^5.5.0"
"@ethersproject/logger" "^5.6.0"
"@ethersproject/logger@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d"
integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==
"@ethersproject/logger@^5.6.0":
version "5.6.0"
resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a"
integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==
"@ethersproject/sha2@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7"
integrity sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==
version "5.6.0"
resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.0.tgz#364c4c11cc753bda36f31f001628706ebadb64d9"
integrity sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==
dependencies:
"@ethersproject/bytes" "^5.5.0"
"@ethersproject/logger" "^5.5.0"
"@ethersproject/bytes" "^5.6.0"
"@ethersproject/logger" "^5.6.0"
hash.js "1.1.7"
"@hapi/hoek@^9.0.0":
@ -140,13 +133,13 @@
snake-case "^3.0.4"
toml "^3.0.0"
"@project-serum/anchor@^0.22.0":
version "0.22.0"
resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.22.0.tgz#79d182851346fb46d471577c63eabdf6f199c03e"
integrity sha512-EJOE790pAQjm07loh7/JYzfcgfYv3SChBb2b9lhVdjjiimSEQrf3ESy+CGMAqcFAsyr699Ewj5k7RizY1y31cg==
"@project-serum/anchor@^0.24.2":
version "0.24.2"
resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.24.2.tgz#a3c52a99605c80735f446ca9b3a4885034731004"
integrity sha512-0/718g8/DnEuwAidUwh5wLYphUYXhUbiClkuRNhvNoa+1Y8a4g2tJyxoae+emV+PG/Gikd/QUBNMkIcimiIRTA==
dependencies:
"@project-serum/borsh" "^0.2.5"
"@solana/web3.js" "^1.17.0"
"@solana/web3.js" "^1.36.0"
base64-js "^1.5.1"
bn.js "^5.1.2"
bs58 "^4.0.1"
@ -155,7 +148,6 @@
cross-fetch "^3.1.5"
crypto-hash "^1.3.0"
eventemitter3 "^4.0.7"
find "^0.3.0"
js-sha256 "^0.9.0"
pako "^2.0.3"
snake-case "^3.0.4"
@ -169,10 +161,10 @@
bn.js "^5.1.2"
buffer-layout "^1.2.0"
"@project-serum/serum@^0.13.62":
version "0.13.62"
resolved "https://registry.yarnpkg.com/@project-serum/serum/-/serum-0.13.62.tgz#97bb9134134a2b6d5fbe25f970ca31a1e15a1ca4"
integrity sha512-AsOB83woe48/sAm86KuCubgxauecoawz+CGXT5HYqOkkhfBpppp9+tVR/dAkOgfIZ9Kc1d8MtNRDNXPojXdlow==
"@project-serum/serum@^0.13.65":
version "0.13.65"
resolved "https://registry.yarnpkg.com/@project-serum/serum/-/serum-0.13.65.tgz#6d3cf07912f13985765237f053cca716fe84b0b0"
integrity sha512-BHRqsTqPSfFB5p+MgI2pjvMBAQtO8ibTK2fYY96boIFkCI3TTwXDt2gUmspeChKO2pqHr5aKevmexzAcXxrSRA==
dependencies:
"@project-serum/anchor" "^0.11.1"
"@solana/spl-token" "^0.1.6"
@ -207,13 +199,6 @@
bigint-buffer "^1.1.5"
bignumber.js "^9.0.1"
"@solana/buffer-layout@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-3.0.0.tgz#b9353caeb9a1589cb77a1b145bcb1a9a93114326"
integrity sha512-MVdgAKKL39tEs0l8je0hKaXLQFb7Rdfb0Xg2LjFZd8Lfdazkg6xiS98uAZrEKvaoF3i4M95ei9RydkGIDMeo3w==
dependencies:
buffer "~6.0.3"
"@solana/buffer-layout@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz#75b1b11adc487234821c81dfae3119b73a5fd734"
@ -243,39 +228,21 @@
"@solana/web3.js" "^1.32.0"
start-server-and-test "^1.14.0"
"@solana/web3.js@^1.17.0":
version "1.35.1"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.35.1.tgz#777b039a3b51e63c347712a57c7db87c9d1db832"
integrity sha512-3bDawFFI0KcvgI8Ae4N4hdQ8+Bg9gu6q+IkhPrYxOF6RYnB3U+9A4u+DhHZWLvTvgoTyesi/m5HzlleKtFEqRQ==
dependencies:
"@babel/runtime" "^7.12.5"
"@ethersproject/sha2" "^5.5.0"
"@solana/buffer-layout" "^3.0.0"
bn.js "^5.0.0"
borsh "^0.4.0"
bs58 "^4.0.1"
buffer "6.0.1"
cross-fetch "^3.1.4"
jayson "^3.4.4"
js-sha3 "^0.8.0"
rpc-websockets "^7.4.2"
secp256k1 "^4.0.2"
superstruct "^0.14.2"
tweetnacl "^1.0.0"
"@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0":
version "1.37.0"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.37.0.tgz#167b5b5d4aedc151237d9230b6142da068b0af34"
integrity sha512-O2iCcgkGdi2FXwVLztPIZHcBuZXdhbVLavMsG+RdEyFGzFD0tQN1rOJ+Xb5eaexjqtgcqRN+Fyg3wAhLcHJbiA==
"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0":
version "1.42.0"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.42.0.tgz#296e4bbab1fbfc198b3e9c3d94016c3876eb6a2c"
integrity sha512-QqGh5DWzrgsWRx4sCPDQIm3390b7buPR16tZI61slQaQwJ2ymrSXPQCe4PPTJEIlzGjCV3dkn2vpT2R32BfK2Q==
dependencies:
"@babel/runtime" "^7.12.5"
"@ethersproject/sha2" "^5.5.0"
"@solana/buffer-layout" "^4.0.0"
"@solana/buffer-layout-utils" "^0.2.0"
bn.js "^5.0.0"
borsh "^0.7.0"
bs58 "^4.0.1"
buffer "6.0.1"
cross-fetch "^3.1.4"
fast-stable-stringify "^1.0.0"
jayson "^3.4.4"
js-sha3 "^0.8.0"
rpc-websockets "^7.4.2"
@ -288,13 +255,6 @@
resolved "https://registry.yarnpkg.com/@tsconfig/recommended/-/recommended-1.0.1.tgz#7619bad397e06ead1c5182926c944e0ca6177f52"
integrity sha512-2xN+iGTbPBEzGSnVp/Hd64vKJCJWxsi9gfs88x4PPMyEjHJoA3o5BY9r5OLPHIZU2pAQxkSAsJFqn6itClP8mQ==
"@types/bn.js@^4.11.5":
version "4.11.6"
resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c"
integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==
dependencies:
"@types/node" "*"
"@types/bs58@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/bs58/-/bs58-4.0.1.tgz#3d51222aab067786d3bc3740a84a7f5a0effaa37"
@ -334,9 +294,9 @@
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
"@types/lodash@^4.14.159":
version "4.14.178"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.178.tgz#341f6d2247db528d4a13ddbb374bcdc80406f4f8"
integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==
version "4.14.182"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2"
integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==
"@types/mocha@^9.1.0":
version "9.1.0"
@ -344,14 +304,14 @@
integrity sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==
"@types/node@*":
version "17.0.19"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.19.tgz#726171367f404bfbe8512ba608a09ebad810c7e6"
integrity sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA==
version "17.0.34"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.34.tgz#3b0b6a50ff797280b8d000c6281d229f9c538cef"
integrity sha512-XImEz7XwTvDBtzlTnm8YvMqGW/ErMWBsKZ+hMTvnDIjGCKxwK5Xpc+c/oQjOauwq8M4OS11hEkpjX8rrI/eEgA==
"@types/node@^12.12.54":
version "12.20.46"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.46.tgz#7e49dee4c54fd19584e6a9e0da5f3dc2e9136bc7"
integrity sha512-cPjLXj8d6anFPzFvOPxS3fvly3Shm5nTfl6g8X5smexixbuGUf7hfr21J5tX9JW+UPStp/5P5R8qrKL5IyVJ+A==
version "12.20.52"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.52.tgz#2fd2dc6bfa185601b15457398d4ba1ef27f81251"
integrity sha512-cfkwWw72849SNYp3Zx0IcIs25vABmFh73xicxhCkTcvtZQeIez15PpwQN8fY3RD7gv1Wrxlc9MEtfMORZDEsGw==
"@types/node@^14.14.37":
version "14.18.12"
@ -630,16 +590,6 @@ bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0:
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002"
integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==
borsh@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.4.0.tgz#9dd6defe741627f1315eac2a73df61421f6ddb9f"
integrity sha512-aX6qtLya3K0AkT66CmYWCCDr77qsE9arV05OmdFpmat9qu8Pg9J5tBUPDztAW5fNh/d/MyVG/OYziP52Ndzx1g==
dependencies:
"@types/bn.js" "^4.11.5"
bn.js "^5.0.0"
bs58 "^4.0.0"
text-encoding-utf-8 "^1.0.2"
borsh@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a"
@ -667,7 +617,7 @@ braces@^3.0.1, braces@~3.0.2:
brorand@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==
browser-stdout@1.3.1:
version "1.3.1"
@ -677,7 +627,7 @@ browser-stdout@1.3.1:
bs58@^4.0.0, bs58@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo=
integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==
dependencies:
base-x "^3.0.2"
@ -791,11 +741,6 @@ chokidar@3.5.3:
optionalDependencies:
fsevents "~2.3.2"
circular-json@^0.5.9:
version "0.5.9"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.9.tgz#932763ae88f4f7dead7a0d09c8a51a4743a53b1d"
integrity sha512-4ivwqHpIFJZBuhN3g/pEcdbnGUywkBblloGbkglyloVjjR3uT6tieI89MVOfbP2tHX5sgb01FuLgAOzebNlJNQ==
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
@ -1190,6 +1135,11 @@ fast-levenshtein@^2.0.6:
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
fast-stable-stringify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz#5c5543462b22aeeefd36d05b34e51c78cb86d313"
integrity sha1-XFVDRisiru79NtBbNOUceMuG0xM=
fastq@^1.6.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c"
@ -1777,9 +1727,9 @@ node-fetch@2.6.7:
whatwg-url "^5.0.0"
node-gyp-build@^4.2.0, node-gyp-build@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==
version "4.4.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4"
integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
@ -1966,15 +1916,14 @@ rimraf@^3.0.2:
glob "^7.1.3"
rpc-websockets@^7.4.2:
version "7.4.17"
resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.4.17.tgz#f38845dd96db0442bff9e15fba9df781beb44cc0"
integrity sha512-eolVi/qlXS13viIUH9aqrde902wzSLAai0IjmOZSRefp5I3CSG/vCnD0c0fDSYCWuEyUoRL1BHQA8K1baEUyow==
version "7.4.18"
resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.4.18.tgz#274c825c0efadbf6fe75f10289229ae537fe9ffb"
integrity sha512-bVu+4qM5CkGVlTqJa6FaAxLbb5uRnyH4te7yjFvoCzbnif7PT4BcvXtNTprHlNvsH+/StB81zUQicxMrUrIomA==
dependencies:
"@babel/runtime" "^7.11.2"
circular-json "^0.5.9"
"@babel/runtime" "^7.17.2"
eventemitter3 "^4.0.7"
uuid "^8.3.0"
ws "^7.4.5"
uuid "^8.3.2"
ws "^8.5.0"
optionalDependencies:
bufferutil "^4.0.1"
utf-8-validate "^5.0.2"
@ -2269,7 +2218,12 @@ tslib@^1.8.1:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@^2.0.3, tslib@^2.1.0:
tslib@^2.0.3:
version "2.4.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
tslib@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
@ -2327,13 +2281,13 @@ uri-js@^4.2.2:
punycode "^2.1.0"
utf-8-validate@^5.0.2:
version "5.0.8"
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.8.tgz#4a735a61661dbb1c59a0868c397d2fe263f14e58"
integrity sha512-k4dW/Qja1BYDl2qD4tOMB9PFVha/UJtxTc1cXYOe3WwA/2m0Yn4qB7wLMpJyLJ/7DR0XnTut3HsCSzDT4ZvKgA==
version "5.0.9"
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.9.tgz#ba16a822fbeedff1a58918f2a6a6b36387493ea3"
integrity sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q==
dependencies:
node-gyp-build "^4.3.0"
uuid@^8.3.0, uuid@^8.3.2:
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
@ -2413,6 +2367,11 @@ ws@^7.4.5:
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.7.tgz#9e0ac77ee50af70d58326ecff7e85eb3fa375e67"
integrity sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==
ws@^8.5.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.6.0.tgz#e5e9f1d9e7ff88083d0c0dd8281ea662a42c9c23"
integrity sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==
y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"

View File

@ -2,7 +2,14 @@
set -e pipefail
# TODO fix need for --skip-lint
# build program,
anchor build --skip-lint
# patch types, which we want in rust, but anchor client doesn't support
./idl-fixup.sh
# update types in ts client package
cp -v ./target/types/mango_v4.ts ./ts/client/src/mango_v4.ts
(cd ./ts/client && tsc)