hedge-web3 0.3.0 → 0.3.2

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,2 +1,2 @@
1
- import { Connection, Signer, Transaction, TransactionSignature } from '@solana/web3.js';
2
- export default function sendAndConfirmWithDebug(connection: Connection, transaction: Transaction, signers: Signer[]): Promise<TransactionSignature | void>;
1
+ import { Connection, Signer, Transaction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
2
+ export default function sendAndConfirmWithDebug(connection: Connection, transaction: Transaction | VersionedTransaction, signers: Signer[], computeUnits?: number): Promise<TransactionSignature | void>;
package/lib/Constants.js CHANGED
@@ -34,7 +34,7 @@ const enc = new TextEncoder();
34
34
  */
35
35
  function getLiquidationPoolStatePublicKey(hedgeProgramId) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
- const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('LiquidationPoolStateV1')], hedgeProgramId);
37
+ const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('LiquidationPoolStateV1')], hedgeProgramId);
38
38
  return poolPublicKey;
39
39
  });
40
40
  }
@@ -44,7 +44,7 @@ function getLiquidationPoolStatePublicKey(hedgeProgramId) {
44
44
  */
45
45
  function getLiquidationPoolUshAccountPublicKey(hedgeProgramId) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('LiquidationPoolUSHAccountV1')], hedgeProgramId);
47
+ const [poolPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('LiquidationPoolUSHAccountV1')], hedgeProgramId);
48
48
  return poolPublicKey;
49
49
  });
50
50
  }
@@ -54,7 +54,7 @@ function getLiquidationPoolUshAccountPublicKey(hedgeProgramId) {
54
54
  */
55
55
  function getUshMintPublicKey(hedgeProgramId) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const [findMintPublicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('UshMintV1')], hedgeProgramId);
57
+ const [findMintPublicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('UshMintV1')], hedgeProgramId);
58
58
  return findMintPublicKey;
59
59
  });
60
60
  }
@@ -64,7 +64,7 @@ function getUshMintPublicKey(hedgeProgramId) {
64
64
  */
65
65
  function getVaultSystemStatePublicKey(hedgeProgramId) {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
- const [publicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('VaultSystemStateV1')], hedgeProgramId);
67
+ const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('VaultSystemStateV1')], hedgeProgramId);
68
68
  return publicKey;
69
69
  });
70
70
  }
@@ -74,7 +74,7 @@ function getVaultSystemStatePublicKey(hedgeProgramId) {
74
74
  */
75
75
  function getReferralStatePublicKey(hedgeProgramId) {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
- const [publicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('ReferralStateV1')], hedgeProgramId);
77
+ const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('ReferralStateV1')], hedgeProgramId);
78
78
  return publicKey;
79
79
  });
80
80
  }
@@ -85,7 +85,7 @@ function getReferralStatePublicKey(hedgeProgramId) {
85
85
  function getReferralAccountPublicKey(hedgeProgramId, ownerPublicKey) {
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
87
  const strToEncode = ownerPublicKey.toBuffer(); //.substring(0, 28)
88
- const [publicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('refer_acct'), strToEncode], hedgeProgramId);
88
+ const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('refer_acct'), strToEncode], hedgeProgramId);
89
89
  return publicKey;
90
90
  });
91
91
  }
@@ -96,7 +96,7 @@ function getReferralAccountPublicKey(hedgeProgramId, ownerPublicKey) {
96
96
  function getUserReferralAccountPublicKey(hedgeProgramId, ownerPublicKey) {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
98
  const strToEncode = ownerPublicKey.toBuffer(); //.substring(0, 28)
99
- const [publicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('user_ref'), strToEncode], hedgeProgramId);
99
+ const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('user_ref'), strToEncode], hedgeProgramId);
100
100
  return publicKey;
101
101
  });
102
102
  }
@@ -106,7 +106,7 @@ function getUserReferralAccountPublicKey(hedgeProgramId, ownerPublicKey) {
106
106
  */
107
107
  function getHedgeMintPublicKey(hedgeProgramId) {
108
108
  return __awaiter(this, void 0, void 0, function* () {
109
- const [publicKey] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('HEDGEMintV1')], hedgeProgramId);
109
+ const [publicKey] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('HEDGEMintV1')], hedgeProgramId);
110
110
  return publicKey;
111
111
  });
