New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ellipsis-labs/phoenix-sdk

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ellipsis-labs/phoenix-sdk - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

9

config.json

@@ -24,4 +24,4 @@ {

"markets": [
"3PgJmaEKQqVzQNAT3WtMaSQxBFPL3WqnvyahRM28PGJH",
"snFwGhLMrzS9YmnKyyiromxZ1oWE9vX7ZpoNHv23cCC"
"6EvJccKnfxXvbAoCwf2iGTAEgckWuU834XAgT7tV4oxm",
"7EBrdSbDLvAJEMjigvSrBGkuRNdH9whvzkeojsHSVQib"
]

@@ -56,3 +56,6 @@ },

],
"markets": []
"markets": [
"6EvJccKnfxXvbAoCwf2iGTAEgckWuU834XAgT7tV4oxm",
"7EBrdSbDLvAJEMjigvSrBGkuRNdH9whvzkeojsHSVQib"
]
},

@@ -59,0 +62,0 @@ "localhost": {

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var Ir=Object.defineProperty;var qt=Object.getOwnPropertySymbols;var Or=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable;var V=Math.pow,vt=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,t)=>{for(var r in t||(t={}))Or.call(t,r)&&vt(e,r,t[r]);if(qt)for(var r of qt(t))Fr.call(t,r)&&vt(e,r,t[r]);return e};var x=(e,t,r)=>new Promise((n,o)=>{var a=i=>{try{u(r.next(i))}catch(c){o(c)}},s=i=>{try{u(r.throw(i))}catch(c){o(c)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(a,s);u((r=r.apply(e,t)).next())});var _web3js = require('@solana/web3.js'); var Le = _interopRequireWildcard(_web3js); var Me = _interopRequireWildcard(_web3js); var Ce = _interopRequireWildcard(_web3js); var Ve = _interopRequireWildcard(_web3js); var ve = _interopRequireWildcard(_web3js); var Re = _interopRequireWildcard(_web3js); var He = _interopRequireWildcard(_web3js); var je = _interopRequireWildcard(_web3js); var Qe = _interopRequireWildcard(_web3js); var Ye = _interopRequireWildcard(_web3js); var Xe = _interopRequireWildcard(_web3js); var et = _interopRequireWildcard(_web3js); var rt = _interopRequireWildcard(_web3js); var nt = _interopRequireWildcard(_web3js); var be = _interopRequireWildcard(_web3js); var at = _interopRequireWildcard(_web3js); var ct = _interopRequireWildcard(_web3js); var lt = _interopRequireWildcard(_web3js);var d=new Map,p=new Map,q= exports.InvalidMarketParametersError =class extends Error{constructor(){super("Invalid market parameters error");this.code=0;this.name="InvalidMarketParameters";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,q)}};d.set(0,()=>new q);p.set("InvalidMarketParameters",()=>new q);var v=class extends Error{constructor(){super("Invalid exchange authority error");this.code=1;this.name="InvalidMarketAuthority";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,v)}};d.set(1,()=>new v);p.set("InvalidMarketAuthority",()=>new v);var N=class extends Error{constructor(){super("Market deserialization error");this.code=2;this.name="FailedToLoadMarketFromAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,N)}};d.set(2,()=>new N);p.set("FailedToLoadMarketFromAccount",()=>new N);var R=class extends Error{constructor(){super("Market already initialized error");this.code=3;this.name="MarketAlreadyInitialized";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,R)}};d.set(3,()=>new R);p.set("MarketAlreadyInitialized",()=>new R);var z=class extends Error{constructor(){super("Market is not initialized error");this.code=4;this.name="MarketUninitialized";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}};d.set(4,()=>new z);p.set("MarketUninitialized",()=>new z);var H=class extends Error{constructor(){super("Invalid state transition error");this.code=5;this.name="InvalidStateTransition";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,H)}};d.set(5,()=>new H);p.set("InvalidStateTransition",()=>new H);var G=class extends Error{constructor(){super("Invalid market signer error");this.code=6;this.name="InvalidMarketSigner";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,G)}};d.set(6,()=>new G);p.set("InvalidMarketSigner",()=>new G);var j=class extends Error{constructor(){super("Invalid lot size error");this.code=7;this.name="InvalidLotSize";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j)}};d.set(7,()=>new j);p.set("InvalidLotSize",()=>new j);var Z=class extends Error{constructor(){super("Invalid tick size error");this.code=8;this.name="InvalidTickSize";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Z)}};d.set(8,()=>new Z);p.set("InvalidTickSize",()=>new Z);var Q=class extends Error{constructor(){super("Invalid mint error");this.code=9;this.name="InvalidMint";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Q)}};d.set(9,()=>new Q);p.set("InvalidMint",()=>new Q);var _=class extends Error{constructor(){super("Invalid base vault error");this.code=10;this.name="InvalidBaseVault";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,_)}};d.set(10,()=>new _);p.set("InvalidBaseVault",()=>new _);var Y=class extends Error{constructor(){super("Invalid quote vault error");this.code=11;this.name="InvalidQuoteVault";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Y)}};d.set(11,()=>new Y);p.set("InvalidQuoteVault",()=>new Y);var J=class extends Error{constructor(){super("Invalid base account error");this.code=12;this.name="InvalidBaseAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,J)}};d.set(12,()=>new J);p.set("InvalidBaseAccount",()=>new J);var X=class extends Error{constructor(){super("Invalid quote account error");this.code=13;this.name="InvalidQuoteAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,X)}};d.set(13,()=>new X);p.set("InvalidQuoteAccount",()=>new X);var $=class extends Error{constructor(){super("Too many events error");this.code=14;this.name="TooManyEvents";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$)}};d.set(14,()=>new $);p.set("TooManyEvents",()=>new $);var ee=class extends Error{constructor(){super("New order error");this.code=15;this.name="NewOrderError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ee)}};d.set(15,()=>new ee);p.set("NewOrderError",()=>new ee);var te=class extends Error{constructor(){super("Reduce order error");this.code=16;this.name="ReduceOrderError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,te)}};d.set(16,()=>new te);p.set("ReduceOrderError",()=>new te);var re=class extends Error{constructor(){super("Cancel multiple orders error");this.code=17;this.name="CancelMultipleOrdersError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,re)}};d.set(17,()=>new re);p.set("CancelMultipleOrdersError",()=>new re);var ie=class extends Error{constructor(){super("Withdraw funds error");this.code=18;this.name="WithdrawFundsError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ie)}};d.set(18,()=>new ie);p.set("WithdrawFundsError",()=>new ie);var ne=class extends Error{constructor(){super("Remove empty orders error");this.code=19;this.name="RemoveEmptyOrdersError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ne)}};d.set(19,()=>new ne);p.set("RemoveEmptyOrdersError",()=>new ne);var oe=class extends Error{constructor(){super("Trader not found error");this.code=20;this.name="TraderNotFound";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,oe)}};d.set(20,()=>new oe);p.set("TraderNotFound",()=>new oe);var se=class extends Error{constructor(){super("Invalid seat status");this.code=21;this.name="InvalidSeatStatus";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,se)}};d.set(21,()=>new se);p.set("InvalidSeatStatus",()=>new se);var ae=class extends Error{constructor(){super("Failed to evict trader");this.code=22;this.name="EvictionError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ae)}};d.set(22,()=>new ae);p.set("EvictionError",()=>new ae);function Ai(e){let t=d.get(e);return t!=null?t():null}function hi(e){let t=p.get(e);return t!=null?t():null}var _borsh = require('borsh');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _bnjs = require('bn.js'); var _bnjs2 = _interopRequireDefault(_bnjs);var _beet = require('@metaplex-foundation/beet'); var S = _interopRequireWildcard(_beet); var Ie = _interopRequireWildcard(_beet); var ye = _interopRequireWildcard(_beet); var Nt = _interopRequireWildcard(_beet); var A = _interopRequireWildcard(_beet); var fe = _interopRequireWildcard(_beet); var ge = _interopRequireWildcard(_beet); var E = _interopRequireWildcard(_beet); var ue = _interopRequireWildcard(_beet); var B = _interopRequireWildcard(_beet); var O = _interopRequireWildcard(_beet); var g = _interopRequireWildcard(_beet); var ce = _interopRequireWildcard(_beet); var ke = _interopRequireWildcard(_beet); var jt = _interopRequireWildcard(_beet); var h = _interopRequireWildcard(_beet); var b = _interopRequireWildcard(_beet); var Qt = _interopRequireWildcard(_beet); var _t = _interopRequireWildcard(_beet); var F = _interopRequireWildcard(_beet); var K = _interopRequireWildcard(_beet); var Be = _interopRequireWildcard(_beet); var D = _interopRequireWildcard(_beet); var Yt = _interopRequireWildcard(_beet); var C = _interopRequireWildcard(_beet); var We = _interopRequireWildcard(_beet); var Ee = _interopRequireWildcard(_beet); var De = _interopRequireWildcard(_beet); var Ue = _interopRequireWildcard(_beet); var qe = _interopRequireWildcard(_beet); var Ne = _interopRequireWildcard(_beet); var ze = _interopRequireWildcard(_beet); var Ge = _interopRequireWildcard(_beet); var Ze = _interopRequireWildcard(_beet); var _e = _interopRequireWildcard(_beet); var Je = _interopRequireWildcard(_beet); var $e = _interopRequireWildcard(_beet); var tt = _interopRequireWildcard(_beet); var it = _interopRequireWildcard(_beet); var ot = _interopRequireWildcard(_beet); var st = _interopRequireWildcard(_beet); var ut = _interopRequireWildcard(_beet); var bt = _interopRequireWildcard(_beet); var y = _interopRequireWildcard(_beet);var _beetsolana = require('@metaplex-foundation/beet-solana'); var kt = _interopRequireWildcard(_beetsolana); var zt = _interopRequireWildcard(_beetsolana); var Ht = _interopRequireWildcard(_beetsolana); var Fe = _interopRequireWildcard(_beetsolana); var xt = _interopRequireWildcard(_beetsolana); var Ft = _interopRequireWildcard(_beetsolana); var br = _interopRequireWildcard(_beetsolana);var Oi=new S.BeetArgsStruct([["instruction",S.u8],["sequenceNumber",S.u64],["timestamp",S.i64],["slot",S.u64],["market",kt.publicKey],["signer",kt.publicKey],["totalEvents",S.u16]],"AuditLogHeader");var Pt=(r=>(r[r.Bid=0]="Bid",r[r.Ask=1]="Ask",r))(Pt||{}),L= exports.sideBeet =Nt.fixedScalarEnum(Pt);var he=new ye.BeetArgsStruct([["side",L],["priceInTicks",ye.u64],["orderSequenceNumber",ye.u64]],"CancelOrderParams");var Mi=new Ie.FixableBeetArgsStruct([["orders",Ie.array(he)]],"CancelMultipleOrdersByIdParams");var Oe=new A.FixableBeetArgsStruct([["side",L],["tickLimit",A.coption(A.u64)],["numOrdersToSearch",A.coption(A.u32)],["numOrdersToCancel",A.coption(A.u32)]],"CancelUpToParams");var wt=new fe.BeetArgsStruct([["priceInTicks",fe.u64],["sizeInBaseLots",fe.u64]],"CondensedOrder");var Rt=new ge.BeetArgsStruct([["quoteLotsToDeposit",ge.u64],["baseLotsToDeposit",ge.u64]],"DepositParams");var Ni=new E.BeetArgsStruct([["index",E.u16],["makerId",zt.publicKey],["orderSequenceNumber",E.u64],["priceInTicks",E.u64],["baseLotsEvicted",E.u64]],"EvictEvent");var zi=new ue.BeetArgsStruct([["index",ue.u16],["feesCollectedInQuoteLots",ue.u64]],"FeeEvent");var Gi=new B.BeetArgsStruct([["index",B.u16],["makerId",Ht.publicKey],["orderSequenceNumber",B.u64],["priceInTicks",B.u64],["baseLotsFilled",B.u64],["baseLotsRemaining",B.u64]],"FillEvent");var Zi=new O.BeetArgsStruct([["index",O.u16],["clientOrderId",O.u128],["totalBaseLotsFilled",O.u64],["totalQuoteLotsFilled",O.u64],["totalFeeInQuoteLots",O.u64]],"FillSummaryEvent");var Gt=new ce.BeetArgsStruct([["bidsSize",ce.u64],["asksSize",ce.u64],["numSeats",ce.u64]],"MarketSizeParams");var St=new ke.BeetArgsStruct([["decimals",ke.u32],["vaultBump",ke.u32],["mintKey",xt.publicKey],["vaultKey",xt.publicKey]],"TokenParams");var At=new g.BeetArgsStruct([["discriminant",g.u64],["status",g.u64],["marketSizeParams",Gt],["baseParams",St],["baseLotSize",g.u64],["quoteParams",St],["quoteLotSize",g.u64],["tickSizeInQuoteAtomsPerBaseUnit",g.u64],["authority",Fe.publicKey],["feeRecipient",Fe.publicKey],["marketSequenceNumber",g.u64],["successor",Fe.publicKey],["rawBaseUnitsPerBaseUnit",g.u32],["padding1",g.u32],["padding2",g.uniformFixedSizeArray(g.u64,32)]],"MarketHeader");var Zt=(s=>(s[s.Uninitialized=0]="Uninitialized",s[s.Active=1]="Active",s[s.PostOnly=2]="PostOnly",s[s.Paused=3]="Paused",s[s.Closed=4]="Closed",s[s.Tombstoned=5]="Tombstoned",s))(Zt||{}),rn= exports.marketStatusBeet =jt.fixedScalarEnum(Zt);var Te=new h.FixableBeetArgsStruct([["bids",h.array(wt)],["asks",h.array(wt)],["clientOrderId",h.coption(h.u128)],["rejectPostOnly",h.bool]],"MultipleOrderPacket");var ht=(n=>(n[n.Abort=0]="Abort",n[n.CancelProvide=1]="CancelProvide",n[n.DecrementTake=2]="DecrementTake",n))(ht||{}),It= exports.selfTradeBehaviorBeet =Qt.fixedScalarEnum(ht);var dn=e=>e.__kind==="PostOnly",pn= exports.isOrderPacketLimit =e=>e.__kind==="Limit",yn= exports.isOrderPacketImmediateOrCancel =e=>e.__kind==="ImmediateOrCancel",M= exports.orderPacketBeet =b.dataEnum([["PostOnly",new b.BeetArgsStruct([["side",L],["priceInTicks",b.u64],["numBaseLots",b.u64],["clientOrderId",b.u128],["rejectPostOnly",b.bool],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["PostOnly"]')],["Limit",new b.FixableBeetArgsStruct([["side",L],["priceInTicks",b.u64],["numBaseLots",b.u64],["selfTradeBehavior",It],["matchLimit",b.coption(b.u64)],["clientOrderId",b.u128],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["Limit"]')],["ImmediateOrCancel",new b.FixableBeetArgsStruct([["side",L],["priceInTicks",b.coption(b.u64)],["numBaseLots",b.u64],["numQuoteLots",b.u64],["minBaseLotsToFill",b.u64],["minQuoteLotsToFill",b.u64],["selfTradeBehavior",It],["matchLimit",b.coption(b.u64)],["clientOrderId",b.u128],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["ImmediateOrCancel"]')]]);var Ot=(i=>(i[i.Uninitialized=0]="Uninitialized",i[i.Header=1]="Header",i[i.Fill=2]="Fill",i[i.Place=3]="Place",i[i.Reduce=4]="Reduce",i[i.Evict=5]="Evict",i[i.FillSummary=6]="FillSummary",i[i.Fee=7]="Fee",i))(Ot||{}),gn= exports.phoenixMarketEventBeet =_t.fixedScalarEnum(Ot);var Pn=new F.BeetArgsStruct([["index",F.u16],["orderSequenceNumber",F.u64],["clientOrderId",F.u128],["priceInTicks",F.u64],["baseLotsPlaced",F.u64]],"PlaceEvent");var xn=new K.BeetArgsStruct([["index",K.u16],["orderSequenceNumber",K.u64],["priceInTicks",K.u64],["baseLotsRemoved",K.u64],["baseLotsRemaining",K.u64]],"ReduceEvent");var Ke=new Be.BeetArgsStruct([["baseParams",he],["size",Be.u64]],"ReduceOrderParams");var On=new D.BeetArgsStruct([["discriminant",D.u64],["market",Ft.publicKey],["trader",Ft.publicKey],["approvalStatus",D.u64],["padding",D.uniformFixedSizeArray(D.u64,16)]],"Seat");var Jt=(n=>(n[n.NotApproved=0]="NotApproved",n[n.Approved=1]="Approved",n[n.Retired=2]="Retired",n))(Jt||{}),Tn= exports.seatApprovalStatusBeet =Yt.fixedScalarEnum(Jt);var Xt=new C.FixableBeetArgsStruct([["quoteLotsToWithdraw",C.coption(C.u64)],["baseLotsToWithdraw",C.coption(C.u64)]],"WithdrawParams");var _spltoken = require('@solana/spl-token'); var $t = _interopRequireWildcard(_spltoken); var er = _interopRequireWildcard(_spltoken); var tr = _interopRequireWildcard(_spltoken); var rr = _interopRequireWildcard(_spltoken); var ir = _interopRequireWildcard(_spltoken); var nr = _interopRequireWildcard(_spltoken); var or = _interopRequireWildcard(_spltoken); var sr = _interopRequireWildcard(_spltoken); var ur = _interopRequireWildcard(_spltoken);var Tr=new We.BeetArgsStruct([["instructionDiscriminator",We.u8]],"CancelAllOrdersInstructionArgs"),Br= exports.cancelAllOrdersInstructionDiscriminator =6;function io(e,t=new Le.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var a;let[r]=Tr.serialize({instructionDiscriminator:Br}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(a=e.tokenProgram)!=null?a:$t.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Le.TransactionInstruction({programId:t,keys:n,data:r})}var Kr=new Ee.BeetArgsStruct([["instructionDiscriminator",Ee.u8]],"CancelAllOrdersWithFreeFundsInstructionArgs"),Wr= exports.cancelAllOrdersWithFreeFundsInstructionDiscriminator =7;function oo(e,t=new Me.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[r]=Kr.serialize({instructionDiscriminator:Wr}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new Me.TransactionInstruction({programId:t,keys:n,data:r})}var Lr=new De.BeetArgsStruct([["instructionDiscriminator",De.u8]],"CancelMultipleOrdersByIdInstructionArgs"),Er= exports.cancelMultipleOrdersByIdInstructionDiscriminator =10;function ao(e,t=new Ce.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var a;let[r]=Lr.serialize({instructionDiscriminator:Er}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(a=e.tokenProgram)!=null?a:er.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Ce.TransactionInstruction({programId:t,keys:n,data:r})}var Mr=new Ue.BeetArgsStruct([["instructionDiscriminator",Ue.u8]],"CancelMultipleOrdersByIdWithFreeFundsInstructionArgs"),Dr= exports.cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator =11;function co(e,t=new Ve.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[r]=Mr.serialize({instructionDiscriminator:Dr}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new Ve.TransactionInstruction({programId:t,keys:n,data:r})}var Cr=new qe.FixableBeetArgsStruct([["instructionDiscriminator",qe.u8],["params",Oe]],"CancelUpToInstructionArgs"),Ur= exports.cancelUpToInstructionDiscriminator =8;function po(e,t,r=new ve.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=Cr.serialize(l({instructionDiscriminator:Ur},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:tr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new ve.TransactionInstruction({programId:r,keys:o,data:n})}var Vr=new Ne.FixableBeetArgsStruct([["instructionDiscriminator",Ne.u8],["params",Oe]],"CancelUpToWithFreeFundsInstructionArgs"),qr= exports.cancelUpToWithFreeFundsInstructionDiscriminator =9;function Po(e,t,r=new Re.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[n]=Vr.serialize(l({instructionDiscriminator:qr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new Re.TransactionInstruction({programId:r,keys:o,data:n})}var vr=new ze.BeetArgsStruct([["instructionDiscriminator",ze.u8],["depositFundsParams",Rt]],"DepositFundsInstructionArgs"),Nr= exports.depositFundsInstructionDiscriminator =13;function ho(e,t,r=new He.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=vr.serialize(l({instructionDiscriminator:Nr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:rr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new He.TransactionInstruction({programId:r,keys:o,data:n})}var Rr=new Ge.BeetArgsStruct([["instructionDiscriminator",Ge.u8]],"LogInstructionArgs"),Tt= exports.logInstructionDiscriminator =15;function Fo(e,t=new je.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[r]=Rr.serialize({instructionDiscriminator:Tt}),n=[{pubkey:e.logAuthority,isWritable:!1,isSigner:!0}];return new je.TransactionInstruction({programId:t,keys:n,data:r})}var zr=new Ze.FixableBeetArgsStruct([["instructionDiscriminator",Ze.u8],["orderPacket",M]],"PlaceLimitOrderInstructionArgs"),Hr= exports.placeLimitOrderInstructionDiscriminator =2;function Wo(e,t,r=new Qe.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=zr.serialize(l({instructionDiscriminator:Hr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:ir.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Qe.TransactionInstruction({programId:r,keys:o,data:n})}var Gr=new _e.FixableBeetArgsStruct([["instructionDiscriminator",_e.u8],["orderPacket",M]],"PlaceLimitOrderWithFreeFundsInstructionArgs"),jr= exports.placeLimitOrderWithFreeFundsInstructionDiscriminator =3;function Co(e,t,r=new Ye.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[n]=Gr.serialize(l({instructionDiscriminator:jr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new Ye.TransactionInstruction({programId:r,keys:o,data:n})}var Zr=new Je.FixableBeetArgsStruct([["instructionDiscriminator",Je.u8],["multipleOrderPacket",Te]],"PlaceMultiplePostOnlyOrdersInstructionArgs"),Qr= exports.placeMultiplePostOnlyOrdersInstructionDiscriminator =16;function No(e,t,r=new Xe.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=Zr.serialize(l({instructionDiscriminator:Qr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:nr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Xe.TransactionInstruction({programId:r,keys:o,data:n})}var _r=new $e.FixableBeetArgsStruct([["instructionDiscriminator",$e.u8],["multipleOrderPacket",Te]],"PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs"),Yr= exports.placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator =17;function jo(e,t,r=new et.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[n]=_r.serialize(l({instructionDiscriminator:Yr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new et.TransactionInstruction({programId:r,keys:o,data:n})}var Jr=new tt.BeetArgsStruct([["instructionDiscriminator",tt.u8],["params",Ke]],"ReduceOrderInstructionArgs"),Xr= exports.reduceOrderInstructionDiscriminator =4;function Jo(e,t,r=new rt.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=Jr.serialize(l({instructionDiscriminator:Xr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:or.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new rt.TransactionInstruction({programId:r,keys:o,data:n})}var $r=new it.BeetArgsStruct([["instructionDiscriminator",it.u8],["params",Ke]],"ReduceOrderWithFreeFundsInstructionArgs"),ei= exports.reduceOrderWithFreeFundsInstructionDiscriminator =5;function rs(e,t,r=new nt.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[n]=$r.serialize(l({instructionDiscriminator:ei},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!0,isSigner:!0}];return new nt.TransactionInstruction({programId:r,keys:o,data:n})}var ti=new ot.BeetArgsStruct([["instructionDiscriminator",ot.u8]],"RequestSeatInstructionArgs"),ri= exports.requestSeatInstructionDiscriminator =14;function os(e,t=new be.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var a;let[r]=ti.serialize({instructionDiscriminator:ri}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.payer,isWritable:!0,isSigner:!0},{pubkey:e.seat,isWritable:!0,isSigner:!1},{pubkey:(a=e.systemProgram)!=null?a:be.SystemProgram.programId,isWritable:!1,isSigner:!1}];return new be.TransactionInstruction({programId:t,keys:n,data:r})}var ii=new st.FixableBeetArgsStruct([["instructionDiscriminator",st.u8],["orderPacket",M]],"SwapInstructionArgs"),ni= exports.swapInstructionDiscriminator =0;function ar(e,t,r=new at.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=ii.serialize(l({instructionDiscriminator:ni},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:sr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new at.TransactionInstruction({programId:r,keys:o,data:n})}var oi=new ut.FixableBeetArgsStruct([["instructionDiscriminator",ut.u8],["orderPacket",M]],"SwapWithFreeFundsInstructionArgs"),si= exports.swapWithFreeFundsInstructionDiscriminator =1;function ds(e,t,r=new ct.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){let[n]=oi.serialize(l({instructionDiscriminator:si},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new ct.TransactionInstruction({programId:r,keys:o,data:n})}var ai=new bt.FixableBeetArgsStruct([["instructionDiscriminator",bt.u8],["withdrawFundsParams",Xt]],"WithdrawFundsInstructionArgs"),ui= exports.withdrawFundsInstructionDiscriminator =12;function ks(e,t,r=new lt.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")){var s;let[n]=ai.serialize(l({instructionDiscriminator:ui},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:ur.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new lt.TransactionInstruction({programId:r,keys:o,data:n})}function mt(e){return new (0, _web3js.PublicKey)(e.readFixedArray(32))}function ra(e,t){return x(this,null,function*(){var s;let r=yield e.getParsedTransaction(t,"confirmed"),n=(s=r==null?void 0:r.meta)==null?void 0:s.innerInstructions;if(!n||!r||!r.slot)return{instructions:[]};let o=[];for(let u of n)for(let i of u.instructions){if(i.programId.toBase58()!=Pe.toBase58())continue;let c=_bs582.default.decode(i.data);c[0]==Tt&&o.push(c.slice(1))}let a=new Array;for(let u of o){let i=new (0, _borsh.BinaryReader)(Buffer.from(u));if(i.readU8()!=1)throw new Error("early Unexpected event");let m=new Array,f=new Array,P={instruction:i.readU8(),sequenceNumber:i.readU64(),timestamp:i.readU64(),slot:i.readU64(),market:mt(i),signer:mt(i),totalEvents:i.readU16()};for(;i.offset<i.buf.length;){let k=i.readU8();switch(k){case 2:m.push({index:i.readU16(),makerId:mt(i),orderSequenceNumber:new (0, _bnjs2.default)(i.readFixedArray(8)),priceInTicks:i.readU64(),baseLotsFilled:i.readU64(),baseLotsRemaining:i.readU64()});break;case 3:m.push({index:i.readU16(),orderSequenceNumber:new (0, _bnjs2.default)(i.readFixedArray(8)),clientOrderId:i.readU64(),priceInTicks:i.readU64(),baseLotsPlaced:i.readU64()});break;case 4:m.push({index:i.readU16(),orderSequenceNumber:i.readU64(),priceInTicks:i.readU64(),baseLotsRemoved:i.readU64(),baseLotsRemaining:i.readU64()});break;case 5:m.push({index:i.readU16(),makerId:mt(i),orderSequenceNumber:i.readU64(),priceInTicks:i.readU64(),baseLotsEvicted:i.readU64()});break;case 6:m.push({index:i.readU16(),clientOrderId:i.readU128(),totalBaseLotsFilled:i.readU64(),totalQuoteLotsFilled:i.readU64(),totalFeeInQuoteLots:i.readU64()});break;case 7:m.push({index:i.readU16(),feesCollectedInQuoteLots:i.readU64()});break;default:throw Error("Unexpected Event")}f.push(k)}a.push({header:P,events:m,enums:f})}return{instructions:a}})}function T(e){let t;return typeof e=="number"?t=e:t=e.toNumber(),t}function W(e){return typeof e=="number"?new (0, _bnjs2.default)(e):e.clone()}function Kt(e){return e.lt(new (0, _bnjs2.default)(0))?-1:e.gt(new (0, _bnjs2.default)(0))?1:0}var lr=new y.BeetArgsStruct([["publicKey",br.publicKey]],"PubkeyWrapper"),we=new y.BeetArgsStruct([["priceInTicks",y.u64],["orderSequenceNumber",y.u64]],"fIFOOrderId"),xe=new y.BeetArgsStruct([["traderIndex",y.u64],["numBaseLots",y.u64],["padding",y.uniformFixedSizeArray(y.u64,2)]],"fIFORestingOrder"),Wt=new y.BeetArgsStruct([["quoteLotsLocked",y.u64],["quoteLotsFree",y.u64],["baseLotsLocked",y.u64],["baseLotsFree",y.u64],["padding",y.uniformFixedSizeArray(y.u64,8)]],"TraderState");var yr=10,di= exports.DEFAULT_MATCH_LIMIT =2048,dt= exports.DEFAULT_SLIPPAGE_PERCENT =.005;function Mt(e){let t=At.byteSize,[r]=At.deserialize(e.subarray(0,t)),n=8*32,o=e.subarray(t+n);t=0;let a=Number(o.readBigUInt64LE(t));t+=8;let s=Number(o.readBigUInt64LE(t));t+=8;let u=Number(o.readBigUInt64LE(t));t+=8;let i=Number(o.readBigUInt64LE(t));t+=8;let c=Number(o.readBigUInt64LE(t));t+=8;let m=Number(o.readBigUInt64LE(t));t+=8,o=o.subarray(t);let f=T(r.marketSizeParams.bidsSize),P=T(r.marketSizeParams.asksSize),k=T(r.marketSizeParams.numSeats),w=16+16+(16+we.byteSize+xe.byteSize)*f,I=16+16+(16+we.byteSize+xe.byteSize)*P,U=16+16+(16+32+Wt.byteSize)*k;t=0;let gt=o.subarray(t,t+w);t+=w;let Ae=o.subarray(t,t+I);t+=I;let wr=o.subarray(t,t+U),xr=Et(gt,we,xe),Sr=Et(Ae,we,xe),Ar=[...xr].sort((de,pe)=>Kt(W(pe[0].priceInTicks).sub(W(de[0].priceInTicks)))),hr=[...Sr].sort((de,pe)=>Kt(W(de[0].priceInTicks).sub(W(pe[0].priceInTicks)))),Vt=new Map;for(let[de,pe]of Et(wr,lr,Wt))Vt.set(de.publicKey,pe);return{header:r,baseLotsPerBaseUnit:a,quoteLotsPerBaseUnitPerTick:s,sequenceNumber:u,takerFeeBps:i,collectedAdjustedQuoteLotFees:c,unclaimedAdjustedQuoteLotFees:m,bids:Ar,asks:hr,traders:Vt}}function Et(e,t,r){let n=new Map,o=0,a=t.byteSize,s=r.byteSize,u=new Array;o+=16,o+=8;let i=e.readInt32LE(o);o+=4;let c=e.readInt32LE(o);o+=4;let m=new Array;for(let w=0;o<e.length&&w<i;w++){let I=new Array;for(let Ae=0;Ae<4;Ae++)I.push(e.readInt32LE(o)),o+=4;let[U]=t.deserialize(e.subarray(o,o+a));o+=a;let[gt]=r.deserialize(e.subarray(o,o+s));o+=s,u.push([U,gt]),m.push([w,I[0]])}let f=new Set,P=c-1,k=0;for(;c!==0;)if([P,c]=m[c-1],f.add(P),k+=1,k>i)throw new Error("Infinite loop detected");for(let[w,[I,U]]of u.entries())f.has(w)||n.set(I,U);return n}function Dt(e,t=yr){let r=[],n=[];for(let[o,a]of e.bids){let s=W(o.priceInTicks),u=W(a.numBaseLots);if(r.length===0)r.push([s,u]);else{let i=r[r.length-1];if(!i)throw Error;if(s.eq(i[0]))i[1]=i[1].add(u);else{if(r.length===t)break;r.push([s,u])}}}for(let[o,a]of e.asks){let s=W(o.priceInTicks),u=W(a.numBaseLots);if(n.length===0)n.push([s,u]);else{let i=n[n.length-1];if(!i)throw Error;if(s.eq(i[0]))i[1]=i[1].add(u);else{if(n.length===t)break;n.push([s,u])}}}return{asks:n.slice(0,t),bids:r.slice(0,t)}}function pr(e,t,r,n){return[T(t)/n*e.quoteLotsPerBaseUnitPerTick*T(e.header.quoteLotSize),T(r)/e.baseLotsPerBaseUnit]}function Ct(e,t=yr){let r=Dt(e,t),n=V(10,T(e.header.quoteParams.decimals));return{bids:r.bids.map(([o,a])=>pr(e,o,a,n)),asks:r.asks.map(([o,a])=>pr(e,o,a,n))}}function fr(e){let t=e.bids,r=e.asks,o=Math.max(...t.map(s=>s[1]),...r.map(s=>s[1])).toString().length,a=(s,u,i)=>{let c=s.toFixed(3),m=u.toFixed(2).padStart(o," ");console.log(c+`\x1B[3${i==="green"?2:1}m`+m+"\x1B[0m")};console.log("\x1B[30mAsks\x1B[0m");for(let[s,u]of r.reverse())a(s,u,"red");console.log("\x1B[30mBids\x1B[0m");for(let[s,u]of t)a(s,u,"green")}function gr({marketAddress:e,marketData:t,trader:r,side:n,inAmount:o,slippage:a=dt,clientOrderId:s=0}){let u=_web3js.PublicKey.findProgramAddressSync([r.toBuffer(),_spltoken.TOKEN_PROGRAM_ID.toBuffer(),t.header.baseParams.mintKey.toBuffer()],_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID)[0],i=_web3js.PublicKey.findProgramAddressSync([r.toBuffer(),_spltoken.TOKEN_PROGRAM_ID.toBuffer(),t.header.quoteParams.mintKey.toBuffer()],_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID)[0],c=_web3js.PublicKey.findProgramAddressSync([Buffer.from("log")],Pe)[0],m={phoenixProgram:Pe,logAuthority:c,market:e,trader:r,baseAccount:u,quoteAccount:i,quoteVault:t.header.quoteParams.vaultKey,baseVault:t.header.baseParams.vaultKey},f=pi({marketData:t,side:n,inAmount:o,slippage:a,clientOrderId:s}),P=ar(m,{orderPacket:l({__kind:"ImmediateOrCancel"},f)});return new (0, _web3js.Transaction)().add(P)}function pi({marketData:e,side:t,inAmount:r,slippage:n=dt,selfTradeBehavior:o=0,matchLimit:a=di,clientOrderId:s=0,useOnlyDepositedFunds:u=!1}){let i=Ut({marketData:e,side:t,inAmount:r}),c=V(10,e.header.baseParams.decimals),m=V(10,e.header.quoteParams.decimals),f=1-n,P=0,k=0,w=0,I=0;return t===1?(P=r*c/parseFloat(e.header.baseLotSize.toString()),I=Math.ceil(i*m/parseFloat(e.header.quoteLotSize.toString())*f)):(w=r*m/parseFloat(e.header.quoteLotSize.toString()),k=Math.ceil(i*c/parseFloat(e.header.baseLotSize.toString())*f)),{side:t,priceInTicks:null,numBaseLots:P,minBaseLotsToFill:k,numQuoteLots:w,minQuoteLotsToFill:I,selfTradeBehavior:o,matchLimit:a,clientOrderId:s,useOnlyDepositedFunds:u}}function Ut({marketData:e,side:t,inAmount:r}){let n=T(e.header.marketSizeParams.bidsSize),o=T(e.header.marketSizeParams.asksSize),a=Ct(e,Math.max(n,o)),s=r*(1-e.takerFeeBps/1e4),u=0;if(t===0)for(let[i,c]of a.asks){let m=c*i;if(m>s){u+=s/i,s=0;break}else u+=c,s-=m}else for(let[i,c]of a.bids)if(c>s){u+=s*i,s=0;break}else u+=c*i,s-=c;return u}var yi=(n=>(n.MainnetBeta="mainnet-beta",n.Devnet="devnet",n.Localhost="localhost",n))(yi||{});function pt(e){return e.includes("devnet")?"devnet":e.includes("local")||e.includes("127.0.0.1")?"localhost":"mainnet-beta"}var Se=class{constructor({name:t,symbol:r,logoUri:n,data:o}){this.name=t,this.symbol=r,this.logoUri=n,this.data=o}};var yt={devnet:{tokens:[{name:"USD Coin",symbol:"USDC",mint:"DK1gsSV2EubSE5S5FdXHpGzw2cAJNVzxeXRmAfxAMpU5",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Solana",symbol:"wSOL",mint:"B1sL3zxwyVnDGzRWCAsBkjL23wyu8HgwQP4XxgnHiSrv",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Bonk",symbol:"Bonk",mint:"8LN9tTVkGLqXRT2SxLUjN8YRHiKzYGLq1wGV1FL7E23P",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/6dhTynDkYsVM7cbF7TKfC9DWB636TcEM935fq7JzL2ES/logo.png"}],markets:["3PgJmaEKQqVzQNAT3WtMaSQxBFPL3WqnvyahRM28PGJH","snFwGhLMrzS9YmnKyyiromxZ1oWE9vX7ZpoNHv23cCC"]},"mainnet-beta":{tokens:[{name:"USD Coin",symbol:"USDC",mint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Wrapped SOL",symbol:"wSOL",mint:"So11111111111111111111111111111111111111112",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Wrapped Ethereum (Sollet)",symbol:"wETH",mint:"2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk/logo.png"},{name:"Wrapped Bitcoin (Sollet)",symbol:"wBTC",mint:"9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk/logo.png"}],markets:[]},localhost:{tokens:[{name:"USD Coin",symbol:"USDC",mint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Wrapped SOL",symbol:"SOL",mint:"So11111111111111111111111111111111111111112",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Bonk",symbol:"Bonk",mint:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/6dhTynDkYsVM7cbF7TKfC9DWB636TcEM935fq7JzL2ES/logo.png"}],markets:["3MZskhKUdNRkeMQ6zyNVSJcCx38o79ohwmSgZ2d5a4cu","HhHRvLFvZid6FD7C96H93F2MkASjYfYAx8Y2P8KMAr6b"]}};var le=class{constructor({name:t,address:r,baseToken:n,quoteToken:o,data:a}){this.name=t,this.address=r,this.baseToken=n,this.quoteToken=o,this.data=a}static load(n){return x(this,arguments,function*({connection:t,address:r}){let o=yield t.getAccountInfo(r);if(!o)throw new Error("Account not found for market: "+r.toBase58());let a=Buffer.from(o.data),s=Mt(a),u=yt[pt(t.rpcEndpoint)].tokens,i=u.find(k=>k.mint===s.header.baseParams.mintKey.toBase58()),c=u.find(k=>k.mint===s.header.quoteParams.mintKey.toBase58());if(i===void 0)throw new Error(`Base token ${s.header.baseParams.mintKey} not found in config`);if(c===void 0)throw new Error(`Quote token ${s.header.quoteParams.mintKey} not found in config`);let m=new Se({name:i.name,symbol:i.symbol,logoUri:i.logoUri,data:l({},s.header.baseParams)}),f=new Se({name:c.name,symbol:c.symbol,logoUri:c.logoUri,data:l({},s.header.quoteParams)});return new le({name:`${m.symbol}/${f.symbol}`,address:r,baseToken:m,quoteToken:f,data:s})})}refresh(t){return x(this,null,function*(){let r=yield t.getAccountInfo(this.address),n=Buffer.from(r.data),o=Mt(n);return this.data=o,this})}getLadder(){return Dt(this.data)}getUiLadder(){return Ct(this.data)}printLadder(){fr(this.getUiLadder())}getSwapTransaction({trader:t,side:r,inAmount:n,slippage:o=dt,clientOrderId:a=0}){return gr({marketAddress:this.address,marketData:this.data,trader:t,side:r,inAmount:n,slippage:o,clientOrderId:a})}getExpectedOutAmount({side:t,inAmount:r}){return Ut({marketData:this.data,side:t,inAmount:r})}};var me=class{constructor(t){this.pubkey=t,this.tokenBalances={}}static create(o){return x(this,arguments,function*({connection:t,pubkey:r,tokens:n}){let a=new me(r);for(let s of n){let u=yield t.getTokenAccountsByOwner(r,{programId:_spltoken.TOKEN_PROGRAM_ID,mint:s.data.mintKey});if(u.value.length===0)continue;let i=u.value[0];a.tokenBalances[s.data.mintKey.toBase58()]=Pr(i.account.data,s.data.decimals)}return a})}refresh(t){return x(this,null,function*(){return yield Promise.all(Object.keys(this.tokenBalances).map(r=>x(this,null,function*(){let o=(yield t.getTokenAccountsByOwner(this.pubkey,{programId:_spltoken.TOKEN_PROGRAM_ID,mint:new (0, _web3js.PublicKey)(r)})).value[0];this.tokenBalances[r]=Pr(o.account.data,this.tokenBalances[r].decimals)}))),this})}};function Pr(e,t){let n=_spltoken.AccountLayout.decode(e).amount.toString();return{amount:n,decimals:t,uiAmount:parseInt(n)/V(10,t)}}var ft=class{constructor({connection:t,tokens:r,markets:n,trader:o}){this.connection=t,this.tokens=r,this.markets=n,this.trader=o}static create(t,r){return x(this,null,function*(){let n=pt(t.rpcEndpoint),o=[],a=[];return yield Promise.all(yt[n].markets.map(s=>x(this,null,function*(){let u=yield le.load({connection:t,address:new (0, _web3js.PublicKey)(s)});o.push(u);for(let i of[u.baseToken,u.quoteToken]){let c=i.data.mintKey.toBase58();a.find(m=>m.data.mintKey.toBase58()===c)||a.push(i)}}))),new ft({connection:t,tokens:a,markets:o,trader:r?yield me.create({connection:t,pubkey:r,tokens:a}):void 0})})}};var xi="phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH",Pe= exports.PROGRAM_ID =new (0, _web3js.PublicKey)(xi);exports.CancelAllOrdersStruct = Tr; exports.CancelAllOrdersWithFreeFundsStruct = Kr; exports.CancelMultipleOrdersByIdStruct = Lr; exports.CancelMultipleOrdersByIdWithFreeFundsStruct = Mr; exports.CancelMultipleOrdersErrorError = re; exports.CancelUpToStruct = Cr; exports.CancelUpToWithFreeFundsStruct = Vr; exports.Client = ft; exports.Cluster = yi; exports.DEFAULT_LADDER_DEPTH = yr; exports.DEFAULT_MATCH_LIMIT = di; exports.DEFAULT_SLIPPAGE_PERCENT = dt; exports.DepositFundsStruct = vr; exports.EvictionErrorError = ae; exports.FailedToLoadMarketFromAccountError = N; exports.InvalidBaseAccountError = J; exports.InvalidBaseVaultError = _; exports.InvalidLotSizeError = j; exports.InvalidMarketAuthorityError = v; exports.InvalidMarketParametersError = q; exports.InvalidMarketSignerError = G; exports.InvalidMintError = Q; exports.InvalidQuoteAccountError = X; exports.InvalidQuoteVaultError = Y; exports.InvalidSeatStatusError = se; exports.InvalidStateTransitionError = H; exports.InvalidTickSizeError = Z; exports.LogStruct = Rr; exports.Market = le; exports.MarketAlreadyInitializedError = R; exports.MarketStatus = Zt; exports.MarketUninitializedError = z; exports.NewOrderErrorError = ee; exports.PROGRAM_ADDRESS = xi; exports.PROGRAM_ID = Pe; exports.PhoenixMarketEvent = Ot; exports.PlaceLimitOrderStruct = zr; exports.PlaceLimitOrderWithFreeFundsStruct = Gr; exports.PlaceMultiplePostOnlyOrdersStruct = Zr; exports.PlaceMultiplePostOnlyOrdersWithFreeFundsStruct = _r; exports.ReduceOrderErrorError = te; exports.ReduceOrderStruct = Jr; exports.ReduceOrderWithFreeFundsStruct = $r; exports.RemoveEmptyOrdersErrorError = ne; exports.RequestSeatStruct = ti; exports.SeatApprovalStatus = Jt; exports.SelfTradeBehavior = ht; exports.Side = Pt; exports.SwapStruct = ii; exports.SwapWithFreeFundsStruct = oi; exports.Token = Se; exports.TooManyEventsError = $; exports.Trader = me; exports.TraderNotFoundError = oe; exports.WithdrawFundsErrorError = ie; exports.WithdrawFundsStruct = ai; exports.auditLogHeaderBeet = Oi; exports.cancelAllOrdersInstructionDiscriminator = Br; exports.cancelAllOrdersWithFreeFundsInstructionDiscriminator = Wr; exports.cancelMultipleOrdersByIdInstructionDiscriminator = Er; exports.cancelMultipleOrdersByIdParamsBeet = Mi; exports.cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator = Dr; exports.cancelOrderParamsBeet = he; exports.cancelUpToInstructionDiscriminator = Ur; exports.cancelUpToParamsBeet = Oe; exports.cancelUpToWithFreeFundsInstructionDiscriminator = qr; exports.clusterFromEndpoint = pt; exports.condensedOrderBeet = wt; exports.createCancelAllOrdersInstruction = io; exports.createCancelAllOrdersWithFreeFundsInstruction = oo; exports.createCancelMultipleOrdersByIdInstruction = ao; exports.createCancelMultipleOrdersByIdWithFreeFundsInstruction = co; exports.createCancelUpToInstruction = po; exports.createCancelUpToWithFreeFundsInstruction = Po; exports.createDepositFundsInstruction = ho; exports.createLogInstruction = Fo; exports.createPlaceLimitOrderInstruction = Wo; exports.createPlaceLimitOrderWithFreeFundsInstruction = Co; exports.createPlaceMultiplePostOnlyOrdersInstruction = No; exports.createPlaceMultiplePostOnlyOrdersWithFreeFundsInstruction = jo; exports.createReduceOrderInstruction = Jo; exports.createReduceOrderWithFreeFundsInstruction = rs; exports.createRequestSeatInstruction = os; exports.createSwapInstruction = ar; exports.createSwapWithFreeFundsInstruction = ds; exports.createWithdrawFundsInstruction = ks; exports.depositFundsInstructionDiscriminator = Nr; exports.depositParamsBeet = Rt; exports.deserializeMarketData = Mt; exports.deserializeRedBlackTree = Et; exports.errorFromCode = Ai; exports.errorFromName = hi; exports.evictEventBeet = Ni; exports.feeEventBeet = zi; exports.fillEventBeet = Gi; exports.fillSummaryEventBeet = Zi; exports.getEventsFromTransaction = ra; exports.getMarketExpectedOutAmount = Ut; exports.getMarketLadder = Dt; exports.getMarketSwapOrderPacket = pi; exports.getMarketSwapTransaction = gr; exports.getMarketUiLadder = Ct; exports.isOrderPacketImmediateOrCancel = yn; exports.isOrderPacketLimit = pn; exports.isOrderPacketPostOnly = dn; exports.logInstructionDiscriminator = Tt; exports.marketHeaderBeet = At; exports.marketSizeParamsBeet = Gt; exports.marketStatusBeet = rn; exports.multipleOrderPacketBeet = Te; exports.orderPacketBeet = M; exports.phoenixMarketEventBeet = gn; exports.placeEventBeet = Pn; exports.placeLimitOrderInstructionDiscriminator = Hr; exports.placeLimitOrderWithFreeFundsInstructionDiscriminator = jr; exports.placeMultiplePostOnlyOrdersInstructionDiscriminator = Qr; exports.placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator = Yr; exports.printUiLadder = fr; exports.readPublicKey = mt; exports.reduceEventBeet = xn; exports.reduceOrderInstructionDiscriminator = Xr; exports.reduceOrderParamsBeet = Ke; exports.reduceOrderWithFreeFundsInstructionDiscriminator = ei; exports.requestSeatInstructionDiscriminator = ri; exports.seatApprovalStatusBeet = Tn; exports.seatBeet = On; exports.selfTradeBehaviorBeet = It; exports.sideBeet = L; exports.sign = Kt; exports.swapInstructionDiscriminator = ni; exports.swapWithFreeFundsInstructionDiscriminator = si; exports.toBN = W; exports.toNum = T; exports.tokenParamsBeet = St; exports.withdrawFundsInstructionDiscriminator = ui; exports.withdrawParamsBeet = Xt;
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var Ir=Object.defineProperty;var Mt=Object.getOwnPropertySymbols;var Or=Object.prototype.hasOwnProperty,Br=Object.prototype.propertyIsEnumerable;var v=Math.pow,Ct=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l=(e,t)=>{for(var r in t||(t={}))Or.call(t,r)&&Ct(e,r,t[r]);if(Mt)for(var r of Mt(t))Br.call(t,r)&&Ct(e,r,t[r]);return e};var w=(e,t,r)=>new Promise((n,o)=>{var a=i=>{try{u(r.next(i))}catch(c){o(c)}},s=i=>{try{u(r.throw(i))}catch(c){o(c)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(a,s);u((r=r.apply(e,t)).next())});var _web3js = require('@solana/web3.js'); var We = _interopRequireWildcard(_web3js); var Ue = _interopRequireWildcard(_web3js); var Re = _interopRequireWildcard(_web3js); var ve = _interopRequireWildcard(_web3js); var Ce = _interopRequireWildcard(_web3js); var ze = _interopRequireWildcard(_web3js); var Ge = _interopRequireWildcard(_web3js); var He = _interopRequireWildcard(_web3js); var Ze = _interopRequireWildcard(_web3js); var Qe = _interopRequireWildcard(_web3js); var _e = _interopRequireWildcard(_web3js); var et = _interopRequireWildcard(_web3js); var rt = _interopRequireWildcard(_web3js); var nt = _interopRequireWildcard(_web3js); var be = _interopRequireWildcard(_web3js); var at = _interopRequireWildcard(_web3js); var ct = _interopRequireWildcard(_web3js); var lt = _interopRequireWildcard(_web3js);var d=new Map,p=new Map,M= exports.InvalidMarketParametersError =class extends Error{constructor(){super("Invalid market parameters error");this.code=0;this.name="InvalidMarketParameters";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,M)}};d.set(0,()=>new M);p.set("InvalidMarketParameters",()=>new M);var C=class extends Error{constructor(){super("Invalid exchange authority error");this.code=1;this.name="InvalidMarketAuthority";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,C)}};d.set(1,()=>new C);p.set("InvalidMarketAuthority",()=>new C);var N=class extends Error{constructor(){super("Market deserialization error");this.code=2;this.name="FailedToLoadMarketFromAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,N)}};d.set(2,()=>new N);p.set("FailedToLoadMarketFromAccount",()=>new N);var z=class extends Error{constructor(){super("Market already initialized error");this.code=3;this.name="MarketAlreadyInitialized";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,z)}};d.set(3,()=>new z);p.set("MarketAlreadyInitialized",()=>new z);var j=class extends Error{constructor(){super("Market is not initialized error");this.code=4;this.name="MarketUninitialized";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j)}};d.set(4,()=>new j);p.set("MarketUninitialized",()=>new j);var G=class extends Error{constructor(){super("Invalid state transition error");this.code=5;this.name="InvalidStateTransition";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,G)}};d.set(5,()=>new G);p.set("InvalidStateTransition",()=>new G);var V=class extends Error{constructor(){super("Invalid market signer error");this.code=6;this.name="InvalidMarketSigner";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,V)}};d.set(6,()=>new V);p.set("InvalidMarketSigner",()=>new V);var H=class extends Error{constructor(){super("Invalid lot size error");this.code=7;this.name="InvalidLotSize";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,H)}};d.set(7,()=>new H);p.set("InvalidLotSize",()=>new H);var Y=class extends Error{constructor(){super("Invalid tick size error");this.code=8;this.name="InvalidTickSize";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Y)}};d.set(8,()=>new Y);p.set("InvalidTickSize",()=>new Y);var Z=class extends Error{constructor(){super("Invalid mint error");this.code=9;this.name="InvalidMint";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Z)}};d.set(9,()=>new Z);p.set("InvalidMint",()=>new Z);var X=class extends Error{constructor(){super("Invalid base vault error");this.code=10;this.name="InvalidBaseVault";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,X)}};d.set(10,()=>new X);p.set("InvalidBaseVault",()=>new X);var Q=class extends Error{constructor(){super("Invalid quote vault error");this.code=11;this.name="InvalidQuoteVault";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Q)}};d.set(11,()=>new Q);p.set("InvalidQuoteVault",()=>new Q);var J=class extends Error{constructor(){super("Invalid base account error");this.code=12;this.name="InvalidBaseAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,J)}};d.set(12,()=>new J);p.set("InvalidBaseAccount",()=>new J);var _=class extends Error{constructor(){super("Invalid quote account error");this.code=13;this.name="InvalidQuoteAccount";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,_)}};d.set(13,()=>new _);p.set("InvalidQuoteAccount",()=>new _);var $=class extends Error{constructor(){super("Too many events error");this.code=14;this.name="TooManyEvents";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$)}};d.set(14,()=>new $);p.set("TooManyEvents",()=>new $);var ee=class extends Error{constructor(){super("New order error");this.code=15;this.name="NewOrderError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ee)}};d.set(15,()=>new ee);p.set("NewOrderError",()=>new ee);var te=class extends Error{constructor(){super("Reduce order error");this.code=16;this.name="ReduceOrderError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,te)}};d.set(16,()=>new te);p.set("ReduceOrderError",()=>new te);var re=class extends Error{constructor(){super("Cancel multiple orders error");this.code=17;this.name="CancelMultipleOrdersError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,re)}};d.set(17,()=>new re);p.set("CancelMultipleOrdersError",()=>new re);var ie=class extends Error{constructor(){super("Withdraw funds error");this.code=18;this.name="WithdrawFundsError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ie)}};d.set(18,()=>new ie);p.set("WithdrawFundsError",()=>new ie);var ne=class extends Error{constructor(){super("Remove empty orders error");this.code=19;this.name="RemoveEmptyOrdersError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ne)}};d.set(19,()=>new ne);p.set("RemoveEmptyOrdersError",()=>new ne);var oe=class extends Error{constructor(){super("Trader not found error");this.code=20;this.name="TraderNotFound";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,oe)}};d.set(20,()=>new oe);p.set("TraderNotFound",()=>new oe);var se=class extends Error{constructor(){super("Invalid seat status");this.code=21;this.name="InvalidSeatStatus";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,se)}};d.set(21,()=>new se);p.set("InvalidSeatStatus",()=>new se);var ae=class extends Error{constructor(){super("Failed to evict trader");this.code=22;this.name="EvictionError";typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ae)}};d.set(22,()=>new ae);p.set("EvictionError",()=>new ae);function Ai(e){let t=d.get(e);return t!=null?t():null}function hi(e){let t=p.get(e);return t!=null?t():null}var _borsh = require('borsh');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _bnjs = require('bn.js'); var _bnjs2 = _interopRequireDefault(_bnjs);var _beet = require('@metaplex-foundation/beet'); var A = _interopRequireWildcard(_beet); var Ie = _interopRequireWildcard(_beet); var ye = _interopRequireWildcard(_beet); var Nt = _interopRequireWildcard(_beet); var h = _interopRequireWildcard(_beet); var fe = _interopRequireWildcard(_beet); var ke = _interopRequireWildcard(_beet); var E = _interopRequireWildcard(_beet); var ue = _interopRequireWildcard(_beet); var T = _interopRequireWildcard(_beet); var B = _interopRequireWildcard(_beet); var k = _interopRequireWildcard(_beet); var ce = _interopRequireWildcard(_beet); var ge = _interopRequireWildcard(_beet); var Ht = _interopRequireWildcard(_beet); var I = _interopRequireWildcard(_beet); var b = _interopRequireWildcard(_beet); var Zt = _interopRequireWildcard(_beet); var Xt = _interopRequireWildcard(_beet); var F = _interopRequireWildcard(_beet); var L = _interopRequireWildcard(_beet); var Te = _interopRequireWildcard(_beet); var q = _interopRequireWildcard(_beet); var Qt = _interopRequireWildcard(_beet); var R = _interopRequireWildcard(_beet); var Ke = _interopRequireWildcard(_beet); var Ee = _interopRequireWildcard(_beet); var qe = _interopRequireWildcard(_beet); var De = _interopRequireWildcard(_beet); var Me = _interopRequireWildcard(_beet); var Ne = _interopRequireWildcard(_beet); var je = _interopRequireWildcard(_beet); var Ve = _interopRequireWildcard(_beet); var Ye = _interopRequireWildcard(_beet); var Xe = _interopRequireWildcard(_beet); var Je = _interopRequireWildcard(_beet); var $e = _interopRequireWildcard(_beet); var tt = _interopRequireWildcard(_beet); var it = _interopRequireWildcard(_beet); var ot = _interopRequireWildcard(_beet); var st = _interopRequireWildcard(_beet); var ut = _interopRequireWildcard(_beet); var bt = _interopRequireWildcard(_beet); var y = _interopRequireWildcard(_beet);var _beetsolana = require('@metaplex-foundation/beet-solana'); var gt = _interopRequireWildcard(_beetsolana); var jt = _interopRequireWildcard(_beetsolana); var Gt = _interopRequireWildcard(_beetsolana); var Be = _interopRequireWildcard(_beetsolana); var wt = _interopRequireWildcard(_beetsolana); var Bt = _interopRequireWildcard(_beetsolana); var br = _interopRequireWildcard(_beetsolana);var Oi=new A.BeetArgsStruct([["instruction",A.u8],["sequenceNumber",A.u64],["timestamp",A.i64],["slot",A.u64],["market",gt.publicKey],["signer",gt.publicKey],["totalEvents",A.u16]],"AuditLogHeader");var Pt=(r=>(r[r.Bid=0]="Bid",r[r.Ask=1]="Ask",r))(Pt||{}),W= exports.sideBeet =Nt.fixedScalarEnum(Pt);var he=new ye.BeetArgsStruct([["side",W],["priceInTicks",ye.u64],["orderSequenceNumber",ye.u64]],"CancelOrderParams");var Ui=new Ie.FixableBeetArgsStruct([["orders",Ie.array(he)]],"CancelMultipleOrdersByIdParams");var Oe=new h.FixableBeetArgsStruct([["side",W],["tickLimit",h.coption(h.u64)],["numOrdersToSearch",h.coption(h.u32)],["numOrdersToCancel",h.coption(h.u32)]],"CancelUpToParams");var xt=new fe.BeetArgsStruct([["priceInTicks",fe.u64],["sizeInBaseLots",fe.u64]],"CondensedOrder");var zt=new ke.BeetArgsStruct([["quoteLotsToDeposit",ke.u64],["baseLotsToDeposit",ke.u64]],"DepositParams");var Ni=new E.BeetArgsStruct([["index",E.u16],["makerId",jt.publicKey],["orderSequenceNumber",E.u64],["priceInTicks",E.u64],["baseLotsEvicted",E.u64]],"EvictEvent");var ji=new ue.BeetArgsStruct([["index",ue.u16],["feesCollectedInQuoteLots",ue.u64]],"FeeEvent");var Vi=new T.BeetArgsStruct([["index",T.u16],["makerId",Gt.publicKey],["orderSequenceNumber",T.u64],["priceInTicks",T.u64],["baseLotsFilled",T.u64],["baseLotsRemaining",T.u64]],"FillEvent");var Yi=new B.BeetArgsStruct([["index",B.u16],["clientOrderId",B.u128],["totalBaseLotsFilled",B.u64],["totalQuoteLotsFilled",B.u64],["totalFeeInQuoteLots",B.u64]],"FillSummaryEvent");var Vt=new ce.BeetArgsStruct([["bidsSize",ce.u64],["asksSize",ce.u64],["numSeats",ce.u64]],"MarketSizeParams");var St=new ge.BeetArgsStruct([["decimals",ge.u32],["vaultBump",ge.u32],["mintKey",wt.publicKey],["vaultKey",wt.publicKey]],"TokenParams");var At=new k.BeetArgsStruct([["discriminant",k.u64],["status",k.u64],["marketSizeParams",Vt],["baseParams",St],["baseLotSize",k.u64],["quoteParams",St],["quoteLotSize",k.u64],["tickSizeInQuoteAtomsPerBaseUnit",k.u64],["authority",Be.publicKey],["feeRecipient",Be.publicKey],["marketSequenceNumber",k.u64],["successor",Be.publicKey],["rawBaseUnitsPerBaseUnit",k.u32],["padding1",k.u32],["padding2",k.uniformFixedSizeArray(k.u64,32)]],"MarketHeader");var Yt=(s=>(s[s.Uninitialized=0]="Uninitialized",s[s.Active=1]="Active",s[s.PostOnly=2]="PostOnly",s[s.Paused=3]="Paused",s[s.Closed=4]="Closed",s[s.Tombstoned=5]="Tombstoned",s))(Yt||{}),rn= exports.marketStatusBeet =Ht.fixedScalarEnum(Yt);var Fe=new I.FixableBeetArgsStruct([["bids",I.array(xt)],["asks",I.array(xt)],["clientOrderId",I.coption(I.u128)],["rejectPostOnly",I.bool]],"MultipleOrderPacket");var ht=(n=>(n[n.Abort=0]="Abort",n[n.CancelProvide=1]="CancelProvide",n[n.DecrementTake=2]="DecrementTake",n))(ht||{}),It= exports.selfTradeBehaviorBeet =Zt.fixedScalarEnum(ht);var dn=e=>e.__kind==="PostOnly",pn= exports.isOrderPacketLimit =e=>e.__kind==="Limit",yn= exports.isOrderPacketImmediateOrCancel =e=>e.__kind==="ImmediateOrCancel",U= exports.orderPacketBeet =b.dataEnum([["PostOnly",new b.BeetArgsStruct([["side",W],["priceInTicks",b.u64],["numBaseLots",b.u64],["clientOrderId",b.u128],["rejectPostOnly",b.bool],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["PostOnly"]')],["Limit",new b.FixableBeetArgsStruct([["side",W],["priceInTicks",b.u64],["numBaseLots",b.u64],["selfTradeBehavior",It],["matchLimit",b.coption(b.u64)],["clientOrderId",b.u128],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["Limit"]')],["ImmediateOrCancel",new b.FixableBeetArgsStruct([["side",W],["priceInTicks",b.coption(b.u64)],["numBaseLots",b.u64],["numQuoteLots",b.u64],["minBaseLotsToFill",b.u64],["minQuoteLotsToFill",b.u64],["selfTradeBehavior",It],["matchLimit",b.coption(b.u64)],["clientOrderId",b.u128],["useOnlyDepositedFunds",b.bool]],'OrderPacketRecord["ImmediateOrCancel"]')]]);var Ot=(i=>(i[i.Uninitialized=0]="Uninitialized",i[i.Header=1]="Header",i[i.Fill=2]="Fill",i[i.Place=3]="Place",i[i.Reduce=4]="Reduce",i[i.Evict=5]="Evict",i[i.FillSummary=6]="FillSummary",i[i.Fee=7]="Fee",i))(Ot||{}),kn= exports.phoenixMarketEventBeet =Xt.fixedScalarEnum(Ot);var Pn=new F.BeetArgsStruct([["index",F.u16],["orderSequenceNumber",F.u64],["clientOrderId",F.u128],["priceInTicks",F.u64],["baseLotsPlaced",F.u64]],"PlaceEvent");var wn=new L.BeetArgsStruct([["index",L.u16],["orderSequenceNumber",L.u64],["priceInTicks",L.u64],["baseLotsRemoved",L.u64],["baseLotsRemaining",L.u64]],"ReduceEvent");var Le=new Te.BeetArgsStruct([["baseParams",he],["size",Te.u64]],"ReduceOrderParams");var On=new q.BeetArgsStruct([["discriminant",q.u64],["market",Bt.publicKey],["trader",Bt.publicKey],["approvalStatus",q.u64],["padding",q.uniformFixedSizeArray(q.u64,16)]],"Seat");var Jt=(n=>(n[n.NotApproved=0]="NotApproved",n[n.Approved=1]="Approved",n[n.Retired=2]="Retired",n))(Jt||{}),Fn= exports.seatApprovalStatusBeet =Qt.fixedScalarEnum(Jt);var _t=new R.FixableBeetArgsStruct([["quoteLotsToWithdraw",R.coption(R.u64)],["baseLotsToWithdraw",R.coption(R.u64)]],"WithdrawParams");var _spltoken = require('@solana/spl-token'); var $t = _interopRequireWildcard(_spltoken); var er = _interopRequireWildcard(_spltoken); var tr = _interopRequireWildcard(_spltoken); var rr = _interopRequireWildcard(_spltoken); var ir = _interopRequireWildcard(_spltoken); var nr = _interopRequireWildcard(_spltoken); var or = _interopRequireWildcard(_spltoken); var sr = _interopRequireWildcard(_spltoken); var ur = _interopRequireWildcard(_spltoken);var Fr=new Ke.BeetArgsStruct([["instructionDiscriminator",Ke.u8]],"CancelAllOrdersInstructionArgs"),Tr= exports.cancelAllOrdersInstructionDiscriminator =6;function io(e,t=new We.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var a;let[r]=Fr.serialize({instructionDiscriminator:Tr}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(a=e.tokenProgram)!=null?a:$t.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new We.TransactionInstruction({programId:t,keys:n,data:r})}var Lr=new Ee.BeetArgsStruct([["instructionDiscriminator",Ee.u8]],"CancelAllOrdersWithFreeFundsInstructionArgs"),Kr= exports.cancelAllOrdersWithFreeFundsInstructionDiscriminator =7;function oo(e,t=new Ue.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[r]=Lr.serialize({instructionDiscriminator:Kr}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new Ue.TransactionInstruction({programId:t,keys:n,data:r})}var Wr=new qe.BeetArgsStruct([["instructionDiscriminator",qe.u8]],"CancelMultipleOrdersByIdInstructionArgs"),Er= exports.cancelMultipleOrdersByIdInstructionDiscriminator =10;function ao(e,t=new Re.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var a;let[r]=Wr.serialize({instructionDiscriminator:Er}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(a=e.tokenProgram)!=null?a:er.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Re.TransactionInstruction({programId:t,keys:n,data:r})}var Ur=new De.BeetArgsStruct([["instructionDiscriminator",De.u8]],"CancelMultipleOrdersByIdWithFreeFundsInstructionArgs"),qr= exports.cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator =11;function co(e,t=new ve.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[r]=Ur.serialize({instructionDiscriminator:qr}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new ve.TransactionInstruction({programId:t,keys:n,data:r})}var Rr=new Me.FixableBeetArgsStruct([["instructionDiscriminator",Me.u8],["params",Oe]],"CancelUpToInstructionArgs"),Dr= exports.cancelUpToInstructionDiscriminator =8;function po(e,t,r=new Ce.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=Rr.serialize(l({instructionDiscriminator:Dr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:tr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Ce.TransactionInstruction({programId:r,keys:o,data:n})}var vr=new Ne.FixableBeetArgsStruct([["instructionDiscriminator",Ne.u8],["params",Oe]],"CancelUpToWithFreeFundsInstructionArgs"),Mr= exports.cancelUpToWithFreeFundsInstructionDiscriminator =9;function Po(e,t,r=new ze.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[n]=vr.serialize(l({instructionDiscriminator:Mr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0}];return new ze.TransactionInstruction({programId:r,keys:o,data:n})}var Cr=new je.BeetArgsStruct([["instructionDiscriminator",je.u8],["depositFundsParams",zt]],"DepositFundsInstructionArgs"),Nr= exports.depositFundsInstructionDiscriminator =13;function ho(e,t,r=new Ge.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=Cr.serialize(l({instructionDiscriminator:Nr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:rr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Ge.TransactionInstruction({programId:r,keys:o,data:n})}var zr=new Ve.BeetArgsStruct([["instructionDiscriminator",Ve.u8]],"LogInstructionArgs"),Ft= exports.logInstructionDiscriminator =15;function Bo(e,t=new He.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[r]=zr.serialize({instructionDiscriminator:Ft}),n=[{pubkey:e.logAuthority,isWritable:!1,isSigner:!0}];return new He.TransactionInstruction({programId:t,keys:n,data:r})}var jr=new Ye.FixableBeetArgsStruct([["instructionDiscriminator",Ye.u8],["orderPacket",U]],"PlaceLimitOrderInstructionArgs"),Gr= exports.placeLimitOrderInstructionDiscriminator =2;function Ko(e,t,r=new Ze.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=jr.serialize(l({instructionDiscriminator:Gr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:ir.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new Ze.TransactionInstruction({programId:r,keys:o,data:n})}var Vr=new Xe.FixableBeetArgsStruct([["instructionDiscriminator",Xe.u8],["orderPacket",U]],"PlaceLimitOrderWithFreeFundsInstructionArgs"),Hr= exports.placeLimitOrderWithFreeFundsInstructionDiscriminator =3;function Ro(e,t,r=new Qe.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[n]=Vr.serialize(l({instructionDiscriminator:Hr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new Qe.TransactionInstruction({programId:r,keys:o,data:n})}var Yr=new Je.FixableBeetArgsStruct([["instructionDiscriminator",Je.u8],["multipleOrderPacket",Fe]],"PlaceMultiplePostOnlyOrdersInstructionArgs"),Zr= exports.placeMultiplePostOnlyOrdersInstructionDiscriminator =16;function No(e,t,r=new _e.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=Yr.serialize(l({instructionDiscriminator:Zr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:nr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new _e.TransactionInstruction({programId:r,keys:o,data:n})}var Xr=new $e.FixableBeetArgsStruct([["instructionDiscriminator",$e.u8],["multipleOrderPacket",Fe]],"PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs"),Qr= exports.placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator =17;function Ho(e,t,r=new et.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[n]=Xr.serialize(l({instructionDiscriminator:Qr},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new et.TransactionInstruction({programId:r,keys:o,data:n})}var Jr=new tt.BeetArgsStruct([["instructionDiscriminator",tt.u8],["params",Le]],"ReduceOrderInstructionArgs"),_r= exports.reduceOrderInstructionDiscriminator =4;function Jo(e,t,r=new rt.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=Jr.serialize(l({instructionDiscriminator:_r},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:or.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new rt.TransactionInstruction({programId:r,keys:o,data:n})}var $r=new it.BeetArgsStruct([["instructionDiscriminator",it.u8],["params",Le]],"ReduceOrderWithFreeFundsInstructionArgs"),ei= exports.reduceOrderWithFreeFundsInstructionDiscriminator =5;function rs(e,t,r=new nt.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[n]=$r.serialize(l({instructionDiscriminator:ei},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!0,isSigner:!0}];return new nt.TransactionInstruction({programId:r,keys:o,data:n})}var ti=new ot.BeetArgsStruct([["instructionDiscriminator",ot.u8]],"RequestSeatInstructionArgs"),ri= exports.requestSeatInstructionDiscriminator =14;function os(e,t=new be.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var a;let[r]=ti.serialize({instructionDiscriminator:ri}),n=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.payer,isWritable:!0,isSigner:!0},{pubkey:e.seat,isWritable:!0,isSigner:!1},{pubkey:(a=e.systemProgram)!=null?a:be.SystemProgram.programId,isWritable:!1,isSigner:!1}];return new be.TransactionInstruction({programId:t,keys:n,data:r})}var ii=new st.FixableBeetArgsStruct([["instructionDiscriminator",st.u8],["orderPacket",U]],"SwapInstructionArgs"),ni= exports.swapInstructionDiscriminator =0;function ar(e,t,r=new at.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=ii.serialize(l({instructionDiscriminator:ni},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:sr.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new at.TransactionInstruction({programId:r,keys:o,data:n})}var oi=new ut.FixableBeetArgsStruct([["instructionDiscriminator",ut.u8],["orderPacket",U]],"SwapWithFreeFundsInstructionArgs"),si= exports.swapWithFreeFundsInstructionDiscriminator =1;function ds(e,t,r=new ct.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){let[n]=oi.serialize(l({instructionDiscriminator:si},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.seat,isWritable:!1,isSigner:!1}];return new ct.TransactionInstruction({programId:r,keys:o,data:n})}var ai=new bt.FixableBeetArgsStruct([["instructionDiscriminator",bt.u8],["withdrawFundsParams",_t]],"WithdrawFundsInstructionArgs"),ui= exports.withdrawFundsInstructionDiscriminator =12;function gs(e,t,r=new lt.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")){var s;let[n]=ai.serialize(l({instructionDiscriminator:ui},t)),o=[{pubkey:e.phoenixProgram,isWritable:!1,isSigner:!1},{pubkey:e.logAuthority,isWritable:!1,isSigner:!1},{pubkey:e.market,isWritable:!0,isSigner:!1},{pubkey:e.trader,isWritable:!1,isSigner:!0},{pubkey:e.baseAccount,isWritable:!0,isSigner:!1},{pubkey:e.quoteAccount,isWritable:!0,isSigner:!1},{pubkey:e.baseVault,isWritable:!0,isSigner:!1},{pubkey:e.quoteVault,isWritable:!0,isSigner:!1},{pubkey:(s=e.tokenProgram)!=null?s:ur.TOKEN_PROGRAM_ID,isWritable:!1,isSigner:!1}];return new lt.TransactionInstruction({programId:r,keys:o,data:n})}function mt(e){return new (0, _web3js.PublicKey)(e.readFixedArray(32))}function ra(e,t){return w(this,null,function*(){var s;let r=yield e.getParsedTransaction(t,"confirmed"),n=(s=r==null?void 0:r.meta)==null?void 0:s.innerInstructions;if(!n||!r||!r.slot)return{instructions:[]};let o=[];for(let u of n)for(let i of u.instructions){if(i.programId.toBase58()!=Pe.toBase58())continue;let c=_bs582.default.decode(i.data);c[0]==Ft&&o.push(c.slice(1))}let a=new Array;for(let u of o){let i=new (0, _borsh.BinaryReader)(Buffer.from(u));if(i.readU8()!=1)throw new Error("early Unexpected event");let m=new Array,f=new Array,P={instruction:i.readU8(),sequenceNumber:i.readU64(),timestamp:i.readU64(),slot:i.readU64(),market:mt(i),signer:mt(i),totalEvents:i.readU16()};for(;i.offset<i.buf.length;){let g=i.readU8();switch(g){case 2:m.push({index:i.readU16(),makerId:mt(i),orderSequenceNumber:new (0, _bnjs2.default)(i.readFixedArray(8)),priceInTicks:i.readU64(),baseLotsFilled:i.readU64(),baseLotsRemaining:i.readU64()});break;case 3:m.push({index:i.readU16(),orderSequenceNumber:new (0, _bnjs2.default)(i.readFixedArray(8)),clientOrderId:i.readU64(),priceInTicks:i.readU64(),baseLotsPlaced:i.readU64()});break;case 4:m.push({index:i.readU16(),orderSequenceNumber:i.readU64(),priceInTicks:i.readU64(),baseLotsRemoved:i.readU64(),baseLotsRemaining:i.readU64()});break;case 5:m.push({index:i.readU16(),makerId:mt(i),orderSequenceNumber:i.readU64(),priceInTicks:i.readU64(),baseLotsEvicted:i.readU64()});break;case 6:m.push({index:i.readU16(),clientOrderId:i.readU128(),totalBaseLotsFilled:i.readU64(),totalQuoteLotsFilled:i.readU64(),totalFeeInQuoteLots:i.readU64()});break;case 7:m.push({index:i.readU16(),feesCollectedInQuoteLots:i.readU64()});break;default:throw Error("Unexpected Event")}f.push(g)}a.push({header:P,events:m,enums:f})}return{instructions:a}})}function S(e){let t;return typeof e=="number"?t=e:t=e.toNumber(),t}function K(e){return typeof e=="number"?new (0, _bnjs2.default)(e):e.clone()}function Lt(e){return e.lt(new (0, _bnjs2.default)(0))?-1:e.gt(new (0, _bnjs2.default)(0))?1:0}var lr=new y.BeetArgsStruct([["publicKey",br.publicKey]],"PubkeyWrapper"),xe=new y.BeetArgsStruct([["priceInTicks",y.u64],["orderSequenceNumber",y.u64]],"fIFOOrderId"),we=new y.BeetArgsStruct([["traderIndex",y.u64],["numBaseLots",y.u64],["padding",y.uniformFixedSizeArray(y.u64,2)]],"fIFORestingOrder"),Kt=new y.BeetArgsStruct([["quoteLotsLocked",y.u64],["quoteLotsFree",y.u64],["baseLotsLocked",y.u64],["baseLotsFree",y.u64],["padding",y.uniformFixedSizeArray(y.u64,8)]],"TraderState");var yr=10,di= exports.DEFAULT_MATCH_LIMIT =2048,dt= exports.DEFAULT_SLIPPAGE_PERCENT =.005;function Ut(e){let t=At.byteSize,[r]=At.deserialize(e.subarray(0,t)),n=8*32,o=e.subarray(t+n);t=0;let a=Number(o.readBigUInt64LE(t));t+=8;let s=Number(o.readBigUInt64LE(t));t+=8;let u=Number(o.readBigUInt64LE(t));t+=8;let i=Number(o.readBigUInt64LE(t));t+=8;let c=Number(o.readBigUInt64LE(t));t+=8;let m=Number(o.readBigUInt64LE(t));t+=8,o=o.subarray(t);let f=S(r.marketSizeParams.bidsSize),P=S(r.marketSizeParams.asksSize),g=S(r.marketSizeParams.numSeats),x=16+16+(16+xe.byteSize+we.byteSize)*f,O=16+16+(16+xe.byteSize+we.byteSize)*P,D=16+16+(16+32+Kt.byteSize)*g;t=0;let kt=o.subarray(t,t+x);t+=x;let Ae=o.subarray(t,t+O);t+=O;let xr=o.subarray(t,t+D),wr=Et(kt,xe,we),Sr=Et(Ae,xe,we),Ar=[...wr].sort((de,pe)=>Lt(K(pe[0].priceInTicks).sub(K(de[0].priceInTicks)))),hr=[...Sr].sort((de,pe)=>Lt(K(de[0].priceInTicks).sub(K(pe[0].priceInTicks)))),vt=new Map;for(let[de,pe]of Et(xr,lr,Kt))vt.set(de.publicKey,pe);return{header:r,baseLotsPerBaseUnit:a,quoteLotsPerBaseUnitPerTick:s,sequenceNumber:u,takerFeeBps:i,collectedAdjustedQuoteLotFees:c,unclaimedAdjustedQuoteLotFees:m,bids:Ar,asks:hr,traders:vt}}function Et(e,t,r){let n=new Map,o=0,a=t.byteSize,s=r.byteSize,u=new Array;o+=16,o+=8;let i=e.readInt32LE(o);o+=4;let c=e.readInt32LE(o);o+=4;let m=new Array;for(let x=0;o<e.length&&x<i;x++){let O=new Array;for(let Ae=0;Ae<4;Ae++)O.push(e.readInt32LE(o)),o+=4;let[D]=t.deserialize(e.subarray(o,o+a));o+=a;let[kt]=r.deserialize(e.subarray(o,o+s));o+=s,u.push([D,kt]),m.push([x,O[0]])}let f=new Set,P=c-1,g=0;for(;c!==0;)if([P,c]=m[c-1],f.add(P),g+=1,g>i)throw new Error("Infinite loop detected");for(let[x,[O,D]]of u.entries())f.has(x)||n.set(O,D);return n}function qt(e,t=yr){let r=[],n=[];for(let[o,a]of e.bids){let s=K(o.priceInTicks),u=K(a.numBaseLots);if(r.length===0)r.push([s,u]);else{let i=r[r.length-1];if(!i)throw Error;if(s.eq(i[0]))i[1]=i[1].add(u);else{if(r.length===t)break;r.push([s,u])}}}for(let[o,a]of e.asks){let s=K(o.priceInTicks),u=K(a.numBaseLots);if(n.length===0)n.push([s,u]);else{let i=n[n.length-1];if(!i)throw Error;if(s.eq(i[0]))i[1]=i[1].add(u);else{if(n.length===t)break;n.push([s,u])}}}return{asks:n.slice(0,t),bids:r.slice(0,t)}}function pr(e,t,r,n){return[S(t)/n*e.quoteLotsPerBaseUnitPerTick*S(e.header.quoteLotSize),S(r)/e.baseLotsPerBaseUnit]}function Rt(e,t=yr){let r=qt(e,t),n=v(10,S(e.header.quoteParams.decimals));return{bids:r.bids.map(([o,a])=>pr(e,o,a,n)),asks:r.asks.map(([o,a])=>pr(e,o,a,n))}}function fr(e){let t=e.bids,r=e.asks,o=Math.max(...t.map(s=>s[1]),...r.map(s=>s[1])).toString().length,a=(s,u,i)=>{let c=s.toFixed(3),m=u.toFixed(2).padStart(o," ");console.log(c+`\x1B[3${i==="green"?2:1}m`+m+"\x1B[0m")};console.log("\x1B[30mAsks\x1B[0m");for(let[s,u]of r.reverse())a(s,u,"red");console.log("\x1B[30mBids\x1B[0m");for(let[s,u]of t)a(s,u,"green")}function kr({marketAddress:e,marketData:t,trader:r,side:n,inAmount:o,slippage:a=dt,clientOrderId:s=0}){let u=_web3js.PublicKey.findProgramAddressSync([r.toBuffer(),_spltoken.TOKEN_PROGRAM_ID.toBuffer(),t.header.baseParams.mintKey.toBuffer()],_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID)[0],i=_web3js.PublicKey.findProgramAddressSync([r.toBuffer(),_spltoken.TOKEN_PROGRAM_ID.toBuffer(),t.header.quoteParams.mintKey.toBuffer()],_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID)[0],c=_web3js.PublicKey.findProgramAddressSync([Buffer.from("log")],Pe)[0],m={phoenixProgram:Pe,logAuthority:c,market:e,trader:r,baseAccount:u,quoteAccount:i,quoteVault:t.header.quoteParams.vaultKey,baseVault:t.header.baseParams.vaultKey},f=pi({marketData:t,side:n,inAmount:o,slippage:a,clientOrderId:s}),P=ar(m,{orderPacket:l({__kind:"ImmediateOrCancel"},f)});return new (0, _web3js.Transaction)().add(P)}function pi({marketData:e,side:t,inAmount:r,slippage:n=dt,selfTradeBehavior:o=0,matchLimit:a=di,clientOrderId:s=0,useOnlyDepositedFunds:u=!1}){let i=Dt({marketData:e,side:t,inAmount:r}),c=v(10,e.header.baseParams.decimals),m=v(10,e.header.quoteParams.decimals),f=1-n,P=0,g=0,x=0,O=0;return t===1?(P=r*c/parseFloat(e.header.baseLotSize.toString()),O=Math.ceil(i*m/parseFloat(e.header.quoteLotSize.toString())*f)):(x=r*m/parseFloat(e.header.quoteLotSize.toString()),g=Math.ceil(i*c/parseFloat(e.header.baseLotSize.toString())*f)),{side:t,priceInTicks:null,numBaseLots:P,minBaseLotsToFill:g,numQuoteLots:x,minQuoteLotsToFill:O,selfTradeBehavior:o,matchLimit:a,clientOrderId:s,useOnlyDepositedFunds:u}}function Dt({marketData:e,side:t,inAmount:r}){let n=S(e.header.marketSizeParams.bidsSize),o=S(e.header.marketSizeParams.asksSize),a=Rt(e,Math.max(n,o)),s=r*(1-e.takerFeeBps/1e4),u=0;if(t===0)for(let[i,c]of a.asks){let m=c*i;if(m>s){u+=s/i,s=0;break}else u+=c,s-=m}else for(let[i,c]of a.bids)if(c>s){u+=s*i,s=0;break}else u+=c*i,s-=c;return u}var yi=(n=>(n.MainnetBeta="mainnet-beta",n.Devnet="devnet",n.Localhost="localhost",n))(yi||{});function pt(e){return e.includes("devnet")?"devnet":e.includes("local")||e.includes("127.0.0.1")?"localhost":"mainnet-beta"}var Se=class{constructor({name:t,symbol:r,logoUri:n,data:o}){this.name=t,this.symbol=r,this.logoUri=n,this.data=o}};var yt={devnet:{tokens:[{name:"USD Coin",symbol:"USDC",mint:"DK1gsSV2EubSE5S5FdXHpGzw2cAJNVzxeXRmAfxAMpU5",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Solana",symbol:"wSOL",mint:"B1sL3zxwyVnDGzRWCAsBkjL23wyu8HgwQP4XxgnHiSrv",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Bonk",symbol:"Bonk",mint:"8LN9tTVkGLqXRT2SxLUjN8YRHiKzYGLq1wGV1FL7E23P",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/6dhTynDkYsVM7cbF7TKfC9DWB636TcEM935fq7JzL2ES/logo.png"}],markets:["6EvJccKnfxXvbAoCwf2iGTAEgckWuU834XAgT7tV4oxm","7EBrdSbDLvAJEMjigvSrBGkuRNdH9whvzkeojsHSVQib"]},"mainnet-beta":{tokens:[{name:"USD Coin",symbol:"USDC",mint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Wrapped SOL",symbol:"wSOL",mint:"So11111111111111111111111111111111111111112",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Wrapped Ethereum (Sollet)",symbol:"wETH",mint:"2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk/logo.png"},{name:"Wrapped Bitcoin (Sollet)",symbol:"wBTC",mint:"9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk/logo.png"}],markets:["6EvJccKnfxXvbAoCwf2iGTAEgckWuU834XAgT7tV4oxm","7EBrdSbDLvAJEMjigvSrBGkuRNdH9whvzkeojsHSVQib"]},localhost:{tokens:[{name:"USD Coin",symbol:"USDC",mint:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png"},{name:"Wrapped SOL",symbol:"SOL",mint:"So11111111111111111111111111111111111111112",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{name:"Bonk",symbol:"Bonk",mint:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",logoUri:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/6dhTynDkYsVM7cbF7TKfC9DWB636TcEM935fq7JzL2ES/logo.png"}],markets:["3MZskhKUdNRkeMQ6zyNVSJcCx38o79ohwmSgZ2d5a4cu","HhHRvLFvZid6FD7C96H93F2MkASjYfYAx8Y2P8KMAr6b"]}};var le=class{constructor({name:t,address:r,baseToken:n,quoteToken:o,data:a}){this.name=t,this.address=r,this.baseToken=n,this.quoteToken=o,this.data=a}static load(n){return w(this,arguments,function*({connection:t,address:r}){let o=yield t.getAccountInfo(r);if(!o)throw new Error("Account not found for market: "+r.toBase58());let a=Buffer.from(o.data),s=Ut(a),u=yt[pt(t.rpcEndpoint)].tokens,i=u.find(g=>g.mint===s.header.baseParams.mintKey.toBase58()),c=u.find(g=>g.mint===s.header.quoteParams.mintKey.toBase58());if(i===void 0)throw new Error(`Base token ${s.header.baseParams.mintKey} not found in config`);if(c===void 0)throw new Error(`Quote token ${s.header.quoteParams.mintKey} not found in config`);let m=new Se({name:i.name,symbol:i.symbol,logoUri:i.logoUri,data:l({},s.header.baseParams)}),f=new Se({name:c.name,symbol:c.symbol,logoUri:c.logoUri,data:l({},s.header.quoteParams)});return new le({name:`${m.symbol}/${f.symbol}`,address:r,baseToken:m,quoteToken:f,data:s})})}refresh(t){return w(this,null,function*(){let r=yield t.getAccountInfo(this.address),n=Buffer.from(r.data),o=Ut(n);return this.data=o,this})}getLadder(){return qt(this.data)}getUiLadder(){return Rt(this.data)}printLadder(){fr(this.getUiLadder())}getSwapTransaction({trader:t,side:r,inAmount:n,slippage:o=dt,clientOrderId:a=0}){return kr({marketAddress:this.address,marketData:this.data,trader:t,side:r,inAmount:n,slippage:o,clientOrderId:a})}getExpectedOutAmount({side:t,inAmount:r}){return Dt({marketData:this.data,side:t,inAmount:r})}getPriceDecimalPlaces(){let t=Math.pow(10,this.data.header.quoteParams.decimals)/S(this.data.header.tickSizeInQuoteAtomsPerBaseUnit),r=0;for(;t%2===0;)t/=2,r+=1;let n=0;for(;t%5===0;)t/=5,n+=1;let o=Math.max(r,n);return Math.max(o,3)+Math.floor(Math.log10(Math.max(this.data.header.rawBaseUnitsPerBaseUnit,1)))}};var me=class{constructor(t){this.pubkey=t,this.tokenBalances={}}static create(o){return w(this,arguments,function*({connection:t,pubkey:r,tokens:n}){let a=new me(r);for(let s of n){let u=yield t.getTokenAccountsByOwner(r,{programId:_spltoken.TOKEN_PROGRAM_ID,mint:s.data.mintKey});if(u.value.length===0)continue;let i=u.value[0];a.tokenBalances[s.data.mintKey.toBase58()]=Pr(i.account.data,s.data.decimals)}return a})}refresh(t){return w(this,null,function*(){return yield Promise.all(Object.keys(this.tokenBalances).map(r=>w(this,null,function*(){let o=(yield t.getTokenAccountsByOwner(this.pubkey,{programId:_spltoken.TOKEN_PROGRAM_ID,mint:new (0, _web3js.PublicKey)(r)})).value[0];this.tokenBalances[r]=Pr(o.account.data,this.tokenBalances[r].decimals)}))),this})}};function Pr(e,t){let n=_spltoken.AccountLayout.decode(e).amount.toString();return{amount:n,decimals:t,uiAmount:parseInt(n)/v(10,t)}}var ft=class{constructor({connection:t,tokens:r,markets:n,trader:o}){this.connection=t,this.tokens=r,this.markets=n,this.trader=o}static create(t,r){return w(this,null,function*(){let n=pt(t.rpcEndpoint),o=[],a=[];return yield Promise.all(yt[n].markets.map(s=>w(this,null,function*(){let u=yield le.load({connection:t,address:new (0, _web3js.PublicKey)(s)});o.push(u);for(let i of[u.baseToken,u.quoteToken]){let c=i.data.mintKey.toBase58();a.find(m=>m.data.mintKey.toBase58()===c)||a.push(i)}}))),new ft({connection:t,tokens:a,markets:o,trader:r?yield me.create({connection:t,pubkey:r,tokens:a}):void 0})})}};var wi="PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY",Pe= exports.PROGRAM_ID =new (0, _web3js.PublicKey)(wi);exports.CancelAllOrdersStruct = Fr; exports.CancelAllOrdersWithFreeFundsStruct = Lr; exports.CancelMultipleOrdersByIdStruct = Wr; exports.CancelMultipleOrdersByIdWithFreeFundsStruct = Ur; exports.CancelMultipleOrdersErrorError = re; exports.CancelUpToStruct = Rr; exports.CancelUpToWithFreeFundsStruct = vr; exports.Client = ft; exports.Cluster = yi; exports.DEFAULT_LADDER_DEPTH = yr; exports.DEFAULT_MATCH_LIMIT = di; exports.DEFAULT_SLIPPAGE_PERCENT = dt; exports.DepositFundsStruct = Cr; exports.EvictionErrorError = ae; exports.FailedToLoadMarketFromAccountError = N; exports.InvalidBaseAccountError = J; exports.InvalidBaseVaultError = X; exports.InvalidLotSizeError = H; exports.InvalidMarketAuthorityError = C; exports.InvalidMarketParametersError = M; exports.InvalidMarketSignerError = V; exports.InvalidMintError = Z; exports.InvalidQuoteAccountError = _; exports.InvalidQuoteVaultError = Q; exports.InvalidSeatStatusError = se; exports.InvalidStateTransitionError = G; exports.InvalidTickSizeError = Y; exports.LogStruct = zr; exports.Market = le; exports.MarketAlreadyInitializedError = z; exports.MarketStatus = Yt; exports.MarketUninitializedError = j; exports.NewOrderErrorError = ee; exports.PROGRAM_ADDRESS = wi; exports.PROGRAM_ID = Pe; exports.PhoenixMarketEvent = Ot; exports.PlaceLimitOrderStruct = jr; exports.PlaceLimitOrderWithFreeFundsStruct = Vr; exports.PlaceMultiplePostOnlyOrdersStruct = Yr; exports.PlaceMultiplePostOnlyOrdersWithFreeFundsStruct = Xr; exports.ReduceOrderErrorError = te; exports.ReduceOrderStruct = Jr; exports.ReduceOrderWithFreeFundsStruct = $r; exports.RemoveEmptyOrdersErrorError = ne; exports.RequestSeatStruct = ti; exports.SeatApprovalStatus = Jt; exports.SelfTradeBehavior = ht; exports.Side = Pt; exports.SwapStruct = ii; exports.SwapWithFreeFundsStruct = oi; exports.Token = Se; exports.TooManyEventsError = $; exports.Trader = me; exports.TraderNotFoundError = oe; exports.WithdrawFundsErrorError = ie; exports.WithdrawFundsStruct = ai; exports.auditLogHeaderBeet = Oi; exports.cancelAllOrdersInstructionDiscriminator = Tr; exports.cancelAllOrdersWithFreeFundsInstructionDiscriminator = Kr; exports.cancelMultipleOrdersByIdInstructionDiscriminator = Er; exports.cancelMultipleOrdersByIdParamsBeet = Ui; exports.cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator = qr; exports.cancelOrderParamsBeet = he; exports.cancelUpToInstructionDiscriminator = Dr; exports.cancelUpToParamsBeet = Oe; exports.cancelUpToWithFreeFundsInstructionDiscriminator = Mr; exports.clusterFromEndpoint = pt; exports.condensedOrderBeet = xt; exports.createCancelAllOrdersInstruction = io; exports.createCancelAllOrdersWithFreeFundsInstruction = oo; exports.createCancelMultipleOrdersByIdInstruction = ao; exports.createCancelMultipleOrdersByIdWithFreeFundsInstruction = co; exports.createCancelUpToInstruction = po; exports.createCancelUpToWithFreeFundsInstruction = Po; exports.createDepositFundsInstruction = ho; exports.createLogInstruction = Bo; exports.createPlaceLimitOrderInstruction = Ko; exports.createPlaceLimitOrderWithFreeFundsInstruction = Ro; exports.createPlaceMultiplePostOnlyOrdersInstruction = No; exports.createPlaceMultiplePostOnlyOrdersWithFreeFundsInstruction = Ho; exports.createReduceOrderInstruction = Jo; exports.createReduceOrderWithFreeFundsInstruction = rs; exports.createRequestSeatInstruction = os; exports.createSwapInstruction = ar; exports.createSwapWithFreeFundsInstruction = ds; exports.createWithdrawFundsInstruction = gs; exports.depositFundsInstructionDiscriminator = Nr; exports.depositParamsBeet = zt; exports.deserializeMarketData = Ut; exports.deserializeRedBlackTree = Et; exports.errorFromCode = Ai; exports.errorFromName = hi; exports.evictEventBeet = Ni; exports.feeEventBeet = ji; exports.fillEventBeet = Vi; exports.fillSummaryEventBeet = Yi; exports.getEventsFromTransaction = ra; exports.getMarketExpectedOutAmount = Dt; exports.getMarketLadder = qt; exports.getMarketSwapOrderPacket = pi; exports.getMarketSwapTransaction = kr; exports.getMarketUiLadder = Rt; exports.isOrderPacketImmediateOrCancel = yn; exports.isOrderPacketLimit = pn; exports.isOrderPacketPostOnly = dn; exports.logInstructionDiscriminator = Ft; exports.marketHeaderBeet = At; exports.marketSizeParamsBeet = Vt; exports.marketStatusBeet = rn; exports.multipleOrderPacketBeet = Fe; exports.orderPacketBeet = U; exports.phoenixMarketEventBeet = kn; exports.placeEventBeet = Pn; exports.placeLimitOrderInstructionDiscriminator = Gr; exports.placeLimitOrderWithFreeFundsInstructionDiscriminator = Hr; exports.placeMultiplePostOnlyOrdersInstructionDiscriminator = Zr; exports.placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator = Qr; exports.printUiLadder = fr; exports.readPublicKey = mt; exports.reduceEventBeet = wn; exports.reduceOrderInstructionDiscriminator = _r; exports.reduceOrderParamsBeet = Le; exports.reduceOrderWithFreeFundsInstructionDiscriminator = ei; exports.requestSeatInstructionDiscriminator = ri; exports.seatApprovalStatusBeet = Fn; exports.seatBeet = On; exports.selfTradeBehaviorBeet = It; exports.sideBeet = W; exports.sign = Lt; exports.swapInstructionDiscriminator = ni; exports.swapWithFreeFundsInstructionDiscriminator = si; exports.toBN = K; exports.toNum = S; exports.tokenParamsBeet = St; exports.withdrawFundsInstructionDiscriminator = ui; exports.withdrawParamsBeet = _t;
{
"name": "@ellipsis-labs/phoenix-sdk",
"version": "1.0.6",
"version": "1.0.7",
"description": "TypeScript SDK for Phoenix",

@@ -26,5 +26,5 @@ "author": "Ellipsis Labs",

"@types/bn.js": "^5.1.1",
"tsup": "^6.5.0",
"tsup": "^6.6.0",
"typescript": "^4.9.4"
}
}

