@hawksightco/hawk-sdk 1.2.10 → 1.2.11

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.
@@ -7,6 +7,13 @@ export declare function depositMultipleToken(params: {
7
7
  mint: web3.PublicKey;
8
8
  amount: BN;
9
9
  }[];
10
+ }): Promise<web3.TransactionInstruction>;
11
+ export declare function depositMultipleTokenV2(params: {
12
+ payer: web3.PublicKey;
13
+ deposit: {
14
+ mint: web3.PublicKey;
15
+ amount: BN;
16
+ }[];
10
17
  pdaTokenType?: TokenType;
11
18
  }): Promise<web3.TransactionInstruction>;
12
19
  export declare function withdrawMultipleToken(params: {
@@ -15,6 +22,13 @@ export declare function withdrawMultipleToken(params: {
15
22
  mint: web3.PublicKey;
16
23
  }[];
17
24
  useSta?: boolean;
25
+ }): Promise<web3.TransactionInstruction>;
26
+ export declare function withdrawMultipleTokenV2(params: {
27
+ payer: web3.PublicKey;
28
+ withdraw: {
29
+ mint: web3.PublicKey;
30
+ }[];
31
+ useSta?: boolean;
18
32
  pdaTokenType?: TokenType;
19
33
  }): Promise<web3.TransactionInstruction>;
20
34
  export type AtomicityContextParams = {
@@ -1 +1 @@
1
- {"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;AASvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,wCAmDA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IA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;AAEF,wBAAsB,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAkBtG"}
@@ -32,13 +32,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleToken = exports.depositMultipleToken = void 0;
35
+ exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleTokenV2 = exports.withdrawMultipleToken = exports.depositMultipleTokenV2 = exports.depositMultipleToken = void 0;
36
36
  const web3 = __importStar(require("@solana/web3.js"));
37
37
  const anchor_1 = require("./anchor");
38
38
  const addresses_1 = require("./addresses");
39
39
  const util = __importStar(require("./functions"));
40
40
  const types_1 = require("./types");
41
41
  function depositMultipleToken(params) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const farm = addresses_1.USDC_FARM;
44
+ const userPda = util.generateUserPda(params.payer, farm);
45
+ const amounts = params.deposit.map((d) => d.amount);
46
+ const remainingAccounts = [];
47
+ params.deposit.map((d) => {
48
+ const mint = d.mint;
49
+ const userToken = util.generateAta(params.payer, d.mint);
50
+ const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
51
+ const userPdaToken = util.generateAta(userPda, d.mint);
52
+ remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
53
+ remainingAccounts.push({
54
+ pubkey: userToken,
55
+ isSigner: false,
56
+ isWritable: true,
57
+ });
58
+ remainingAccounts.push({
59
+ pubkey: userPdaToken,
60
+ isSigner: false,
61
+ isWritable: true,
62
+ });
63
+ remainingAccounts.push({
64
+ pubkey: ownerFeeToken,
65
+ isSigner: false,
66
+ isWritable: true,
67
+ });
68
+ });
69
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
70
+ .depositMultipleToken(amounts)
71
+ .accounts({
72
+ farm,
73
+ userPda,
74
+ payer: params.payer,
75
+ hsFeeOwner: addresses_1.SITE_FEE_OWNER,
76
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
77
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
78
+ systemProgram: web3.SystemProgram.programId,
79
+ })
80
+ .remainingAccounts(remainingAccounts)
81
+ .instruction();
82
+ return ix;
83
+ });
84
+ }
85
+ exports.depositMultipleToken = depositMultipleToken;
86
+ function depositMultipleTokenV2(params) {
42
87
  return __awaiter(this, void 0, void 0, function* () {
43
88
  const farm = addresses_1.USDC_FARM;
44
89
  const userPda = util.generateUserPda(params.payer, farm);
@@ -79,7 +124,7 @@ function depositMultipleToken(params) {
79
124
  });
80
125
  });
81
126
  const ix = yield anchor_1.Anchor.instance().iyfMain.methods
82
- .depositMultipleToken(amounts, skipIdempotent)
127
+ .depositMultipleTokenV2(amounts, skipIdempotent)
83
128
  .accounts({
84
129
  farm,
85
130
  userPda,
@@ -94,8 +139,53 @@ function depositMultipleToken(params) {
94
139
  return ix;
95
140
  });
96
141
  }
97
- exports.depositMultipleToken = depositMultipleToken;
142
+ exports.depositMultipleTokenV2 = depositMultipleTokenV2;
98
143
  function withdrawMultipleToken(params) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const farm = addresses_1.USDC_FARM;
146
+ const userPda = util.generateUserPda(params.payer, farm);
147
+ const remainingAccounts = [];
148
+ let skipIdempotent = false;
149
+ params.withdraw.map((d) => {
150
+ const mint = d.mint;
151
+ const userToken = util.generateAta(params.payer, d.mint);
152
+ const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint);
153
+ const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
154
+ remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
155
+ remainingAccounts.push({
156
+ pubkey: userToken,
157
+ isSigner: false,
158
+ isWritable: true,
159
+ });
160
+ remainingAccounts.push({
161
+ pubkey: userPdaToken,
162
+ isSigner: false,
163
+ isWritable: true,
164
+ });
165
+ remainingAccounts.push({
166
+ pubkey: ownerFeeToken,
167
+ isSigner: false,
168
+ isWritable: true,
169
+ });
170
+ });
171
+ const ix = yield anchor_1.Anchor.instance().iyfMain.methods
172
+ .withdrawMultipleToken()
173
+ .accounts({
174
+ farm,
175
+ userPda,
176
+ payer: params.payer,
177
+ hsFeeOwner: addresses_1.SITE_FEE_OWNER,
178
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
179
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
180
+ systemProgram: web3.SystemProgram.programId,
181
+ })
182
+ .remainingAccounts(remainingAccounts)
183
+ .instruction();
184
+ return ix;
185
+ });
186
+ }
187
+ exports.withdrawMultipleToken = withdrawMultipleToken;
188
+ function withdrawMultipleTokenV2(params) {
99
189
  return __awaiter(this, void 0, void 0, function* () {
100
190
  const farm = addresses_1.USDC_FARM;
101
191
  const userPda = util.generateUserPda(params.payer, farm);
@@ -136,7 +226,7 @@ function withdrawMultipleToken(params) {
136
226
  });
137
227
  });
