diff --git a/.env.sample b/.env.sample index a3eacb1c..83294276 100644 --- a/.env.sample +++ b/.env.sample @@ -1,2 +1,2 @@ ANCHOR_PROVIDER_URL=https://api.devnet.solana.com -ANCHOR_WALLET=/Users/pindaroso/.config/solana/id.json \ No newline at end of file +ANCHOR_WALLET=~/.config/solana/id.json \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b53635..23dbebf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 **Note:** Version 0 of Semantic Versioning is handled differently from version 1 and above. The minor version will be incremented upon a breaking change and the patch version will be incremented for features. +## [2.2.13] - 2023-10-04 + +### Fixes + +- psyoptions-american: Refactored PsyOptions American instrument to handle call and put logic. See PR ([#166](https://github.com/convergence-rfq/convergence-program-library/pull/166)) for full details. + ## [2.2.12] - 2023-08-17 ### Fixes diff --git a/psyoptions-american-instrument/js/package.json b/psyoptions-american-instrument/js/package.json index 135d0b06..4244acf9 100644 --- a/psyoptions-american-instrument/js/package.json +++ b/psyoptions-american-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/psyoptions-american-instrument", - "version": "2.2.12", + "version": "2.2.13", "license": "MIT", "publishConfig": { "access": "public", diff --git a/psyoptions-american-instrument/program/src/instructions.rs b/psyoptions-american-instrument/program/src/instructions.rs index 988c24fc..e859ce5e 100644 --- a/psyoptions-american-instrument/program/src/instructions.rs +++ b/psyoptions-american-instrument/program/src/instructions.rs @@ -16,10 +16,8 @@ pub struct ValidateData<'info> { /// user provided pub american_meta: Account<'info, OptionMarket>, - #[account(constraint = american_meta.underlying_asset_mint == mint_info.mint_address @ PsyoptionsAmericanError::PassedMintDoesNotMatch)] - pub mint_info: Account<'info, MintInfo>, - #[account(constraint = american_meta.quote_asset_mint == quote_mint.mint_address @ PsyoptionsAmericanError::PassedMintDoesNotMatch)] - pub quote_mint: Account<'info, MintInfo>, + pub underlying_asset_mint: Account<'info, MintInfo>, + pub stable_asset_mint: Account<'info, MintInfo>, } #[derive(Accounts)] diff --git a/psyoptions-american-instrument/program/src/lib.rs b/psyoptions-american-instrument/program/src/lib.rs index 48a20892..2a6ce7e6 100644 --- a/psyoptions-american-instrument/program/src/lib.rs +++ b/psyoptions-american-instrument/program/src/lib.rs @@ -6,6 +6,7 @@ use errors::PsyoptionsAmericanError; use instructions::*; use rfq::state::MintType; use rfq::state::{AssetIdentifier, AuthoritySide}; +use risk_engine::state::OptionType; use state::{AssetIdentifierDuplicate, ParsedLegData}; use state::{AuthoritySideDuplicate, TOKEN_DECIMALS}; @@ -30,8 +31,8 @@ pub mod psyoptions_american_instrument { ) -> Result<()> { let ValidateData { american_meta, - mint_info, - quote_mint, + underlying_asset_mint, + stable_asset_mint, .. } = &ctx.accounts; @@ -49,30 +50,64 @@ pub mod psyoptions_american_instrument { american_meta_address == american_meta.key(), PsyoptionsAmericanError::PassedAmericanMetaDoesNotMatch ); + + let option_type = option_common_data.option_type; + let underlying_amount_per_contract: u64; + let strike_price: u64; + let underlying_mint: Pubkey; + let quote_mint: Pubkey; let expected_mint = american_meta.option_mint; + + match option_type { + OptionType::Call => { + underlying_amount_per_contract = 10_u64.pow(underlying_asset_mint.decimals as u32); + strike_price = option_common_data.strike_price; + quote_mint = stable_asset_mint.mint_address; + underlying_mint = underlying_asset_mint.mint_address; + } + OptionType::Put => { + underlying_amount_per_contract = option_common_data.strike_price; + strike_price = 10_u64.pow(underlying_asset_mint.decimals as u32); + quote_mint = underlying_asset_mint.mint_address; + underlying_mint = stable_asset_mint.mint_address; + } + } + require!( mint_address == expected_mint, PsyoptionsAmericanError::PassedMintDoesNotMatch ); + require!( - option_common_data.underlying_amount_per_contract - == american_meta.underlying_amount_per_contract, - PsyoptionsAmericanError::PassedUnderlyingAmountPerContractDoesNotMatch + underlying_mint == american_meta.underlying_asset_mint, + PsyoptionsAmericanError::PassedMintDoesNotMatch ); - require_eq!( - option_common_data.underlying_amound_per_contract_decimals, - mint_info.decimals, + + require!( + quote_mint == american_meta.quote_asset_mint, + PsyoptionsAmericanError::PassedMintDoesNotMatch + ); + + require!( + underlying_amount_per_contract == american_meta.underlying_amount_per_contract, PsyoptionsAmericanError::PassedUnderlyingAmountPerContractDoesNotMatch ); + require!( - option_common_data.strike_price == american_meta.quote_amount_per_contract, + strike_price == american_meta.quote_amount_per_contract, PsyoptionsAmericanError::PassedStrikePriceDoesNotMatch ); require_eq!( option_common_data.strike_price_decimals, - quote_mint.decimals, + stable_asset_mint.decimals, PsyoptionsAmericanError::PassedStrikePriceDecimalsDoesNotMatch ); + require_eq!( + option_common_data.underlying_amound_per_contract_decimals, + underlying_asset_mint.decimals, + PsyoptionsAmericanError::PassedUnderlyingAmountPerContractDecimalsDoesNotMatch + ); + require!( option_common_data.expiration_timestamp == american_meta.expiration_unix_timestamp, PsyoptionsAmericanError::PassedExpirationTimestampDoesNotMatch @@ -84,7 +119,7 @@ pub mod psyoptions_american_instrument { ); if let (Some(passed_base_asset_index), MintType::AssetWithRisk { base_asset_index }) = - (base_asset_index, mint_info.mint_type) + (base_asset_index, underlying_asset_mint.mint_type) { require!( passed_base_asset_index == u16::from(base_asset_index), diff --git a/psyoptions-european-instrument/js/package.json b/psyoptions-european-instrument/js/package.json index 6b709290..42258b66 100644 --- a/psyoptions-european-instrument/js/package.json +++ b/psyoptions-european-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/psyoptions-european-instrument", - "version": "2.2.12", + "version": "2.2.13", "license": "MIT", "publishConfig": { "access": "public", diff --git a/psyoptions-european-instrument/program/src/lib.rs b/psyoptions-european-instrument/program/src/lib.rs index ed62413d..3769cfd5 100644 --- a/psyoptions-european-instrument/program/src/lib.rs +++ b/psyoptions-european-instrument/program/src/lib.rs @@ -33,7 +33,7 @@ pub mod psyoptions_european_instrument { ) -> Result<()> { let ValidateData { euro_meta, - mint_info, + underlying_asset_mint, .. } = &ctx.accounts; @@ -89,7 +89,7 @@ pub mod psyoptions_european_instrument { ); if let (Some(passed_base_asset_index), MintType::AssetWithRisk { base_asset_index }) = - (base_asset_index, mint_info.mint_type) + (base_asset_index, underlying_asset_mint.mint_type) { require!( passed_base_asset_index == u16::from(base_asset_index), @@ -331,8 +331,8 @@ pub struct ValidateData<'info> { /// user provided pub euro_meta: Account<'info, EuroMeta>, - #[account(constraint = euro_meta.underlying_mint == mint_info.mint_address @ PsyoptionsEuropeanError::PassedMintDoesNotMatch)] - pub mint_info: Account<'info, MintInfo>, + #[account(constraint = euro_meta.underlying_mint == underlying_asset_mint.mint_address @ PsyoptionsEuropeanError::PassedMintDoesNotMatch)] + pub underlying_asset_mint: Account<'info, MintInfo>, } #[derive(Accounts)] diff --git a/rfq/js/package.json b/rfq/js/package.json index 8bc7516b..b42d2a8f 100644 --- a/rfq/js/package.json +++ b/rfq/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/rfq", - "version": "2.2.12", + "version": "2.2.13", "license": "MIT", "publishConfig": { "access": "public", diff --git a/risk-engine/js/package.json b/risk-engine/js/package.json index ec9fcdc8..b93a97bb 100644 --- a/risk-engine/js/package.json +++ b/risk-engine/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/risk-engine", - "version": "2.2.12", + "version": "2.2.13", "license": "MIT", "publishConfig": { "access": "public", diff --git a/spot-instrument/js/package.json b/spot-instrument/js/package.json index b4be55e8..84f32a46 100644 --- a/spot-instrument/js/package.json +++ b/spot-instrument/js/package.json @@ -1,6 +1,6 @@ { "name": "@convergence-rfq/spot-instrument", - "version": "2.2.12", + "version": "2.2.13", "license": "MIT", "publishConfig": { "access": "public", diff --git a/tests/integration/psyoptionsAmerican.spec.ts b/tests/integration/psyoptionsAmerican.spec.ts index 7f014eab..8b4cf3c0 100644 --- a/tests/integration/psyoptionsAmerican.spec.ts +++ b/tests/integration/psyoptionsAmerican.spec.ts @@ -32,13 +32,13 @@ describe("Psyoptions American instrument integration tests", async () => { maker = context.maker.publicKey; }); - it("Create buy RFQ for 1 option", async () => { + it("Create buy RFQ for 1 option [CALL]", async () => { const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.maker); - await options.mintPsyOptions(context.maker, new anchor.BN(1)); + await options.mintPsyOptions(context.maker, new anchor.BN(1), OptionType.CALL); const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot( context, - ["quote", "asset", options.callMint], + ["quote", "asset", options.optionMint], [context.taker.publicKey, context.maker.publicKey] ); @@ -58,18 +58,70 @@ describe("Psyoptions American instrument integration tests", async () => { }); // Taker confirms to buy 1 option - await response.confirm({ side: QuoteSide.Ask, legMultiplierBps: toLegMultiplier(1) }); + await response.confirm({ + side: QuoteSide.Ask, + legMultiplierBps: toLegMultiplier(1), + }); + await response.prepareSettlement(AuthoritySide.Taker); + await response.prepareSettlement(AuthoritySide.Maker); + + // taker should receive 1 option, maker should receive 50$ and lose 1 bitcoin as option collateral + await response.settle(maker, [taker]); + await tokenMeasurer.expectChange([ + { token: options.optionMint, user: taker, delta: new BN(1) }, + { token: "quote", user: taker, delta: withTokenDecimals(-50) }, + { token: "quote", user: maker, delta: withTokenDecimals(50) }, + { token: "asset", user: maker, delta: withTokenDecimals(0) }, + { token: options.optionMint, user: maker, delta: new BN(-1) }, + ]); + + await response.unlockResponseCollateral(); + await response.cleanUp(); + }); + + it("Create buy RFQ for 1 option [PUT]", async () => { + const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.maker, { + optionType: OptionType.PUT, + }); + await options.mintPsyOptions(context.maker, new anchor.BN(1), OptionType.PUT); + + const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot( + context, + ["quote", "asset", options.optionMint], + [context.taker.publicKey, context.maker.publicKey] + ); + + const rfq = await context.createRfq({ + legs: [ + PsyoptionsAmericanInstrumentClass.create(context, options, OptionType.PUT, { + amount: new BN(1), + side: LegSide.Long, + }), + ], + }); + + // Response with agreeing to sell 2 options for 50$ or buy 5 for 45$ + const response = await rfq.respond({ + bid: Quote.getStandard(toAbsolutePrice(withTokenDecimals(45)), toLegMultiplier(5)), + ask: Quote.getStandard(toAbsolutePrice(withTokenDecimals(50)), toLegMultiplier(2)), + }); + + // Taker confirms to buy 1 option + await response.confirm({ + side: QuoteSide.Ask, + legMultiplierBps: toLegMultiplier(1), + }); await response.prepareSettlement(AuthoritySide.Taker); await response.prepareSettlement(AuthoritySide.Maker); // taker should receive 1 option, maker should receive 50$ and lose 1 bitcoin as option collateral await response.settle(maker, [taker]); await tokenMeasurer.expectChange([ - { token: options.callMint, user: taker, delta: new BN(1) }, + { token: options.optionMint, user: taker, delta: new BN(1) }, { token: "quote", user: taker, delta: withTokenDecimals(-50) }, { token: "quote", user: maker, delta: withTokenDecimals(50) }, { token: "asset", user: maker, delta: withTokenDecimals(0) }, - { token: options.callMint, user: maker, delta: new BN(-1) }, + { token: options.optionMint, user: maker, delta: new BN(-1) }, ]); await response.unlockResponseCollateral(); @@ -78,10 +130,10 @@ describe("Psyoptions American instrument integration tests", async () => { it("Create sell RFQ where taker wants 2 options", async () => { const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.taker); - await options.mintPsyOptions(context.taker, new anchor.BN(2)); + await options.mintPsyOptions(context.taker, new anchor.BN(2), OptionType.CALL); const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot( context, - ["asset", "quote", options.callMint], + ["asset", "quote", options.optionMint], [taker, maker] ); @@ -99,7 +151,10 @@ describe("Psyoptions American instrument integration tests", async () => { const response = await rfq.respond({ bid: Quote.getStandard(toAbsolutePrice(withTokenDecimals(45)), toLegMultiplier(2)), }); - await response.confirm({ side: QuoteSide.Bid, legMultiplierBps: toLegMultiplier(2) }); + await response.confirm({ + side: QuoteSide.Bid, + legMultiplierBps: toLegMultiplier(2), + }); // taker confirms to sell 2 options @@ -119,11 +174,11 @@ describe("Psyoptions American instrument integration tests", async () => { await response.settle(taker, [maker]); await tokenMeasurer.expectChange([ - { token: options.callMint, user: taker, delta: new BN(-2) }, + { token: options.optionMint, user: taker, delta: new BN(-2) }, { token: "quote", user: taker, delta: withTokenDecimals(90) }, { token: "quote", user: maker, delta: withTokenDecimals(-90) }, { token: "asset", user: maker, delta: withTokenDecimals(0) }, - { token: options.callMint, user: maker, delta: new BN(2) }, + { token: options.optionMint, user: maker, delta: new BN(2) }, ]); await response.unlockResponseCollateral(); @@ -133,7 +188,7 @@ describe("Psyoptions American instrument integration tests", async () => { it("Create two-way RFQ with one Psyoptions American option leg, respond but maker defaults on settlement", async () => { // Create a two way RFQ specifying 1 option put as a leg const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.taker); - await options.mintPsyOptions(context.taker, new anchor.BN(2)); + await options.mintPsyOptions(context.taker, new anchor.BN(2), OptionType.CALL); const rfq = await context.createRfq({ activeWindow: 2, @@ -154,8 +209,11 @@ describe("Psyoptions American instrument integration tests", async () => { }); // taker confirms to sell 2 options - await response.confirm({ side: QuoteSide.Bid, legMultiplierBps: toLegMultiplier(2) }); - const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot(context, [options.callMint], [taker]); + await response.confirm({ + side: QuoteSide.Bid, + legMultiplierBps: toLegMultiplier(2), + }); + const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot(context, [options.optionMint], [taker]); await response.prepareSettlement(AuthoritySide.Taker); return [response, tokenMeasurer]; @@ -164,7 +222,7 @@ describe("Psyoptions American instrument integration tests", async () => { await response.revertSettlementPreparation(AuthoritySide.Taker); // taker have returned his assets - await tokenMeasurer.expectChange([{ token: options.callMint, user: taker, delta: new BN(0) }]); + await tokenMeasurer.expectChange([{ token: options.optionMint, user: taker, delta: new BN(0) }]); await response.settleOnePartyDefault(); await response.cleanUp(); @@ -174,7 +232,7 @@ describe("Psyoptions American instrument integration tests", async () => { it("Create two-way RFQ with one Psyoptions American option leg, respond but taker defaults on settlement", async () => { // create a two way RFQ specifying 1 option put as a leg const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.taker); - await options.mintPsyOptions(context.taker, new anchor.BN(2)); + await options.mintPsyOptions(context.taker, new anchor.BN(2), OptionType.CALL); const rfq = await context.createRfq({ activeWindow: 2, settlingWindow: 1, @@ -194,7 +252,10 @@ describe("Psyoptions American instrument integration tests", async () => { }); // taker confirms to sell 2 options - await response.confirm({ side: QuoteSide.Bid, legMultiplierBps: toLegMultiplier(2) }); + await response.confirm({ + side: QuoteSide.Bid, + legMultiplierBps: toLegMultiplier(2), + }); const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot(context, ["quote"], [maker]); await response.prepareSettlement(AuthoritySide.Maker); await tokenMeasurer.expectChange([{ token: "quote", user: maker, delta: withTokenDecimals(new BN(-90)) }]); @@ -213,9 +274,13 @@ describe("Psyoptions American instrument integration tests", async () => { it("With fractional leg multiplier, rounds option amount to a bigger amount for a maker at settlement", async () => { const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.taker); - await options.mintPsyOptions(context.taker, new anchor.BN(1)); + await options.mintPsyOptions(context.taker, new anchor.BN(1), OptionType.CALL); - const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot(context, ["quote", options.callMint], [taker, maker]); + const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot( + context, + ["quote", options.optionMint], + [taker, maker] + ); const rfq = await context.createRfq({ legs: [ @@ -233,15 +298,18 @@ describe("Psyoptions American instrument integration tests", async () => { }); // Taker confirms to sell 0.4 option - await response.confirm({ side: QuoteSide.Bid, legMultiplierBps: toLegMultiplier(0.4) }); + await response.confirm({ + side: QuoteSide.Bid, + legMultiplierBps: toLegMultiplier(0.4), + }); await response.prepareSettlement(AuthoritySide.Taker); await response.prepareSettlement(AuthoritySide.Maker); // maker should receive 1 option(0.4 rounded up), taker should receive 40 * 0.4 = 16$ await response.settle(taker, [maker]); await tokenMeasurer.expectChange([ - { token: options.callMint, user: taker, delta: new BN(-1) }, - { token: options.callMint, user: maker, delta: new BN(1) }, + { token: options.optionMint, user: taker, delta: new BN(-1) }, + { token: options.optionMint, user: maker, delta: new BN(1) }, { token: "quote", user: taker, delta: withTokenDecimals(16) }, { token: "quote", user: maker, delta: withTokenDecimals(-16) }, ]); @@ -252,9 +320,13 @@ describe("Psyoptions American instrument integration tests", async () => { it("With fractional leg multiplier, rounds option amount to a lower amount for a taker at settlement", async () => { const options = await AmericanPsyoptions.initalizeNewPsyoptionsAmerican(context, context.maker); - await options.mintPsyOptions(context.maker, new anchor.BN(2)); + await options.mintPsyOptions(context.maker, new anchor.BN(2), OptionType.CALL); - const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot(context, ["quote", options.callMint], [taker, maker]); + const tokenMeasurer = await TokenChangeMeasurer.takeSnapshot( + context, + ["quote", options.optionMint], + [taker, maker] + ); const rfq = await context.createRfq({ legs: [ @@ -272,15 +344,18 @@ describe("Psyoptions American instrument integration tests", async () => { }); // Taker confirms to buy 1.4 option - await response.confirm({ side: QuoteSide.Ask, legMultiplierBps: toLegMultiplier(1.4) }); + await response.confirm({ + side: QuoteSide.Ask, + legMultiplierBps: toLegMultiplier(1.4), + }); await response.prepareSettlement(AuthoritySide.Taker); await response.prepareSettlement(AuthoritySide.Maker); // taker should receive 1 option(1.4 rounded down), maker should receive 50 * 1.4 = 70$ await response.settle(maker, [taker]); await tokenMeasurer.expectChange([ - { token: options.callMint, user: taker, delta: new BN(1) }, - { token: options.callMint, user: maker, delta: new BN(-1) }, + { token: options.optionMint, user: taker, delta: new BN(1) }, + { token: options.optionMint, user: maker, delta: new BN(-1) }, { token: "quote", user: taker, delta: withTokenDecimals(-70) }, { token: "quote", user: maker, delta: withTokenDecimals(70) }, ]); diff --git a/tests/utilities/instruments/psyoptionsAmericanInstrument.ts b/tests/utilities/instruments/psyoptionsAmericanInstrument.ts index 69c6dbd9..ba5c225c 100644 --- a/tests/utilities/instruments/psyoptionsAmericanInstrument.ts +++ b/tests/utilities/instruments/psyoptionsAmericanInstrument.ts @@ -32,8 +32,8 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { static create( context: Context, - OptionMarket: AmericanPsyoptions, - Optiontype: OptionType, + optionMarket: AmericanPsyoptions, + optionType: OptionType, { amount = DEFAULT_INSTRUMENT_AMOUNT, side = DEFAULT_INSTRUMENT_SIDE, @@ -42,11 +42,24 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { side?: LegSide; } = {} ): InstrumentController { - const instrument = new PsyoptionsAmericanInstrumentClass(context, OptionMarket, Optiontype); - OptionMarket.underlyingMint.assertRegisteredAsBaseAsset(); + const optionInfoClone: OptionMarketWithKey = Object.assign({}, optionMarket.OptionInfo); + if (optionType === OptionType.PUT) { + optionInfoClone.underlyingAmountPerContract = optionMarket.OptionInfo.quoteAmountPerContract; + optionInfoClone.quoteAmountPerContract = optionMarket.OptionInfo.underlyingAmountPerContract; + optionInfoClone.underlyingAssetMint = optionMarket.OptionInfo.quoteAssetMint; + optionInfoClone.quoteAssetMint = optionMarket.OptionInfo.underlyingAssetMint; + } + const optionMarketClone: AmericanPsyoptions = Object.assign({}, optionMarket); + optionMarketClone.OptionInfo = optionInfoClone; + const instrument = new PsyoptionsAmericanInstrumentClass(context, optionMarketClone, optionType); + optionMarketClone.underlyingMint.assertRegisteredAsBaseAsset(); return new InstrumentController( instrument as Instrument, - { amount, side: side, baseAssetIndex: OptionMarket.underlyingMint.baseAssetIndex }, + { + amount, + side: side, + baseAssetIndex: optionMarketClone.underlyingMint.baseAssetIndex, + }, 0 ); } @@ -61,7 +74,7 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { serializeInstrumentData(): Buffer { const op = this.OptionMarket.OptionInfo; - const mint = this.OptionMarket.callMint.publicKey.toBytes(); + const mint = this.OptionMarket.optionMint.publicKey.toBytes(); const optionMarket = this.OptionMarket.optionMarketKey.toBytes(); const underlyingamountPerContract = op.underlyingAmountPerContract.toBuffer("le", 8); @@ -90,9 +103,21 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { this.OptionMarket.underlyingMint.assertRegistered(); this.OptionMarket.quoteMint.assertRegistered(); return [ - { pubkey: this.OptionMarket.optionMarketKey, isSigner: false, isWritable: false }, - { pubkey: this.OptionMarket.underlyingMint.mintInfoAddress, isSigner: false, isWritable: false }, - { pubkey: this.OptionMarket.quoteMint.mintInfoAddress, isSigner: false, isWritable: false }, + { + pubkey: this.OptionMarket.optionMarketKey, + isSigner: false, + isWritable: false, + }, + { + pubkey: this.OptionMarket.underlyingMint.mintInfoAddress, + isSigner: false, + isWritable: false, + }, + { + pubkey: this.OptionMarket.quoteMint.mintInfoAddress, + isSigner: false, + isWritable: false, + }, ]; } @@ -107,11 +132,15 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { return [ { pubkey: caller.publicKey, isSigner: true, isWritable: true }, { - pubkey: await getAssociatedTokenAddress(this.OptionMarket.callMint.publicKey, caller.publicKey), + pubkey: await getAssociatedTokenAddress(this.OptionMarket.optionMint.publicKey, caller.publicKey), isSigner: false, isWritable: true, }, - { pubkey: this.OptionMarket.callMint.publicKey, isSigner: false, isWritable: false }, + { + pubkey: this.OptionMarket.optionMint.publicKey, + isSigner: false, + isWritable: false, + }, { pubkey: await getInstrumentEscrowPda(response.account, assetIndentifier, this.getProgramId()), isSigner: false, @@ -131,7 +160,7 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { isWritable: true, }, { - pubkey: await this.OptionMarket.callMint.getAssociatedAddress(assetReceiver), + pubkey: await this.OptionMarket.optionMint.getAssociatedAddress(assetReceiver), isSigner: false, isWritable: true, }, @@ -154,7 +183,7 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { isWritable: true, }, { - pubkey: await this.OptionMarket.callMint.getAssociatedAddress(caller.publicKey), + pubkey: await this.OptionMarket.optionMint.getAssociatedAddress(caller.publicKey), isSigner: false, isWritable: true, }, @@ -175,7 +204,7 @@ export class PsyoptionsAmericanInstrumentClass implements Instrument { isWritable: true, }, { - pubkey: await this.OptionMarket.callMint.getAssociatedAddress(this.context.dao.publicKey), + pubkey: await this.OptionMarket.optionMint.getAssociatedAddress(this.context.dao.publicKey), isSigner: false, isWritable: true, }, @@ -188,13 +217,11 @@ export class AmericanPsyoptions { private constructor( public context: Context, private program = AmericanPsyoptions.createProgramWithProvider(context.maker, context), - public optionMint: PublicKey, - public writerMint: PublicKey, + public optionMint: Mint, + public writerMint: Mint, public optionMarketKey: PublicKey, public underlyingMint: Mint, public quoteMint: Mint, - public callMint: Mint, - public callWriterMint: Mint, public OptionInfo: OptionMarketWithKey ) {} @@ -240,12 +267,13 @@ export class AmericanPsyoptions { underlyingMint = context.btcToken, quoteMint = context.quoteToken, underlyingAmountPerContract = withTokenDecimals(1), - quoteAmountPerContract = withTokenDecimals(100), + quoteAmountPerContract = withTokenDecimals(30), + optionType = OptionType.CALL, } = {} ) { const program = this.createProgramWithProvider(user, context); const expiration = new BN(Date.now() / 1000 + 360000); // 1 hour in the future - const psyOptMarket = await this.initializeMarket( + let psyOptMarket = await this.initializeMarket( program, expiration, quoteMint.publicKey, @@ -253,8 +281,18 @@ export class AmericanPsyoptions { underlyingAmountPerContract, underlyingMint.publicKey ); + if (optionType == OptionType.PUT) { + psyOptMarket = await this.initializeMarket( + program, + expiration, + underlyingMint.publicKey, + underlyingAmountPerContract, + quoteAmountPerContract, + quoteMint.publicKey + ); + } - const [callMint, callWriterMint] = await executeInParallel( + const [optionMint, writerMint] = await executeInParallel( () => Mint.wrap(context, psyOptMarket.optionMintKey), () => Mint.wrap(context, psyOptMarket.writerMintKey) ); @@ -267,27 +305,35 @@ export class AmericanPsyoptions { return new AmericanPsyoptions( context, program, - psyOptMarket.optionMintKey, - psyOptMarket.writerMintKey, + optionMint, + writerMint, psyOptMarket.optionMarketKey, underlyingMint, quoteMint, - callMint, - callWriterMint, market ); } - public async mintPsyOptions(mintBy: Signer, amount: anchor.BN) { + public async mintPsyOptions(mintBy: Signer, amount: anchor.BN, optionType: OptionType) { let ix = await instructions.mintOptionV2Instruction( this.program, - await this.callMint.getAssociatedAddress(mintBy.publicKey), - await this.callWriterMint.getAssociatedAddress(mintBy.publicKey), + await this.optionMint.getAssociatedAddress(mintBy.publicKey), + await this.writerMint.getAssociatedAddress(mintBy.publicKey), await this.underlyingMint.getAssociatedAddress(mintBy.publicKey), amount, this.OptionInfo ); + if (optionType == OptionType.PUT) { + ix = await instructions.mintOptionV2Instruction( + this.program, + await this.optionMint.getAssociatedAddress(mintBy.publicKey), + await this.writerMint.getAssociatedAddress(mintBy.publicKey), + await this.quoteMint.getAssociatedAddress(mintBy.publicKey), + amount, + this.OptionInfo + ); + } let tx = new anchor.web3.Transaction(); ix.signers.push(mintBy); tx.add(ix.ix); diff --git a/yarn.lock b/yarn.lock index 471b5264..c6afd7ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,12 +2,22 @@ # yarn lockfile v1 -"@babel/runtime@^7.10.5", "@babel/runtime@^7.17.2", "@babel/runtime@^7.22.3": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.6.tgz#57d64b9ae3cff1d67eb067ae117dac087f5bd438" - integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ== +"@babel/runtime@^7.10.5", "@babel/runtime@^7.17.2", "@babel/runtime@^7.22.6": + version "7.23.1" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.1.tgz#72741dc4d413338a91dcb044a86f3c0bc402646d" + integrity sha512-hC2v6p8ZSI/W0HUzh3V8C5g+NwSKzKPtJwSpTjwl0o297GP9+ZLQSkdvHz46CM3LqyoXxq+5G9komY+eSqSO0g== dependencies: - regenerator-runtime "^0.13.11" + regenerator-runtime "^0.14.0" + +"@convergence-rfq/beet-solana@=0.4.9": + version "0.4.9" + resolved "https://registry.yarnpkg.com/@convergence-rfq/beet-solana/-/beet-solana-0.4.9.tgz#c0a0b0bc98786bc4337f9b94f780bdea9651f81c" + integrity sha512-4NBLz5Xs45O7NJqLkKhS0nuIu4qOwtJ83QVz317pFzDMd9UKbD2+VRnzKu7rcsPMIxGqKKp5BrHbaiZEh94pfQ== + dependencies: + "@convergence-rfq/beet" "=0.7.8" + "@solana/web3.js" "^1.56.2" + bs58 "^5.0.0" + debug "^4.3.4" "@convergence-rfq/beet-solana@^0.4.11": version "0.4.11" @@ -19,6 +29,24 @@ bs58 "^5.0.0" debug "^4.3.4" +"@convergence-rfq/beet@=0.7.8": + version "0.7.8" + resolved "https://registry.yarnpkg.com/@convergence-rfq/beet/-/beet-0.7.8.tgz#80c21a7a9a931770c02c2034844388de2f433122" + integrity sha512-+nyeTlqzpr9PsLhzJ5aC594KFIYmQ6ucHcy/fsWp//KNhgRlA98ADl+E+zNoMnwS8owHTGYdW3P3adWpv8iOJA== + dependencies: + ansicolors "^0.3.2" + bn.js "^5.2.0" + debug "^4.3.3" + +"@convergence-rfq/beet@=0.7.9": + version "0.7.9" + resolved "https://registry.yarnpkg.com/@convergence-rfq/beet/-/beet-0.7.9.tgz#9fea925bc8323150d801251957a1066deb914927" + integrity sha512-8JPbjnuUVfQiV/9e9OHyLSucIQliMlzkg1w31EqOlk5p1G1cT5eR6dTLlAf2XJtu+2cTqxS1BPUIXBGLyJZMjQ== + dependencies: + ansicolors "^0.3.2" + bn.js "^5.2.0" + debug "^4.3.3" + "@convergence-rfq/beet@^0.7.10": version "0.7.10" resolved "https://registry.yarnpkg.com/@convergence-rfq/beet/-/beet-0.7.10.tgz#dabce4c8645333cb530ff8f09732c2e8013343a3" @@ -28,13 +56,13 @@ bn.js "^5.2.0" debug "^4.3.3" -"@convergence-rfq/solita@^0.15.10": - version "0.15.10" - resolved "https://registry.yarnpkg.com/@convergence-rfq/solita/-/solita-0.15.10.tgz#6a00ffcf9b656b7b0596cf7a6330c8875baca92f" - integrity sha512-Owy51H0uXDONeX6IEuCblKvO9Jsw6RLr7aoJwMvewGv2t4qJfjZ30NAyqYuo/r+lpbadqZXpS26zUBGVb4XaDw== +"@convergence-rfq/solita@^0.16.0": + version "0.16.0" + resolved "https://registry.yarnpkg.com/@convergence-rfq/solita/-/solita-0.16.0.tgz#db30fe6e6ec1f048368da88a34123e8775a1768e" + integrity sha512-P3HcjI+lmEy2wNgMfe6rEU8cQwceLHpbF7I5IpSF3jAG0KdDBOWHf3+AIdQOuxm2jk397nAWi2+yNQ3Mh9PlAQ== dependencies: - "@convergence-rfq/beet" "^0.7.10" - "@convergence-rfq/beet-solana" "^0.4.11" + "@convergence-rfq/beet" "=0.7.9" + "@convergence-rfq/beet-solana" "=0.4.9" "@metaplex-foundation/rustbin" "^0.3.0" "@solana/web3.js" "^1.56.2" camelcase "^6.2.1" @@ -111,9 +139,9 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@metaplex-foundation/rustbin@^0.3.0": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/rustbin/-/rustbin-0.3.1.tgz#bbcd61e8699b73c0b062728c6f5e8d52e8145042" - integrity sha512-hWd2JPrnt2/nJzkBpZD3Y6ZfCUlJujv2K7qUfsxdS0jSwLrSrOvYwmNWFw6mc3lbULj6VP4WDyuy9W5/CHU/lQ== + version "0.3.5" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/rustbin/-/rustbin-0.3.5.tgz#56d028afd96c2b56ad3bbea22ff454adde900e8c" + integrity sha512-m0wkRBEQB/8krwMwKBvFugufZtYwMXiGHud2cTDAv+aGXK4M90y0Hx67/wpu+AqqoQfdV8VM9YezUOHKD+Z5kA== dependencies: debug "^4.3.3" semver "^7.3.7" @@ -140,16 +168,16 @@ "@solana/spl-token" "^0.2.0" "@noble/curves@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" - integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== dependencies: - "@noble/hashes" "1.3.1" + "@noble/hashes" "1.3.2" -"@noble/hashes@1.3.1", "@noble/hashes@^1.3.0": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" - integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== +"@noble/hashes@1.3.2", "@noble/hashes@^1.3.1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== "@project-serum/anchor@0.25.0": version "0.25.0" @@ -297,23 +325,23 @@ buffer "^6.0.3" "@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.28.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.68.0": - version "1.78.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.0.tgz#82058f040c7706674d88db0afb8fbb2826f48bb6" - integrity sha512-CSjCjo+RELJ5puoZALfznN5EF0YvL1V8NQrQYovsdjE1lCV6SqbKAIZD0+9LlqCBoa1ibuUaR7G2SooYzvzmug== + version "1.78.5" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.5.tgz#591cd47423cdb0b5e5cb7e8dc4dc70b2abe02f80" + integrity sha512-2ZHsDNqkKdglJQrIvJ3p2DmgS3cGnary3VJyqt9C1SPrpAtLYzcElr3xyXJOznyQTU/8AMw+GoF11lFoKbicKg== dependencies: - "@babel/runtime" "^7.22.3" + "@babel/runtime" "^7.22.6" "@noble/curves" "^1.0.0" - "@noble/hashes" "^1.3.0" + "@noble/hashes" "^1.3.1" "@solana/buffer-layout" "^4.0.0" - agentkeepalive "^4.2.1" + agentkeepalive "^4.3.0" bigint-buffer "^1.1.5" - bn.js "^5.0.0" + bn.js "^5.2.1" borsh "^0.7.0" bs58 "^4.0.1" buffer "6.0.3" fast-stable-stringify "^1.0.0" jayson "^4.1.0" - node-fetch "^2.6.11" + node-fetch "^2.6.12" rpc-websockets "^7.5.1" superstruct "^0.14.2" @@ -338,14 +366,14 @@ integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== "@types/chai@^4.3.0": - version "4.3.5" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.5.tgz#ae69bcbb1bebb68c4ac0b11e9d8ed04526b3562b" - integrity sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng== + version "4.3.6" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.6.tgz#7b489e8baf393d5dd1266fb203ddd4ea941259e6" + integrity sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw== "@types/connect@^3.4.33": - version "3.4.35" - resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" - integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ== + version "3.4.36" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.36.tgz#e511558c15a39cb29bd5357eebb57bd1459cd1ab" + integrity sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w== dependencies: "@types/node" "*" @@ -360,9 +388,9 @@ integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== "@types/node@*", "@types/node@^20.4.2": - version "20.4.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.4.tgz#c79c7cc22c9d0e97a7944954c9e663bcbd92b0cb" - integrity sha512-CukZhumInROvLq3+b5gLev+vgpsIqC2D0deQr/yS1WnxvmYLlJXZpaQrQiseMY+6xusl79E04UjWoqyr+t1/Ew== + version "20.8.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.2.tgz#d76fb80d87d0d8abfe334fc6d292e83e5524efc4" + integrity sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w== "@types/node@^12.12.54": version "12.20.55" @@ -399,13 +427,11 @@ acorn@^8.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -agentkeepalive@^4.2.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.3.0.tgz#bb999ff07412653c1803b3ced35e50729830a255" - integrity sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg== +agentkeepalive@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== dependencies: - debug "^4.1.0" - depd "^2.0.0" humanize-ms "^1.2.1" ansi-colors@4.1.1: @@ -506,9 +532,9 @@ bigint-buffer@^1.1.5: bindings "^1.3.0" bignumber.js@^9.0.1, bignumber.js@^9.1.0: - version "9.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" - integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== binary-extensions@^2.0.0: version "2.2.0" @@ -527,7 +553,7 @@ bluebird@3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0: +bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -623,17 +649,17 @@ chai-bn@^0.3.1: integrity sha512-vuzEy0Cb+k8zqi2SHOmvZdRSbKcSOJfS1Nv8+6YDJIyCzfxkTCHLNRyjRIoRJ3WJtYb/c7OHjrvLoGeyO4A/gA== chai@^4.3.6: - version "4.3.7" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" - integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== + version "4.3.10" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.10.tgz#d784cec635e3b7e2ffb66446a63b4e33bd390384" + integrity sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g== dependencies: assertion-error "^1.1.0" - check-error "^1.0.2" - deep-eql "^4.1.2" - get-func-name "^2.0.0" - loupe "^2.3.1" + check-error "^1.0.3" + deep-eql "^4.1.3" + get-func-name "^2.0.2" + loupe "^2.3.6" pathval "^1.1.1" - type-detect "^4.0.5" + type-detect "^4.0.8" chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" @@ -643,10 +669,12 @@ chalk@^4.0.0, chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -check-error@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" - integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== +check-error@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" + integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== + dependencies: + get-func-name "^2.0.2" check-more-types@2.24.0: version "2.24.0" @@ -744,7 +772,7 @@ debug@4.3.3: dependencies: ms "2.1.2" -debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4: +debug@4.3.4, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -756,7 +784,7 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -deep-eql@^4.1.2: +deep-eql@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== @@ -773,11 +801,6 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -depd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - diff@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" @@ -928,9 +951,9 @@ flat@^5.0.2: integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== follow-redirects@^1.14.9: - version "1.15.2" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" - integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + version "1.15.3" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" + integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== form-data@^4.0.0: version "4.0.0" @@ -952,19 +975,19 @@ fs.realpath@^1.0.0: integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== +get-func-name@^2.0.0, get-func-name@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" + integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== get-stream@^6.0.0: version "6.0.1" @@ -1129,9 +1152,9 @@ jayson@^4.1.0: ws "^7.4.5" joi@^17.7.0: - version "17.9.2" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.9.2.tgz#8b2e4724188369f55451aebd1d0b1d9482470690" - integrity sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw== + version "17.10.2" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.10.2.tgz#4ecc348aa89ede0b48335aad172e0f5591e55b29" + integrity sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA== dependencies: "@hapi/hoek" "^9.0.0" "@hapi/topo" "^5.0.0" @@ -1198,7 +1221,7 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -loupe@^2.3.1: +loupe@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== @@ -1220,9 +1243,9 @@ lru-cache@^6.0.0: yallist "^4.0.0" "lru-cache@^9.1.1 || ^10.0.0": - version "10.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.0.tgz#b9e2a6a72a129d81ab317202d93c7691df727e61" - integrity sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw== + version "10.0.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a" + integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g== lunr@^2.3.9: version "2.3.9" @@ -1305,9 +1328,9 @@ minipass@^4.2.4: integrity sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ== "minipass@^5.0.0 || ^6.0.2 || ^7.0.0": - version "7.0.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.2.tgz#58a82b7d81c7010da5bd4b2c0c85ac4b4ec5131e" - integrity sha512-eL79dXrE1q9dBbDCLg7xfn/vl7MS4F1gvJAgjJrQli/jbQWdUttuVawphqpffoIYfRdq78LHx6GP4bU/EQ2ATA== + version "7.0.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" + integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== mkdirp@^0.5.1: version "0.5.6" @@ -1369,17 +1392,17 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" -node-fetch@^2.6.11, node-fetch@^2.6.12: - version "2.6.12" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba" - integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== +node-fetch@^2.6.12: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" node-gyp-build@^4.3.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055" - integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ== + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" @@ -1492,10 +1515,10 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" -regenerator-runtime@^0.13.11: - version "0.13.11" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" - integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== require-directory@^2.1.1: version "2.1.1" @@ -1510,9 +1533,9 @@ rimraf@^4.1.2: glob "^9.2.0" rpc-websockets@^7.5.1: - version "7.5.1" - resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.5.1.tgz#e0a05d525a97e7efc31a0617f093a13a2e10c401" - integrity sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w== + version "7.6.0" + resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.6.0.tgz#d3f4c0dac108ca35566b0e31552c32e58928cd04" + integrity sha512-Jgcs8q6t8Go98dEulww1x7RysgTkzpCMelVxZW4hvuyFtOGpeUz9prpr2KjUa/usqxgFCd9Tu3+yhHEP9GVmiQ== dependencies: "@babel/runtime" "^7.17.2" eventemitter3 "^4.0.7" @@ -1776,11 +1799,11 @@ tsconfig-paths@^3.5.0: strip-bom "^3.0.0" tslib@^2.0.3, tslib@^2.1.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410" - integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig== + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== -type-detect@^4.0.0, type-detect@^4.0.5: +type-detect@^4.0.0, type-detect@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== @@ -1884,9 +1907,9 @@ ws@^7.4.5: integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== ws@^8.5.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + version "8.14.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" + integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== y18n@^5.0.5: version "5.0.8"