hedge-web3 0.2.22 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- package/declarations/Constants.d.ts +15 -0
- package/declarations/idl/vault.d.ts +832 -179
- package/declarations/index.d.ts +26 -21
- package/declarations/instructions/closeLiquidationPoolPosition.d.ts +2 -2
- package/declarations/instructions/createReferralAccount.d.ts +17 -0
- package/declarations/instructions/createUserReferralAccount.d.ts +5 -0
- package/declarations/instructions/depositLiquidationPool.d.ts +2 -2
- package/declarations/instructions/loanVault.d.ts +2 -2
- package/declarations/instructions/psmEditAccount.d.ts +12 -0
- package/declarations/instructions/psmMintUsh.d.ts +2 -2
- package/declarations/instructions/psmRedeemUsh.d.ts +2 -2
- package/declarations/instructions/referralClaimFees.d.ts +16 -0
- package/declarations/instructions/updateReferralAccount.d.ts +13 -0
- package/declarations/instructions/updateReferralState.d.ts +20 -0
- package/lib/Constants.js +36 -1
- package/lib/idl/vault.js +830 -177
- package/lib/index.js +26 -21
- package/lib/instructions/closeLiquidationPoolPosition.js +16 -3
- package/lib/instructions/createReferralAccount.js +80 -0
- package/lib/instructions/createUserReferralAccount.js +61 -0
- package/lib/instructions/depositLiquidationPool.js +16 -5
- package/lib/instructions/loanVault.js +16 -3
- package/lib/instructions/psmEditAccount.js +60 -0
- package/lib/instructions/psmMintUsh.js +14 -3
- package/lib/instructions/psmRedeemUsh.js +14 -3
- package/lib/instructions/referralClaimFees.js +84 -0
- package/lib/instructions/updateReferralAccount.js +50 -0
- package/lib/instructions/updateReferralState.js +57 -0
- package/package.json +1 -1
- package/src/Constants.ts +42 -0
- package/src/idl/vault.ts +1845 -539
- package/src/index.ts +28 -21
- package/src/instructions/closeLiquidationPoolPosition.ts +25 -1
- package/src/instructions/createReferralAccount.ts +127 -0
- package/src/instructions/createUserReferralAccount.ts +86 -0
- package/src/instructions/depositLiquidationPool.ts +24 -4
- package/src/instructions/loanVault.ts +20 -1
- package/src/instructions/{psmEditAccount.rs → psmEditAccount.ts} +0 -0
- package/src/instructions/psmMintUsh.ts +20 -1
- package/src/instructions/psmRedeemUsh.ts +20 -1
- package/src/instructions/referralClaimFees.ts +159 -0
- package/src/instructions/updateReferralAccount.ts +77 -0
- package/src/instructions/updateReferralState.ts +93 -0
package/declarations/index.d.ts
CHANGED
@@ -1,34 +1,39 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './
|
3
|
-
export * from './
|
4
|
-
export * from './instructions/claimStakingPoolPosition';
|
5
|
-
export * from './instructions/depositLiquidationPool';
|
6
|
-
export * from './instructions/closeLiquidationPoolPosition';
|
1
|
+
export * from './Constants';
|
2
|
+
export * from './HedgeDecimal';
|
3
|
+
export * from './idl/vault';
|
7
4
|
export * from './instructions/claimLiquidationPoolPosition';
|
5
|
+
export * from './instructions/claimStakingPoolPosition';
|
8
6
|
export * from './instructions/closeClaimedLiquidationPoolPosition';
|
7
|
+
export * from './instructions/closeLiquidationPoolPosition';
|
8
|
+
export * from './instructions/createReferralAccount';
|
9
|
+
export * from './instructions/createStakingPool';
|
10
|
+
export * from './instructions/createUserReferralAccount';
|
9
11
|
export * from './instructions/createVault';
|
10
|
-
export * from './instructions/
|
11
|
-
export * from './instructions/
|
12
|
+
export * from './instructions/depositLiquidationPool';
|
13
|
+
export * from './instructions/depositStakingPool';
|
12
14
|
export * from './instructions/depositVault';
|
13
|
-
export * from './instructions/
|
15
|
+
export * from './instructions/initHedgeFoundation';
|
16
|
+
export * from './instructions/initHedgeFoundationTokens';
|
17
|
+
export * from './instructions/liquidateVault';
|
14
18
|
export * from './instructions/loanVault';
|
15
|
-
export * from './instructions/
|
19
|
+
export * from './instructions/psmMintUsh';
|
20
|
+
export * from './instructions/psmRedeemUsh';
|
16
21
|
export * from './instructions/redeemVault';
|
17
|
-
export * from './instructions/
|
22
|
+
export * from './instructions/referralClaimFees';
|
18
23
|
export * from './instructions/refreshOraclePrice';
|
19
|
-
export * from './instructions/
|
20
|
-
export * from './instructions/initHedgeFoundationTokens';
|
24
|
+
export * from './instructions/repayVault';
|
21
25
|
export * from './instructions/setHalted';
|
22
|
-
export * from './instructions/updateVaultType';
|
23
26
|
export * from './instructions/transferVault';
|
24
|
-
export * from './
|
25
|
-
export * from './
|
26
|
-
export * from './
|
27
|
-
export * from './
|
28
|
-
export * from './
|
29
|
-
export * from './state/StakingPoolPosition';
|
27
|
+
export * from './instructions/updateReferralAccount';
|
28
|
+
export * from './instructions/updateReferralState';
|
29
|
+
export * from './instructions/updateVaultType';
|
30
|
+
export * from './instructions/withdrawStakingPool';
|
31
|
+
export * from './instructions/withdrawVault';
|
30
32
|
export * from './state/LiquidationPoolEra';
|
31
33
|
export * from './state/LiquidationPoolState';
|
32
34
|
export * from './state/LiquidationPosition';
|
35
|
+
export * from './state/StakingPool';
|
36
|
+
export * from './state/StakingPoolPosition';
|
37
|
+
export * from './state/VaultAccount';
|
38
|
+
export * from './state/VaultHistoryEvent';
|
33
39
|
export * from './utils/getLinkedListAccounts';
|
34
|
-
export * from './idl/vault';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Program, Provider } from '@project-serum/anchor';
|
2
2
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
3
|
import { Vault } from '../idl/vault';
|
4
|
-
export declare function closeLiquidationPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer, overrideStartTime?: number): Promise<PublicKey>;
|
5
|
-
export declare function closeLiquidationPoolPositionInstruction(program: Program<Vault>, poolEra: PublicKey, poolPosition: PublicKey, payerPublicKey: PublicKey, payerUshAccount: PublicKey, payerAssociatedHedgeAccount: PublicKey, communityAssociatedHedgeTokenAccount: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
4
|
+
export declare function closeLiquidationPoolPosition(program: Program<Vault>, provider: Provider, poolPosition: PublicKey, payer: Signer, overrideStartTime?: number, referrer?: PublicKey): Promise<PublicKey>;
|
5
|
+
export declare function closeLiquidationPoolPositionInstruction(program: Program<Vault>, poolEra: PublicKey, poolPosition: PublicKey, payerPublicKey: PublicKey, payerUshAccount: PublicKey, payerAssociatedHedgeAccount: PublicKey, communityAssociatedHedgeTokenAccount: PublicKey, userReferralAccountPublicKey: PublicKey, referralAccountPublicKey: PublicKey, referralStatePublicKey: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Program, Provider } from '@project-serum/anchor';
|
2
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
|
+
/** @type {Function} - Creates a new referral account.
|
5
|
+
* This checks the user has enough HDG in their wallet or staked and
|
6
|
+
* then allows them to create a referral account. If they meet the PSM referral threshold,
|
7
|
+
* they will be eligible for PSM cut.
|
8
|
+
* Params:
|
9
|
+
* - program: Program<Vault> : The program instance of Hedge Vault program
|
10
|
+
* - provider: Provider : Current connection
|
11
|
+
* - payer: Signer : who we are creating the referral account for
|
12
|
+
* - poolPublicKey: PublicKey : a key to a pool position. If the position is closed or does not belong to the signer it will be ignored
|
13
|
+
* - referrer: PublicKey
|
14
|
+
* - overrideTime?: number
|
15
|
+
*/
|
16
|
+
export declare function createReferralAccount(program: Program<Vault>, provider: Provider, payer: Signer, poolPosition: PublicKey, overrideTime?: number): Promise<PublicKey>;
|
17
|
+
export declare function createReferralAccountInstruction(program: Program<Vault>, payerPublicKey: PublicKey, poolPositionPublicKey: PublicKey, referralAccountPublicKey: PublicKey, referralStatePublicKey: PublicKey, hedgeMintPublicKey: PublicKey, hdgAssociatedTokenAccountPublicKey: PublicKey, userReferralAccountPublicKey: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Program, Provider } from '@project-serum/anchor';
|
2
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
|
+
export declare function createUserReferralAccount(program: Program<Vault>, provider: Provider, payer: Signer, referrer?: PublicKey, overrideTime?: number): Promise<PublicKey>;
|
5
|
+
export declare function createUserReferralAccountInstruction(program: Program<Vault>, payerPublicKey: PublicKey, referralAccount: PublicKey, userReferralAccount: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -2,5 +2,5 @@
|
|
2
2
|
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
3
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
4
|
import { Vault } from '../idl/vault';
|
5
|
-
export declare function depositLiquidationPool(program: Program<Vault>, provider: Provider, payer: Signer, depositAmount: BN, overrideStartTime?: number): Promise<PublicKey>;
|
6
|
-
export declare function depositLiquidationPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, payerUshAccount: PublicKey, poolPositionPublicKey: PublicKey, depositAmount: BN, overrideStartTime?: number): Promise<TransactionInstruction>;
|
5
|
+
export declare function depositLiquidationPool(program: Program<Vault>, provider: Provider, payer: Signer, depositAmount: BN, overrideStartTime?: number, referrer?: PublicKey): Promise<PublicKey>;
|
6
|
+
export declare function depositLiquidationPoolInstruction(program: Program<Vault>, payerPublicKey: PublicKey, vaultSystemStatePublicKey: PublicKey, payerUshAccount: PublicKey, poolPositionPublicKey: PublicKey, depositAmount: BN, userReferralAccountPublicKey: PublicKey, referralAccountPublicKey: PublicKey, overrideStartTime?: number): Promise<TransactionInstruction>;
|
@@ -2,5 +2,5 @@
|
|
2
2
|
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
3
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
4
|
import { Vault } from '../idl/vault';
|
5
|
-
export declare function loanVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, loanAmount: number, overrideTime?: number): Promise<PublicKey>;
|
6
|
-
export declare function loanVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, loanAmount: BN, overrideTime?: number): Promise<TransactionInstruction>;
|
5
|
+
export declare function loanVault(program: Program<Vault>, provider: Provider, payer: Signer, vaultPublicKey: PublicKey, loanAmount: number, overrideTime?: number, referrer?: PublicKey): Promise<PublicKey>;
|
6
|
+
export declare function loanVaultInstruction(program: Program<Vault>, payerPublicKey: PublicKey, ownerUshAccount: PublicKey, vaultPublickey: PublicKey, vaultAssociatedTokenAccount: PublicKey, historyPublicKey: PublicKey, vaultTypeAccount: PublicKey, vaultTypeAssociatedTokenAccount: PublicKey, oldSmallerPublicKey: PublicKey, newSmallerPublicKey: PublicKey, newLargerPublicKey: PublicKey, loanAmount: BN, referralAccountPublicKey: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
|
+
import { Vault } from '../idl/vault';
|
5
|
+
export declare enum psmStatus {
|
6
|
+
PsmEnabled = 0,
|
7
|
+
PsmDisabled = 1,
|
8
|
+
MintOnly = 2,
|
9
|
+
RedeemOnly = 3
|
10
|
+
}
|
11
|
+
export declare function psmEditAccount(program: Program<Vault>, provider: Provider, payer: Signer, collateralMint: PublicKey, mintFee: number, redeemFee: number, debtLimit: number, minSwap: number, overrideTime?: number): Promise<PublicKey>;
|
12
|
+
export declare function psmEditAccountInstruction(program: Program<Vault>, payerPublicKey: PublicKey, psmAccount: PublicKey, collateralMint: PublicKey, mintFee: BN, redeemFee: BN, debtLimit: BN, minSwap: BN, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -2,5 +2,5 @@
|
|
2
2
|
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
3
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
4
|
import { Vault } from '../idl/vault';
|
5
|
-
export declare function psmMintUsh(program: Program<Vault>, provider: Provider, payer: Signer, collateralMint: PublicKey, collateralAmount: number, overrideTime?: number): Promise<PublicKey>;
|
6
|
-
export declare function psmMintUshInstruction(program: Program<Vault>, payerPublicKey: PublicKey, psmAccount: PublicKey, collateralMint: PublicKey, collateralAmount: BN, overrideTime?: number): Promise<TransactionInstruction>;
|
5
|
+
export declare function psmMintUsh(program: Program<Vault>, provider: Provider, payer: Signer, collateralMint: PublicKey, collateralAmount: number, overrideTime?: number, referrer?: PublicKey): Promise<PublicKey>;
|
6
|
+
export declare function psmMintUshInstruction(program: Program<Vault>, payerPublicKey: PublicKey, psmAccount: PublicKey, collateralMint: PublicKey, collateralAmount: BN, referralStatePublicKey: PublicKey, referralAccountPublicKey: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -2,5 +2,5 @@
|
|
2
2
|
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
3
|
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
4
|
import { Vault } from '../idl/vault';
|
5
|
-
export declare function psmRedeemUsh(program: Program<Vault>, provider: Provider, payer: Signer, collateralMint: PublicKey, ushAmount: number, overrideTime?: number): Promise<PublicKey>;
|
6
|
-
export declare function psmRedeemUshInstruction(program: Program<Vault>, payerPublicKey: PublicKey, psmAccount: PublicKey, collateralMint: PublicKey, ushAmount: BN, overrideTime?: number): Promise<TransactionInstruction>;
|
5
|
+
export declare function psmRedeemUsh(program: Program<Vault>, provider: Provider, payer: Signer, collateralMint: PublicKey, ushAmount: number, overrideTime?: number, referrer?: PublicKey): Promise<PublicKey>;
|
6
|
+
export declare function psmRedeemUshInstruction(program: Program<Vault>, payerPublicKey: PublicKey, psmAccount: PublicKey, collateralMint: PublicKey, ushAmount: BN, referralStatePublicKey: PublicKey, referralAccountPublicKey: PublicKey, overrideTime?: number): Promise<TransactionInstruction>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Program, Provider } from '@project-serum/anchor';
|
2
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
3
|
+
import { Vault } from '../idl/vault';
|
4
|
+
/** @type {Function} - Allows a referrer to claims their fees.
|
5
|
+
* This checks the user has enough HDG in their wallet or staked and
|
6
|
+
* then allows them to claim earned fees. If they meet the PSM referral threshold,
|
7
|
+
* they will be eligible for PSM cut.
|
8
|
+
* Params:
|
9
|
+
* - program: Program<Vault> : The program instance of Hedge Vault program
|
10
|
+
* - provider: Provider : Current connection
|
11
|
+
* - payer: Signer : who we are creating the referral account for
|
12
|
+
* - poolPublicKey: PublicKey : a key to a pool position. If the position is closed or does not belong to the signer it will be ignored
|
13
|
+
* - referrer: PublicKey
|
14
|
+
*/
|
15
|
+
export declare function referralClaimFees(program: Program<Vault>, provider: Provider, payer: Signer, poolPosition: PublicKey): Promise<PublicKey>;
|
16
|
+
export declare function referralClaimFeesInstruction(program: Program<Vault>, payerPublicKey: PublicKey, vaultSystemStatePublicKey: PublicKey, poolPositionPublicKey: PublicKey, referralAccountPublicKey: PublicKey, referralStatePublicKey: PublicKey, hedgeMintPublicKey: PublicKey, hdgAssociatedTokenAccountPublicKey: PublicKey, ushMintPublicKey: PublicKey, ushAssociatedTokenAccountPublicKey: PublicKey, communityAssociatedHedgeTokenAccountPublicKey: PublicKey, feePoolPublicKey: PublicKey, feePoolAssociatedUshTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
|
+
import { Vault } from '../idl/vault';
|
5
|
+
export interface ReferralAccountConfig {
|
6
|
+
setupCut?: BN;
|
7
|
+
referredUserDiscount?: BN;
|
8
|
+
stabilityCut?: BN;
|
9
|
+
psmCut?: BN;
|
10
|
+
hdgThreshold?: BN;
|
11
|
+
}
|
12
|
+
export declare function updateReferralAccount(program: Program<Vault>, provider: Provider, payer: Signer, referrer: PublicKey, config: ReferralAccountConfig): Promise<PublicKey>;
|
13
|
+
export declare function updateReferralAccountInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, referralAccountPublicKey: PublicKey, payerPublicKey: PublicKey, referralAccountConfig: ReferralAccountConfig): Promise<TransactionInstruction>;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
import { BN, Program, Provider } from '@project-serum/anchor';
|
3
|
+
import { PublicKey, Signer, TransactionInstruction } from '@solana/web3.js';
|
4
|
+
import { Vault } from '../idl/vault';
|
5
|
+
export interface ReferralStateConfig {
|
6
|
+
setupCut?: BN;
|
7
|
+
referredUserDiscount?: BN;
|
8
|
+
stabilityCut?: BN;
|
9
|
+
psmCut?: BN;
|
10
|
+
maxSetupCut?: BN;
|
11
|
+
maxReferredDiscount?: BN;
|
12
|
+
maxStabilityCut?: BN;
|
13
|
+
maxPsmCut?: BN;
|
14
|
+
hdgThreshold?: BN;
|
15
|
+
hdgPsmThreshold?: BN;
|
16
|
+
referralThreshold?: BN;
|
17
|
+
referralEnabled?: boolean;
|
18
|
+
}
|
19
|
+
export declare function updateReferralState(program: Program<Vault>, provider: Provider, payer: Signer, config: ReferralStateConfig): Promise<PublicKey>;
|
20
|
+
export declare function updateReferralStateInstruction(program: Program<Vault>, vaultSystemStatePublicKey: PublicKey, referralStatePublicKey: PublicKey, payerPublicKey: PublicKey, referralStateConfig: ReferralStateConfig): Promise<TransactionInstruction>;
|
package/lib/Constants.js
CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
});
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.getUshMintPublicKey = exports.getLiquidationPoolUshAccountPublicKey = exports.getLiquidationPoolStatePublicKey = exports.CHAINLINK_PROGRAM_ID = exports.CHAINLINK_SOL_USD_PUBLICKEY = exports.CHAINLINK_SOL_USD_ID = exports.HEDGE_PROGRAM_PUBLICKEY = exports.HEDGE_PROGRAM_ID = void 0;
|
12
|
+
exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getUserReferralAccountPublicKey = exports.getReferralAccountPublicKey = exports.getReferralStatePublicKey = exports.getVaultSystemStatePublicKey = exports.getUshMintPublicKey = exports.getLiquidationPoolUshAccountPublicKey = exports.getLiquidationPoolStatePublicKey = exports.CHAINLINK_PROGRAM_ID = exports.CHAINLINK_SOL_USD_PUBLICKEY = exports.CHAINLINK_SOL_USD_ID = exports.HEDGE_PROGRAM_PUBLICKEY = exports.HEDGE_PROGRAM_ID = void 0;
|
13
13
|
const spl_token_1 = require("@solana/spl-token");
|
14
14
|
const web3_js_1 = require("@solana/web3.js");
|
15
15
|
exports.HEDGE_PROGRAM_ID = 'HedgeEohwU6RqokrvPU4Hb6XKPub8NuKbnPmY7FoMMtN';
|
@@ -61,6 +61,41 @@ function getVaultSystemStatePublicKey() {
|
|
61
61
|
});
|
62
62
|
}
|
63
63
|
exports.getVaultSystemStatePublicKey = getVaultSystemStatePublicKey;
|
64
|
+
/**
|
65
|
+
*
|
66
|
+
* @returns The Referral State public key
|
67
|
+
*/
|
68
|
+
function getReferralStatePublicKey() {
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
70
|
+
const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('ReferralStateV1')], exports.HEDGE_PROGRAM_PUBLICKEY);
|
71
|
+
return publicKey;
|
72
|
+
});
|
73
|
+
}
|
74
|
+
exports.getReferralStatePublicKey = getReferralStatePublicKey;
|
75
|
+
/**
|
76
|
+
*
|
77
|
+
* @returns The Referral State public key based off the owner's public key
|
78
|
+
*/
|
79
|
+
function getReferralAccountPublicKey(ownerPublicKey) {
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
81
|
+
const strToEncode = ownerPublicKey.toBuffer(); //.substring(0, 28)
|
82
|
+
const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('refer_acct'), strToEncode], exports.HEDGE_PROGRAM_PUBLICKEY);
|
83
|
+
return publicKey;
|
84
|
+
});
|
85
|
+
}
|
86
|
+
exports.getReferralAccountPublicKey = getReferralAccountPublicKey;
|
87
|
+
/**
|
88
|
+
*
|
89
|
+
* @returns The user referral account public key based off the user's public key
|
90
|
+
*/
|
91
|
+
function getUserReferralAccountPublicKey(ownerPublicKey) {
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
93
|
+
const strToEncode = ownerPublicKey.toBuffer(); //.substring(0, 28)
|
94
|
+
const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('user_ref'), strToEncode], exports.HEDGE_PROGRAM_PUBLICKEY);
|
95
|
+
return publicKey;
|
96
|
+
});
|
97
|
+
}
|
98
|
+
exports.getUserReferralAccountPublicKey = getUserReferralAccountPublicKey;
|
64
99
|
/**
|
65
100
|
*
|
66
101
|
* @returns The HDG mint public key
|