@whetstone-research/doppler-sdk 1.0.18 → 1.0.20
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-BESE77DM.js +3840 -0
- package/dist/chunk-BESE77DM.js.map +1 -0
- package/dist/chunk-KJ6W44WF.cjs +4089 -0
- package/dist/chunk-KJ6W44WF.cjs.map +1 -0
- package/dist/{chunk-AKLS6T3R.cjs → chunk-Y6TJIH33.cjs} +36 -24
- package/dist/chunk-Y6TJIH33.cjs.map +1 -0
- package/dist/{chunk-6TOPYGOG.js → chunk-ZUJKBFXW.js} +35 -24
- package/dist/chunk-ZUJKBFXW.js.map +1 -0
- package/dist/{oracle-7PmpwwPx.d.ts → oracle-D1wPWydZ.d.cts} +1 -33
- package/dist/{oracle-7PmpwwPx.d.cts → oracle-D1wPWydZ.d.ts} +1 -33
- package/dist/{pda-PZRHQJMK.cjs → pda-A4PIAS5Y.cjs} +20 -16
- package/dist/pda-A4PIAS5Y.cjs.map +1 -0
- package/dist/{pda-N6ULJYLG.js → pda-JVAD45XJ.js} +3 -3
- package/dist/pda-JVAD45XJ.js.map +1 -0
- package/dist/solana/index.cjs +391 -3247
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +176 -207
- package/dist/solana/index.d.ts +176 -207
- package/dist/solana/index.js +67 -2923
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +53 -85
- package/dist/solana/react/index.cjs.map +1 -1
- package/dist/solana/react/index.d.cts +7 -1
- package/dist/solana/react/index.d.ts +7 -1
- package/dist/solana/react/index.js +15 -47
- package/dist/solana/react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6TOPYGOG.js.map +0 -1
- package/dist/chunk-AKLS6T3R.cjs.map +0 -1
- package/dist/chunk-C2D7CIXP.js +0 -977
- package/dist/chunk-C2D7CIXP.js.map +0 -1
- package/dist/chunk-GUGN3EYX.cjs +0 -1069
- package/dist/chunk-GUGN3EYX.cjs.map +0 -1
- package/dist/pda-N6ULJYLG.js.map +0 -1
- package/dist/pda-PZRHQJMK.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
import { Rpc, SolanaRpcApi, Address, TransactionSigner } from '@solana/kit';
|
|
5
5
|
import { WalletAccount, Wallet } from '@wallet-standard/base';
|
|
6
6
|
import { StandardConnectFeature, StandardDisconnectFeature } from '@wallet-standard/features';
|
|
7
|
-
import { P as Pool,
|
|
7
|
+
import { P as Pool, l as SwapQuote, k as TradeDirection, n as AddLiquidityQuote, o as RemoveLiquidityQuote, a as Position, Q as PositionValue, U as PositionWithAddress, O as OracleState, X as TwapResult, E as OracleWithAddress } from '../../oracle-D1wPWydZ.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for the AMM provider
|
|
@@ -847,6 +847,12 @@ interface CollectFeesOptions {
|
|
|
847
847
|
max0?: bigint;
|
|
848
848
|
/** Maximum amount of token1 to collect (default: all) */
|
|
849
849
|
max1?: bigint;
|
|
850
|
+
/** Token0 program; defaults to tokenProgram or classic SPL Token */
|
|
851
|
+
token0Program?: Address;
|
|
852
|
+
/** Token1 program; defaults to tokenProgram or classic SPL Token */
|
|
853
|
+
token1Program?: Address;
|
|
854
|
+
/** Shared SPL Token program fallback */
|
|
855
|
+
tokenProgram?: Address;
|
|
850
856
|
/** User's token0 account */
|
|
851
857
|
userToken0: Address;
|
|
852
858
|
/** User's token1 account */
|
|
@@ -4,7 +4,7 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
import { Rpc, SolanaRpcApi, Address, TransactionSigner } from '@solana/kit';
|
|
5
5
|
import { WalletAccount, Wallet } from '@wallet-standard/base';
|
|
6
6
|
import { StandardConnectFeature, StandardDisconnectFeature } from '@wallet-standard/features';
|
|
7
|
-
import { P as Pool,
|
|
7
|
+
import { P as Pool, l as SwapQuote, k as TradeDirection, n as AddLiquidityQuote, o as RemoveLiquidityQuote, a as Position, Q as PositionValue, U as PositionWithAddress, O as OracleState, X as TwapResult, E as OracleWithAddress } from '../../oracle-D1wPWydZ.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for the AMM provider
|
|
@@ -847,6 +847,12 @@ interface CollectFeesOptions {
|
|
|
847
847
|
max0?: bigint;
|
|
848
848
|
/** Maximum amount of token1 to collect (default: all) */
|
|
849
849
|
max1?: bigint;
|
|
850
|
+
/** Token0 program; defaults to tokenProgram or classic SPL Token */
|
|
851
|
+
token0Program?: Address;
|
|
852
|
+
/** Token1 program; defaults to tokenProgram or classic SPL Token */
|
|
853
|
+
token1Program?: Address;
|
|
854
|
+
/** Shared SPL Token program fallback */
|
|
855
|
+
tokenProgram?: Address;
|
|
850
856
|
/** User's token0 account */
|
|
851
857
|
userToken0: Address;
|
|
852
858
|
/** User's token1 account */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { fetchPool, getSwapQuote, getSwapQuoteExactOut, ratioToNumber, getAddLiquidityQuote, getRemoveLiquidityQuote, fetchPosition, getPendingFees, getPositionValue, fetchUserPositions, fetchOracle, consultTwap, getOracleSpotPrices, getOracleDeviation, getOracleAge, isOracleStale, getOracleBufferStats, comparePoolAndOraclePrices, getOracleForPool
|
|
2
|
-
import { CPMM_PROGRAM_ID, BPS_DENOM,
|
|
1
|
+
import { fetchPool, getSwapQuote, getSwapQuoteExactOut, ratioToNumber, getAddLiquidityQuote, getRemoveLiquidityQuote, fetchPosition, getPendingFees, getPositionValue, fetchUserPositions, getCollectFeesInstruction, fetchOracle, consultTwap, getOracleSpotPrices, getOracleDeviation, getOracleAge, isOracleStale, getOracleBufferStats, comparePoolAndOraclePrices, getOracleForPool } from '../../chunk-BESE77DM.js';
|
|
2
|
+
import { CPMM_PROGRAM_ID, BPS_DENOM, TOKEN_PROGRAM_ADDRESS, getOracleAddress } from '../../chunk-ZUJKBFXW.js';
|
|
3
3
|
import '../../chunk-PZ5AY32C.js';
|
|
4
4
|
import { createContext, useMemo, useContext, useState, useEffect, useCallback, useRef } from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
import { createSolanaRpc, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstruction, signTransactionMessageWithSigners, getBase64EncodedWireTransaction
|
|
6
|
+
import { createSolanaRpc, createTransactionMessage, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstruction, signTransactionMessageWithSigners, getBase64EncodedWireTransaction } from '@solana/kit';
|
|
7
7
|
|
|
8
8
|
var AmmContext = createContext(null);
|
|
9
9
|
function AmmProvider({
|
|
@@ -841,7 +841,7 @@ function usePosition(poolAddress, positionId = 0n, options = {}) {
|
|
|
841
841
|
setLoading(true);
|
|
842
842
|
setError(null);
|
|
843
843
|
try {
|
|
844
|
-
const { getPositionAddress } = await import('../../pda-
|
|
844
|
+
const { getPositionAddress } = await import('../../pda-JVAD45XJ.js');
|
|
845
845
|
const [posAddr] = await getPositionAddress(
|
|
846
846
|
poolAddress,
|
|
847
847
|
ownerAddress,
|
|
@@ -984,44 +984,6 @@ function useUserPositions(poolFilter, options = {}) {
|
|
|
984
984
|
refetch: fetchPositions
|
|
985
985
|
};
|
|
986
986
|
}
|
|
987
|
-
function createCollectFeesInstruction(accounts, args, programId = CPMM_PROGRAM_ID) {
|
|
988
|
-
const {
|
|
989
|
-
pool,
|
|
990
|
-
position,
|
|
991
|
-
owner,
|
|
992
|
-
authority,
|
|
993
|
-
vault0,
|
|
994
|
-
vault1,
|
|
995
|
-
token0Mint,
|
|
996
|
-
token1Mint,
|
|
997
|
-
user0,
|
|
998
|
-
user1,
|
|
999
|
-
tokenProgram = TOKEN_PROGRAM_ADDRESS
|
|
1000
|
-
} = accounts;
|
|
1001
|
-
const keys = [
|
|
1002
|
-
{ address: pool, role: AccountRole.WRITABLE },
|
|
1003
|
-
{ address: position, role: AccountRole.WRITABLE },
|
|
1004
|
-
{ address: owner, role: AccountRole.READONLY_SIGNER },
|
|
1005
|
-
{ address: authority, role: AccountRole.READONLY },
|
|
1006
|
-
{ address: vault0, role: AccountRole.WRITABLE },
|
|
1007
|
-
{ address: vault1, role: AccountRole.WRITABLE },
|
|
1008
|
-
{ address: token0Mint, role: AccountRole.READONLY },
|
|
1009
|
-
{ address: token1Mint, role: AccountRole.READONLY },
|
|
1010
|
-
{ address: user0, role: AccountRole.WRITABLE },
|
|
1011
|
-
{ address: user1, role: AccountRole.WRITABLE },
|
|
1012
|
-
{ address: tokenProgram, role: AccountRole.READONLY }
|
|
1013
|
-
];
|
|
1014
|
-
const data = encodeInstructionData(
|
|
1015
|
-
INSTRUCTION_DISCRIMINATORS.collectFees,
|
|
1016
|
-
collectFeesArgsCodec,
|
|
1017
|
-
args
|
|
1018
|
-
);
|
|
1019
|
-
return {
|
|
1020
|
-
programAddress: programId,
|
|
1021
|
-
accounts: keys,
|
|
1022
|
-
data
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
987
|
var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
|
|
1026
988
|
function useFees(positionAddress, poolAddress, options = {}) {
|
|
1027
989
|
const {
|
|
@@ -1136,24 +1098,30 @@ function useFees(positionAddress, poolAddress, options = {}) {
|
|
|
1136
1098
|
const {
|
|
1137
1099
|
max0 = MAX_FEE_AMOUNT,
|
|
1138
1100
|
max1 = MAX_FEE_AMOUNT,
|
|
1101
|
+
token0Program,
|
|
1102
|
+
token1Program,
|
|
1103
|
+
tokenProgram,
|
|
1139
1104
|
userToken0,
|
|
1140
1105
|
userToken1
|
|
1141
1106
|
} = collectOptions;
|
|
1142
|
-
const ix =
|
|
1107
|
+
const ix = getCollectFeesInstruction(
|
|
1143
1108
|
{
|
|
1144
1109
|
pool: poolAddress,
|
|
1145
1110
|
position: positionAddress,
|
|
1146
|
-
owner: wallet.
|
|
1111
|
+
owner: wallet.signer,
|
|
1147
1112
|
authority: pool.authority,
|
|
1148
1113
|
vault0: pool.vault0,
|
|
1149
1114
|
vault1: pool.vault1,
|
|
1150
1115
|
token0Mint: pool.token0Mint,
|
|
1151
1116
|
token1Mint: pool.token1Mint,
|
|
1152
1117
|
user0: userToken0,
|
|
1153
|
-
user1: userToken1
|
|
1118
|
+
user1: userToken1,
|
|
1119
|
+
token0Program: token0Program ?? tokenProgram ?? TOKEN_PROGRAM_ADDRESS,
|
|
1120
|
+
token1Program: token1Program ?? tokenProgram ?? TOKEN_PROGRAM_ADDRESS,
|
|
1121
|
+
max0,
|
|
1122
|
+
max1
|
|
1154
1123
|
},
|
|
1155
|
-
{
|
|
1156
|
-
programId
|
|
1124
|
+
{ programAddress: programId }
|
|
1157
1125
|
);
|
|
1158
1126
|
const { value: latestBlockhash } = await rpc.getLatestBlockhash({ commitment }).send();
|
|
1159
1127
|
const baseMessage = createTransactionMessage({ version: "legacy" });
|