punkkit-sdk 1.0.23 → 1.0.24
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/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +28 -0
- package/dist/index.mjs +28 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,20 @@ interface ModifyPositionParams {
|
|
|
131
131
|
|
|
132
132
|
declare function addLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint | number, amount1: bigint | number, poolKey: PoolKey): Promise<ethers.providers.TransactionReceipt>;
|
|
133
133
|
|
|
134
|
+
interface UserPosition {
|
|
135
|
+
tokenId: number;
|
|
136
|
+
tickLower: number;
|
|
137
|
+
tickUpper: number;
|
|
138
|
+
liquidity: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Fetch all liquidity positions for a specific user from the LiquidPool contract.
|
|
142
|
+
* @param wallet The user's wallet or signer instance.
|
|
143
|
+
* @param userAddress Addres of the user to fetch positions for. If not provided, it uses the wallet's address.
|
|
144
|
+
* @returns An array of UserPosition objects containing the position details.
|
|
145
|
+
*/
|
|
146
|
+
declare function getUserPositions(wallet: Wallet, userAddress?: string): Promise<UserPosition[]>;
|
|
147
|
+
|
|
134
148
|
declare function getContract(wallet: Wallet, name: string): Promise<Contract>;
|
|
135
149
|
|
|
136
150
|
declare function modifyPosition(contract: Contract, modifyPositionParams: ModifyPositionParams, hookData: string): Promise<any>;
|
|
@@ -190,4 +204,4 @@ declare function balanceOf(contractAddress: string, provider: SignerOrProvider,
|
|
|
190
204
|
declare function getAllVouchers(contractAddress: string, provider: SignerOrProvider): Promise<string[]>;
|
|
191
205
|
declare function BuildUseVoucherTx(tx: providers.TransactionRequest, voucherName: string): providers.TransactionRequest;
|
|
192
206
|
|
|
193
|
-
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
|
207
|
+
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,20 @@ interface ModifyPositionParams {
|
|
|
131
131
|
|
|
132
132
|
declare function addLiq(wallet: Wallet, priceLower: number, priceUpper: number, amount0: bigint | number, amount1: bigint | number, poolKey: PoolKey): Promise<ethers.providers.TransactionReceipt>;
|
|
133
133
|
|
|
134
|
+
interface UserPosition {
|
|
135
|
+
tokenId: number;
|
|
136
|
+
tickLower: number;
|
|
137
|
+
tickUpper: number;
|
|
138
|
+
liquidity: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Fetch all liquidity positions for a specific user from the LiquidPool contract.
|
|
142
|
+
* @param wallet The user's wallet or signer instance.
|
|
143
|
+
* @param userAddress Addres of the user to fetch positions for. If not provided, it uses the wallet's address.
|
|
144
|
+
* @returns An array of UserPosition objects containing the position details.
|
|
145
|
+
*/
|
|
146
|
+
declare function getUserPositions(wallet: Wallet, userAddress?: string): Promise<UserPosition[]>;
|
|
147
|
+
|
|
134
148
|
declare function getContract(wallet: Wallet, name: string): Promise<Contract>;
|
|
135
149
|
|
|
136
150
|
declare function modifyPosition(contract: Contract, modifyPositionParams: ModifyPositionParams, hookData: string): Promise<any>;
|
|
@@ -190,4 +204,4 @@ declare function balanceOf(contractAddress: string, provider: SignerOrProvider,
|
|
|
190
204
|
declare function getAllVouchers(contractAddress: string, provider: SignerOrProvider): Promise<string[]>;
|
|
191
205
|
declare function BuildUseVoucherTx(tx: providers.TransactionRequest, voucherName: string): providers.TransactionRequest;
|
|
192
206
|
|
|
193
|
-
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
|
207
|
+
export { BuildUseVoucherTx, type ChallengeMatchResultParams, type CreateAuctionConfigParams, type CreateAuctionParams, type ModifyPositionParams, type PlaceBidParams, type PoolKey, type RevealBidParams, type RevealLockParams, type SetUnlockStrategyParams, type SignerOrProvider, type SubmitMatchResultsParams, type SwapParams, type UnlockTokensParams, type UserPosition, type WithdrawMatchResultParams, addLiq, amount0, amount1, balanceOf, buyVoucher, buyVoucherWithEth, calculateLiqDelta, calculatePriceFromTick, calculateTickFromPrice, calculateTickFromPriceWithSpacing, createAuction$1 as createAuction, createAuctionConfig, createAuction as createAuctionOnVault, createVoucher, getActiveAuctionsCount, getAllVouchers, getAuctionContract, getAuctionInfo, getAuctionLockInfo, getContract, getCurrentTick, getLiquidity, getLockInfo, getMatchResult, getPoolId, getPoolPrice, getPoolSqrtPrice, getProvider, getSqrtPriceAtTick, getUserPositions, getVoucherContract, getVoucherInfo, liquidity0, liquidity1, main, modifyPosition, mutiVoucherABI, placeBid, priceToSqrtPrice, revealBid, revealLock, submitMatchResults, swap, toWei, unlockTokens, useVoucher, withdrawMatchResult };
|
package/dist/index.js
CHANGED
|
@@ -36237,6 +36237,7 @@ __export(index_exports, {
|
|
|
36237
36237
|
getPoolSqrtPrice: () => getPoolSqrtPrice,
|
|
36238
36238
|
getProvider: () => getProvider,
|
|
36239
36239
|
getSqrtPriceAtTick: () => getSqrtPriceAtTick,
|
|
36240
|
+
getUserPositions: () => getUserPositions,
|
|
36240
36241
|
getVoucherContract: () => getVoucherContract,
|
|
36241
36242
|
getVoucherInfo: () => getVoucherInfo,
|
|
36242
36243
|
liquidity0: () => liquidity0,
|
|
@@ -38647,6 +38648,32 @@ if (typeof require !== "undefined" && typeof module !== "undefined" && require.m
|
|
|
38647
38648
|
});
|
|
38648
38649
|
}
|
|
38649
38650
|
|
|
38651
|
+
// src/uniswap/1-marketprice/getPositions.ts
|
|
38652
|
+
init_contract();
|
|
38653
|
+
async function getUserPositions(wallet2, userAddress) {
|
|
38654
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38655
|
+
const targetAddress = userAddress || await wallet2.getAddress();
|
|
38656
|
+
console.log(`[SDK] Fetching liquidity NFT positions for address: ${targetAddress}`);
|
|
38657
|
+
try {
|
|
38658
|
+
const positions = await liqPool.getPosition(targetAddress);
|
|
38659
|
+
const formattedPositions = positions.map((pos) => {
|
|
38660
|
+
return {
|
|
38661
|
+
tokenId: pos.tokenId.toNumber(),
|
|
38662
|
+
// tick is int24, so it should fit standard JS number
|
|
38663
|
+
tickLower: pos.tickLower,
|
|
38664
|
+
tickUpper: pos.tickUpper,
|
|
38665
|
+
// liquidity is int256, keep as string to prevent JS precision loss
|
|
38666
|
+
liquidity: pos.liquidity.toString()
|
|
38667
|
+
};
|
|
38668
|
+
});
|
|
38669
|
+
console.log(`[SDK] Found ${formattedPositions.length} position(s).`);
|
|
38670
|
+
return formattedPositions;
|
|
38671
|
+
} catch (error) {
|
|
38672
|
+
console.error(`[SDK] Failed to fetch user positions: `, error);
|
|
38673
|
+
throw error;
|
|
38674
|
+
}
|
|
38675
|
+
}
|
|
38676
|
+
|
|
38650
38677
|
// src/uniswap/3-dynamicfee/dynamicfee.ts
|
|
38651
38678
|
init_lib49();
|
|
38652
38679
|
var provider = new ethers_exports.providers.JsonRpcProvider("http://localhost:8545");
|
|
@@ -39076,6 +39103,7 @@ function BuildUseVoucherTx(tx, voucherName) {
|
|
|
39076
39103
|
getPoolSqrtPrice,
|
|
39077
39104
|
getProvider,
|
|
39078
39105
|
getSqrtPriceAtTick,
|
|
39106
|
+
getUserPositions,
|
|
39079
39107
|
getVoucherContract,
|
|
39080
39108
|
getVoucherInfo,
|
|
39081
39109
|
liquidity0,
|
package/dist/index.mjs
CHANGED
|
@@ -36241,6 +36241,7 @@ __export(index_exports, {
|
|
|
36241
36241
|
getPoolSqrtPrice: () => getPoolSqrtPrice,
|
|
36242
36242
|
getProvider: () => getProvider,
|
|
36243
36243
|
getSqrtPriceAtTick: () => getSqrtPriceAtTick,
|
|
36244
|
+
getUserPositions: () => getUserPositions,
|
|
36244
36245
|
getVoucherContract: () => getVoucherContract,
|
|
36245
36246
|
getVoucherInfo: () => getVoucherInfo,
|
|
36246
36247
|
liquidity0: () => liquidity0,
|
|
@@ -38650,6 +38651,32 @@ if (typeof __require !== "undefined" && typeof module !== "undefined" && __requi
|
|
|
38650
38651
|
});
|
|
38651
38652
|
}
|
|
38652
38653
|
|
|
38654
|
+
// src/uniswap/1-marketprice/getPositions.ts
|
|
38655
|
+
init_contract();
|
|
38656
|
+
async function getUserPositions(wallet2, userAddress) {
|
|
38657
|
+
const liqPool = await getContract(wallet2, "LiquidPool");
|
|
38658
|
+
const targetAddress = userAddress || await wallet2.getAddress();
|
|
38659
|
+
console.log(`[SDK] Fetching liquidity NFT positions for address: ${targetAddress}`);
|
|
38660
|
+
try {
|
|
38661
|
+
const positions = await liqPool.getPosition(targetAddress);
|
|
38662
|
+
const formattedPositions = positions.map((pos) => {
|
|
38663
|
+
return {
|
|
38664
|
+
tokenId: pos.tokenId.toNumber(),
|
|
38665
|
+
// tick is int24, so it should fit standard JS number
|
|
38666
|
+
tickLower: pos.tickLower,
|
|
38667
|
+
tickUpper: pos.tickUpper,
|
|
38668
|
+
// liquidity is int256, keep as string to prevent JS precision loss
|
|
38669
|
+
liquidity: pos.liquidity.toString()
|
|
38670
|
+
};
|
|
38671
|
+
});
|
|
38672
|
+
console.log(`[SDK] Found ${formattedPositions.length} position(s).`);
|
|
38673
|
+
return formattedPositions;
|
|
38674
|
+
} catch (error) {
|
|
38675
|
+
console.error(`[SDK] Failed to fetch user positions: `, error);
|
|
38676
|
+
throw error;
|
|
38677
|
+
}
|
|
38678
|
+
}
|
|
38679
|
+
|
|
38653
38680
|
// src/uniswap/3-dynamicfee/dynamicfee.ts
|
|
38654
38681
|
init_lib49();
|
|
38655
38682
|
var provider = new ethers_exports.providers.JsonRpcProvider("http://localhost:8545");
|
|
@@ -39078,6 +39105,7 @@ export {
|
|
|
39078
39105
|
getPoolSqrtPrice,
|
|
39079
39106
|
getProvider,
|
|
39080
39107
|
getSqrtPriceAtTick,
|
|
39108
|
+
getUserPositions,
|
|
39081
39109
|
getVoucherContract,
|
|
39082
39110
|
getVoucherInfo,
|
|
39083
39111
|
liquidity0,
|