@zebec-network/zebec-vault-sdk 1.0.3 → 1.0.4
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/service.d.ts +2 -0
- package/dist/service.js +29 -5
- package/package.json +1 -1
package/dist/service.d.ts
CHANGED
|
@@ -67,12 +67,14 @@ export declare class ZebecVaultService {
|
|
|
67
67
|
caller?: Address;
|
|
68
68
|
proposal: Address;
|
|
69
69
|
partialSigners?: Signer[];
|
|
70
|
+
addressLookupTables?: Address[];
|
|
70
71
|
}): Promise<TransactionPayload>;
|
|
71
72
|
executeProposalDirect(params: {
|
|
72
73
|
vault: Address;
|
|
73
74
|
proposer?: Address;
|
|
74
75
|
actions: TransactionInstruction[];
|
|
75
76
|
partialSigners?: Signer[];
|
|
77
|
+
addressLookupTables?: Address[];
|
|
76
78
|
}): Promise<TransactionPayload>;
|
|
77
79
|
whitelistTokens(params: {
|
|
78
80
|
whitelister?: Address;
|
package/dist/service.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ZebecVaultService = void 0;
|
|
7
|
+
const assert_1 = __importDefault(require("assert"));
|
|
4
8
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
9
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
10
|
const solana_common_1 = require("@zebec-network/solana-common");
|
|
@@ -277,10 +281,20 @@ class ZebecVaultService {
|
|
|
277
281
|
});
|
|
278
282
|
return acc;
|
|
279
283
|
}, []);
|
|
280
|
-
const signers = params.partialSigners ? params.partialSigners : [];
|
|
281
284
|
const ix = await this.getExecuteProposalInstruction(caller, proposal, remainingAccounts);
|
|
282
|
-
console.log("ix:", JSON.stringify(ix.keys, null, 2));
|
|
283
|
-
|
|
285
|
+
// console.log("ix:", JSON.stringify(ix.keys, null, 2));
|
|
286
|
+
const addressLookupTableAccounts = [];
|
|
287
|
+
if (params.addressLookupTables) {
|
|
288
|
+
const promises = params.addressLookupTables.map(async (lookupTable) => {
|
|
289
|
+
const lookupTables = await this.connection.getAddressLookupTable((0, anchor_1.translateAddress)(lookupTable));
|
|
290
|
+
const lookupTableAccount = lookupTables.value;
|
|
291
|
+
(0, assert_1.default)(lookupTableAccount, "Lookup table account not found");
|
|
292
|
+
return lookupTableAccount;
|
|
293
|
+
});
|
|
294
|
+
const accounts = await Promise.all(promises);
|
|
295
|
+
addressLookupTableAccounts.push(...accounts);
|
|
296
|
+
}
|
|
297
|
+
return this._createTransactionPayload(caller, [ix], params.partialSigners, addressLookupTableAccounts);
|
|
284
298
|
}
|
|
285
299
|
async executeProposalDirect(params) {
|
|
286
300
|
const proposer = params.proposer ? (0, anchor_1.translateAddress)(params.proposer) : this.provider.publicKey;
|
|
@@ -308,8 +322,18 @@ class ZebecVaultService {
|
|
|
308
322
|
return acc;
|
|
309
323
|
}, []);
|
|
310
324
|
const ix = await this.getExecuteProposalDirectInstruction(vault, proposer, actions, remainingAccounts);
|
|
311
|
-
const
|
|
312
|
-
|
|
325
|
+
const addressLookupTableAccounts = [];
|
|
326
|
+
if (params.addressLookupTables) {
|
|
327
|
+
const promises = params.addressLookupTables.map(async (lookupTable) => {
|
|
328
|
+
const lookupTables = await this.connection.getAddressLookupTable((0, anchor_1.translateAddress)(lookupTable));
|
|
329
|
+
const lookupTableAccount = lookupTables.value;
|
|
330
|
+
(0, assert_1.default)(lookupTableAccount, "Lookup table account not found");
|
|
331
|
+
return lookupTableAccount;
|
|
332
|
+
});
|
|
333
|
+
const accounts = await Promise.all(promises);
|
|
334
|
+
addressLookupTableAccounts.push(...accounts);
|
|
335
|
+
}
|
|
336
|
+
return this._createTransactionPayload(proposer, [ix], params.partialSigners, addressLookupTableAccounts);
|
|
313
337
|
}
|
|
314
338
|
async whitelistTokens(params) {
|
|
315
339
|
const whitelister = params.whitelister ? (0, anchor_1.translateAddress)(params.whitelister) : this.provider.publicKey;
|