@crypticdot/defituna-core 3.2.6 → 3.3.0
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/browser/defituna_core_js_bindings.d.ts +207 -20
- package/dist/browser/defituna_core_js_bindings_bg.js +1347 -54
- package/dist/browser/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/defituna_core_js_bindings_bg.wasm.d.ts +60 -3
- package/dist/nodejs/defituna_core_js_bindings.d.ts +207 -20
- package/dist/nodejs/defituna_core_js_bindings.js +1363 -54
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/defituna_core_js_bindings_bg.wasm.d.ts +60 -3
- package/package.json +2 -2
|
@@ -631,7 +631,6 @@ export function swapQuoteByInputToken(token_in: bigint, specified_token_a: boole
|
|
|
631
631
|
* The exact input or output amount for the swap transaction.
|
|
632
632
|
*/
|
|
633
633
|
export function swapQuoteByOutputToken(token_out: bigint, specified_token_a: boolean, slippage_tolerance_bps: number, fusion_pool: FusionPoolFacade, tick_arrays: TickArrayFacade[], transfer_fee_a?: TransferFee | null, transfer_fee_b?: TransferFee | null): ExactOutSwapQuote;
|
|
634
|
-
export function _INVALID_ARGUMENTS(): string;
|
|
635
634
|
/**
|
|
636
635
|
* Spot position increase quote
|
|
637
636
|
*
|
|
@@ -643,13 +642,15 @@ export function _INVALID_ARGUMENTS(): string;
|
|
|
643
642
|
* - `slippage_tolerance_bps`: An optional slippage tolerance in basis points. Defaults to the global slippage tolerance if not provided.
|
|
644
643
|
* - `protocol_fee_rate`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
645
644
|
* - `protocol_fee_rate_on_collateral`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
645
|
+
* - `mint_a`: Token A mint address
|
|
646
|
+
* - `mint_b`: Token B mint address
|
|
646
647
|
* - `fusion_pool`: Fusion pool.
|
|
647
|
-
* - `tick_arrays`:
|
|
648
|
+
* - `tick_arrays`: Optional five tick arrays around the current pool price. If not provided, the quote will be calculated using the Jupiter Aggregator.
|
|
648
649
|
*
|
|
649
650
|
* # Returns
|
|
650
651
|
* - `IncreaseSpotPositionQuoteResult`: quote result
|
|
651
652
|
*/
|
|
652
|
-
export function getIncreaseSpotPositionQuote(increase_amount: bigint, collateral_token: number, position_token: number, leverage: number, slippage_tolerance_bps: number | null | undefined, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, fusion_pool: FusionPoolFacade, tick_arrays
|
|
653
|
+
export function getIncreaseSpotPositionQuote(increase_amount: bigint, collateral_token: number, position_token: number, leverage: number, slippage_tolerance_bps: number | null | undefined, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, mint_a: Pubkey, mint_b: Pubkey, fusion_pool: FusionPoolFacade, tick_arrays?: TickArrayFacade[] | null): Promise<any>;
|
|
653
654
|
/**
|
|
654
655
|
* Spot position decrease quote
|
|
655
656
|
*
|
|
@@ -665,12 +666,12 @@ export function getIncreaseSpotPositionQuote(increase_amount: bigint, collateral
|
|
|
665
666
|
* - `protocol_fee_rate`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
666
667
|
* - `protocol_fee_rate_on_collateral`: Protocol fee rate from a market account represented as hundredths of a basis point (0.01% = 100).
|
|
667
668
|
* - `fusion_pool`: Fusion pool.
|
|
668
|
-
* - `tick_arrays`:
|
|
669
|
+
* - `tick_arrays`: Optional five tick arrays around the current pool price. If not provided, the quote will be calculated using the Jupiter Aggregator.
|
|
669
670
|
*
|
|
670
671
|
* # Returns
|
|
671
672
|
* - `DecreaseSpotPositionQuoteResult`: quote result
|
|
672
673
|
*/
|
|
673
|
-
export function getDecreaseSpotPositionQuote(decrease_amount: bigint, collateral_token: number, leverage: number, reduce_only: boolean, slippage_tolerance_bps: number | null | undefined, position_token: number, position_amount: bigint, position_debt: bigint, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, fusion_pool: FusionPoolFacade, tick_arrays
|
|
674
|
+
export function getDecreaseSpotPositionQuote(decrease_amount: bigint, collateral_token: number, leverage: number, reduce_only: boolean, slippage_tolerance_bps: number | null | undefined, position_token: number, position_amount: bigint, position_debt: bigint, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, mint_a: Pubkey, mint_b: Pubkey, fusion_pool: FusionPoolFacade, tick_arrays?: TickArrayFacade[] | null): Promise<any>;
|
|
674
675
|
/**
|
|
675
676
|
* Returns the liquidation price
|
|
676
677
|
*
|
|
@@ -704,8 +705,21 @@ export function getLiquidationPrice(position_token: number, amount: number, debt
|
|
|
704
705
|
* # Returns
|
|
705
706
|
* - `u64`: the maximum tradable amount
|
|
706
707
|
*/
|
|
707
|
-
export function getTradableAmount(collateral_token: number, available_balance: bigint, leverage: number, new_position_token: number, reduce_only: boolean, position_token: number, position_amount: bigint, position_debt: bigint, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, fusion_pool: FusionPoolFacade, tick_arrays
|
|
708
|
+
export function getTradableAmount(collateral_token: number, available_balance: bigint, leverage: number, new_position_token: number, reduce_only: boolean, position_token: number, position_amount: bigint, position_debt: bigint, protocol_fee_rate: number, protocol_fee_rate_on_collateral: number, fusion_pool: FusionPoolFacade, tick_arrays?: TickArrayFacade[] | null): bigint;
|
|
708
709
|
export function calculateTunaProtocolFee(collateral_token: number, borrowed_token: number, collateral: bigint, borrow: bigint, protocol_fee_rate_on_collateral: number, protocol_fee_rate: number): TokenPair;
|
|
710
|
+
export function _INVALID_ARGUMENTS(): string;
|
|
711
|
+
export function _TICK_ARRAYS_NOT_PROVIDED(): string;
|
|
712
|
+
export function _JUPITER_QUOTE_REQUEST_ERROR(): string;
|
|
713
|
+
export function _JUPITER_SWAP_INSTRUCTIONS_REQUEST_ERROR(): string;
|
|
714
|
+
/**
|
|
715
|
+
* Initialize Javascript logging and panic handler
|
|
716
|
+
*/
|
|
717
|
+
export function solana_program_init(): void;
|
|
718
|
+
export interface CollectFeesQuote {
|
|
719
|
+
feeOwedA: bigint;
|
|
720
|
+
feeOwedB: bigint;
|
|
721
|
+
}
|
|
722
|
+
|
|
709
723
|
export interface TickArrayFacade {
|
|
710
724
|
startTickIndex: number;
|
|
711
725
|
ticks: TickFacade[];
|
|
@@ -779,11 +793,6 @@ export interface DecreaseLiquidityQuote {
|
|
|
779
793
|
tokenMinB: bigint;
|
|
780
794
|
}
|
|
781
795
|
|
|
782
|
-
export interface CollectFeesQuote {
|
|
783
|
-
feeOwedA: bigint;
|
|
784
|
-
feeOwedB: bigint;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
796
|
export interface TokenPair {
|
|
788
797
|
a: bigint;
|
|
789
798
|
b: bigint;
|
|
@@ -839,28 +848,206 @@ export interface TunaSpotPositionFacade {
|
|
|
839
848
|
upperLimitOrderSqrtPrice: bigint;
|
|
840
849
|
}
|
|
841
850
|
|
|
842
|
-
export interface
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
851
|
+
export interface SwapInstruction {
|
|
852
|
+
data: number[];
|
|
853
|
+
accounts: AccountMeta[];
|
|
854
|
+
addressLookupTableAddresses: Pubkey[];
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
export interface IncreaseSpotPositionQuoteResult {
|
|
846
858
|
collateral: bigint;
|
|
847
859
|
borrow: bigint;
|
|
848
|
-
decreaseAcceptableSwapAmount: bigint;
|
|
849
|
-
increaseMinSwapOutputAmount: bigint;
|
|
850
860
|
estimatedAmount: bigint;
|
|
861
|
+
swapInputAmount: bigint;
|
|
862
|
+
minSwapOutputAmount: bigint;
|
|
851
863
|
protocolFeeA: bigint;
|
|
852
864
|
protocolFeeB: bigint;
|
|
853
865
|
priceImpact: number;
|
|
866
|
+
jupiterSwapIx: SwapInstruction | undefined;
|
|
854
867
|
}
|
|
855
868
|
|
|
856
|
-
export interface
|
|
869
|
+
export interface DecreaseSpotPositionQuoteResult {
|
|
870
|
+
decreasePercent: number;
|
|
871
|
+
collateralToken: number;
|
|
872
|
+
positionToken: number;
|
|
857
873
|
collateral: bigint;
|
|
858
874
|
borrow: bigint;
|
|
875
|
+
decreaseAcceptableSwapAmount: bigint;
|
|
876
|
+
increaseMinSwapOutputAmount: bigint;
|
|
859
877
|
estimatedAmount: bigint;
|
|
860
|
-
swapInputAmount: bigint;
|
|
861
|
-
minSwapOutputAmount: bigint;
|
|
862
878
|
protocolFeeA: bigint;
|
|
863
879
|
protocolFeeB: bigint;
|
|
864
880
|
priceImpact: number;
|
|
881
|
+
jupiterSwapIx: SwapInstruction | undefined;
|
|
865
882
|
}
|
|
866
883
|
|
|
884
|
+
/**
|
|
885
|
+
* A hash; the 32-byte output of a hashing algorithm.
|
|
886
|
+
*
|
|
887
|
+
* This struct is used most often in `solana-sdk` and related crates to contain
|
|
888
|
+
* a [SHA-256] hash, but may instead contain a [blake3] hash.
|
|
889
|
+
*
|
|
890
|
+
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
|
891
|
+
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
|
892
|
+
*/
|
|
893
|
+
export class Hash {
|
|
894
|
+
free(): void;
|
|
895
|
+
[Symbol.dispose](): void;
|
|
896
|
+
/**
|
|
897
|
+
* Create a new Hash object
|
|
898
|
+
*
|
|
899
|
+
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
|
900
|
+
*/
|
|
901
|
+
constructor(value: any);
|
|
902
|
+
/**
|
|
903
|
+
* Return the base58 string representation of the hash
|
|
904
|
+
*/
|
|
905
|
+
toString(): string;
|
|
906
|
+
/**
|
|
907
|
+
* Checks if two `Hash`s are equal
|
|
908
|
+
*/
|
|
909
|
+
equals(other: Hash): boolean;
|
|
910
|
+
/**
|
|
911
|
+
* Return the `Uint8Array` representation of the hash
|
|
912
|
+
*/
|
|
913
|
+
toBytes(): Uint8Array;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* wasm-bindgen version of the Instruction struct.
|
|
917
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
918
|
+
* is fixed. This must not diverge from the regular non-wasm Instruction struct.
|
|
919
|
+
*/
|
|
920
|
+
export class Instruction {
|
|
921
|
+
private constructor();
|
|
922
|
+
free(): void;
|
|
923
|
+
[Symbol.dispose](): void;
|
|
924
|
+
}
|
|
925
|
+
export class Instructions {
|
|
926
|
+
free(): void;
|
|
927
|
+
[Symbol.dispose](): void;
|
|
928
|
+
constructor();
|
|
929
|
+
push(instruction: Instruction): void;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* A vanilla Ed25519 key pair
|
|
933
|
+
*/
|
|
934
|
+
export class Keypair {
|
|
935
|
+
free(): void;
|
|
936
|
+
[Symbol.dispose](): void;
|
|
937
|
+
/**
|
|
938
|
+
* Create a new `Keypair `
|
|
939
|
+
*/
|
|
940
|
+
constructor();
|
|
941
|
+
/**
|
|
942
|
+
* Convert a `Keypair` to a `Uint8Array`
|
|
943
|
+
*/
|
|
944
|
+
toBytes(): Uint8Array;
|
|
945
|
+
/**
|
|
946
|
+
* Recover a `Keypair` from a `Uint8Array`
|
|
947
|
+
*/
|
|
948
|
+
static fromBytes(bytes: Uint8Array): Keypair;
|
|
949
|
+
/**
|
|
950
|
+
* Return the `Pubkey` for this `Keypair`
|
|
951
|
+
*/
|
|
952
|
+
pubkey(): Pubkey;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* wasm-bindgen version of the Message struct.
|
|
956
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
957
|
+
* is fixed. This must not diverge from the regular non-wasm Message struct.
|
|
958
|
+
*/
|
|
959
|
+
export class Message {
|
|
960
|
+
private constructor();
|
|
961
|
+
free(): void;
|
|
962
|
+
[Symbol.dispose](): void;
|
|
963
|
+
/**
|
|
964
|
+
* The id of a recent ledger entry.
|
|
965
|
+
*/
|
|
966
|
+
recent_blockhash: Hash;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* The address of a [Solana account][acc].
|
|
970
|
+
*
|
|
971
|
+
* Some account addresses are [ed25519] public keys, with corresponding secret
|
|
972
|
+
* keys that are managed off-chain. Often, though, account addresses do not
|
|
973
|
+
* have corresponding secret keys — as with [_program derived
|
|
974
|
+
* addresses_][pdas] — or the secret key is not relevant to the operation
|
|
975
|
+
* of a program, and may have even been disposed of. As running Solana programs
|
|
976
|
+
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
|
977
|
+
* defined in `solana-program` but in `solana-sdk`.
|
|
978
|
+
*
|
|
979
|
+
* [acc]: https://solana.com/docs/core/accounts
|
|
980
|
+
* [ed25519]: https://ed25519.cr.yp.to/
|
|
981
|
+
* [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
|
|
982
|
+
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
|
983
|
+
*/
|
|
984
|
+
export class Pubkey {
|
|
985
|
+
free(): void;
|
|
986
|
+
[Symbol.dispose](): void;
|
|
987
|
+
/**
|
|
988
|
+
* Create a new Pubkey object
|
|
989
|
+
*
|
|
990
|
+
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
|
991
|
+
*/
|
|
992
|
+
constructor(value: any);
|
|
993
|
+
/**
|
|
994
|
+
* Return the base58 string representation of the public key
|
|
995
|
+
*/
|
|
996
|
+
toString(): string;
|
|
997
|
+
/**
|
|
998
|
+
* Check if a `Pubkey` is on the ed25519 curve.
|
|
999
|
+
*/
|
|
1000
|
+
isOnCurve(): boolean;
|
|
1001
|
+
/**
|
|
1002
|
+
* Checks if two `Pubkey`s are equal
|
|
1003
|
+
*/
|
|
1004
|
+
equals(other: Pubkey): boolean;
|
|
1005
|
+
/**
|
|
1006
|
+
* Return the `Uint8Array` representation of the public key
|
|
1007
|
+
*/
|
|
1008
|
+
toBytes(): Uint8Array;
|
|
1009
|
+
/**
|
|
1010
|
+
* Derive a Pubkey from another Pubkey, string seed, and a program id
|
|
1011
|
+
*/
|
|
1012
|
+
static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
|
|
1013
|
+
/**
|
|
1014
|
+
* Derive a program address from seeds and a program id
|
|
1015
|
+
*/
|
|
1016
|
+
static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
|
|
1017
|
+
/**
|
|
1018
|
+
* Find a valid program address
|
|
1019
|
+
*
|
|
1020
|
+
* Returns:
|
|
1021
|
+
* * `[PubKey, number]` - the program address and bump seed
|
|
1022
|
+
*/
|
|
1023
|
+
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* wasm-bindgen version of the Transaction struct.
|
|
1027
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
1028
|
+
* is fixed. This must not diverge from the regular non-wasm Transaction struct.
|
|
1029
|
+
*/
|
|
1030
|
+
export class Transaction {
|
|
1031
|
+
free(): void;
|
|
1032
|
+
[Symbol.dispose](): void;
|
|
1033
|
+
/**
|
|
1034
|
+
* Create a new `Transaction`
|
|
1035
|
+
*/
|
|
1036
|
+
constructor(instructions: Instructions, payer?: Pubkey | null);
|
|
1037
|
+
/**
|
|
1038
|
+
* Return a message containing all data that should be signed.
|
|
1039
|
+
*/
|
|
1040
|
+
message(): Message;
|
|
1041
|
+
/**
|
|
1042
|
+
* Return the serialized message data to sign.
|
|
1043
|
+
*/
|
|
1044
|
+
messageData(): Uint8Array;
|
|
1045
|
+
/**
|
|
1046
|
+
* Verify the transaction
|
|
1047
|
+
*/
|
|
1048
|
+
verify(): void;
|
|
1049
|
+
partialSign(keypair: Keypair, recent_blockhash: Hash): void;
|
|
1050
|
+
isSigned(): boolean;
|
|
1051
|
+
toBytes(): Uint8Array;
|
|
1052
|
+
static fromBytes(bytes: Uint8Array): Transaction;
|
|
1053
|
+
}
|