138
228
  const ix = yield anchor_1.Anchor.instance().iyfMain.methods
139
- .withdrawMultipleToken(skipIdempotent)
229
+ .withdrawMultipleTokenV2(skipIdempotent)
140
230
  .accounts({
141
231
  farm,
142
232
  userPda,
@@ -151,7 +241,7 @@ function withdrawMultipleToken(params) {
151
241
  return ix;
152
242
  });
153
243
  }
154
- exports.withdrawMultipleToken = withdrawMultipleToken;
244
+ exports.withdrawMultipleTokenV2 = withdrawMultipleTokenV2;
155
245
  function setTransactionSlot(_a) {
156
246
  return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
157
247
  const ix = yield anchor_1.Anchor
@@ -6055,6 +6055,74 @@ export type IndexYieldFarming = {
6055
6055
  "isSigner": false;
6056
6056
  }
6057
6057
  ];
6058
+ "args": [
6059
+ {
6060
+ "name": "amounts";
6061
+ "type": {
6062
+ "vec": "u64";
6063
+ };
6064
+ }
6065
+ ];
6066
+ },
6067
+ {
6068
+ "name": "depositMultipleTokenV2";
6069
+ "accounts": [
6070
+ {
6071
+ "name": "farm";
6072
+ "isMut": false;
6073
+ "isSigner": false;
6074
+ },
6075
+ {
6076
+ "name": "userPda";
6077
+ "isMut": true;
6078
+ "isSigner": false;
6079
+ "pda": {
6080
+ "seeds": [
6081
+ {
6082
+ "kind": "const";
6083
+ "type": "string";
6084
+ "value": "multi-user";
6085
+ },
6086
+ {
6087
+ "kind": "account";
6088
+ "type": "publicKey";
6089
+ "account": "FarmAccountMulti";
6090
+ "path": "farm";
6091
+ },
6092
+ {
6093
+ "kind": "account";
6094
+ "type": "publicKey";
6095
+ "path": "payer";
6096
+ }
6097
+ ];
6098
+ };
6099
+ },
6100
+ {
6101
+ "name": "payer";
6102
+ "isMut": false;
6103
+ "isSigner": true;
6104
+ },
6105
+ {
6106
+ "name": "hsFeeOwner";
6107
+ "isMut": false;
6108
+ "isSigner": false;
6109
+ },
6110
+ {
6111
+ "name": "associatedTokenProgram";
6112
+ "isMut": false;
6113
+ "isSigner": false;
6114
+ },
6115
+ {
6116
+ "name": "tokenProgram";
6117
+ "isMut": false;
6118
+ "isSigner": false;
6119
+ },
6120
+ {
6121
+ "name": "systemProgram";
6122
+ "isMut": false;
6123
+ "isSigner": false;
6124
+ }
6125
+ ];
6058
6126
  "args": [
6059
6127
  {
6060
6128
  "name": "amounts";
@@ -6127,6 +6195,67 @@ export type IndexYieldFarming = {
6127
6195
  "isSigner": false;
6128
6196
  }
6129
6197
  ];
6198
+ "args": [];
6199
+ },
6200
+ {
6201
+ "name": "withdrawMultipleTokenV2";
6202
+ "accounts": [
6203
+ {
6204
+ "name": "farm";
6205
+ "isMut": false;
6206
+ "isSigner": false;
6207
+ },
6208
+ {
6209
+ "name": "userPda";
6210
+ "isMut": true;
6211
+ "isSigner": false;
6212
+ "pda": {
6213
+ "seeds": [
6214
+ {
6215
+ "kind": "const";
6216
+ "type": "string";
6217
+ "value": "multi-user";
6218
+ },
6219
+ {
6220
+ "kind": "account";
6221
+ "type": "publicKey";
6222
+ "account": "FarmAccountMulti";
6223
+ "path": "farm";
6224
+ },
6225
+ {
6226
+ "kind": "account";
6227
+ "type": "publicKey";
6228
+ "path": "payer";
6229
+ }
6230
+ ];
6231
+ };
6232
+ },
6233
+ {
6234
+ "name": "payer";
6235
+ "isMut": false;
6236
+ "isSigner": true;
6237
+ },
6238
+ {
6239
+ "name": "hsFeeOwner";
6240
+ "isMut": false;
6241
+ "isSigner": false;
6242
+ },
6243
+ {
6244
+ "name": "associatedTokenProgram";
6245
+ "isMut": false;
6246
+ "isSigner": false;
6247
+ },
6248
+ {
6249
+ "name": "tokenProgram";
6250
+ "isMut": false;
6251
+ "isSigner": false;
6252
+ },
6253
+ {
6254
+ "name": "systemProgram";
6255
+ "isMut": false;
6256
+ "isSigner": false;
6257
+ }
6258
+ ];
6130
6259
  "args": [
6131
6260
  {
6132
6261
  "name": "skipIdempotent";