hedge-web3 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,5 +10,6 @@ export declare function getVaultSystemStatePublicKey(): Promise<PublicKey>;
10
10
  export declare function getHedgeMintPublicKey(): Promise<PublicKey>;
11
11
  export declare function getPoolPublicKeyForMint(mintPublicKey: PublicKey): Promise<[PublicKey, number, string]>;
12
12
  export declare function getVaultTypeAccountPublicKey(collateralType: string): Promise<PublicKey>;
13
+ export declare function getVaultTypeOracleAccountPublicKey(collateralType: string): Promise<PublicKey>;
13
14
  export declare function findVaultAddress(vaultSalt: string): Promise<PublicKey>;
14
15
  export declare function findAssociatedTokenAddress(walletAddress: PublicKey, tokenMintAddress: PublicKey): Promise<PublicKey>;
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.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;
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
15
  exports.HEDGE_PROGRAM_ID = 'h6GZ7ZMB6Jwmj3k4mQZY1bfXMGREEWH47uJHbKvE6nd';
@@ -67,6 +67,13 @@ function getVaultTypeAccountPublicKey(collateralType) {
67
67
  });
68
68
  }
69
69
  exports.getVaultTypeAccountPublicKey = getVaultTypeAccountPublicKey;
70
+ function getVaultTypeOracleAccountPublicKey(collateralType) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const [vaultTypeOracleAccount] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode(collateralType), enc.encode('Oracle')], exports.HEDGE_PROGRAM_PUBLICKEY);
73
+ return vaultTypeOracleAccount;
74
+ });
75
+ }
76
+ exports.getVaultTypeOracleAccountPublicKey = getVaultTypeOracleAccountPublicKey;
70
77
  function findVaultAddress(vaultSalt) {
71
78
  return __awaiter(this, void 0, void 0, function* () {
72
79
  const [vaultAddress] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('Vault'), enc.encode(vaultSalt)], exports.HEDGE_PROGRAM_PUBLICKEY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedge-web3",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Hedge Javascript Web3 API",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/src/Constants.ts CHANGED
@@ -43,6 +43,10 @@ export async function getVaultTypeAccountPublicKey (collateralType: string): Pro
43
43
  const [vaultTypeAccount] = await PublicKey.findProgramAddress([enc.encode(collateralType), enc.encode('State')], HEDGE_PROGRAM_PUBLICKEY)
44
44
  return vaultTypeAccount
45
45
  }
46
+ export async function getVaultTypeOracleAccountPublicKey (collateralType: string): Promise<PublicKey> {
47
+ const [vaultTypeOracleAccount] = await PublicKey.findProgramAddress([enc.encode(collateralType), enc.encode('Oracle')], HEDGE_PROGRAM_PUBLICKEY)
48
+ return vaultTypeOracleAccount
49
+ }
46
50
  export async function findVaultAddress (vaultSalt: string): Promise<PublicKey> {
47
51
  const [vaultAddress] = await PublicKey.findProgramAddress([enc.encode('Vault'), enc.encode(vaultSalt)], HEDGE_PROGRAM_PUBLICKEY)
48
52
  return vaultAddress