pnp-sdk 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HN2SKUTC.js → chunk-SIMCEKAG.js} +194 -61
- package/dist/chunk-SIMCEKAG.js.map +1 -0
- package/dist/cli.cjs +193 -60
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +193 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-HN2SKUTC.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -960,6 +960,56 @@ declare class PNPClient {
|
|
|
960
960
|
publicKey: PublicKey;
|
|
961
961
|
account: GlobalConfigType;
|
|
962
962
|
}>;
|
|
963
|
+
/**
|
|
964
|
+
* Get V2 AMM market price data including prices and multipliers
|
|
965
|
+
*
|
|
966
|
+
* ✅ READ-ONLY - No signer required! Works with just an RPC connection.
|
|
967
|
+
*
|
|
968
|
+
* This function fetches on-chain market data and calculates:
|
|
969
|
+
* - YES/NO token prices using the V2 AMM formula
|
|
970
|
+
* - Multipliers (potential payout ratios)
|
|
971
|
+
*
|
|
972
|
+
* Formulas:
|
|
973
|
+
* - YES Price: (marketReserves × yesTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
974
|
+
* - NO Price: (marketReserves × noTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
975
|
+
* - YES Multiplier: 1 + (noTokenSupply / yesTokenSupply)²
|
|
976
|
+
* - NO Multiplier: 1 + (yesTokenSupply / noTokenSupply)²
|
|
977
|
+
*
|
|
978
|
+
* @param market - Market public key or address string
|
|
979
|
+
* @returns V2 market price data with prices, multipliers, and supplies
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* // Works without a signer!
|
|
984
|
+
* const client = new PNPClient("https://api.devnet.solana.com");
|
|
985
|
+
* const priceData = await client.getMarketPriceV2("3LsfeB3RhQKJc2eHdEcb9XQzkF6eP9BFa6HTD6vvug9j");
|
|
986
|
+
* console.log(`YES Price: ${priceData.yesPrice}`);
|
|
987
|
+
* console.log(`NO Price: ${priceData.noPrice}`);
|
|
988
|
+
* console.log(`YES Multiplier: ${priceData.yesMultiplier}x`);
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
getMarketPriceV2(market: PublicKey | string): Promise<{
|
|
992
|
+
/** Market reserves (collateral) in UI units */
|
|
993
|
+
marketReserves: number;
|
|
994
|
+
/** YES tokens minted in UI units */
|
|
995
|
+
yesTokenSupply: number;
|
|
996
|
+
/** NO tokens minted in UI units */
|
|
997
|
+
noTokenSupply: number;
|
|
998
|
+
/** YES token price (0-1) */
|
|
999
|
+
yesPrice: number;
|
|
1000
|
+
/** NO token price (0-1) */
|
|
1001
|
+
noPrice: number;
|
|
1002
|
+
/** YES multiplier (potential payout ratio) */
|
|
1003
|
+
yesMultiplier: number;
|
|
1004
|
+
/** NO multiplier (potential payout ratio) */
|
|
1005
|
+
noMultiplier: number;
|
|
1006
|
+
/** Raw market reserves in base units */
|
|
1007
|
+
marketReservesRaw: bigint;
|
|
1008
|
+
/** Raw YES tokens in base units */
|
|
1009
|
+
yesTokenSupplyRaw: bigint;
|
|
1010
|
+
/** Raw NO tokens in base units */
|
|
1011
|
+
noTokenSupplyRaw: bigint;
|
|
1012
|
+
}>;
|
|
963
1013
|
/**
|
|
964
1014
|
* Set market resolvable status (V2 markets)
|
|
965
1015
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -960,6 +960,56 @@ declare class PNPClient {
|
|
|
960
960
|
publicKey: PublicKey;
|
|
961
961
|
account: GlobalConfigType;
|
|
962
962
|
}>;
|
|
963
|
+
/**
|
|
964
|
+
* Get V2 AMM market price data including prices and multipliers
|
|
965
|
+
*
|
|
966
|
+
* ✅ READ-ONLY - No signer required! Works with just an RPC connection.
|
|
967
|
+
*
|
|
968
|
+
* This function fetches on-chain market data and calculates:
|
|
969
|
+
* - YES/NO token prices using the V2 AMM formula
|
|
970
|
+
* - Multipliers (potential payout ratios)
|
|
971
|
+
*
|
|
972
|
+
* Formulas:
|
|
973
|
+
* - YES Price: (marketReserves × yesTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
974
|
+
* - NO Price: (marketReserves × noTokenSupply) / (yesTokenSupply² + noTokenSupply²)
|
|
975
|
+
* - YES Multiplier: 1 + (noTokenSupply / yesTokenSupply)²
|
|
976
|
+
* - NO Multiplier: 1 + (yesTokenSupply / noTokenSupply)²
|
|
977
|
+
*
|
|
978
|
+
* @param market - Market public key or address string
|
|
979
|
+
* @returns V2 market price data with prices, multipliers, and supplies
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* // Works without a signer!
|
|
984
|
+
* const client = new PNPClient("https://api.devnet.solana.com");
|
|
985
|
+
* const priceData = await client.getMarketPriceV2("3LsfeB3RhQKJc2eHdEcb9XQzkF6eP9BFa6HTD6vvug9j");
|
|
986
|
+
* console.log(`YES Price: ${priceData.yesPrice}`);
|
|
987
|
+
* console.log(`NO Price: ${priceData.noPrice}`);
|
|
988
|
+
* console.log(`YES Multiplier: ${priceData.yesMultiplier}x`);
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
getMarketPriceV2(market: PublicKey | string): Promise<{
|
|
992
|
+
/** Market reserves (collateral) in UI units */
|
|
993
|
+
marketReserves: number;
|
|
994
|
+
/** YES tokens minted in UI units */
|
|
995
|
+
yesTokenSupply: number;
|
|
996
|
+
/** NO tokens minted in UI units */
|
|
997
|
+
noTokenSupply: number;
|
|
998
|
+
/** YES token price (0-1) */
|
|
999
|
+
yesPrice: number;
|
|
1000
|
+
/** NO token price (0-1) */
|
|
1001
|
+
noPrice: number;
|
|
1002
|
+
/** YES multiplier (potential payout ratio) */
|
|
1003
|
+
yesMultiplier: number;
|
|
1004
|
+
/** NO multiplier (potential payout ratio) */
|
|
1005
|
+
noMultiplier: number;
|
|
1006
|
+
/** Raw market reserves in base units */
|
|
1007
|
+
marketReservesRaw: bigint;
|
|
1008
|
+
/** Raw YES tokens in base units */
|
|
1009
|
+
yesTokenSupplyRaw: bigint;
|
|
1010
|
+
/** Raw NO tokens in base units */
|
|
1011
|
+
noTokenSupplyRaw: bigint;
|
|
1012
|
+
}>;
|
|
963
1013
|
/**
|
|
964
1014
|
* Set market resolvable status (V2 markets)
|
|
965
1015
|
*
|
package/dist/index.js
CHANGED