@@ -19,3 +19,3 @@ import { PublicKey } from "@solana/web3.js";

*/
export const PROGRAM_ADDRESS = "phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH";
export const PROGRAM_ADDRESS = "PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY";

@@ -22,0 +22,0 @@ /**

@@ -8,5 +8,5 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";

@@ -19,4 +19,4 @@ /**

export const CancelAllOrdersStruct = new beet.BeetArgsStruct<{
instructionDiscriminator: number
}>([['instructionDiscriminator', beet.u8]], 'CancelAllOrdersInstructionArgs')
instructionDiscriminator: number;
}>([["instructionDiscriminator", beet.u8]], "CancelAllOrdersInstructionArgs");
/**

@@ -38,14 +38,14 @@ * Accounts required by the _CancelAllOrders_ instruction

export type CancelAllOrdersInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const cancelAllOrdersInstructionDiscriminator = 6
export const cancelAllOrdersInstructionDiscriminator = 6;

@@ -62,7 +62,7 @@ /**

accounts: CancelAllOrdersInstructionAccounts,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {
const [data] = CancelAllOrdersStruct.serialize({
instructionDiscriminator: cancelAllOrdersInstructionDiscriminator,
})
});
const keys: web3.AccountMeta[] = [

@@ -114,3 +114,3 @@ {

},
]
];

@@ -121,4 +121,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,4 +8,4 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";

@@ -18,7 +18,7 @@ /**

export const CancelAllOrdersWithFreeFundsStruct = new beet.BeetArgsStruct<{
instructionDiscriminator: number
instructionDiscriminator: number;
}>(
[['instructionDiscriminator', beet.u8]],
'CancelAllOrdersWithFreeFundsInstructionArgs'
)
[["instructionDiscriminator", beet.u8]],
"CancelAllOrdersWithFreeFundsInstructionArgs"
);
/**

@@ -36,9 +36,9 @@ * Accounts required by the _CancelAllOrdersWithFreeFunds_ instruction

export type CancelAllOrdersWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
};
export const cancelAllOrdersWithFreeFundsInstructionDiscriminator = 7
export const cancelAllOrdersWithFreeFundsInstructionDiscriminator = 7;

@@ -55,3 +55,3 @@ /**

accounts: CancelAllOrdersWithFreeFundsInstructionAccounts,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -61,3 +61,3 @@ const [data] = CancelAllOrdersWithFreeFundsStruct.serialize({

cancelAllOrdersWithFreeFundsInstructionDiscriminator,
})
});
const keys: web3.AccountMeta[] = [

@@ -84,3 +84,3 @@ {

},
]
];

@@ -91,4 +91,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -62,3 +62,3 @@ /**

accounts: CancelMultipleOrdersByIdInstructionAccounts,
programId = new web3.PublicKey("phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH")
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -65,0 +65,0 @@ const [data] = CancelMultipleOrdersByIdStruct.serialize({

@@ -8,4 +8,4 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";

@@ -19,5 +19,5 @@ /**

new beet.BeetArgsStruct<{ instructionDiscriminator: number }>(
[['instructionDiscriminator', beet.u8]],
'CancelMultipleOrdersByIdWithFreeFundsInstructionArgs'
)
[["instructionDiscriminator", beet.u8]],
"CancelMultipleOrdersByIdWithFreeFundsInstructionArgs"
);
/**

@@ -35,9 +35,9 @@ * Accounts required by the _CancelMultipleOrdersByIdWithFreeFunds_ instruction

export type CancelMultipleOrdersByIdWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
};
export const cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator = 11
export const cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator = 11;

@@ -54,3 +54,3 @@ /**

accounts: CancelMultipleOrdersByIdWithFreeFundsInstructionAccounts,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -60,3 +60,3 @@ const [data] = CancelMultipleOrdersByIdWithFreeFundsStruct.serialize({

cancelMultipleOrdersByIdWithFreeFundsInstructionDiscriminator,
})
});
const keys: web3.AccountMeta[] = [

@@ -83,3 +83,3 @@ {

},
]
];

@@ -90,4 +90,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,9 +8,9 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
CancelUpToParams,
cancelUpToParamsBeet,
} from '../types/CancelUpToParams'
} from "../types/CancelUpToParams";

@@ -23,4 +23,4 @@ /**

export type CancelUpToInstructionArgs = {
params: CancelUpToParams
}
params: CancelUpToParams;
};
/**

@@ -33,11 +33,11 @@ * @category Instructions

CancelUpToInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['params', cancelUpToParamsBeet],
["instructionDiscriminator", beet.u8],
["params", cancelUpToParamsBeet],
],
'CancelUpToInstructionArgs'
)
"CancelUpToInstructionArgs"
);
/**

@@ -59,14 +59,14 @@ * Accounts required by the _CancelUpTo_ instruction

export type CancelUpToInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const cancelUpToInstructionDiscriminator = 8
export const cancelUpToInstructionDiscriminator = 8;

@@ -86,3 +86,3 @@ /**

args: CancelUpToInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -92,3 +92,3 @@ const [data] = CancelUpToStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -140,3 +140,3 @@ {

},
]
];

@@ -147,4 +147,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,8 +8,8 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
CancelUpToParams,
cancelUpToParamsBeet,
} from '../types/CancelUpToParams'
} from "../types/CancelUpToParams";

@@ -22,4 +22,4 @@ /**

export type CancelUpToWithFreeFundsInstructionArgs = {
params: CancelUpToParams
}
params: CancelUpToParams;
};
/**

@@ -32,11 +32,11 @@ * @category Instructions

CancelUpToWithFreeFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['params', cancelUpToParamsBeet],
["instructionDiscriminator", beet.u8],
["params", cancelUpToParamsBeet],
],
'CancelUpToWithFreeFundsInstructionArgs'
)
"CancelUpToWithFreeFundsInstructionArgs"
);
/**

@@ -54,9 +54,9 @@ * Accounts required by the _CancelUpToWithFreeFunds_ instruction

export type CancelUpToWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
};
export const cancelUpToWithFreeFundsInstructionDiscriminator = 9
export const cancelUpToWithFreeFundsInstructionDiscriminator = 9;

@@ -76,3 +76,3 @@ /**

args: CancelUpToWithFreeFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -82,3 +82,3 @@ const [data] = CancelUpToWithFreeFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -105,3 +105,3 @@ {

},
]
];

@@ -112,4 +112,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,6 +8,6 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { DepositParams, depositParamsBeet } from '../types/DepositParams'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { DepositParams, depositParamsBeet } from "../types/DepositParams";

@@ -20,4 +20,4 @@ /**

export type DepositFundsInstructionArgs = {
depositFundsParams: DepositParams
}
depositFundsParams: DepositParams;
};
/**

@@ -30,11 +30,11 @@ * @category Instructions

DepositFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['depositFundsParams', depositParamsBeet],
["instructionDiscriminator", beet.u8],
["depositFundsParams", depositParamsBeet],
],
'DepositFundsInstructionArgs'
)
"DepositFundsInstructionArgs"
);
/**

@@ -57,15 +57,15 @@ * Accounts required by the _DepositFunds_ instruction

export type DepositFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const depositFundsInstructionDiscriminator = 13
export const depositFundsInstructionDiscriminator = 13;

@@ -85,3 +85,3 @@ /**

args: DepositFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -91,3 +91,3 @@ const [data] = DepositFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -144,3 +144,3 @@ {

},
]
];

@@ -151,4 +151,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,4 +8,4 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";

@@ -18,4 +18,4 @@ /**

export const LogStruct = new beet.BeetArgsStruct<{
instructionDiscriminator: number
}>([['instructionDiscriminator', beet.u8]], 'LogInstructionArgs')
instructionDiscriminator: number;
}>([["instructionDiscriminator", beet.u8]], "LogInstructionArgs");
/**

@@ -30,6 +30,6 @@ * Accounts required by the _Log_ instruction

export type LogInstructionAccounts = {
logAuthority: web3.PublicKey
}
logAuthority: web3.PublicKey;
};
export const logInstructionDiscriminator = 15
export const logInstructionDiscriminator = 15;

@@ -46,7 +46,7 @@ /**

accounts: LogInstructionAccounts,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {
const [data] = LogStruct.serialize({
instructionDiscriminator: logInstructionDiscriminator,
})
});
const keys: web3.AccountMeta[] = [

@@ -58,3 +58,3 @@ {

},
]
];

@@ -65,4 +65,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,6 +8,6 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { OrderPacket, orderPacketBeet } from '../types/OrderPacket'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { OrderPacket, orderPacketBeet } from "../types/OrderPacket";

@@ -20,4 +20,4 @@ /**

export type PlaceLimitOrderInstructionArgs = {
orderPacket: OrderPacket
}
orderPacket: OrderPacket;
};
/**

@@ -30,11 +30,11 @@ * @category Instructions

PlaceLimitOrderInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['orderPacket', orderPacketBeet],
["instructionDiscriminator", beet.u8],
["orderPacket", orderPacketBeet],
],
'PlaceLimitOrderInstructionArgs'
)
"PlaceLimitOrderInstructionArgs"
);
/**

@@ -57,15 +57,15 @@ * Accounts required by the _PlaceLimitOrder_ instruction

export type PlaceLimitOrderInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const placeLimitOrderInstructionDiscriminator = 2
export const placeLimitOrderInstructionDiscriminator = 2;

@@ -85,3 +85,3 @@ /**

args: PlaceLimitOrderInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -91,3 +91,3 @@ const [data] = PlaceLimitOrderStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -144,3 +144,3 @@ {

},
]
];

@@ -151,4 +151,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,5 +8,5 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { OrderPacket, orderPacketBeet } from '../types/OrderPacket'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { OrderPacket, orderPacketBeet } from "../types/OrderPacket";

@@ -19,4 +19,4 @@ /**

export type PlaceLimitOrderWithFreeFundsInstructionArgs = {
orderPacket: OrderPacket
}
orderPacket: OrderPacket;
};
/**

@@ -30,11 +30,11 @@ * @category Instructions

PlaceLimitOrderWithFreeFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['orderPacket', orderPacketBeet],
["instructionDiscriminator", beet.u8],
["orderPacket", orderPacketBeet],
],
'PlaceLimitOrderWithFreeFundsInstructionArgs'
)
"PlaceLimitOrderWithFreeFundsInstructionArgs"
);
/**

@@ -53,10 +53,10 @@ * Accounts required by the _PlaceLimitOrderWithFreeFunds_ instruction

export type PlaceLimitOrderWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
};
export const placeLimitOrderWithFreeFundsInstructionDiscriminator = 3
export const placeLimitOrderWithFreeFundsInstructionDiscriminator = 3;

@@ -76,3 +76,3 @@ /**

args: PlaceLimitOrderWithFreeFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -83,3 +83,3 @@ const [data] = PlaceLimitOrderWithFreeFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -111,3 +111,3 @@ {

},
]
];

@@ -118,4 +118,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,9 +8,9 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
MultipleOrderPacket,
multipleOrderPacketBeet,
} from '../types/MultipleOrderPacket'
} from "../types/MultipleOrderPacket";

@@ -23,4 +23,4 @@ /**

export type PlaceMultiplePostOnlyOrdersInstructionArgs = {
multipleOrderPacket: MultipleOrderPacket
}
multipleOrderPacket: MultipleOrderPacket;
};
/**

@@ -33,11 +33,11 @@ * @category Instructions

PlaceMultiplePostOnlyOrdersInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['multipleOrderPacket', multipleOrderPacketBeet],
["instructionDiscriminator", beet.u8],
["multipleOrderPacket", multipleOrderPacketBeet],
],
'PlaceMultiplePostOnlyOrdersInstructionArgs'
)
"PlaceMultiplePostOnlyOrdersInstructionArgs"
);
/**

@@ -60,15 +60,15 @@ * Accounts required by the _PlaceMultiplePostOnlyOrders_ instruction

export type PlaceMultiplePostOnlyOrdersInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const placeMultiplePostOnlyOrdersInstructionDiscriminator = 16
export const placeMultiplePostOnlyOrdersInstructionDiscriminator = 16;

@@ -88,3 +88,3 @@ /**

args: PlaceMultiplePostOnlyOrdersInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -95,3 +95,3 @@ const [data] = PlaceMultiplePostOnlyOrdersStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -148,3 +148,3 @@ {

},
]
];

@@ -155,4 +155,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,8 +8,8 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
MultipleOrderPacket,
multipleOrderPacketBeet,
} from '../types/MultipleOrderPacket'
} from "../types/MultipleOrderPacket";

@@ -22,4 +22,4 @@ /**

export type PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs = {
multipleOrderPacket: MultipleOrderPacket
}
multipleOrderPacket: MultipleOrderPacket;
};
/**

@@ -33,11 +33,11 @@ * @category Instructions

PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['multipleOrderPacket', multipleOrderPacketBeet],
["instructionDiscriminator", beet.u8],
["multipleOrderPacket", multipleOrderPacketBeet],
],
'PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs'
)
"PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs"
);
/**

@@ -56,10 +56,10 @@ * Accounts required by the _PlaceMultiplePostOnlyOrdersWithFreeFunds_ instruction

export type PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
};
export const placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator = 17
export const placeMultiplePostOnlyOrdersWithFreeFundsInstructionDiscriminator = 17;

@@ -79,3 +79,3 @@ /**

args: PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -86,3 +86,3 @@ const [data] = PlaceMultiplePostOnlyOrdersWithFreeFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -114,3 +114,3 @@ {

},
]
];

@@ -121,4 +121,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,9 +8,9 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
ReduceOrderParams,
reduceOrderParamsBeet,
} from '../types/ReduceOrderParams'
} from "../types/ReduceOrderParams";

@@ -23,4 +23,4 @@ /**

export type ReduceOrderInstructionArgs = {
params: ReduceOrderParams
}
params: ReduceOrderParams;
};
/**

@@ -33,11 +33,11 @@ * @category Instructions

ReduceOrderInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['params', reduceOrderParamsBeet],
["instructionDiscriminator", beet.u8],
["params", reduceOrderParamsBeet],
],
'ReduceOrderInstructionArgs'
)
"ReduceOrderInstructionArgs"
);
/**

@@ -59,14 +59,14 @@ * Accounts required by the _ReduceOrder_ instruction

export type ReduceOrderInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const reduceOrderInstructionDiscriminator = 4
export const reduceOrderInstructionDiscriminator = 4;

@@ -86,3 +86,3 @@ /**

args: ReduceOrderInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -92,3 +92,3 @@ const [data] = ReduceOrderStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -140,3 +140,3 @@ {

},
]
];

@@ -147,4 +147,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,8 +8,8 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import {
ReduceOrderParams,
reduceOrderParamsBeet,
} from '../types/ReduceOrderParams'
} from "../types/ReduceOrderParams";

@@ -22,4 +22,4 @@ /**

export type ReduceOrderWithFreeFundsInstructionArgs = {
params: ReduceOrderParams
}
params: ReduceOrderParams;
};
/**

@@ -32,11 +32,11 @@ * @category Instructions

ReduceOrderWithFreeFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['params', reduceOrderParamsBeet],
["instructionDiscriminator", beet.u8],
["params", reduceOrderParamsBeet],
],
'ReduceOrderWithFreeFundsInstructionArgs'
)
"ReduceOrderWithFreeFundsInstructionArgs"
);
/**

@@ -54,9 +54,9 @@ * Accounts required by the _ReduceOrderWithFreeFunds_ instruction

export type ReduceOrderWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
};
export const reduceOrderWithFreeFundsInstructionDiscriminator = 5
export const reduceOrderWithFreeFundsInstructionDiscriminator = 5;

@@ -76,3 +76,3 @@ /**

args: ReduceOrderWithFreeFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -82,3 +82,3 @@ const [data] = ReduceOrderWithFreeFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -105,3 +105,3 @@ {

},
]
];

@@ -112,4 +112,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,4 +8,4 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";

@@ -18,4 +18,4 @@ /**

export const RequestSeatStruct = new beet.BeetArgsStruct<{
instructionDiscriminator: number
}>([['instructionDiscriminator', beet.u8]], 'RequestSeatInstructionArgs')
instructionDiscriminator: number;
}>([["instructionDiscriminator", beet.u8]], "RequestSeatInstructionArgs");
/**

@@ -34,11 +34,11 @@ * Accounts required by the _RequestSeat_ instruction

export type RequestSeatInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
payer: web3.PublicKey
seat: web3.PublicKey
systemProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
payer: web3.PublicKey;
seat: web3.PublicKey;
systemProgram?: web3.PublicKey;
};
export const requestSeatInstructionDiscriminator = 14
export const requestSeatInstructionDiscriminator = 14;

@@ -55,7 +55,7 @@ /**

accounts: RequestSeatInstructionAccounts,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {
const [data] = RequestSeatStruct.serialize({
instructionDiscriminator: requestSeatInstructionDiscriminator,
})
});
const keys: web3.AccountMeta[] = [

@@ -92,3 +92,3 @@ {

},
]
];

@@ -99,4 +99,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,6 +8,6 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { OrderPacket, orderPacketBeet } from '../types/OrderPacket'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { OrderPacket, orderPacketBeet } from "../types/OrderPacket";

@@ -20,4 +20,4 @@ /**

export type SwapInstructionArgs = {
orderPacket: OrderPacket
}
orderPacket: OrderPacket;
};
/**

@@ -30,11 +30,11 @@ * @category Instructions

SwapInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['orderPacket', orderPacketBeet],
["instructionDiscriminator", beet.u8],
["orderPacket", orderPacketBeet],
],
'SwapInstructionArgs'
)
"SwapInstructionArgs"
);
/**

@@ -56,14 +56,14 @@ * Accounts required by the _Swap_ instruction

export type SwapInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const swapInstructionDiscriminator = 0
export const swapInstructionDiscriminator = 0;

@@ -83,3 +83,3 @@ /**

args: SwapInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -89,3 +89,3 @@ const [data] = SwapStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -137,3 +137,3 @@ {

},
]
];

@@ -144,4 +144,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
}
});
return ix;
}

@@ -8,5 +8,5 @@ /**

import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { OrderPacket, orderPacketBeet } from '../types/OrderPacket'
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { OrderPacket, orderPacketBeet } from "../types/OrderPacket";

@@ -19,4 +19,4 @@ /**

export type SwapWithFreeFundsInstructionArgs = {
orderPacket: OrderPacket
}
orderPacket: OrderPacket;
};
/**

@@ -29,11 +29,11 @@ * @category Instructions

SwapWithFreeFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['orderPacket', orderPacketBeet],
["instructionDiscriminator", beet.u8],
["orderPacket", orderPacketBeet],
],
'SwapWithFreeFundsInstructionArgs'
)
"SwapWithFreeFundsInstructionArgs"
);
/**

@@ -52,10 +52,10 @@ * Accounts required by the _SwapWithFreeFunds_ instruction

export type SwapWithFreeFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
seat: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
seat: web3.PublicKey;
};
export const swapWithFreeFundsInstructionDiscriminator = 1
export const swapWithFreeFundsInstructionDiscriminator = 1;

@@ -75,3 +75,3 @@ /**

args: SwapWithFreeFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -81,3 +81,3 @@ const [data] = SwapWithFreeFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -109,3 +109,3 @@ {

},
]
];

@@ -116,4 +116,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -8,6 +8,6 @@ /**

import * as splToken from '@solana/spl-token'
import * as beet from '@metaplex-foundation/beet'
import * as web3 from '@solana/web3.js'
import { WithdrawParams, withdrawParamsBeet } from '../types/WithdrawParams'
import * as splToken from "@solana/spl-token";
import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { WithdrawParams, withdrawParamsBeet } from "../types/WithdrawParams";

@@ -20,4 +20,4 @@ /**

export type WithdrawFundsInstructionArgs = {
withdrawFundsParams: WithdrawParams
}
withdrawFundsParams: WithdrawParams;
};
/**

@@ -30,11 +30,11 @@ * @category Instructions

WithdrawFundsInstructionArgs & {
instructionDiscriminator: number
instructionDiscriminator: number;
}
>(
[
['instructionDiscriminator', beet.u8],
['withdrawFundsParams', withdrawParamsBeet],
["instructionDiscriminator", beet.u8],
["withdrawFundsParams", withdrawParamsBeet],
],
'WithdrawFundsInstructionArgs'
)
"WithdrawFundsInstructionArgs"
);
/**

@@ -56,14 +56,14 @@ * Accounts required by the _WithdrawFunds_ instruction

export type WithdrawFundsInstructionAccounts = {
phoenixProgram: web3.PublicKey
logAuthority: web3.PublicKey
market: web3.PublicKey
trader: web3.PublicKey
baseAccount: web3.PublicKey
quoteAccount: web3.PublicKey
baseVault: web3.PublicKey
quoteVault: web3.PublicKey
tokenProgram?: web3.PublicKey
}
phoenixProgram: web3.PublicKey;
logAuthority: web3.PublicKey;
market: web3.PublicKey;
trader: web3.PublicKey;
baseAccount: web3.PublicKey;
quoteAccount: web3.PublicKey;
baseVault: web3.PublicKey;
quoteVault: web3.PublicKey;
tokenProgram?: web3.PublicKey;
};
export const withdrawFundsInstructionDiscriminator = 12
export const withdrawFundsInstructionDiscriminator = 12;

@@ -83,3 +83,3 @@ /**

args: WithdrawFundsInstructionArgs,
programId = new web3.PublicKey('phnxNHfGNVjpVVuHkceK3MgwZ1bW25ijfWACKhVFbBH')
programId = new web3.PublicKey("PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY")
) {

@@ -89,3 +89,3 @@ const [data] = WithdrawFundsStruct.serialize({

...args,
})
});
const keys: web3.AccountMeta[] = [

@@ -137,3 +137,3 @@ {

},
]
];

@@ -144,4 +144,4 @@ const ix = new web3.TransactionInstruction({

data,
})
return ix
});
return ix;
}

@@ -16,2 +16,3 @@ import { Connection, PublicKey } from "@solana/web3.js";

clusterFromEndpoint,
toNum,
} from "./utils";

@@ -249,2 +250,26 @@ import { Token } from "./token";

}
getPriceDecimalPlaces(): number {
let target =
Math.pow(10, this.data.header.quoteParams.decimals) /
toNum(this.data.header.tickSizeInQuoteAtomsPerBaseUnit);
let exp2 = 0;
while (target % 2 === 0) {
target /= 2;
exp2 += 1;
}
let exp5 = 0;
while (target % 5 === 0) {
target /= 5;
exp5 += 1;
}
let precision = Math.max(exp2, exp5);
return (
Math.max(precision, 3) +
Math.floor(
Math.log10(Math.max(this.data.header.rawBaseUnitsPerBaseUnit, 1))
)
);
}
}

@@ -20,3 +20,3 @@ import {

const marketAddress = new PublicKey(
"5iLqmcg8vifdnnw6wEpVtQxFE4Few5uiceDWzi3jvzH8"
"3PgJmaEKQqVzQNAT3WtMaSQxBFPL3WqnvyahRM28PGJH"
);

@@ -134,3 +134,12 @@ const marketAccount = await connection.getAccountInfo(

const txResult = await Phoenix.getEventsFromTransaction(connection, txId);
let txResult = await Phoenix.getEventsFromTransaction(connection, txId);
let counter = 1;
while (txResult.instructions.length == 0) {
txResult = await Phoenix.getEventsFromTransaction(connection, txId);
counter += 1;
if (counter == 10) {
throw Error("Failed to fetch transaction");
}
}
const fillEvents = txResult.instructions[0];

@@ -137,0 +146,0 @@

@@ -9,4 +9,2 @@ import { Connection } from "@solana/web3.js";

phoenix.subscribe();
const market = phoenix.markets.find((market) => market.name === "wSOL/USDC");

@@ -27,6 +25,5 @@ if (!market) throw new Error("Market not found");

await market.refresh(connection);
await new Promise((res) => setTimeout(res, 500));
}
phoenix.unsubscribe();
}

@@ -33,0 +30,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc