hedge-web3 0.1.20 → 0.1.21

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.
@@ -1,5 +1,5 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- export declare const HEDGE_PROGRAM_ID = "h6GZ7ZMB6Jwmj3k4mQZY1bfXMGREEWH47uJHbKvE6nd";
2
+ export declare const HEDGE_PROGRAM_ID = "h8i3RfCeswxUSEwXCi5hjnvMfcdY6ZGr44dLKEKL8b3";
3
3
  export declare const HEDGE_PROGRAM_PUBLICKEY: PublicKey;
4
4
  export declare const CHAINLINK_SOL_USD_ID = "FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf";
5
5
  export declare const CHAINLINK_SOL_USD_PUBLICKEY: PublicKey;
package/lib/Constants.js CHANGED
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.findAssociatedTokenAddress = exports.findVaultAddress = exports.getVaultTypeOracleAccountPublicKey = exports.getVaultTypeAccountPublicKey = exports.getPoolPublicKeyForMint = exports.getHedgeMintPublicKey = exports.getVaultSystemStatePublicKey = exports.getUsdhMintPublicKey = exports.getLiquidationPoolUsdhAccountPublicKey = exports.getLiquidationPoolStatePublicKey = 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
- exports.HEDGE_PROGRAM_ID = 'h6GZ7ZMB6Jwmj3k4mQZY1bfXMGREEWH47uJHbKvE6nd';
15
+ exports.HEDGE_PROGRAM_ID = 'h8i3RfCeswxUSEwXCi5hjnvMfcdY6ZGr44dLKEKL8b3';
16
16
  exports.HEDGE_PROGRAM_PUBLICKEY = new web3_js_1.PublicKey(exports.HEDGE_PROGRAM_ID);
17
17
  exports.CHAINLINK_SOL_USD_ID = 'FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf';
18
18
  exports.CHAINLINK_SOL_USD_PUBLICKEY = new web3_js_1.PublicKey(exports.CHAINLINK_SOL_USD_ID);
@@ -34,6 +34,7 @@ exports.closeLiquidationPoolPosition = closeLiquidationPoolPosition;
34
34
  function closeLiquidationPoolPositionInstruction(program, poolEra, poolPosition, payerPublicKey, payerUsdhAccount, payerAssociatedHedgeAccount, communityAssociatedHedgeTokenAccount, overrideStartTime) {
35
35
  return __awaiter(this, void 0, void 0, function* () {
36
36
  const vaultSystemStatePublicKey = yield (0, Constants_1.getVaultSystemStatePublicKey)();
37
+ const usdhMint = yield (0, Constants_1.getUsdhMintPublicKey)();
37
38
  const hedgeMint = yield (0, Constants_1.getHedgeMintPublicKey)();
38
39
  const poolUsdhAccount = yield (0, Constants_1.getLiquidationPoolUsdhAccountPublicKey)();
39
40
  const poolState = yield (0, Constants_1.getLiquidationPoolStatePublicKey)();
@@ -48,6 +49,7 @@ function closeLiquidationPoolPositionInstruction(program, poolEra, poolPosition,
48
49
  payer: payerPublicKey,
49
50
  ownerUsdhAccount: payerUsdhAccount,
50
51
  hedgeMint: hedgeMint,
52
+ usdhMint: usdhMint,
51
53
  payerAssociatedHedgeAccount: payerAssociatedHedgeAccount,
52
54
  communityAssociatedHedgeTokenAccount: communityAssociatedHedgeTokenAccount,
53
55
  associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -26,6 +26,7 @@ function createStakingPool(program, provider, payer, mintPublicKey, hedgeTokensT
26
26
  exports.createStakingPool = createStakingPool;
27
27
  function createStakingPoolInstruction(program, payerPublicKey, mintPublicKey, hedgeTokensToBeMinted, overrideStartTime) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ console.log("createStakingPoolInstruction program ID", program.programId.toString());
29
30
  const vaultSystemStatePublicKey = yield (0, Constants_1.getVaultSystemStatePublicKey)();
30
31
  const usdhMintPublickey = yield (0, Constants_1.getUsdhMintPublicKey)();
31
32
  const [poolPublickey, poolBump, poolSeedPhrase] = yield (0, Constants_1.getPoolPublicKeyForMint)(mintPublicKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedge-web3",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Hedge Javascript Web3 API",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/src/Constants.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'
2
2
  import { PublicKey } from '@solana/web3.js'
3
3
 
4
- export const HEDGE_PROGRAM_ID = 'h6GZ7ZMB6Jwmj3k4mQZY1bfXMGREEWH47uJHbKvE6nd'
4
+ export const HEDGE_PROGRAM_ID = 'h8i3RfCeswxUSEwXCi5hjnvMfcdY6ZGr44dLKEKL8b3'
5
5
  export const HEDGE_PROGRAM_PUBLICKEY = new PublicKey(HEDGE_PROGRAM_ID)
6
6
 
7
7
  export const CHAINLINK_SOL_USD_ID = 'FmAmfoyPXiA8Vhhe6MZTr3U6rZfEZ1ctEHay1ysqCqcf'
@@ -49,6 +49,7 @@ export async function closeLiquidationPoolPositionInstruction (
49
49
  ): Promise<TransactionInstruction> {
50
50
 
51
51
  const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
52
+ const usdhMint = await getUsdhMintPublicKey()
52
53
  const hedgeMint = await getHedgeMintPublicKey()
53
54
  const poolUsdhAccount = await getLiquidationPoolUsdhAccountPublicKey()
54
55
  const poolState = await getLiquidationPoolStatePublicKey()
@@ -65,6 +66,7 @@ export async function closeLiquidationPoolPositionInstruction (
65
66
  payer: payerPublicKey,
66
67
  ownerUsdhAccount: payerUsdhAccount,
67
68
  hedgeMint: hedgeMint,
69
+ usdhMint: usdhMint,
68
70
  payerAssociatedHedgeAccount: payerAssociatedHedgeAccount,
69
71
  communityAssociatedHedgeTokenAccount: communityAssociatedHedgeTokenAccount,
70
72
  associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -33,6 +33,7 @@ export async function createStakingPoolInstruction (
33
33
  hedgeTokensToBeMinted: number,
34
34
  overrideStartTime?: number
35
35
  ): Promise<TransactionInstruction> {
36
+ console.log("createStakingPoolInstruction program ID", program.programId.toString())
36
37
  const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
37
38
  const usdhMintPublickey = await getUsdhMintPublicKey()
38
39
  const [poolPublickey, poolBump, poolSeedPhrase] = await getPoolPublicKeyForMint(mintPublicKey)