@haven-fi/solauto-sdk 1.0.102 → 1.0.104
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAOnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EAMvB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,8BAAsB,aAAc,SAAQ,SAAS;IAmC1C,SAAS,CAAC,EAAE,OAAO;IAlCrB,eAAe,EAAG,eAAe,CAAC;IAElC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EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
|
|
@@ -124,7 +124,6 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
|
124
124
|
];
|
|
125
125
|
}
|
|
126
126
|
async fetchExistingAuthorityLutAccounts() {
|
|
127
|
-
console.log("Fetching lut accounts", this.authorityLutAddress?.toString());
|
|
128
127
|
const lookupTable = this.authorityLutAddress
|
|
129
128
|
? await this.connection.getAddressLookupTable(this.authorityLutAddress)
|
|
130
129
|
: null;
|
|
@@ -135,30 +134,25 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
|
135
134
|
return lookupTable?.value?.state.addresses ?? [];
|
|
136
135
|
}
|
|
137
136
|
async updateLookupTable() {
|
|
138
|
-
console.log("Getting existing accoutns");
|
|
139
137
|
const existingLutAccounts = await this.fetchExistingAuthorityLutAccounts();
|
|
140
|
-
console.log("existing accoutns", existingLutAccounts.length);
|
|
141
138
|
if (this.lutAccountsToAdd().every((element) => existingLutAccounts
|
|
142
139
|
.map((x) => x.toString().toLowerCase())
|
|
143
140
|
.includes(element.toString().toLowerCase()))) {
|
|
144
141
|
return undefined;
|
|
145
142
|
}
|
|
146
143
|
let tx = (0, umi_1.transactionBuilder)();
|
|
147
|
-
console.log("lut address", this.authorityLutAddress?.toString());
|
|
148
144
|
if (this.authorityLutAddress === undefined) {
|
|
149
145
|
const [createLookupTableInst, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
|
|
150
146
|
authority: this.authority,
|
|
151
147
|
payer: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey),
|
|
152
148
|
recentSlot: await this.umi.rpc.getSlot({ commitment: "finalized" }),
|
|
153
149
|
});
|
|
154
|
-
console.log("new luit", lookupTableAddress.toString());
|
|
155
150
|
this.authorityLutAddress = lookupTableAddress;
|
|
156
151
|
tx = tx.add((0, solanaUtils_1.getWrappedInstruction)(this.signer, createLookupTableInst));
|
|
157
152
|
}
|
|
158
153
|
const accountsToAdd = this.lutAccountsToAdd().filter((x) => !existingLutAccounts
|
|
159
154
|
.map((x) => x.toString().toLowerCase())
|
|
160
155
|
.includes(x.toString().toLowerCase()));
|
|
161
|
-
console.log("add accounts", accountsToAdd.length);
|
|
162
156
|
if (accountsToAdd.length > 0) {
|
|
163
157
|
tx = tx.add((0, solanaUtils_1.getWrappedInstruction)(this.signer, web3_js_1.AddressLookupTableProgram.extendLookupTable({
|
|
164
158
|
payer: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey),
|
|
@@ -167,14 +161,12 @@ class SolautoClient extends txHandler_1.TxHandler {
|
|
|
167
161
|
addresses: accountsToAdd,
|
|
168
162
|
})));
|
|
169
163
|
}
|
|
170
|
-
console.log("Hello");
|
|
171
164
|
const addingReferredBy = accountsToAdd.length === 1 &&
|
|
172
165
|
accountsToAdd[0].toString().toLowerCase() ===
|
|
173
166
|
this.referredBySupplyTa?.toString().toLowerCase();
|
|
174
167
|
if (tx.getInstructions().length > 0) {
|
|
175
168
|
this.log("Updating authority lookup table...");
|
|
176
169
|
}
|
|
177
|
-
console.log("instructions", tx.getInstructions().length);
|
|
178
170
|
return { updateLutTx: tx, needsToBeIsolated: !addingReferredBy };
|
|
179
171
|
}
|
|
180
172
|
solautoPositionSettings() {
|
package/package.json
CHANGED
|
@@ -262,7 +262,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
async fetchExistingAuthorityLutAccounts(): Promise<PublicKey[]> {
|
|
265
|
-
console.log("Fetching lut accounts", this.authorityLutAddress?.toString());
|
|
266
265
|
const lookupTable = this.authorityLutAddress
|
|
267
266
|
? await this.connection.getAddressLookupTable(this.authorityLutAddress)
|
|
268
267
|
: null;
|
|
@@ -276,9 +275,7 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
276
275
|
async updateLookupTable(): Promise<
|
|
277
276
|
{ updateLutTx: TransactionBuilder; needsToBeIsolated: boolean } | undefined
|
|
278
277
|
> {
|
|
279
|
-
console.log("Getting existing accoutns");
|
|
280
278
|
const existingLutAccounts = await this.fetchExistingAuthorityLutAccounts();
|
|
281
|
-
console.log("existing accoutns", existingLutAccounts.length);
|
|
282
279
|
if (
|
|
283
280
|
this.lutAccountsToAdd().every((element) =>
|
|
284
281
|
existingLutAccounts
|
|
@@ -291,7 +288,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
291
288
|
|
|
292
289
|
let tx = transactionBuilder();
|
|
293
290
|
|
|
294
|
-
console.log("lut address", this.authorityLutAddress?.toString());
|
|
295
291
|
if (this.authorityLutAddress === undefined) {
|
|
296
292
|
const [createLookupTableInst, lookupTableAddress] =
|
|
297
293
|
AddressLookupTableProgram.createLookupTable({
|
|
@@ -299,7 +295,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
299
295
|
payer: toWeb3JsPublicKey(this.signer.publicKey),
|
|
300
296
|
recentSlot: await this.umi.rpc.getSlot({ commitment: "finalized" }),
|
|
301
297
|
});
|
|
302
|
-
console.log("new luit", lookupTableAddress.toString());
|
|
303
298
|
this.authorityLutAddress = lookupTableAddress;
|
|
304
299
|
tx = tx.add(getWrappedInstruction(this.signer, createLookupTableInst));
|
|
305
300
|
}
|
|
@@ -310,8 +305,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
310
305
|
.map((x) => x.toString().toLowerCase())
|
|
311
306
|
.includes(x.toString().toLowerCase())
|
|
312
307
|
);
|
|
313
|
-
console.log("add accounts", accountsToAdd.length);
|
|
314
|
-
|
|
315
308
|
if (accountsToAdd.length > 0) {
|
|
316
309
|
tx = tx.add(
|
|
317
310
|
getWrappedInstruction(
|
|
@@ -325,7 +318,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
325
318
|
)
|
|
326
319
|
);
|
|
327
320
|
}
|
|
328
|
-
console.log("Hello");
|
|
329
321
|
|
|
330
322
|
const addingReferredBy =
|
|
331
323
|
accountsToAdd.length === 1 &&
|
|
@@ -335,7 +327,6 @@ export abstract class SolautoClient extends TxHandler {
|
|
|
335
327
|
if (tx.getInstructions().length > 0) {
|
|
336
328
|
this.log("Updating authority lookup table...");
|
|
337
329
|
}
|
|
338
|
-
console.log("instructions", tx.getInstructions().length);
|
|
339
330
|
|
|
340
331
|
return { updateLutTx: tx, needsToBeIsolated: !addingReferredBy };
|
|
341
332
|
}
|
package/src/utils/solanaUtils.ts
CHANGED
|
@@ -290,6 +290,7 @@ export async function sendSingleOptimizedTransaction(
|
|
|
290
290
|
const feeEstimate = await getComputeUnitPriceEstimate(umi, tx, prioritySetting);
|
|
291
291
|
console.log("Compute unit price: ", feeEstimate);
|
|
292
292
|
|
|
293
|
+
console.log(tx.getInstructions());
|
|
293
294
|
const simulationResult = await retryWithExponentialBackoff(
|
|
294
295
|
async () =>
|
|
295
296
|
await simulateTransaction(
|