@triadxyz/triad-protocol 3.2.8-beta → 3.3.0-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/claim.d.ts +1 -1
- package/dist/claim.js +11 -2
- package/dist/index.js +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/swap.d.ts +3 -3
- package/dist/utils/swap.js +3 -3
- package/package.json +1 -1
package/dist/claim.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export default class Claim {
|
|
|
49
49
|
* @param claimVaultName - Claim vault name
|
|
50
50
|
* @param mint - Mint
|
|
51
51
|
*/
|
|
52
|
-
updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint,
|
|
52
|
+
updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint, claimData }: UpdateClaimVaultAmountArgs): Promise<string | import("@solana/web3.js").VersionedTransaction>;
|
|
53
53
|
/**
|
|
54
54
|
* Update Claim Vault End Ts
|
|
55
55
|
* @param endTs - End ts
|
package/dist/claim.js
CHANGED
|
@@ -94,7 +94,11 @@ class Claim {
|
|
|
94
94
|
*/
|
|
95
95
|
createClaimVault({ totalAmount, totalUsers, name, isFirstComeFirstServed, endTs, claimData, mint }) {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
|
|
97
|
+
let merkleRoot = null;
|
|
98
|
+
if (claimData) {
|
|
99
|
+
const { merkleRoot: root } = (0, merkle_1.generateMerkleTree)(claimData);
|
|
100
|
+
merkleRoot = root;
|
|
101
|
+
}
|
|
98
102
|
const ixs = [
|
|
99
103
|
yield this.program.methods
|
|
100
104
|
.createClaimVault({
|
|
@@ -141,8 +145,13 @@ class Claim {
|
|
|
141
145
|
* @param claimVaultName - Claim vault name
|
|
142
146
|
* @param mint - Mint
|
|
143
147
|
*/
|
|
144
|
-
updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint,
|
|
148
|
+
updateClaimVaultAmount({ amount, newUsers, claimVaultName, mint, claimData }) {
|
|
145
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
let merkleRoot = null;
|
|
151
|
+
if (claimData) {
|
|
152
|
+
const { merkleRoot: root } = (0, merkle_1.generateMerkleTree)(claimData);
|
|
153
|
+
merkleRoot = root;
|
|
154
|
+
}
|
|
146
155
|
const ixs = [
|
|
147
156
|
yield this.program.methods
|
|
148
157
|
.updateClaimVaultAmount({
|
package/dist/index.js
CHANGED
|
@@ -519,7 +519,7 @@ class TriadProtocolClient {
|
|
|
519
519
|
inToken: token,
|
|
520
520
|
outToken: constants_1.TRD_MINT.toString(),
|
|
521
521
|
amount,
|
|
522
|
-
|
|
522
|
+
payer: this.rpcOptions.payer.toBase58()
|
|
523
523
|
});
|
|
524
524
|
amountInTRD = outAmount;
|
|
525
525
|
if (swapIxs.length === 0) {
|
|
@@ -752,7 +752,7 @@ class TriadProtocolClient {
|
|
|
752
752
|
inToken: constants_1.TRD_MINT.toString(),
|
|
753
753
|
outToken: constants_1.USDC_MINT.toString(),
|
|
754
754
|
amount: Math.floor(amountInTRD),
|
|
755
|
-
|
|
755
|
+
payer: this.rpcOptions.payer.toBase58()
|
|
756
756
|
});
|
|
757
757
|
if (swapIxs.length === 0) {
|
|
758
758
|
return;
|
|
@@ -946,7 +946,7 @@ class TriadProtocolClient {
|
|
|
946
946
|
inToken: constants_1.TRD_MINT.toString(),
|
|
947
947
|
outToken: constants_1.USDC_MINT.toString(),
|
|
948
948
|
amount: Math.floor(amountInTRD),
|
|
949
|
-
|
|
949
|
+
payer: this.rpcOptions.payer.toBase58()
|
|
950
950
|
});
|
|
951
951
|
if (swapIxs.length === 0) {
|
|
952
952
|
return;
|
|
@@ -1087,7 +1087,7 @@ class TriadProtocolClient {
|
|
|
1087
1087
|
inToken: constants_1.USDC_MINT.toBase58(),
|
|
1088
1088
|
outToken: constants_1.TRD_MINT.toString(),
|
|
1089
1089
|
amount: amountOfUSDC.toNumber() / Math.pow(10, 6),
|
|
1090
|
-
|
|
1090
|
+
payer: this.rpcOptions.payer.toBase58()
|
|
1091
1091
|
});
|
|
1092
1092
|
if (swapIxs.length > 0) {
|
|
1093
1093
|
ixs.push(...setupInstructions);
|
package/dist/types/index.d.ts
CHANGED
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AddressLookupTableAccount, Connection, TransactionInstruction } from '@solana/web3.js';
|
|
2
|
-
export declare const swap: ({ connection, wallet, inToken, outToken, amount,
|
|
2
|
+
export declare const swap: ({ connection, wallet, inToken, outToken, amount, payer }: {
|
|
3
3
|
connection: Connection;
|
|
4
4
|
wallet: string;
|
|
5
5
|
inToken: string;
|
|
6
6
|
outToken: string;
|
|
7
7
|
amount: number;
|
|
8
|
-
|
|
8
|
+
payer: string;
|
|
9
9
|
}) => Promise<{
|
|
10
10
|
swapIxs: TransactionInstruction[];
|
|
11
11
|
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
12
|
-
setupInstructions:
|
|
12
|
+
setupInstructions: any[];
|
|
13
13
|
outAmount: any;
|
|
14
14
|
}>;
|
|
15
15
|
export declare const getPrice: (token: string) => Promise<any>;
|
package/dist/utils/swap.js
CHANGED
|
@@ -18,7 +18,7 @@ const web3_js_1 = require("@solana/web3.js");
|
|
|
18
18
|
const spl_token_1 = require("@solana/spl-token");
|
|
19
19
|
const pda_1 = require("./pda");
|
|
20
20
|
const constants_1 = require("./constants");
|
|
21
|
-
const swap = ({ connection, wallet, inToken, outToken, amount,
|
|
21
|
+
const swap = ({ connection, wallet, inToken, outToken, amount, payer }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
22
|
const token = TOKENS[inToken];
|
|
23
23
|
if (!token) {
|
|
24
24
|
throw new Error('Token not found');
|
|
@@ -29,7 +29,7 @@ const swap = ({ connection, wallet, inToken, outToken, amount, feePayer }) => __
|
|
|
29
29
|
const swapResponse = yield axios_1.default.post('https://lite-api.jup.ag/swap/v1/swap-instructions', {
|
|
30
30
|
quoteResponse: quoteData,
|
|
31
31
|
userPublicKey: wallet,
|
|
32
|
-
|
|
32
|
+
payer,
|
|
33
33
|
feeAccount: inToken === constants_1.TRD_MINT.toString() ? getFeeAccount() : undefined
|
|
34
34
|
});
|
|
35
35
|
const { setupInstructions, swapInstruction, addressLookupTableAddresses } = swapResponse.data;
|
|
@@ -37,7 +37,7 @@ const swap = ({ connection, wallet, inToken, outToken, amount, feePayer }) => __
|
|
|
37
37
|
swapIxs: [deserializeInstruction(swapInstruction)],
|
|
38
38
|
addressLookupTableAccounts: yield getAddressLookupTableAccounts(connection, addressLookupTableAddresses),
|
|
39
39
|
setupInstructions: setupInstructions.length > 0
|
|
40
|
-
? [deserializeInstruction
|
|
40
|
+
? [...setupInstructions.map(deserializeInstruction)]
|
|
41
41
|
: [],
|
|
42
42
|
outAmount: quoteData.otherAmountThreshold
|
|
43
43
|
};
|