@triadxyz/triad-protocol 3.2.7-beta → 3.2.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 +8 -4
- package/dist/utils/swap.d.ts +2 -1
- package/dist/utils/swap.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -518,7 +518,8 @@ class TriadProtocolClient {
|
|
|
518
518
|
wallet: this.program.provider.publicKey.toBase58(),
|
|
519
519
|
inToken: token,
|
|
520
520
|
outToken: constants_1.TRD_MINT.toString(),
|
|
521
|
-
amount
|
|
521
|
+
amount,
|
|
522
|
+
feePayer: this.rpcOptions.payer.toBase58()
|
|
522
523
|
});
|
|
523
524
|
amountInTRD = outAmount;
|
|
524
525
|
if (swapIxs.length === 0) {
|
|
@@ -750,7 +751,8 @@ class TriadProtocolClient {
|
|
|
750
751
|
wallet: this.program.provider.publicKey.toBase58(),
|
|
751
752
|
inToken: constants_1.TRD_MINT.toString(),
|
|
752
753
|
outToken: constants_1.USDC_MINT.toString(),
|
|
753
|
-
amount: Math.floor(amountInTRD)
|
|
754
|
+
amount: Math.floor(amountInTRD),
|
|
755
|
+
feePayer: this.rpcOptions.payer.toBase58()
|
|
754
756
|
});
|
|
755
757
|
if (swapIxs.length === 0) {
|
|
756
758
|
return;
|
|
@@ -943,7 +945,8 @@ class TriadProtocolClient {
|
|
|
943
945
|
wallet: this.program.provider.publicKey.toBase58(),
|
|
944
946
|
inToken: constants_1.TRD_MINT.toString(),
|
|
945
947
|
outToken: constants_1.USDC_MINT.toString(),
|
|
946
|
-
amount: Math.floor(amountInTRD)
|
|
948
|
+
amount: Math.floor(amountInTRD),
|
|
949
|
+
feePayer: this.rpcOptions.payer.toBase58()
|
|
947
950
|
});
|
|
948
951
|
if (swapIxs.length === 0) {
|
|
949
952
|
return;
|
|
@@ -1083,7 +1086,8 @@ class TriadProtocolClient {
|
|
|
1083
1086
|
wallet: this.program.provider.publicKey.toBase58(),
|
|
1084
1087
|
inToken: constants_1.USDC_MINT.toBase58(),
|
|
1085
1088
|
outToken: constants_1.TRD_MINT.toString(),
|
|
1086
|
-
amount: amountOfUSDC.toNumber() / Math.pow(10, 6)
|
|
1089
|
+
amount: amountOfUSDC.toNumber() / Math.pow(10, 6),
|
|
1090
|
+
feePayer: this.rpcOptions.payer.toBase58()
|
|
1087
1091
|
});
|
|
1088
1092
|
if (swapIxs.length > 0) {
|
|
1089
1093
|
ixs.push(...setupInstructions);
|
package/dist/utils/swap.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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, feePayer }: {
|
|
3
3
|
connection: Connection;
|
|
4
4
|
wallet: string;
|
|
5
5
|
inToken: string;
|
|
6
6
|
outToken: string;
|
|
7
7
|
amount: number;
|
|
8
|
+
feePayer: string;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
swapIxs: TransactionInstruction[];
|
|
10
11
|
addressLookupTableAccounts: AddressLookupTableAccount[];
|
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 }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const swap = ({ connection, wallet, inToken, outToken, amount, feePayer }) => __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,6 +29,7 @@ const swap = ({ connection, wallet, inToken, outToken, amount }) => __awaiter(vo
|
|
|
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
|
+
feePayer,
|
|
32
33
|
feeAccount: inToken === constants_1.TRD_MINT.toString() ? getFeeAccount() : undefined
|
|
33
34
|
});
|
|
34
35
|
const { setupInstructions, swapInstruction, addressLookupTableAddresses } = swapResponse.data;
|