@triadxyz/triad-protocol 1.1.2-beta → 1.1.3-beta

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/index.d.ts CHANGED
@@ -78,9 +78,8 @@ export default class TriadProtocolClient {
78
78
  pnl: import("bn.js");
79
79
  }[];
80
80
  }[]>;
81
- withdrawV1({ wallet, ticker, userPosition, positionIndex }: {
81
+ withdrawV1({ wallet, ticker, positionIndex }: {
82
82
  wallet: PublicKey;
83
- userPosition: PublicKey;
84
83
  ticker: PublicKey;
85
84
  positionIndex: number;
86
85
  }, options?: RpcOptions): Promise<any>;
package/dist/index.js CHANGED
@@ -143,14 +143,15 @@ class TriadProtocolClient {
143
143
  parseFloat(item.totalWithdrawn.toString()));
144
144
  });
145
145
  }
146
- withdrawV1({ wallet, ticker, userPosition, positionIndex }, options) {
146
+ withdrawV1({ wallet, ticker, positionIndex }, options) {
147
147
  return __awaiter(this, void 0, void 0, function* () {
148
148
  const vaultPDA = (0, pda_1.getVaultAddressSync)(this.program.programId, ticker);
149
+ const userPositionPDA = (0, pda_1.getUserPositionPDA)(this.program.programId, wallet, ticker);
149
150
  const VaultTokenAccountPDA = (0, pda_1.getTokenVaultAddressSync)(this.program.programId, vaultPDA);
150
151
  const userTokenAccount = yield (0, spl_token_1.getAssociatedTokenAddress)(new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'), this.provider.wallet.publicKey);
151
152
  return (0, sendTransactionWithOptions_1.default)(this.program.methods.withdrawV1(positionIndex).accounts({
152
153
  signer: wallet,
153
- userPosition,
154
+ userPosition: userPositionPDA,
154
155
  userTokenAccount,
155
156
  vault: vaultPDA,
156
157
  ticker,
@@ -165,7 +165,10 @@ const getReferral = () => __awaiter(void 0, void 0, void 0, function* () {
165
165
  console.log(response);
166
166
  });
167
167
  const getUserPositions = () => __awaiter(void 0, void 0, void 0, function* () {
168
- const response = yield triadProtocol.getUserPositionsWithAmount(wallet.publicKey);
168
+ const response = yield triadProtocol.getUserPositionsWithAmount(new web3_js_1.PublicKey('5U4TmSUBqDaefmamimoSGak8GK5xwXoM5nAaCZJpynpL'));
169
+ console.log(response);
170
+ });
171
+ const getTickers = () => __awaiter(void 0, void 0, void 0, function* () {
172
+ const response = yield triadProtocol.getTickers();
169
173
  console.log(response);
170
174
  });
171
- getUserPositions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "1.1.2-beta",
3
+ "version": "1.1.3-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",