-
Notifications
You must be signed in to change notification settings - Fork 2
Transfer position events #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matepal00
wants to merge
9
commits into
master
Choose a base branch
from
transfer-position-events
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ac90e75
repaired testnet
matepal00 9ffbed2
bump
matepal00 ef7b86c
add checking for owner
matepal00 36ce75a
requested changes
matepal00 5b9b0fc
requested changes v2
matepal00 7f69267
bump
matepal00 89210c8
Merge remote-tracking branch 'origin' into transfer-position-events
matepal00 d08afb9
prepare for mainnet
matepal00 b109863
Merge branch 'master' of github.com:invariant-labs/leaderboard into t…
Sniezka1927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| version https://git-lfs.github.com/spec/v1 | ||
| oid sha256:0c07489fcf6d2101ceb6eb338ae88926299eeb176842bf12a8d951bdcc43eb4c | ||
| size 2114 | ||
| {"6Wpj1RUs1hBwKuAzfFPGeHtgiQp5Fx4PVkDwfgzkLYCu":{"active":[{"event":{"owner":"6Wpj1RUs1hBwKuAzfFPGeHtgiQp5Fx4PVkDwfgzkLYCu","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"03","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"679763d2","secondsPerLiquidityInsideInitial":"7f15f9f605b6dfd5e3"},"points":"0719f11100"},{"event":{"owner":"6Wpj1RUs1hBwKuAzfFPGeHtgiQp5Fx4PVkDwfgzkLYCu","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"02","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"67976352","secondsPerLiquidityInsideInitial":"7f043fd87a20ad019f"},"points":"07676d7e00"},{"event":{"owner":"6Wpj1RUs1hBwKuAzfFPGeHtgiQp5Fx4PVkDwfgzkLYCu","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"01","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"679762e5","secondsPerLiquidityInsideInitial":"7ef523872230f5cbd3"},"points":"07a8fe2900"}],"closed":[]},"FA62Nzqaz2EEBFLdYK7QYCxqz8dgNCzPnHJmfb9zQNmR":{"active":[{"event":{"owner":"FA62Nzqaz2EEBFLdYK7QYCxqz8dgNCzPnHJmfb9zQNmR","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"00","liquidity":"5af36b8e8185","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"6793d965","secondsPerLiquidityInsideInitial":"014bd01608959f3a2c"},"points":"085a3e7456c100"}],"closed":[]},"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV":{"active":[],"closed":[{"events":[{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"03","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"679763cc","secondsPerLiquidityInsideInitial":"7f152570637267b26a"},{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"03","liquidity":"174876e800","upperTick":221790,"currentTick":0,"lowerTick":-221790,"upperTickSecondsPerLiquidityOutside":"00","lowerTickSecondsPerLiquidityOutside":"00","poolSecondsPerLiquidityGlobal":"7f152570637267b26a","currentTimestamp":"679763d2"}],"points":"00"},{"events":[{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"02","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"6797634c","secondsPerLiquidityInsideInitial":"7f036b1c8c07ac37e1"},{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"02","liquidity":"174876e800","upperTick":221790,"currentTick":0,"lowerTick":-221790,"upperTickSecondsPerLiquidityOutside":"00","lowerTickSecondsPerLiquidityOutside":"00","poolSecondsPerLiquidityGlobal":"7f036b1c8c07ac37e1","currentTimestamp":"67976352"}],"points":"00"},{"events":[{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"01","liquidity":"174876e800","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"679762c2","secondsPerLiquidityInsideInitial":"7ef04956d8f1f0f921"},{"owner":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"01","liquidity":"174876e800","upperTick":221790,"currentTick":0,"lowerTick":-221790,"upperTickSecondsPerLiquidityOutside":"00","lowerTickSecondsPerLiquidityOutside":"00","poolSecondsPerLiquidityGlobal":"7ef04956d8f1f0f921","currentTimestamp":"679762e5"}],"points":"00"}]},"3ZB2UBvE4QUTKNexk55TW4UwE85WNaVdmjqTenuGADV1":{"active":[],"closed":[{"events":[{"owner":"3ZB2UBvE4QUTKNexk55TW4UwE85WNaVdmjqTenuGADV1","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"00","liquidity":"5af36b8e8185","lowerTick":-221790,"upperTick":221790,"currentTimestamp":"6793d00e","secondsPerLiquidityInsideInitial":"00"},{"owner":"3ZB2UBvE4QUTKNexk55TW4UwE85WNaVdmjqTenuGADV1","pool":"3aK4ibSQamqLnB2yvCYLh1DjVDqYKBLyhT8vVs5u8cdo","id":"00","liquidity":"5af36b8e8185","upperTick":221790,"currentTick":0,"lowerTick":-221790,"upperTickSecondsPerLiquidityOutside":"00","lowerTickSecondsPerLiquidityOutside":"00","poolSecondsPerLiquidityGlobal":"00","currentTimestamp":"6793d965"}],"points":"00"}]}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| [{"address":"Fp93x7oYTZftGN8jUPv9qE1dVPEASH33P33ew19JedDV","points":"04a7ef7558","last24hPoints":"04a7ef7558","lpPoints":"00","swapPoints":"04a7ef7558","last24hLpPoints":"00","last24hSwapPoints":"04a7ef7558","positions":0,"swaps":2,"rank":1}] | ||
| {} |
Git LFS file not shown
Binary file not shown.
Binary file not shown.
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { AnchorProvider } from "@coral-xyz/anchor"; | ||
| import { bs58 } from "@coral-xyz/anchor/dist/cjs/utils/bytes"; | ||
| import { IWallet, Market, Network } from "@invariant-labs/sdk-eclipse"; | ||
| import { TransferPositionOwnership } from "@invariant-labs/sdk-eclipse/lib/market"; | ||
| import { Keypair } from "@solana/web3.js"; | ||
|
|
||
| require("dotenv").config(); | ||
|
|
||
| const provider = AnchorProvider.local( | ||
| "https://testnet.dev2.eclipsenetwork.xyz" | ||
| ); | ||
| const connection = provider.connection; | ||
|
|
||
| const POSITION_OWNER = Keypair.fromSecretKey( | ||
| bs58.decode(process.env.OWNER_PRIVATE_KEY as string) | ||
| ); | ||
| const TARGET = Keypair.fromSecretKey( | ||
| bs58.decode(process.env.TARGET_PRIVATE_KEY as string) | ||
| ); | ||
|
|
||
| const main = async () => { | ||
| const market = Market.build( | ||
| Network.TEST, | ||
| provider.wallet as IWallet, | ||
| connection | ||
| ); | ||
| const positions = await market.getAllUserPositionsWithIds( | ||
| POSITION_OWNER.publicKey | ||
| ); | ||
| console.log(positions[positions.length - 1][1]); | ||
|
|
||
| const transferPositionOwnership: TransferPositionOwnership = { | ||
| owner: POSITION_OWNER.publicKey, | ||
| recipient: TARGET.publicKey, | ||
| index: positions.length - 1, | ||
| }; | ||
| await market.transferPositionOwnership( | ||
| transferPositionOwnership, | ||
| POSITION_OWNER | ||
| ); | ||
| }; | ||
|
|
||
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.