@haven-fi/solauto-sdk 1.0.254 → 1.0.256
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/referralStateManager.d.ts.map +1 -1
- package/dist/clients/referralStateManager.js +2 -1
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +4 -21
- package/package.json +1 -1
- package/src/clients/referralStateManager.ts +5 -7
- package/src/transactions/transactionsManager.ts +4 -24
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAC1C,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,MAAM,CAAC;IAEhB,aAAa,EAAG,SAAS,CAAC;IAC1B,iBAAiB,EAAG,aAAa,GAAG,IAAI,CAAC;IACzC,SAAS,EAAG,SAAS,CAAC;IAEtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,eAAe,CAAC,EAAE,SAAS,CAAC;IAE7B,UAAU,CAAC,IAAI,EAAE,wBAAwB;IA6B/C,mBAAmB,IAAI,MAAM,EAAE;IAS/B,aAAa,CAAC,UAAU,CAAC,EAAE,SAAS;
|
1
|
+
{"version":3,"file":"referralStateManager.d.ts","sourceRoot":"","sources":["../../src/clients/referralStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IAC1C,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,MAAM,CAAC;IAEhB,aAAa,EAAG,SAAS,CAAC;IAC1B,iBAAiB,EAAG,aAAa,GAAG,IAAI,CAAC;IACzC,SAAS,EAAG,SAAS,CAAC;IAEtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,eAAe,CAAC,EAAE,SAAS,CAAC;IAE7B,UAAU,CAAC,IAAI,EAAE,wBAAwB;IA6B/C,mBAAmB,IAAI,MAAM,EAAE;IAS/B,aAAa,CAAC,UAAU,CAAC,EAAE,SAAS;IAsBpC,sBAAsB,CACpB,YAAY,CAAC,EAAE,SAAS,EACxB,WAAW,CAAC,EAAE,SAAS,GACtB,kBAAkB;IAerB,mBAAmB,IAAI,kBAAkB;IA0BnC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D"}
|
@@ -45,7 +45,8 @@ class ReferralStateManager extends txHandler_1.TxHandler {
|
|
45
45
|
this.referredBy = finalReferredBy;
|
46
46
|
this.referredByState = finalReferredBy
|
47
47
|
? (0, utils_1.getReferralState)(finalReferredBy, this.programId)
|
48
|
-
: this.referralStateData
|
48
|
+
: this.referralStateData &&
|
49
|
+
!(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.referredByState).equals(web3_js_1.PublicKey.default)
|
49
50
|
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.referredByState)
|
50
51
|
: undefined;
|
51
52
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAK7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IARtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACjB,WAAW,EAAE,OAAO,CAAS;gBAG3B,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAKV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IA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jB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,kBAAkB;IAC1B,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAVpB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA8CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IAyDzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA+BxB,qBAAqB;YAiDrB,cAAc;YAyBd,eAAe;CAkD9B"}
|
@@ -11,7 +11,6 @@ const generalUtils_1 = require("../utils/generalUtils");
|
|
11
11
|
const transactionUtils_1 = require("./transactionUtils");
|
12
12
|
const types_1 = require("../types");
|
13
13
|
const web3_js_1 = require("@solana/web3.js");
|
14
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
15
14
|
// import { sendJitoBundledTransactions } from "../utils/jitoUtils";
|
16
15
|
class TransactionTooLargeError extends Error {
|
17
16
|
constructor(message) {
|
@@ -247,33 +246,17 @@ class TransactionsManager {
|
|
247
246
|
const items = [...transactions];
|
248
247
|
const client = this.txHandler;
|
249
248
|
const updateLookupTable = await client.updateLookupTable();
|
250
|
-
|
251
|
-
if (updateLookupTable && !isolatedLutTx) {
|
252
|
-
for (const item of items) {
|
253
|
-
await item.initialize();
|
254
|
-
}
|
255
|
-
const txAccounts = items.flatMap((x) => x.tx.getInstructions().flatMap((x) => x.keys.map((x) => x.pubkey)));
|
256
|
-
const newAccountsUsage = txAccounts.reduce((count, pk) => {
|
257
|
-
return updateLookupTable.accountsToAdd.find((x) => x.equals((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(pk)))
|
258
|
-
? count + 1
|
259
|
-
: count;
|
260
|
-
}, 0);
|
261
|
-
isolatedLutTx = Boolean(newAccountsUsage);
|
262
|
-
}
|
263
|
-
console.log(updateLookupTable?.accountsToAdd.map(x => x.toString()));
|
264
|
-
if (updateLookupTable && isolatedLutTx) {
|
249
|
+
if (updateLookupTable && updateLookupTable?.new) {
|
265
250
|
await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
|
266
251
|
}
|
267
252
|
this.lookupTables.defaultLuts = client.defaultLookupTables();
|
268
|
-
|
269
|
-
|
270
|
-
await item.initialize();
|
271
|
-
}
|
253
|
+
for (const item of items) {
|
254
|
+
await item.initialize();
|
272
255
|
}
|
273
256
|
const [choresBefore, choresAfter] = await (0, transactionUtils_1.getTransactionChores)(client, (0, umi_1.transactionBuilder)().add(items
|
274
257
|
.filter((x) => x.tx && x.tx.getInstructions().length > 0)
|
275
258
|
.map((x) => x.tx)));
|
276
|
-
if (updateLookupTable && !
|
259
|
+
if (updateLookupTable && !updateLookupTable?.new) {
|
277
260
|
choresBefore.prepend(updateLookupTable.tx);
|
278
261
|
}
|
279
262
|
if (choresBefore.getInstructions().length > 0) {
|
package/package.json
CHANGED
@@ -93,7 +93,10 @@ export class ReferralStateManager extends TxHandler {
|
|
93
93
|
this.referredBy = finalReferredBy;
|
94
94
|
this.referredByState = finalReferredBy
|
95
95
|
? getReferralState(finalReferredBy, this.programId)
|
96
|
-
: this.referralStateData
|
96
|
+
: this.referralStateData &&
|
97
|
+
!toWeb3JsPublicKey(this.referralStateData.referredByState).equals(
|
98
|
+
PublicKey.default
|
99
|
+
)
|
97
100
|
? toWeb3JsPublicKey(this.referralStateData.referredByState)
|
98
101
|
: undefined;
|
99
102
|
}
|
@@ -126,12 +129,7 @@ export class ReferralStateManager extends TxHandler {
|
|
126
129
|
);
|
127
130
|
const feesDestinationTa =
|
128
131
|
referralFeesDestMint !== NATIVE_MINT
|
129
|
-
? publicKey(
|
130
|
-
getTokenAccount(
|
131
|
-
this.authority,
|
132
|
-
referralFeesDestMint
|
133
|
-
)
|
134
|
-
)
|
132
|
+
? publicKey(getTokenAccount(this.authority, referralFeesDestMint))
|
135
133
|
: undefined;
|
136
134
|
|
137
135
|
return claimReferralFees(this.umi, {
|
@@ -366,33 +366,13 @@ export class TransactionsManager {
|
|
366
366
|
|
367
367
|
const updateLookupTable = await client.updateLookupTable();
|
368
368
|
|
369
|
-
|
370
|
-
if (updateLookupTable && !isolatedLutTx) {
|
371
|
-
for (const item of items) {
|
372
|
-
await item.initialize();
|
373
|
-
}
|
374
|
-
const txAccounts = items.flatMap((x) =>
|
375
|
-
x.tx!.getInstructions().flatMap((x) => x.keys.map((x) => x.pubkey))
|
376
|
-
);
|
377
|
-
const newAccountsUsage = txAccounts.reduce((count, pk) => {
|
378
|
-
return updateLookupTable.accountsToAdd.find((x) =>
|
379
|
-
x.equals(toWeb3JsPublicKey(pk))
|
380
|
-
)
|
381
|
-
? count + 1
|
382
|
-
: count;
|
383
|
-
}, 0);
|
384
|
-
isolatedLutTx = Boolean(newAccountsUsage);
|
385
|
-
}
|
386
|
-
console.log(updateLookupTable?.accountsToAdd.map(x => x.toString()));
|
387
|
-
if (updateLookupTable && isolatedLutTx) {
|
369
|
+
if (updateLookupTable && updateLookupTable?.new) {
|
388
370
|
await this.updateLut(updateLookupTable.tx, updateLookupTable.new);
|
389
371
|
}
|
390
372
|
this.lookupTables.defaultLuts = client.defaultLookupTables();
|
391
373
|
|
392
|
-
|
393
|
-
|
394
|
-
await item.initialize();
|
395
|
-
}
|
374
|
+
for (const item of items) {
|
375
|
+
await item.initialize();
|
396
376
|
}
|
397
377
|
|
398
378
|
const [choresBefore, choresAfter] = await getTransactionChores(
|
@@ -403,7 +383,7 @@ export class TransactionsManager {
|
|
403
383
|
.map((x) => x.tx!)
|
404
384
|
)
|
405
385
|
);
|
406
|
-
if (updateLookupTable && !
|
386
|
+
if (updateLookupTable && !updateLookupTable?.new) {
|
407
387
|
choresBefore.prepend(updateLookupTable.tx);
|
408
388
|
}
|
409
389
|
if (choresBefore.getInstructions().length > 0) {
|