@triadxyz/triad-protocol 3.1.7-beta → 3.1.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 +10 -12
- package/dist/types/idl_triad_protocol.json +66 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/triad_protocol.d.ts +66 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -278,7 +278,8 @@ class TriadProtocolClient {
|
|
|
278
278
|
ixs.push(yield this.program.methods
|
|
279
279
|
.createSubUserTrade(subUserTradePDA)
|
|
280
280
|
.accounts({
|
|
281
|
-
signer: this.program.provider.publicKey
|
|
281
|
+
signer: this.program.provider.publicKey,
|
|
282
|
+
payer: this.rpcOptions.payer
|
|
282
283
|
})
|
|
283
284
|
.instruction());
|
|
284
285
|
return (0, sendVersionedTransaction_1.default)(this.program, ixs, this.rpcOptions);
|
|
@@ -316,7 +317,8 @@ class TriadProtocolClient {
|
|
|
316
317
|
ixs.push(yield this.program.methods
|
|
317
318
|
.createUserTrade()
|
|
318
319
|
.accounts({
|
|
319
|
-
signer: this.program.provider.publicKey
|
|
320
|
+
signer: this.program.provider.publicKey,
|
|
321
|
+
payer: this.rpcOptions.payer
|
|
320
322
|
})
|
|
321
323
|
.instruction());
|
|
322
324
|
return {
|
|
@@ -328,9 +330,6 @@ class TriadProtocolClient {
|
|
|
328
330
|
try {
|
|
329
331
|
let nonce = null;
|
|
330
332
|
for (const userTrade of myUserTrades) {
|
|
331
|
-
if (userTrade.nonce === '9') {
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
333
|
if (nonce !== null) {
|
|
335
334
|
break;
|
|
336
335
|
}
|
|
@@ -341,7 +340,6 @@ class TriadProtocolClient {
|
|
|
341
340
|
}
|
|
342
341
|
});
|
|
343
342
|
}
|
|
344
|
-
console.log('nonce', nonce);
|
|
345
343
|
if (nonce === null) {
|
|
346
344
|
throw new Error('No open orders found');
|
|
347
345
|
}
|
|
@@ -351,13 +349,13 @@ class TriadProtocolClient {
|
|
|
351
349
|
};
|
|
352
350
|
}
|
|
353
351
|
catch (_a) {
|
|
354
|
-
console.log('No open orders found');
|
|
355
352
|
const mainUserTrade = myUserTrades.find((trade) => !trade.isSubUser);
|
|
356
353
|
const subUserTradePDA = (0, pda_1.getSubUserTradePDA)(this.program.programId, this.program.provider.publicKey, Number(mainUserTrade.nonce) + 1);
|
|
357
354
|
ixs.push(yield this.program.methods
|
|
358
355
|
.createSubUserTrade(subUserTradePDA)
|
|
359
356
|
.accounts({
|
|
360
|
-
signer: this.program.provider.publicKey
|
|
357
|
+
signer: this.program.provider.publicKey,
|
|
358
|
+
payer: this.rpcOptions.payer
|
|
361
359
|
})
|
|
362
360
|
.instruction());
|
|
363
361
|
return {
|
|
@@ -435,11 +433,11 @@ class TriadProtocolClient {
|
|
|
435
433
|
return;
|
|
436
434
|
}
|
|
437
435
|
}
|
|
438
|
-
const { userTradePDA, userTradeIxs } = yield this.getUserTradeNonce(marketId, Object.keys(orders[0].orderDirection)[0]);
|
|
439
|
-
if (userTradeIxs.length > 0) {
|
|
440
|
-
ixs.push(...userTradeIxs);
|
|
441
|
-
}
|
|
442
436
|
for (const order of orders) {
|
|
437
|
+
const { userTradePDA, userTradeIxs } = yield this.getUserTradeNonce(marketId, Object.keys(order.orderDirection)[0]);
|
|
438
|
+
if (userTradeIxs.length > 0) {
|
|
439
|
+
ixs.push(...userTradeIxs);
|
|
440
|
+
}
|
|
443
441
|
ixs.push(yield this.program.methods
|
|
444
442
|
.placeBidOrder({
|
|
445
443
|
amount: new bn_js_1.default(order.amount * Math.pow(10, constants_1.BASE_DECIMALS)),
|
|
@@ -3028,6 +3028,10 @@
|
|
|
3028
3028
|
"name": "ClaimTokenEvent",
|
|
3029
3029
|
"discriminator": [127, 10, 14, 49, 47, 171, 31, 127]
|
|
3030
3030
|
},
|
|
3031
|
+
{
|
|
3032
|
+
"name": "ClaimVaultEvent",
|
|
3033
|
+
"discriminator": [106, 57, 180, 175, 87, 6, 132, 91]
|
|
3034
|
+
},
|
|
3031
3035
|
{
|
|
3032
3036
|
"name": "CollectMarketFeeEvent",
|
|
3033
3037
|
"discriminator": [210, 147, 203, 216, 158, 111, 59, 143]
|
|
@@ -3563,6 +3567,68 @@
|
|
|
3563
3567
|
]
|
|
3564
3568
|
}
|
|
3565
3569
|
},
|
|
3570
|
+
{
|
|
3571
|
+
"name": "ClaimVaultEvent",
|
|
3572
|
+
"type": {
|
|
3573
|
+
"kind": "struct",
|
|
3574
|
+
"fields": [
|
|
3575
|
+
{
|
|
3576
|
+
"name": "authority",
|
|
3577
|
+
"type": "pubkey"
|
|
3578
|
+
},
|
|
3579
|
+
{
|
|
3580
|
+
"name": "init_ts",
|
|
3581
|
+
"type": "i64"
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
"name": "end_ts",
|
|
3585
|
+
"type": "i64"
|
|
3586
|
+
},
|
|
3587
|
+
{
|
|
3588
|
+
"name": "total_amount",
|
|
3589
|
+
"type": "u64"
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
"name": "total_claimed",
|
|
3593
|
+
"type": "u64"
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
"name": "total_users",
|
|
3597
|
+
"type": "u64"
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
"name": "claimed_users",
|
|
3601
|
+
"type": "u64"
|
|
3602
|
+
},
|
|
3603
|
+
{
|
|
3604
|
+
"name": "token_per_user",
|
|
3605
|
+
"type": "u64"
|
|
3606
|
+
},
|
|
3607
|
+
{
|
|
3608
|
+
"name": "mint",
|
|
3609
|
+
"type": "pubkey"
|
|
3610
|
+
},
|
|
3611
|
+
{
|
|
3612
|
+
"name": "is_active",
|
|
3613
|
+
"type": "bool"
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
"name": "name",
|
|
3617
|
+
"type": "string"
|
|
3618
|
+
},
|
|
3619
|
+
{
|
|
3620
|
+
"name": "is_first_come_first_served",
|
|
3621
|
+
"type": "bool"
|
|
3622
|
+
},
|
|
3623
|
+
{
|
|
3624
|
+
"name": "merkle_root",
|
|
3625
|
+
"type": {
|
|
3626
|
+
"array": ["u8", 32]
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
]
|
|
3630
|
+
}
|
|
3631
|
+
},
|
|
3566
3632
|
{
|
|
3567
3633
|
"name": "ClaimedUser",
|
|
3568
3634
|
"type": {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4131,6 +4131,10 @@ export type TriadProtocol = {
|
|
|
4131
4131
|
name: 'claimTokenEvent';
|
|
4132
4132
|
discriminator: [127, 10, 14, 49, 47, 171, 31, 127];
|
|
4133
4133
|
},
|
|
4134
|
+
{
|
|
4135
|
+
name: 'claimVaultEvent';
|
|
4136
|
+
discriminator: [106, 57, 180, 175, 87, 6, 132, 91];
|
|
4137
|
+
},
|
|
4134
4138
|
{
|
|
4135
4139
|
name: 'collectMarketFeeEvent';
|
|
4136
4140
|
discriminator: [210, 147, 203, 216, 158, 111, 59, 143];
|
|
@@ -4666,6 +4670,68 @@ export type TriadProtocol = {
|
|
|
4666
4670
|
];
|
|
4667
4671
|
};
|
|
4668
4672
|
},
|
|
4673
|
+
{
|
|
4674
|
+
name: 'claimVaultEvent';
|
|
4675
|
+
type: {
|
|
4676
|
+
kind: 'struct';
|
|
4677
|
+
fields: [
|
|
4678
|
+
{
|
|
4679
|
+
name: 'authority';
|
|
4680
|
+
type: 'pubkey';
|
|
4681
|
+
},
|
|
4682
|
+
{
|
|
4683
|
+
name: 'initTs';
|
|
4684
|
+
type: 'i64';
|
|
4685
|
+
},
|
|
4686
|
+
{
|
|
4687
|
+
name: 'endTs';
|
|
4688
|
+
type: 'i64';
|
|
4689
|
+
},
|
|
4690
|
+
{
|
|
4691
|
+
name: 'totalAmount';
|
|
4692
|
+
type: 'u64';
|
|
4693
|
+
},
|
|
4694
|
+
{
|
|
4695
|
+
name: 'totalClaimed';
|
|
4696
|
+
type: 'u64';
|
|
4697
|
+
},
|
|
4698
|
+
{
|
|
4699
|
+
name: 'totalUsers';
|
|
4700
|
+
type: 'u64';
|
|
4701
|
+
},
|
|
4702
|
+
{
|
|
4703
|
+
name: 'claimedUsers';
|
|
4704
|
+
type: 'u64';
|
|
4705
|
+
},
|
|
4706
|
+
{
|
|
4707
|
+
name: 'tokenPerUser';
|
|
4708
|
+
type: 'u64';
|
|
4709
|
+
},
|
|
4710
|
+
{
|
|
4711
|
+
name: 'mint';
|
|
4712
|
+
type: 'pubkey';
|
|
4713
|
+
},
|
|
4714
|
+
{
|
|
4715
|
+
name: 'isActive';
|
|
4716
|
+
type: 'bool';
|
|
4717
|
+
},
|
|
4718
|
+
{
|
|
4719
|
+
name: 'name';
|
|
4720
|
+
type: 'string';
|
|
4721
|
+
},
|
|
4722
|
+
{
|
|
4723
|
+
name: 'isFirstComeFirstServed';
|
|
4724
|
+
type: 'bool';
|
|
4725
|
+
},
|
|
4726
|
+
{
|
|
4727
|
+
name: 'merkleRoot';
|
|
4728
|
+
type: {
|
|
4729
|
+
array: ['u8', 32];
|
|
4730
|
+
};
|
|
4731
|
+
}
|
|
4732
|
+
];
|
|
4733
|
+
};
|
|
4734
|
+
},
|
|
4669
4735
|
{
|
|
4670
4736
|
name: 'claimedUser';
|
|
4671
4737
|
type: {
|