@triadxyz/triad-protocol 1.9.6-beta → 1.9.8-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.js +26 -44
- package/dist/trade.d.ts +2 -2
- package/dist/trade.js +23 -13
- package/dist/types/idl_triad_protocol.json +2 -2
- package/dist/types/index.d.ts +0 -30
- package/dist/types/stake.d.ts +0 -38
- package/dist/types/stake.js +0 -10
- package/dist/types/trade.d.ts +2 -17
- package/dist/types/triad_protocol.d.ts +2 -2
- package/dist/utils/helpers.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,20 +43,17 @@ class TriadProtocolClient {
|
|
|
43
43
|
transferPoseidon(args, verifier, options) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const ixs = [];
|
|
46
|
-
const PoseidonCollectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL);
|
|
47
|
-
const TicketCollectionPDA = (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.TICKET_COLLECTION_SYMBOL);
|
|
48
46
|
for (const arg of args) {
|
|
49
|
-
const NftPDA = (0, pda_1.getNftPDA)(this.program.programId, arg.ticketNumber);
|
|
50
47
|
ixs.push(yield this.program.methods
|
|
51
48
|
.transferPoseidon()
|
|
52
49
|
.accounts({
|
|
53
50
|
signer: this.provider.wallet.publicKey,
|
|
54
|
-
nft:
|
|
51
|
+
nft: (0, pda_1.getNftPDA)(this.program.programId, arg.ticketNumber),
|
|
55
52
|
poseidonAsset: arg.poseidonAsset,
|
|
56
53
|
ticketAsset: arg.ticketAsset,
|
|
57
54
|
verifier: constants_1.VERIFIER,
|
|
58
|
-
poseidonCollection:
|
|
59
|
-
ticketCollection:
|
|
55
|
+
poseidonCollection: (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL),
|
|
56
|
+
ticketCollection: (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.TICKET_COLLECTION_SYMBOL),
|
|
60
57
|
coreTicketCollection: constants_1.TICKET_CORE_COLLECTION,
|
|
61
58
|
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION
|
|
62
59
|
})
|
|
@@ -73,17 +70,13 @@ class TriadProtocolClient {
|
|
|
73
70
|
* @param options - RPC options
|
|
74
71
|
*/
|
|
75
72
|
withdrawPoseidon({ poseidonAsset, nft }, options) {
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
poseidonCollection: PoseidonCollectionPDA,
|
|
84
|
-
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION
|
|
85
|
-
}), options);
|
|
86
|
-
});
|
|
73
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.withdrawPoseidon().accounts({
|
|
74
|
+
signer: this.provider.wallet.publicKey,
|
|
75
|
+
nft: (0, pda_1.getPoseidonPDA)(this.program.programId, nft),
|
|
76
|
+
poseidonAsset,
|
|
77
|
+
poseidonCollection: (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL),
|
|
78
|
+
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION
|
|
79
|
+
}), options);
|
|
87
80
|
}
|
|
88
81
|
/**
|
|
89
82
|
* Collect Royalty
|
|
@@ -92,13 +85,10 @@ class TriadProtocolClient {
|
|
|
92
85
|
* @param options - RPC options
|
|
93
86
|
*/
|
|
94
87
|
collectRoyalty(collection, options) {
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
collection: collectionPDA
|
|
100
|
-
}), options);
|
|
101
|
-
});
|
|
88
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.collectRoyalty().accounts({
|
|
89
|
+
signer: this.provider.wallet.publicKey,
|
|
90
|
+
collection: (0, pda_1.getCollectionPDA)(this.program.programId, collection)
|
|
91
|
+
}), options);
|
|
102
92
|
}
|
|
103
93
|
/**
|
|
104
94
|
* Add Trader Poseidon
|
|
@@ -108,16 +98,12 @@ class TriadProtocolClient {
|
|
|
108
98
|
* @param options - RPC options
|
|
109
99
|
*/
|
|
110
100
|
addTraderPoseidon({ user, poseidonAsset }, options) {
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION,
|
|
118
|
-
poseidonCollection: PoseidonCollectionPDA
|
|
119
|
-
}), options);
|
|
120
|
-
});
|
|
101
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.addTraderPoseidon().accounts({
|
|
102
|
+
poseidonAsset,
|
|
103
|
+
userTrade: (0, trade_2.getUserTradePDA)(this.program.programId, user),
|
|
104
|
+
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION,
|
|
105
|
+
poseidonCollection: (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL)
|
|
106
|
+
}), options);
|
|
121
107
|
}
|
|
122
108
|
/**
|
|
123
109
|
* Remove Trader Poseidon
|
|
@@ -126,16 +112,12 @@ class TriadProtocolClient {
|
|
|
126
112
|
* @param options - RPC options
|
|
127
113
|
*/
|
|
128
114
|
removeTraderPoseidon({ user, poseidonAsset }, options) {
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION,
|
|
136
|
-
poseidonCollection: PoseidonCollectionPDA
|
|
137
|
-
}), options);
|
|
138
|
-
});
|
|
115
|
+
return (0, sendTransactionWithOptions_1.default)(this.program.methods.removeTraderPoseidon().accounts({
|
|
116
|
+
userTrade: (0, trade_2.getUserTradePDA)(this.program.programId, user),
|
|
117
|
+
poseidonAsset,
|
|
118
|
+
corePoseidonCollection: constants_1.POSEIDON_CORE_COLLECTION,
|
|
119
|
+
poseidonCollection: (0, pda_1.getCollectionPDA)(this.program.programId, constants_1.POSEIDON_COLLECTION_SYMBOL)
|
|
120
|
+
}), options);
|
|
139
121
|
}
|
|
140
122
|
}
|
|
141
123
|
exports.default = TriadProtocolClient;
|
package/dist/trade.d.ts
CHANGED
|
@@ -220,12 +220,12 @@ export default class Trade {
|
|
|
220
220
|
* @param options - RPC options
|
|
221
221
|
*
|
|
222
222
|
*/
|
|
223
|
-
payoutOrder(
|
|
223
|
+
payoutOrder(orders: {
|
|
224
224
|
marketId: number;
|
|
225
225
|
orderId: number;
|
|
226
226
|
userNonce: number;
|
|
227
227
|
mint: PublicKey;
|
|
228
|
-
}, options?: RpcOptions): Promise<string>;
|
|
228
|
+
}[], options?: RpcOptions): Promise<string>;
|
|
229
229
|
/**
|
|
230
230
|
* Allow Market to Payout
|
|
231
231
|
* @param marketId - The ID of the market
|
package/dist/trade.js
CHANGED
|
@@ -248,21 +248,31 @@ class Trade {
|
|
|
248
248
|
* @param options - RPC options
|
|
249
249
|
*
|
|
250
250
|
*/
|
|
251
|
-
payoutOrder(
|
|
251
|
+
payoutOrder(orders, options) {
|
|
252
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const subUserTradePDA = (0, trade_2.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, userNonce);
|
|
257
|
-
userTradePDA = (0, trade_2.getUserTradePDA)(this.program.programId, subUserTradePDA);
|
|
253
|
+
const ixs = [];
|
|
254
|
+
if (orders.length > 10) {
|
|
255
|
+
throw new Error('Max 10 orders per transaction');
|
|
258
256
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
257
|
+
for (const order of orders) {
|
|
258
|
+
const marketPDA = (0, trade_2.getMarketPDA)(this.program.programId, order.marketId);
|
|
259
|
+
let userTradePDA = (0, trade_2.getUserTradePDA)(this.program.programId, this.provider.publicKey);
|
|
260
|
+
if (order.userNonce !== 0) {
|
|
261
|
+
const subUserTradePDA = (0, trade_2.getSubUserTradePDA)(this.program.programId, this.provider.publicKey, order.userNonce);
|
|
262
|
+
userTradePDA = (0, trade_2.getUserTradePDA)(this.program.programId, subUserTradePDA);
|
|
263
|
+
}
|
|
264
|
+
ixs.push(yield this.program.methods
|
|
265
|
+
.payoutOrder(new bn_js_1.default(order.orderId))
|
|
266
|
+
.accounts({
|
|
267
|
+
signer: this.provider.publicKey,
|
|
268
|
+
userTrade: userTradePDA,
|
|
269
|
+
market: marketPDA,
|
|
270
|
+
mint: order.mint,
|
|
271
|
+
tokenProgram: (0, helpers_1.getTokenProgram)(order.mint)
|
|
272
|
+
})
|
|
273
|
+
.instruction());
|
|
274
|
+
}
|
|
275
|
+
return (0, sendVersionedTransaction_1.default)(this.provider, ixs, options);
|
|
266
276
|
});
|
|
267
277
|
}
|
|
268
278
|
/**
|
|
@@ -2452,11 +2452,11 @@
|
|
|
2452
2452
|
"type": "u16"
|
|
2453
2453
|
},
|
|
2454
2454
|
{
|
|
2455
|
-
"name": "
|
|
2455
|
+
"name": "payout_fee_available",
|
|
2456
2456
|
"type": "u64"
|
|
2457
2457
|
},
|
|
2458
2458
|
{
|
|
2459
|
-
"name": "
|
|
2459
|
+
"name": "payout_fee_claimed",
|
|
2460
2460
|
"type": "u64"
|
|
2461
2461
|
},
|
|
2462
2462
|
{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,36 +4,6 @@ export type RpcOptions = {
|
|
|
4
4
|
microLamports?: number;
|
|
5
5
|
computeBudget?: number;
|
|
6
6
|
};
|
|
7
|
-
export type MintTicketArgs = {
|
|
8
|
-
discount: number;
|
|
9
|
-
isBoosted: boolean;
|
|
10
|
-
rarity: {
|
|
11
|
-
common: {};
|
|
12
|
-
} | {
|
|
13
|
-
uncommon: {};
|
|
14
|
-
} | {
|
|
15
|
-
rare: {};
|
|
16
|
-
} | {
|
|
17
|
-
legendary: {};
|
|
18
|
-
} | {
|
|
19
|
-
epic: {};
|
|
20
|
-
} | {
|
|
21
|
-
mythic: {};
|
|
22
|
-
};
|
|
23
|
-
verifier: string;
|
|
24
|
-
nftMint: PublicKey;
|
|
25
|
-
};
|
|
26
|
-
export type OrderStatus = {
|
|
27
|
-
init: {};
|
|
28
|
-
} | {
|
|
29
|
-
open: {};
|
|
30
|
-
} | {
|
|
31
|
-
closed: {};
|
|
32
|
-
} | {
|
|
33
|
-
claimed: {};
|
|
34
|
-
} | {
|
|
35
|
-
liquidated: {};
|
|
36
|
-
};
|
|
37
7
|
export type TransferPoseidonArgs = {
|
|
38
8
|
poseidonAsset: PublicKey;
|
|
39
9
|
ticketAsset: PublicKey;
|
package/dist/types/stake.d.ts
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
|
-
export type Collection = 'alligators' | 'coleta' | 'undead' | 'pyth';
|
|
4
|
-
export type StakeNftArgs = {
|
|
5
|
-
wallet: PublicKey;
|
|
6
|
-
items: {
|
|
7
|
-
mint: PublicKey;
|
|
8
|
-
name: string;
|
|
9
|
-
}[];
|
|
10
|
-
};
|
|
11
3
|
export type StakeTokenArgs = {
|
|
12
4
|
name: string;
|
|
13
5
|
wallet: PublicKey;
|
|
14
6
|
amount: number;
|
|
15
7
|
};
|
|
16
|
-
export type InitializeStakeArgs = {
|
|
17
|
-
name: string;
|
|
18
|
-
slots: BN;
|
|
19
|
-
amount: BN;
|
|
20
|
-
collection: string;
|
|
21
|
-
};
|
|
22
8
|
export type UpdateStakeVaultArgs = {
|
|
23
9
|
amount?: BN;
|
|
24
10
|
isLocked?: boolean;
|
|
@@ -39,30 +25,6 @@ export type ClaimStakeRewardsArgs = {
|
|
|
39
25
|
stake: Stake;
|
|
40
26
|
collections: number;
|
|
41
27
|
};
|
|
42
|
-
export type UpdateBoostArgs = {
|
|
43
|
-
wallet: PublicKey;
|
|
44
|
-
nfts: {
|
|
45
|
-
name: string;
|
|
46
|
-
wallet: string;
|
|
47
|
-
}[];
|
|
48
|
-
};
|
|
49
|
-
export type UpdateStakeRewardsArgs = {
|
|
50
|
-
day: number;
|
|
51
|
-
wallet: PublicKey;
|
|
52
|
-
items: {
|
|
53
|
-
rewards: BN;
|
|
54
|
-
apr: number;
|
|
55
|
-
nftName: string;
|
|
56
|
-
}[];
|
|
57
|
-
};
|
|
58
|
-
export declare enum RARITY_WEIGHT {
|
|
59
|
-
COMMON = 1,
|
|
60
|
-
UNCOMMON = 2,
|
|
61
|
-
RARE = 3,
|
|
62
|
-
EPIC = 4,
|
|
63
|
-
LEGENDARY = 5,
|
|
64
|
-
MYTHIC = 6
|
|
65
|
-
}
|
|
66
28
|
export type StakeVault = {
|
|
67
29
|
name: string;
|
|
68
30
|
collection: string;
|
package/dist/types/stake.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RARITY_WEIGHT = void 0;
|
|
4
|
-
var RARITY_WEIGHT;
|
|
5
|
-
(function (RARITY_WEIGHT) {
|
|
6
|
-
RARITY_WEIGHT[RARITY_WEIGHT["COMMON"] = 1] = "COMMON";
|
|
7
|
-
RARITY_WEIGHT[RARITY_WEIGHT["UNCOMMON"] = 2] = "UNCOMMON";
|
|
8
|
-
RARITY_WEIGHT[RARITY_WEIGHT["RARE"] = 3] = "RARE";
|
|
9
|
-
RARITY_WEIGHT[RARITY_WEIGHT["EPIC"] = 4] = "EPIC";
|
|
10
|
-
RARITY_WEIGHT[RARITY_WEIGHT["LEGENDARY"] = 5] = "LEGENDARY";
|
|
11
|
-
RARITY_WEIGHT[RARITY_WEIGHT["MYTHIC"] = 6] = "MYTHIC";
|
|
12
|
-
})(RARITY_WEIGHT || (exports.RARITY_WEIGHT = RARITY_WEIGHT = {}));
|
package/dist/types/trade.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export type Market = {
|
|
|
17
17
|
nextOrderId: string;
|
|
18
18
|
feeBps: number;
|
|
19
19
|
isAllowedToPayout: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
payoutFeeAvailable: string;
|
|
21
|
+
payoutFeeClaimed: string;
|
|
22
22
|
marketFeeAvailable: string;
|
|
23
23
|
marketFeeClaimed: string;
|
|
24
24
|
marketStart: string;
|
|
@@ -92,8 +92,6 @@ export type PlaceBidOrderArgs = {
|
|
|
92
92
|
flop: {};
|
|
93
93
|
};
|
|
94
94
|
mint: PublicKey;
|
|
95
|
-
bidOrderId: number | null;
|
|
96
|
-
bidNonce: number | null;
|
|
97
95
|
};
|
|
98
96
|
export type PlaceAskOrderArgs = {
|
|
99
97
|
marketId: number;
|
|
@@ -115,19 +113,6 @@ export type InitializeMarketArgs = {
|
|
|
115
113
|
feeBps: number;
|
|
116
114
|
customer: PublicKey | null;
|
|
117
115
|
};
|
|
118
|
-
export type UpdateMarketArgs = {
|
|
119
|
-
marketId: number;
|
|
120
|
-
marketEnd?: number;
|
|
121
|
-
winningDirection?: {
|
|
122
|
-
hype: {};
|
|
123
|
-
} | {
|
|
124
|
-
flop: {};
|
|
125
|
-
} | {
|
|
126
|
-
none: {};
|
|
127
|
-
} | {
|
|
128
|
-
draw: {};
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
116
|
export type CreateCustomerArgs = {
|
|
132
117
|
id: number;
|
|
133
118
|
name: string;
|
|
@@ -3154,11 +3154,11 @@ export type TriadProtocol = {
|
|
|
3154
3154
|
type: 'u16';
|
|
3155
3155
|
},
|
|
3156
3156
|
{
|
|
3157
|
-
name: '
|
|
3157
|
+
name: 'payoutFeeAvailable';
|
|
3158
3158
|
type: 'u64';
|
|
3159
3159
|
},
|
|
3160
3160
|
{
|
|
3161
|
-
name: '
|
|
3161
|
+
name: 'payoutFeeClaimed';
|
|
3162
3162
|
type: 'u64';
|
|
3163
3163
|
},
|
|
3164
3164
|
{
|
package/dist/utils/helpers.js
CHANGED
|
@@ -74,8 +74,8 @@ const formatMarket = (account, address) => {
|
|
|
74
74
|
marketStart: account.marketStart.toString(),
|
|
75
75
|
marketEnd: account.marketEnd.toString(),
|
|
76
76
|
question: Buffer.from(account.question).toString().replace(/\0+$/, ''),
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
payoutFeeAvailable: account.payoutFeeAvailable.toString(),
|
|
78
|
+
payoutFeeClaimed: account.payoutFeeClaimed.toString(),
|
|
79
79
|
marketFeeAvailable: account.marketFeeAvailable.toString(),
|
|
80
80
|
marketFeeClaimed: account.marketFeeClaimed.toString(),
|
|
81
81
|
winningDirection: trade_1.WinningDirection[Object.keys(account.winningDirection)[0].toUpperCase()],
|