@triadxyz/triad-protocol 4.2.0 → 4.2.1
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 +4 -167
- package/dist/index.js +15 -576
- package/dist/market.d.ts +163 -0
- package/dist/market.js +571 -0
- package/dist/poseidon.d.ts +2 -4
- package/dist/poseidon.js +10 -16
- package/dist/predictor.d.ts +8 -1
- package/dist/predictor.js +34 -14
- package/dist/stake.d.ts +0 -15
- package/dist/stake.js +0 -60
- package/dist/trade.d.ts +7 -6
- package/dist/trade.js +44 -54
- package/dist/types/idl_triad_protocol.json +511 -900
- package/dist/types/index.d.ts +1 -4
- package/dist/types/predictor.d.ts +6 -0
- package/dist/types/trade.d.ts +7 -2
- package/dist/types/triad_protocol.d.ts +619 -1388
- package/dist/utils/helpers.d.ts +2 -2
- package/dist/utils/helpers.js +6 -7
- package/dist/utils/sendVersionedTransaction.js +3 -11
- package/package.json +1 -1
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
import {
|
|
2
|
+
import { IdlAccounts, Program } from '@coral-xyz/anchor';
|
|
3
3
|
import { Market, Order, OrderDirection, OrderSide, OrderStatus, OrderType, OrderDirectionEncoded, OrderTypeEncoded, OrderSideEncoded, OrderStatusEncoded, Pool, BookOrder } from '../types';
|
|
4
4
|
import { Stake, StakeVault, Unstake } from '../types/stake';
|
|
5
5
|
import { Customer } from '../types/customer';
|
|
@@ -26,7 +26,7 @@ export declare const getOrderStatus: (status: OrderStatusEncoded) => OrderStatus
|
|
|
26
26
|
export declare const getOrderDirectionEncoded: (orderDirection: OrderDirection) => OrderDirectionEncoded;
|
|
27
27
|
export declare const getOppositeOrderDirection: (orderDirection: OrderDirection) => OrderDirection;
|
|
28
28
|
export declare const getOppositeOrderDirectionEncoded: (orderDirection: OrderDirectionEncoded) => OrderDirectionEncoded;
|
|
29
|
-
export declare const formatPredictor: (account: IdlAccounts<TriadProtocol>['predictor'], publicKey: PublicKey
|
|
29
|
+
export declare const formatPredictor: (account: IdlAccounts<TriadProtocol>['predictor'], publicKey: PublicKey) => Predictor;
|
|
30
30
|
export declare const getPriceFeedAccountForProgram: (priceFeedId: string) => PublicKey;
|
|
31
31
|
export declare const getFeedIdFromHex: (input?: string) => PublicKey | null;
|
|
32
32
|
export declare const getCustomerById: (program: Program<TriadProtocol>, customerId: number) => Promise<Customer>;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -103,10 +103,7 @@ const formatMarket = (account, address) => {
|
|
|
103
103
|
marketStart: account.marketStart.toString(),
|
|
104
104
|
marketEnd: account.marketEnd.toString(),
|
|
105
105
|
question: Buffer.from(account.question).toString().replace(/\0+$/, ''),
|
|
106
|
-
|
|
107
|
-
payoutFeeClaimed: account.payoutFeeClaimed.toString(),
|
|
108
|
-
marketFeeAvailable: account.marketFeeAvailable.toString(),
|
|
109
|
-
marketFeeClaimed: account.marketFeeClaimed.toString(),
|
|
106
|
+
feeGenerated: account.feeGenerated.toString(),
|
|
110
107
|
winningDirection: types_1.WinningDirection[Object.keys(account.winningDirection)[0].toUpperCase()],
|
|
111
108
|
marketLiquidityAtStart: account.marketLiquidityAtStart.toNumber() > 0
|
|
112
109
|
? account.marketLiquidityAtStart.toString()
|
|
@@ -262,13 +259,15 @@ const getOppositeOrderDirectionEncoded = (orderDirection) => {
|
|
|
262
259
|
return { hype: {} };
|
|
263
260
|
};
|
|
264
261
|
exports.getOppositeOrderDirectionEncoded = getOppositeOrderDirectionEncoded;
|
|
265
|
-
const formatPredictor = (account, publicKey
|
|
262
|
+
const formatPredictor = (account, publicKey) => {
|
|
266
263
|
return {
|
|
267
264
|
address: publicKey.toBase58(),
|
|
268
|
-
authority:
|
|
265
|
+
authority: account.authority.toString(),
|
|
269
266
|
refer: account.refer.toString(),
|
|
270
267
|
customerId: account.customerId,
|
|
271
|
-
balance: balance.toNumber() / 1e6
|
|
268
|
+
balance: account.balance.toNumber() / 1e6,
|
|
269
|
+
rewardsAvailable: account.rewardsAvailable.toNumber() / 1e6,
|
|
270
|
+
rewardsClaimed: account.rewardsClaimed.toNumber() / 1e6
|
|
272
271
|
};
|
|
273
272
|
};
|
|
274
273
|
exports.formatPredictor = formatPredictor;
|
|
@@ -8,12 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
const web3_js_1 = require("@solana/web3.js");
|
|
16
|
-
const getPriorityFee_1 = __importDefault(require("./getPriorityFee"));
|
|
17
13
|
const sendVersionedTransaction = (program, ixs, options, addressLookupTableAccounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
14
|
var _a;
|
|
19
15
|
if (options === null || options === void 0 ? void 0 : options.microLamports) {
|
|
@@ -21,13 +17,9 @@ const sendVersionedTransaction = (program, ixs, options, addressLookupTableAccou
|
|
|
21
17
|
microLamports: options.microLamports
|
|
22
18
|
}));
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
microLamports: priorityFee
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
const { blockhash } = yield program.provider.connection.getLatestBlockhash();
|
|
20
|
+
const { blockhash } = yield program.provider.connection.getLatestBlockhash({
|
|
21
|
+
commitment: 'confirmed'
|
|
22
|
+
});
|
|
31
23
|
if (program.provider.publicKey.toBase58() !== ((_a = options === null || options === void 0 ? void 0 : options.payer) === null || _a === void 0 ? void 0 : _a.toBase58())) {
|
|
32
24
|
return new web3_js_1.VersionedTransaction(new web3_js_1.TransactionMessage({
|
|
33
25
|
instructions: ixs,
|