112
112
  }
@@ -119,7 +119,7 @@ function getHedgeMintPublicKey(hedgeProgramId) {
119
119
  function getPoolPublicKeyForMint(hedgeProgramId, mintPublicKey) {
120
120
  return __awaiter(this, void 0, void 0, function* () {
121
121
  const strToEncode = mintPublicKey.toString().substring(0, 12);
122
- const [publicKey, bump] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode(strToEncode)], hedgeProgramId);
122
+ const [publicKey, bump] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode(strToEncode)], hedgeProgramId);
123
123
  return [publicKey, bump, strToEncode];
124
124
  });
125
125
  }
@@ -130,7 +130,7 @@ function getPoolPublicKeyForMint(hedgeProgramId, mintPublicKey) {
130
130
  */
131
131
  function getVaultTypeAccountPublicKey(hedgeProgramId, collateralType) {
132
132
  return __awaiter(this, void 0, void 0, function* () {
133
- const [vaultTypeAccount] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode(collateralType), enc.encode('State')], hedgeProgramId);
133
+ const [vaultTypeAccount] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode(collateralType), enc.encode('State')], hedgeProgramId);
134
134
  return vaultTypeAccount;
135
135
  });
136
136
  }
@@ -141,7 +141,7 @@ function getVaultTypeAccountPublicKey(hedgeProgramId, collateralType) {
141
141
  */
142
142
  function getVaultTypeOracleAccountPublicKey(hedgeProgramId, collateralType) {
143
143
  return __awaiter(this, void 0, void 0, function* () {
144
- const [vaultTypeOracleAccount] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode(collateralType), enc.encode('Oracle')], hedgeProgramId);
144
+ const [vaultTypeOracleAccount] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode(collateralType), enc.encode('Oracle')], hedgeProgramId);
145
145
  return vaultTypeOracleAccount;
146
146
  });
147
147
  }
@@ -153,7 +153,7 @@ function getVaultTypeOracleAccountPublicKey(hedgeProgramId, collateralType) {
153
153
  */
154
154
  function findVaultAddress(hedgeProgramId, vaultSalt) {
155
155
  return __awaiter(this, void 0, void 0, function* () {
156
- const [vaultAddress] = yield web3_js_1.PublicKey.findProgramAddressSync([enc.encode('Vault'), enc.encode(vaultSalt)], hedgeProgramId);
156
+ const [vaultAddress] = yield web3_js_1.PublicKey.findProgramAddress([enc.encode('Vault'), enc.encode(vaultSalt)], hedgeProgramId);
157
157
  return vaultAddress;
158
158
  });
159
159
  }
@@ -165,6 +165,6 @@ function findVaultAddress(hedgeProgramId, vaultSalt) {
165
165
  */
166
166
  function findAssociatedTokenAddress(hedgeProgramId, walletAddress, tokenMintAddress) {
167
167
  return __awaiter(this, void 0, void 0, function* () {
168
- return (yield web3_js_1.PublicKey.findProgramAddressSync([walletAddress.toBuffer(), spl_token_1.TOKEN_PROGRAM_ID.toBuffer(), tokenMintAddress.toBuffer()], spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID))[0];
168
+ return (yield web3_js_1.PublicKey.findProgramAddress([walletAddress.toBuffer(), spl_token_1.TOKEN_PROGRAM_ID.toBuffer(), tokenMintAddress.toBuffer()], spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID))[0];
169
169
  });
170
170
  }
@@ -165,6 +165,6 @@ function findVaultAddress(hedgeProgramId, vaultSalt) {
165
165
  */
166
166
  function findAssociatedTokenAddress(hedgeProgramId, walletAddress, tokenMintAddress) {
167
167
  return __awaiter(this, void 0, void 0, function* () {
168
- return (yield web3_js_1.PublicKey.findProgramAddressSync([walletAddress.toBuffer(), spl_token_1.TOKEN_PROGRAM_ID.toBuffer(), tokenMintAddress.toBuffer()], spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID))[0];
168
+ return (web3_js_1.PublicKey.findProgramAddressSync([walletAddress.toBuffer(), spl_token_1.TOKEN_PROGRAM_ID.toBuffer(), tokenMintAddress.toBuffer()], spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID))[0];
169
169
  });
170
170
  }