@triadxyz/triad-protocol 2.5.1-beta → 2.5.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
@@ -5,6 +5,10 @@ import { TriadProtocol } from './types/triad_protocol';
5
5
  import { CreateMarketArgs, OpenOrderArgs, UserTrade, CreateCustomerArgs, MarketBidOrderArgs, CancelBidOrderArgs, CancelAskOrderArgs, PlaceBidOrderArgs, PlaceAskOrderArgs, CreatePoolArgs, BookOrder, MarketAskOrderArgs, RpcOptions, CollectMarketFeeArgs } from './types';
6
6
  import Stake from './stake';
7
7
  import Poseidon from './poseidon';
8
+ export * from './types';
9
+ export * from './types/stake';
10
+ export * from './types/poseidon';
11
+ export * from './utils/helpers';
8
12
  export default class TriadProtocolClient {
9
13
  program: Program<TriadProtocol>;
10
14
  provider: AnchorProvider;
package/dist/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
17
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
18
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -24,6 +38,10 @@ const sendVersionedTransaction_1 = __importDefault(require("./utils/sendVersione
24
38
  const swap_1 = require("./utils/swap");
25
39
  const stake_1 = __importDefault(require("./stake"));
26
40
  const poseidon_1 = __importDefault(require("./poseidon"));
41
+ __exportStar(require("./types"), exports);
42
+ __exportStar(require("./types/stake"), exports);
43
+ __exportStar(require("./types/poseidon"), exports);
44
+ __exportStar(require("./utils/helpers"), exports);
27
45
  class TriadProtocolClient {
28
46
  constructor(connection, wallet) {
29
47
  this.decimals = constants_1.TRD_DECIMALS; // We're using only TRD or USDC so we can use the same decimals 6
package/dist/stake.d.ts CHANGED
@@ -70,7 +70,7 @@ export default class Stake {
70
70
  * @param options - RPC options
71
71
  *
72
72
  */
73
- unstakeToken(options?: RpcOptions): Promise<string>;
73
+ unstakeToken(unstakePDA: PublicKey, options?: RpcOptions): Promise<string>;
74
74
  /**
75
75
  * Claim Stake Rewards
76
76
  * @param options - RPC options
package/dist/stake.js CHANGED
@@ -80,7 +80,7 @@ class Stake {
80
80
  }
81
81
  }
82
82
  ]);
83
- return stake.map((stake) => (0, helpers_1.formatUnstake)(stake.account));
83
+ return stake.map((stake) => (0, helpers_1.formatUnstake)(stake.account, stake.publicKey));
84
84
  });
85
85
  }
86
86
  /**
@@ -155,13 +155,14 @@ class Stake {
155
155
  * @param options - RPC options
156
156
  *
157
157
  */
158
- unstakeToken(options) {
158
+ unstakeToken(unstakePDA, options) {
159
159
  return __awaiter(this, void 0, void 0, function* () {
160
160
  const ixs = [];
161
161
  ixs.push(yield this.program.methods
162
162
  .unstakeToken()
163
163
  .accounts({
164
- signer: this.program.provider.publicKey
164
+ signer: this.program.provider.publicKey,
165
+ unstake: unstakePDA
165
166
  })
166
167
  .instruction());
167
168
  return (0, sendVersionedTransaction_1.default)(this.program, ixs, options);
@@ -33,6 +33,7 @@ export type StakeV2 = {
33
33
  amount: number;
34
34
  };
35
35
  export type Unstake = {
36
+ address: string;
36
37
  authority: string;
37
38
  amount: number;
38
39
  withdrawTs: number;
@@ -8,7 +8,7 @@ export declare const decodeString: (bytes: number[]) => string;
8
8
  export declare const formatStakeVault: (stakeVault: IdlAccounts<TriadProtocol>['stakeVault']) => StakeVault;
9
9
  export declare const formatStakeV2: (stake: IdlAccounts<TriadProtocol>['stakeV2']) => StakeV2;
10
10
  export declare const formatStake: (stake: IdlAccounts<TriadProtocol>['stakeV3']) => StakeV3;
11
- export declare const formatUnstake: (unstake: IdlAccounts<TriadProtocol>['unstake']) => Unstake;
11
+ export declare const formatUnstake: (unstake: IdlAccounts<TriadProtocol>['unstake'], address: PublicKey) => Unstake;
12
12
  export declare const formatPool: (account: IdlAccounts<TriadProtocol>['pool'], address: PublicKey) => Pool;
13
13
  export declare const formatMarket: (account: IdlAccounts<TriadProtocol>['marketV2'], address: PublicKey) => Market;
14
14
  export declare const formatUserTrade: (account: IdlAccounts<TriadProtocol>['userTrade'], publicKey: PublicKey) => UserTrade;
@@ -63,8 +63,9 @@ const formatStake = (stake) => {
63
63
  };
64
64
  };
65
65
  exports.formatStake = formatStake;
66
- const formatUnstake = (unstake) => {
66
+ const formatUnstake = (unstake, address) => {
67
67
  return {
68
+ address: address.toBase58(),
68
69
  authority: unstake.authority.toBase58(),
69
70
  amount: unstake.amount.toNumber() / Math.pow(10, 6),
70
71
  withdrawTs: unstake.withdrawTs.toNumber()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "2.5.1-beta",
3
+ "version": "2.5.3-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",