@hawksightco/hawk-sdk 1.3.1 → 1.3.3
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/src/classes/account-cache/AccountCache.d.ts +7 -0
- package/dist/src/classes/account-cache/AccountCache.d.ts.map +1 -1
- package/dist/src/classes/account-cache/AccountCache.js +14 -1
- package/dist/src/hawksight.d.ts +1 -2
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +2 -2
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,14 @@ type AccountInfoInternal = {
|
|
|
7
7
|
type _AccountCache = Record<string, AccountInfoInternal>;
|
|
8
8
|
export declare abstract class AccountCache {
|
|
9
9
|
protected connection: web3.Connection;
|
|
10
|
+
/**
|
|
11
|
+
* Cache of accounts.
|
|
12
|
+
*/
|
|
10
13
|
protected accounts: _AccountCache;
|
|
14
|
+
/**
|
|
15
|
+
* Promise that resolves when the accounts are fetched.
|
|
16
|
+
* This is used to wait for the accounts to be fetched before using them.
|
|
17
|
+
*/
|
|
11
18
|
protected pending: Promise<void> | null;
|
|
12
19
|
/**
|
|
13
20
|
* Instantiate the AccountCache class
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountCache.d.ts","sourceRoot":"","sources":["../../../../src/classes/account-cache/AccountCache.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC,CAAA;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEzD,8BAAsB,YAAY;
|
|
1
|
+
{"version":3,"file":"AccountCache.d.ts","sourceRoot":"","sources":["../../../../src/classes/account-cache/AccountCache.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC,CAAA;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEzD,8BAAsB,YAAY;IAmB9B,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAjBvC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAM;IAEvC;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAQ;IAE/C;;;;OAIG;gBAES,UAAU,EAAE,IAAI,CAAC,UAAU;IAGvC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,yBAAyB,IAAI,IAAI,CAAC,SAAS,EAAE;IAEhE;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,OAAO;IAE5C;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;IAOxC;;;;;;OAMG;IACH,8BAA8B,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,UAAU,GAAE,IAAI,CAAC,UAAwB,GAAG,IAAI;IAuCpG,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;CAM9C"}
|
|
@@ -18,7 +18,14 @@ class AccountCache {
|
|
|
18
18
|
*/
|
|
19
19
|
constructor(connection) {
|
|
20
20
|
this.connection = connection;
|
|
21
|
+
/**
|
|
22
|
+
* Cache of accounts.
|
|
23
|
+
*/
|
|
21
24
|
this.accounts = {};
|
|
25
|
+
/**
|
|
26
|
+
* Promise that resolves when the accounts are fetched.
|
|
27
|
+
* This is used to wait for the accounts to be fetched before using them.
|
|
28
|
+
*/
|
|
22
29
|
this.pending = null;
|
|
23
30
|
}
|
|
24
31
|
/**
|
|
@@ -39,7 +46,13 @@ class AccountCache {
|
|
|
39
46
|
*/
|
|
40
47
|
getBatchedMultipleAccountsInfo(pubkeys, commitment = "confirmed") {
|
|
41
48
|
// Check first if account is already fetched. Skips accounts that are marked to be refetched.
|
|
42
|
-
const pubkeysToFetch = pubkeys.filter(pubkey =>
|
|
49
|
+
const pubkeysToFetch = pubkeys.filter(pubkey => {
|
|
50
|
+
const cache = this.accounts[pubkey.toString()];
|
|
51
|
+
if (cache) {
|
|
52
|
+
return cache.refetch;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
43
56
|
const batchSize = 100;
|
|
44
57
|
const batches = [];
|
|
45
58
|
for (let i = 0; i < pubkeysToFetch.length; i += batchSize) {
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -46,9 +46,8 @@ export type VerifyTransactionSlotParams = {
|
|
|
46
46
|
};
|
|
47
47
|
export declare function verifyTransactionSlot({ userWallet }: AtomicityContextParams): Promise<web3.TransactionInstruction>;
|
|
48
48
|
export type StoreTokenContextParams = {
|
|
49
|
-
connection: web3.Connection;
|
|
50
49
|
userWallet: web3.PublicKey;
|
|
51
50
|
mint: web3.PublicKey;
|
|
52
51
|
};
|
|
53
|
-
export declare function storeToken(params: StoreTokenContextParams): Promise<web3.TransactionInstruction>;
|
|
52
|
+
export declare function storeToken(connection: web3.Connection, params: StoreTokenContextParams): Promise<web3.TransactionInstruction>;
|
|
54
53
|
//# sourceMappingURL=hawksight.d.ts.map
|
|
@@ -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,U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verifyTransactionSlot;
|
|
296
|
-
function storeToken(params) {
|
|
296
|
+
function storeToken(connection, params) {
|
|
297
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
298
|
const userPda = util.generateUserPda(params.userWallet);
|
|
299
|
-
const tokenProgramMap = yield util.getTokenProgramMapForMints(
|
|
299
|
+
const tokenProgramMap = yield util.getTokenProgramMapForMints(connection, [params.mint]);
|
|
300
300
|
const tokenProgram = tokenProgramMap[params.mint.toString()];
|
|
301
301
|
const ix = yield anchor_1.Anchor
|
|
302
302
|
.instance().iyfMain.methods
|
|
@@ -95,7 +95,7 @@ class IyfMainIxGenerator {
|
|
|
95
95
|
// Initialize anchor
|
|
96
96
|
anchor_1.Anchor.initialize(connection);
|
|
97
97
|
// Get verify transaction slot instruction
|
|
98
|
-
return yield (0, hawksight_1.storeToken)(params);
|
|
98
|
+
return yield (0, hawksight_1.storeToken)(connection, params);
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
/**
|