@helium/spl-utils 0.1.4 → 0.2.0
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/lib/cjs/index.js +1 -13
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/transaction.js +6 -5
- package/lib/cjs/transaction.js.map +1 -1
- package/lib/esm/src/index.js +0 -6
- package/lib/esm/src/index.js.map +1 -1
- package/lib/esm/src/transaction.js +1 -1
- package/lib/esm/src/transaction.js.map +1 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/index.d.ts +0 -6
- package/lib/types/src/index.d.ts.map +1 -1
- package/lib/types/src/transaction.d.ts +1 -0
- package/lib/types/src/transaction.d.ts.map +1 -1
- package/package.json +6 -3
- package/lib/cjs/accountFetchCache/accountFetchCache.js +0 -406
- package/lib/cjs/accountFetchCache/accountFetchCache.js.map +0 -1
- package/lib/cjs/accountFetchCache/eventEmitter.js +0 -37
- package/lib/cjs/accountFetchCache/eventEmitter.js.map +0 -1
- package/lib/cjs/accountFetchCache/getMultipleAccounts.js +0 -53
- package/lib/cjs/accountFetchCache/getMultipleAccounts.js.map +0 -1
- package/lib/cjs/accountFetchCache/index.js +0 -20
- package/lib/cjs/accountFetchCache/index.js.map +0 -1
- package/lib/cjs/accountsResolver/ataResolver.js +0 -31
- package/lib/cjs/accountsResolver/ataResolver.js.map +0 -1
- package/lib/cjs/accountsResolver/combineResolvers.js +0 -27
- package/lib/cjs/accountsResolver/combineResolvers.js.map +0 -1
- package/lib/cjs/accountsResolver/heliumCommonResolver.js +0 -43
- package/lib/cjs/accountsResolver/heliumCommonResolver.js.map +0 -1
- package/lib/cjs/accountsResolver/individual.js +0 -96
- package/lib/cjs/accountsResolver/individual.js.map +0 -1
- package/lib/cjs/accountsResolver/utils.js +0 -32
- package/lib/cjs/accountsResolver/utils.js.map +0 -1
- package/lib/esm/src/accountFetchCache/accountFetchCache.js +0 -379
- package/lib/esm/src/accountFetchCache/accountFetchCache.js.map +0 -1
- package/lib/esm/src/accountFetchCache/eventEmitter.js +0 -33
- package/lib/esm/src/accountFetchCache/eventEmitter.js.map +0 -1
- package/lib/esm/src/accountFetchCache/getMultipleAccounts.js +0 -32
- package/lib/esm/src/accountFetchCache/getMultipleAccounts.js.map +0 -1
- package/lib/esm/src/accountFetchCache/index.js +0 -4
- package/lib/esm/src/accountFetchCache/index.js.map +0 -1
- package/lib/esm/src/accountsResolver/ataResolver.js +0 -17
- package/lib/esm/src/accountsResolver/ataResolver.js.map +0 -1
- package/lib/esm/src/accountsResolver/combineResolvers.js +0 -14
- package/lib/esm/src/accountsResolver/combineResolvers.js.map +0 -1
- package/lib/esm/src/accountsResolver/heliumCommonResolver.js +0 -31
- package/lib/esm/src/accountsResolver/heliumCommonResolver.js.map +0 -1
- package/lib/esm/src/accountsResolver/individual.js +0 -78
- package/lib/esm/src/accountsResolver/individual.js.map +0 -1
- package/lib/esm/src/accountsResolver/utils.js +0 -27
- package/lib/esm/src/accountsResolver/utils.js.map +0 -1
- package/lib/types/src/accountFetchCache/accountFetchCache.d.ts +0 -67
- package/lib/types/src/accountFetchCache/accountFetchCache.d.ts.map +0 -1
- package/lib/types/src/accountFetchCache/eventEmitter.d.ts +0 -19
- package/lib/types/src/accountFetchCache/eventEmitter.d.ts.map +0 -1
- package/lib/types/src/accountFetchCache/getMultipleAccounts.d.ts +0 -7
- package/lib/types/src/accountFetchCache/getMultipleAccounts.d.ts.map +0 -1
- package/lib/types/src/accountFetchCache/index.d.ts +0 -4
- package/lib/types/src/accountFetchCache/index.d.ts.map +0 -1
- package/lib/types/src/accountsResolver/ataResolver.d.ts +0 -9
- package/lib/types/src/accountsResolver/ataResolver.d.ts.map +0 -1
- package/lib/types/src/accountsResolver/combineResolvers.d.ts +0 -3
- package/lib/types/src/accountsResolver/combineResolvers.d.ts.map +0 -1
- package/lib/types/src/accountsResolver/heliumCommonResolver.d.ts +0 -2
- package/lib/types/src/accountsResolver/heliumCommonResolver.d.ts.map +0 -1
- package/lib/types/src/accountsResolver/individual.d.ts +0 -25
- package/lib/types/src/accountsResolver/individual.d.ts.map +0 -1
- package/lib/types/src/accountsResolver/utils.d.ts +0 -7
- package/lib/types/src/accountsResolver/utils.d.ts.map +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ataResolver = void 0;
|
|
13
|
-
const individual_1 = require("./individual");
|
|
14
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
15
|
-
const utils_1 = require("./utils");
|
|
16
|
-
function ataResolver({ instruction, account, mint, owner, }) {
|
|
17
|
-
return (0, individual_1.resolveIndividual)(({ path, accounts, idlIx, provider }) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
var _a;
|
|
19
|
-
if ((typeof instruction === "undefined" || idlIx.name === instruction) && path.join(".") === account) {
|
|
20
|
-
const mintKey = (0, utils_1.get)(accounts, mint.split("."));
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
const ownerKey = owner ? (0, utils_1.get)(accounts, owner.split(".")) : (_a = provider.wallet) === null || _a === void 0 ? void 0 : _a.publicKey;
|
|
23
|
-
if (mintKey && ownerKey) {
|
|
24
|
-
return (0, spl_token_1.getAssociatedTokenAddress)(mintKey, ownerKey, true);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return undefined;
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
exports.ataResolver = ataResolver;
|
|
31
|
-
//# sourceMappingURL=ataResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ataResolver.js","sourceRoot":"","sources":["../../../src/accountsResolver/ataResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAAiD;AACjD,iDAA8D;AAC9D,mCAA8B;AAS9B,SAAgB,WAAW,CAAuB,EAChD,WAAW,EACX,OAAO,EACP,IAAI,EACJ,KAAK,GACW;IAChB,OAAO,IAAA,8BAAiB,EAAC,CAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;;QACrE,IAAI,CAAC,OAAO,WAAW,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE;YACpG,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAc,CAAC;YAC5D,aAAa;YACb,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,WAAG,EAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAc,CAAC,CAAC,CAAC,MAAA,QAAQ,CAAC,MAAM,0CAAE,SAAS,CAAC;YAEnG,IAAI,OAAO,IAAI,QAAQ,EAAE;gBACvB,OAAO,IAAA,qCAAyB,EAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;aAC3D;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAA,CAAC,CAAC;AACL,CAAC;AAlBD,kCAkBC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.combineResolvers = void 0;
|
|
13
|
-
function combineResolvers(...resolvers) {
|
|
14
|
-
return (args) => __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
let resolved = 0;
|
|
16
|
-
let accounts = args.accounts;
|
|
17
|
-
for (let i = 0; i < resolvers.length; i += 1) {
|
|
18
|
-
const resolver = resolvers[i];
|
|
19
|
-
const result = yield resolver(Object.assign(Object.assign({}, args), { accounts }));
|
|
20
|
-
accounts = result.accounts;
|
|
21
|
-
resolved += result.resolved;
|
|
22
|
-
}
|
|
23
|
-
return { accounts, resolved };
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
exports.combineResolvers = combineResolvers;
|
|
27
|
-
//# sourceMappingURL=combineResolvers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combineResolvers.js","sourceRoot":"","sources":["../../../src/accountsResolver/combineResolvers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,SAAgB,gBAAgB,CAC9B,GAAG,SAA4C;IAE/C,OAAO,CAAO,IAAI,EAAE,EAAE;QACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,MAAM,GAAG,MAAM,QAAQ,iCAAM,IAAI,KAAE,QAAQ,IAAG,CAAC;YACrD,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAC3B,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;SAC7B;QAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAChC,CAAC,CAAA,CAAC;AACJ,CAAC;AAfD,4CAeC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.heliumCommonResolver = void 0;
|
|
13
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
14
|
-
const individual_1 = require("./individual");
|
|
15
|
-
exports.heliumCommonResolver = (0, individual_1.resolveIndividual)(({ path }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
switch (path[path.length - 1]) {
|
|
17
|
-
case "dataCreditsProgram":
|
|
18
|
-
return new web3_js_1.PublicKey("credMBJhYFzfn7NxBMdU4aUqFggAjgztaCcv2Fo6fPT");
|
|
19
|
-
case "tokenMetadataProgram":
|
|
20
|
-
return new web3_js_1.PublicKey("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");
|
|
21
|
-
case "heliumSubDaosProgram":
|
|
22
|
-
return new web3_js_1.PublicKey("hdaoVTCqhfHHo75XdAMxBKdUqvq1i5bF23sisBqVgGR");
|
|
23
|
-
case "bubblegumProgram":
|
|
24
|
-
return new web3_js_1.PublicKey("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY");
|
|
25
|
-
case "compressionProgram":
|
|
26
|
-
return new web3_js_1.PublicKey("cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK");
|
|
27
|
-
case "logWrapper":
|
|
28
|
-
return new web3_js_1.PublicKey("noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV");
|
|
29
|
-
case "governanceProgramId":
|
|
30
|
-
return new web3_js_1.PublicKey("hgovkRU6Ghe1Qoyb54HdSLdqN7VtxaifBzRmh9jtd3S");
|
|
31
|
-
case "voterStakeRegistryProgramId":
|
|
32
|
-
return new web3_js_1.PublicKey("hvsrNC3NKbcryqDs2DocYHZ9yPKEVzdSjQG6RVtK1s8");
|
|
33
|
-
case "vsrProgram":
|
|
34
|
-
return new web3_js_1.PublicKey("hvsrNC3NKbcryqDs2DocYHZ9yPKEVzdSjQG6RVtK1s8");
|
|
35
|
-
case "instructions":
|
|
36
|
-
return new web3_js_1.PublicKey("Sysvar1nstructions1111111111111111111111111");
|
|
37
|
-
case "lazyDistributorProgram":
|
|
38
|
-
return new web3_js_1.PublicKey("1azyuavdMyvsivtNxPoz6SucD18eDHeXzFCUPq5XU7w");
|
|
39
|
-
default:
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
//# sourceMappingURL=heliumCommonResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heliumCommonResolver.js","sourceRoot":"","sources":["../../../src/accountsResolver/heliumCommonResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4C;AAC5C,6CAAiD;AAGpC,QAAA,oBAAoB,GAAG,IAAA,8BAAiB,EAAC,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;IACvE,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;QAC7B,KAAK,oBAAoB;YACvB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,sBAAsB;YACzB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,sBAAsB;YACzB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,kBAAkB;YACrB,OAAO,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC;QACvE,KAAK,oBAAoB;YACvB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,YAAY;YACf,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,qBAAqB;YACxB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,6BAA6B;YAChC,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,YAAY;YACf,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,cAAc;YACjB,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE,KAAK,wBAAwB;YAC3B,OAAO,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;QACtE;YACE,OAAO;KACV;AACH,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.resolveIndividual = void 0;
|
|
16
|
-
const camelcase_1 = __importDefault(require("camelcase"));
|
|
17
|
-
const utils_1 = require("./utils");
|
|
18
|
-
function resolveIndividualImpl({ idlAccounts, programId, provider, args, accounts, path = [], resolver, idlIx, }) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const newPath = [...path, (0, camelcase_1.default)(idlAccounts.name)];
|
|
21
|
-
try {
|
|
22
|
-
if (idlAccounts.accounts) {
|
|
23
|
-
let resolved = 0;
|
|
24
|
-
const subAccounts = idlAccounts.accounts;
|
|
25
|
-
for (let k = 0; k < subAccounts.length; k += 1) {
|
|
26
|
-
const subAccount = subAccounts[k];
|
|
27
|
-
resolved += yield resolveIndividualImpl({
|
|
28
|
-
idlAccounts: subAccount,
|
|
29
|
-
programId,
|
|
30
|
-
provider,
|
|
31
|
-
args,
|
|
32
|
-
accounts,
|
|
33
|
-
path: newPath,
|
|
34
|
-
resolver,
|
|
35
|
-
idlIx,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return resolved;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
let resolved = 0;
|
|
42
|
-
let value = (0, utils_1.get)(accounts, newPath);
|
|
43
|
-
if (!value) {
|
|
44
|
-
value = yield resolver({
|
|
45
|
-
programId,
|
|
46
|
-
provider,
|
|
47
|
-
path: newPath,
|
|
48
|
-
args,
|
|
49
|
-
accounts,
|
|
50
|
-
idlIx,
|
|
51
|
-
});
|
|
52
|
-
if (value) {
|
|
53
|
-
resolved = 1;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
(0, utils_1.set)(accounts, newPath, value);
|
|
57
|
-
return resolved;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
console.error(`Error while resolving ${newPath}`, e);
|
|
62
|
-
throw e;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Allows custom account resolution by functionaly operating on one account at a time.
|
|
68
|
-
*
|
|
69
|
-
* Check the `path` arg to see the account name being operated on, and use `accounts` , `args` , and `provider` to fill in any
|
|
70
|
-
* details necessary
|
|
71
|
-
*
|
|
72
|
-
* @param resolver
|
|
73
|
-
* @returns
|
|
74
|
-
*/
|
|
75
|
-
function resolveIndividual(resolver) {
|
|
76
|
-
return ({ idlIx, args, accounts, programId, provider }) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
let resolved = 0;
|
|
78
|
-
for (let k = 0; k < idlIx.accounts.length; k += 1) {
|
|
79
|
-
resolved += yield resolveIndividualImpl({
|
|
80
|
-
idlAccounts: idlIx.accounts[k],
|
|
81
|
-
programId,
|
|
82
|
-
provider,
|
|
83
|
-
resolver,
|
|
84
|
-
args,
|
|
85
|
-
accounts,
|
|
86
|
-
idlIx,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
accounts,
|
|
91
|
-
resolved
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
exports.resolveIndividual = resolveIndividual;
|
|
96
|
-
//# sourceMappingURL=individual.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"individual.js","sourceRoot":"","sources":["../../../src/accountsResolver/individual.ts"],"names":[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E,KAAK,CAAC,CAAC;gBAC9B,OAAO,QAAQ,CAAC;aACjB;SACF;QAAC,OAAO,CAAM,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;YACrD,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CAAA;AAED;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,QAA4B;IAE5B,OAAO,CAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC9D,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACjD,QAAQ,IAAI,MAAM,qBAAqB,CAAC;gBACtC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC9B,SAAS;gBACT,QAAQ;gBACR,QAAQ;gBACR,IAAI;gBACJ,QAAQ;gBACR,KAAK;aACN,CAAC,CAAC;SACJ;QACD,OAAO;YACL,QAAQ;YACR,QAAQ;SACT,CAAA;IACH,CAAC,CAAA,CAAC;AACJ,CAAC;AArBD,8CAqBC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.get = exports.set = void 0;
|
|
4
|
-
function set(accounts, path, value) {
|
|
5
|
-
if (!value) {
|
|
6
|
-
return accounts;
|
|
7
|
-
}
|
|
8
|
-
let curr = accounts;
|
|
9
|
-
path.forEach((p, idx) => {
|
|
10
|
-
const isLast = idx == path.length - 1;
|
|
11
|
-
if (isLast) {
|
|
12
|
-
curr[p] = value;
|
|
13
|
-
}
|
|
14
|
-
curr[p] = curr[p] || {};
|
|
15
|
-
curr = curr[p];
|
|
16
|
-
});
|
|
17
|
-
return accounts;
|
|
18
|
-
}
|
|
19
|
-
exports.set = set;
|
|
20
|
-
function get(accounts, path) {
|
|
21
|
-
// Only return if pubkey
|
|
22
|
-
const ret = path.reduce((acc, subPath) => {
|
|
23
|
-
if (acc) {
|
|
24
|
-
return acc[subPath];
|
|
25
|
-
}
|
|
26
|
-
}, accounts);
|
|
27
|
-
if (ret && ret.toBase58) {
|
|
28
|
-
return ret;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.get = get;
|
|
32
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/accountsResolver/utils.ts"],"names":[],"mappings":";;;AAIA,SAAgB,GAAG,CACjB,QAAkB,EAClB,IAAc,EACd,KAA4B;IAE5B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACtB,MAAM,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACtC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;SACjB;QAED,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,GAAG,IAAI,CAAC,CAAC,CAAa,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AArBD,kBAqBC;AAED,SAAgB,GAAG,CAAC,QAAkB,EAAE,IAAc;IACpD,wBAAwB;IACxB,MAAM,GAAG,GAAqC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QACzE,IAAI,GAAG,EAAE;YACP,OAAQ,GAAgB,CAAC,OAAO,CAAC,CAAC;SACnC;IACH,CAAC,EAAE,QAA4C,CAAC,CAAC;IAEjD,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE;QACvB,OAAO,GAAgB,CAAC;KACzB;AACH,CAAC;AAXD,kBAWC"}
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { Connection, PublicKey, Transaction } from "@solana/web3.js";
|
|
2
|
-
import { EventEmitter } from "./eventEmitter";
|
|
3
|
-
export const DEFAULT_CHUNK_SIZE = 99;
|
|
4
|
-
export const DEFAULT_DELAY = 50;
|
|
5
|
-
function getWriteableAccounts(instructions) {
|
|
6
|
-
return instructions
|
|
7
|
-
.flatMap((i) => i.keys)
|
|
8
|
-
.filter((k) => k.isWritable)
|
|
9
|
-
.map((a) => a.pubkey);
|
|
10
|
-
}
|
|
11
|
-
let id = 0;
|
|
12
|
-
export class AccountFetchCache {
|
|
13
|
-
connection;
|
|
14
|
-
chunkSize;
|
|
15
|
-
delay;
|
|
16
|
-
commitment;
|
|
17
|
-
accountWatchersCount = new Map();
|
|
18
|
-
accountChangeListeners = new Map();
|
|
19
|
-
statics = new Set();
|
|
20
|
-
missingAccounts = new Map();
|
|
21
|
-
genericCache = new Map();
|
|
22
|
-
keyToAccountParser = new Map();
|
|
23
|
-
timeout = null;
|
|
24
|
-
currentBatch = new Set();
|
|
25
|
-
pendingCallbacks = new Map();
|
|
26
|
-
pendingCalls = new Map();
|
|
27
|
-
emitter = new EventEmitter();
|
|
28
|
-
oldGetAccountinfo;
|
|
29
|
-
oldSendTransaction;
|
|
30
|
-
oldSendRawTransaction;
|
|
31
|
-
missingInterval;
|
|
32
|
-
constructor({ connection, chunkSize = DEFAULT_CHUNK_SIZE, delay = DEFAULT_DELAY, commitment, missingRefetchDelay = 10000, extendConnection = false, }) {
|
|
33
|
-
this.connection = connection;
|
|
34
|
-
this.chunkSize = chunkSize;
|
|
35
|
-
this.delay = delay;
|
|
36
|
-
this.commitment = commitment;
|
|
37
|
-
this.missingInterval = setInterval(this.fetchMissing.bind(this), missingRefetchDelay);
|
|
38
|
-
this.oldSendTransaction = connection.sendTransaction.bind(connection);
|
|
39
|
-
this.oldSendRawTransaction =
|
|
40
|
-
connection.sendRawTransaction.bind(connection);
|
|
41
|
-
const self = this;
|
|
42
|
-
if (extendConnection) {
|
|
43
|
-
this.oldGetAccountinfo = connection.getAccountInfo.bind(connection);
|
|
44
|
-
connection.getAccountInfo = async (publicKey, com) => {
|
|
45
|
-
if ((com || connection.commitment) == commitment ||
|
|
46
|
-
typeof (com || connection.commitment) == "undefined") {
|
|
47
|
-
const [result, dispose] = await this.searchAndWatch(publicKey);
|
|
48
|
-
setTimeout(dispose, 30 * 1000); // cache for 30s
|
|
49
|
-
return result?.account || null;
|
|
50
|
-
}
|
|
51
|
-
return self.oldGetAccountinfo(publicKey, com);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
connection.sendTransaction = async function overloadedSendTransaction(...args) {
|
|
55
|
-
const result = await self.oldSendTransaction(...args);
|
|
56
|
-
this.confirmTransaction(result, "finalized")
|
|
57
|
-
.then(() => {
|
|
58
|
-
return self.requeryMissing(args[0].instructions);
|
|
59
|
-
})
|
|
60
|
-
.catch(console.error);
|
|
61
|
-
return result;
|
|
62
|
-
};
|
|
63
|
-
connection.sendRawTransaction = async function overloadedSendRawTransaction(rawTransaction, options) {
|
|
64
|
-
const result = await self.oldSendRawTransaction(rawTransaction, options);
|
|
65
|
-
try {
|
|
66
|
-
const instructions = Transaction.from(rawTransaction).instructions;
|
|
67
|
-
this.confirmTransaction(result, "finalized")
|
|
68
|
-
.then(() => {
|
|
69
|
-
return self.requeryMissing(instructions);
|
|
70
|
-
})
|
|
71
|
-
.catch(console.error);
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
// TODO: handle transaction v2
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
async requeryMissing(instructions) {
|
|
80
|
-
const writeableAccounts = getWriteableAccounts(instructions).map((a) => a.toBase58());
|
|
81
|
-
await Promise.all(writeableAccounts.map(async (account) => {
|
|
82
|
-
const parser = this.missingAccounts.get(account);
|
|
83
|
-
const [found, dispose] = await this.searchAndWatch(new PublicKey(account), parser, this.statics.has(account), true);
|
|
84
|
-
dispose();
|
|
85
|
-
if (found) {
|
|
86
|
-
this.missingAccounts.delete(account);
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
async fetchMissing() {
|
|
91
|
-
try {
|
|
92
|
-
await Promise.all([...this.missingAccounts].map(([account, _]) => this.searchAndWatch(new PublicKey(account), this.missingAccounts.get(account), this.statics.has(account), true).then(([_, dispose]) => dispose()) // Dispose immediately, this isn't watching.
|
|
93
|
-
));
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
// This happens in an interval, so just log errors
|
|
97
|
-
console.error(e);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
close() {
|
|
101
|
-
if (this.oldGetAccountinfo) {
|
|
102
|
-
this.connection.getAccountInfo = this.oldGetAccountinfo;
|
|
103
|
-
}
|
|
104
|
-
this.connection.sendTransaction = this.oldSendTransaction;
|
|
105
|
-
this.connection.sendRawTransaction = this.oldSendRawTransaction;
|
|
106
|
-
clearInterval(this.missingInterval);
|
|
107
|
-
}
|
|
108
|
-
async fetchBatch() {
|
|
109
|
-
const currentBatch = this.currentBatch;
|
|
110
|
-
this.currentBatch = new Set(); // Erase current batch from state, so we can fetch multiple at a time
|
|
111
|
-
try {
|
|
112
|
-
const keys = Array.from(currentBatch);
|
|
113
|
-
const array = await this.connection.getMultipleAccountsInfo(keys.map(b => new PublicKey(b)), this.commitment);
|
|
114
|
-
keys.forEach((key, index) => {
|
|
115
|
-
const callback = this.pendingCallbacks.get(key);
|
|
116
|
-
callback && callback(array[index], null);
|
|
117
|
-
});
|
|
118
|
-
return { keys, array };
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
currentBatch.forEach((key) => {
|
|
122
|
-
const callback = this.pendingCallbacks.get(key);
|
|
123
|
-
callback && callback(null, e);
|
|
124
|
-
});
|
|
125
|
-
throw e;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async addToBatch(id) {
|
|
129
|
-
const idStr = id.toBase58();
|
|
130
|
-
this.currentBatch.add(idStr);
|
|
131
|
-
this.timeout != null && clearTimeout(this.timeout);
|
|
132
|
-
if (this.currentBatch.size > DEFAULT_CHUNK_SIZE) {
|
|
133
|
-
this.fetchBatch();
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
this.timeout = setTimeout(() => this.fetchBatch(), this.delay);
|
|
137
|
-
}
|
|
138
|
-
const promise = new Promise((resolve, reject) => {
|
|
139
|
-
this.pendingCallbacks.set(idStr, (info, err) => {
|
|
140
|
-
this.pendingCallbacks.delete(idStr);
|
|
141
|
-
if (err) {
|
|
142
|
-
return reject(err);
|
|
143
|
-
}
|
|
144
|
-
resolve(info);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
return promise;
|
|
148
|
-
}
|
|
149
|
-
async flush() {
|
|
150
|
-
this.timeout && clearTimeout(this.timeout);
|
|
151
|
-
await this.fetchBatch();
|
|
152
|
-
}
|
|
153
|
-
async searchAndWatch(pubKey, parser, isStatic = false, // optimization, set if the data will never change
|
|
154
|
-
forceRequery = false) {
|
|
155
|
-
let id;
|
|
156
|
-
if (typeof pubKey === "string") {
|
|
157
|
-
id = new PublicKey(pubKey);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
id = pubKey;
|
|
161
|
-
}
|
|
162
|
-
if (!pubKey) {
|
|
163
|
-
return [undefined, () => { }];
|
|
164
|
-
}
|
|
165
|
-
const address = id.toBase58();
|
|
166
|
-
const data = await this.search(pubKey, parser, isStatic, forceRequery);
|
|
167
|
-
const dispose = this.watch(id, parser, !!data);
|
|
168
|
-
const cacheEntry = this.genericCache.get(address);
|
|
169
|
-
if (!this.genericCache.has(address) || cacheEntry != data) {
|
|
170
|
-
this.updateCache(address, data || null);
|
|
171
|
-
}
|
|
172
|
-
return [data, dispose];
|
|
173
|
-
}
|
|
174
|
-
async updateCache(id, data) {
|
|
175
|
-
const isNew = !this.genericCache.has(id);
|
|
176
|
-
this.genericCache.set(id, data || null);
|
|
177
|
-
this.emitter.raiseCacheUpdated(id, isNew, this.keyToAccountParser.get(id));
|
|
178
|
-
}
|
|
179
|
-
static defaultParser = (pubkey, account) => ({
|
|
180
|
-
pubkey,
|
|
181
|
-
account,
|
|
182
|
-
});
|
|
183
|
-
// The same as query, except swallows errors and returns undefined.
|
|
184
|
-
async search(pubKey, parser, isStatic = false, // optimization, set if the data will never change
|
|
185
|
-
forceRequery = false) {
|
|
186
|
-
let id;
|
|
187
|
-
if (typeof pubKey === "string") {
|
|
188
|
-
id = new PublicKey(pubKey);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
id = pubKey;
|
|
192
|
-
}
|
|
193
|
-
this.registerParser(id, parser);
|
|
194
|
-
const address = id.toBase58();
|
|
195
|
-
if (isStatic) {
|
|
196
|
-
this.statics.add(address);
|
|
197
|
-
}
|
|
198
|
-
else if (this.statics.has(address)) {
|
|
199
|
-
this.statics.delete(address); // If trying to use this as not static, need to rm it from the statics list.
|
|
200
|
-
}
|
|
201
|
-
if (!forceRequery && this.genericCache.has(address)) {
|
|
202
|
-
const result = this.genericCache.get(address);
|
|
203
|
-
return result == null
|
|
204
|
-
? undefined
|
|
205
|
-
: result;
|
|
206
|
-
}
|
|
207
|
-
const existingQuery = this.pendingCalls.get(address);
|
|
208
|
-
if (!forceRequery && existingQuery) {
|
|
209
|
-
return existingQuery;
|
|
210
|
-
}
|
|
211
|
-
const query = this.addToBatch(id).then((data) => {
|
|
212
|
-
this.pendingCalls.delete(address);
|
|
213
|
-
if (!data) {
|
|
214
|
-
return undefined;
|
|
215
|
-
}
|
|
216
|
-
const result = this.getParsed(id, data, parser) || {
|
|
217
|
-
pubkey: id,
|
|
218
|
-
account: data,
|
|
219
|
-
info: undefined,
|
|
220
|
-
};
|
|
221
|
-
// Only set the cache for defined static accounts. Static accounts can change if they go from nonexistant to existant.
|
|
222
|
-
// Rely on searchAndWatch to set the generic cache for everything else.
|
|
223
|
-
if (isStatic && result && result.info) {
|
|
224
|
-
this.updateCache(address, result);
|
|
225
|
-
}
|
|
226
|
-
return result;
|
|
227
|
-
});
|
|
228
|
-
this.pendingCalls.set(address, query);
|
|
229
|
-
return query;
|
|
230
|
-
}
|
|
231
|
-
onAccountChange(key, parser, account) {
|
|
232
|
-
try {
|
|
233
|
-
const parsed = this.getParsed(key, account, parser);
|
|
234
|
-
const address = key.toBase58();
|
|
235
|
-
console.log("accountFetchCache", `Received account change ${key}`, parsed);
|
|
236
|
-
this.updateCache(address, parsed || null);
|
|
237
|
-
}
|
|
238
|
-
catch (e) {
|
|
239
|
-
console.error("accountFetchCache", "Failed to update account", e);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
watch(id, parser, exists = true) {
|
|
243
|
-
const address = id.toBase58();
|
|
244
|
-
const isStatic = this.statics.has(address);
|
|
245
|
-
let oldCount = (this.accountWatchersCount.get(address) || 0) + 1;
|
|
246
|
-
this.accountWatchersCount.set(address, oldCount);
|
|
247
|
-
if (exists && !isStatic) {
|
|
248
|
-
// Only websocket watch accounts that exist
|
|
249
|
-
// Don't recreate listeners
|
|
250
|
-
// xNFT doesn't support onAccountChange, so we have to make a new usable connection.
|
|
251
|
-
if (!this.accountChangeListeners.has(address)) {
|
|
252
|
-
try {
|
|
253
|
-
this.accountChangeListeners.set(address, this.connection.onAccountChange(id, (account) => this.onAccountChange(id, undefined, account), this.commitment));
|
|
254
|
-
}
|
|
255
|
-
catch (e) {
|
|
256
|
-
if (e.toString().includes("not implemented")) {
|
|
257
|
-
// @ts-ignore
|
|
258
|
-
this.usableConnection =
|
|
259
|
-
// @ts-ignore
|
|
260
|
-
this.usableConnection ||
|
|
261
|
-
new Connection(
|
|
262
|
-
// @ts-ignore
|
|
263
|
-
this.connection._rpcEndpoint, this.commitment);
|
|
264
|
-
this.accountChangeListeners.set(address,
|
|
265
|
-
// @ts-ignore
|
|
266
|
-
this.usableConnection.onAccountChange(id,
|
|
267
|
-
// @ts-ignore
|
|
268
|
-
(account) => this.onAccountChange(id, undefined, account), this.commitment));
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
console.error(e);
|
|
272
|
-
throw e;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
else if (!exists) {
|
|
278
|
-
// Poll accounts that don't exist
|
|
279
|
-
this.missingAccounts.set(address, parser || this.missingAccounts.get(address));
|
|
280
|
-
}
|
|
281
|
-
return () => {
|
|
282
|
-
const newCount = this.accountWatchersCount.get(address) - 1;
|
|
283
|
-
this.accountWatchersCount.set(address, newCount);
|
|
284
|
-
if (newCount <= 0) {
|
|
285
|
-
const subscriptionId = this.accountChangeListeners.get(address);
|
|
286
|
-
if (subscriptionId) {
|
|
287
|
-
this.accountChangeListeners.delete(address);
|
|
288
|
-
try {
|
|
289
|
-
this.connection.removeAccountChangeListener(subscriptionId);
|
|
290
|
-
}
|
|
291
|
-
catch (e) {
|
|
292
|
-
if (e.toString().includes("not implemented")) {
|
|
293
|
-
// @ts-ignore
|
|
294
|
-
this.usableConnection.removeAccountChangeListener(subscriptionId);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
this.missingAccounts.delete(address);
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
async query(pubKey, parser) {
|
|
303
|
-
const ret = await this.search(pubKey, parser);
|
|
304
|
-
if (!ret) {
|
|
305
|
-
throw new Error("Account not found");
|
|
306
|
-
}
|
|
307
|
-
return ret;
|
|
308
|
-
}
|
|
309
|
-
getParsed(id, obj, parser) {
|
|
310
|
-
const address = typeof id === "string" ? id : id?.toBase58();
|
|
311
|
-
this.registerParser(id, parser);
|
|
312
|
-
const deserialize = (this.keyToAccountParser.get(address) ||
|
|
313
|
-
AccountFetchCache.defaultParser);
|
|
314
|
-
const account = deserialize(new PublicKey(address), obj);
|
|
315
|
-
if (!account) {
|
|
316
|
-
return {
|
|
317
|
-
pubkey: new PublicKey(id),
|
|
318
|
-
account: obj,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
return account;
|
|
322
|
-
}
|
|
323
|
-
get(pubKey) {
|
|
324
|
-
let key;
|
|
325
|
-
if (typeof pubKey !== "string") {
|
|
326
|
-
key = pubKey.toBase58();
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
key = pubKey;
|
|
330
|
-
}
|
|
331
|
-
return this.genericCache.get(key);
|
|
332
|
-
}
|
|
333
|
-
delete(pubKey) {
|
|
334
|
-
let key;
|
|
335
|
-
if (typeof pubKey !== "string") {
|
|
336
|
-
key = pubKey.toBase58();
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
key = pubKey;
|
|
340
|
-
}
|
|
341
|
-
const subId = this.accountChangeListeners.get(key);
|
|
342
|
-
if (subId) {
|
|
343
|
-
this.connection.removeAccountChangeListener(subId);
|
|
344
|
-
this.accountChangeListeners.delete(key);
|
|
345
|
-
}
|
|
346
|
-
if (this.genericCache.has(key)) {
|
|
347
|
-
this.genericCache.delete(key);
|
|
348
|
-
this.emitter.raiseCacheDeleted(key);
|
|
349
|
-
return true;
|
|
350
|
-
}
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
byParser(parser) {
|
|
354
|
-
const result = [];
|
|
355
|
-
for (const id of this.keyToAccountParser.keys()) {
|
|
356
|
-
if (this.keyToAccountParser.get(id) === parser) {
|
|
357
|
-
result.push(id);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return result;
|
|
361
|
-
}
|
|
362
|
-
registerParser(pubkey, parser) {
|
|
363
|
-
if (pubkey) {
|
|
364
|
-
const address = typeof pubkey === "string" ? pubkey : pubkey?.toBase58();
|
|
365
|
-
if (parser && !this.keyToAccountParser.get(address)) {
|
|
366
|
-
this.keyToAccountParser.set(address, parser);
|
|
367
|
-
const cached = this.genericCache.get(address);
|
|
368
|
-
if (cached) {
|
|
369
|
-
const parsed = parser(cached.pubkey, cached.account);
|
|
370
|
-
if (parsed) {
|
|
371
|
-
this.genericCache.set(address, parsed);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return pubkey;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
//# sourceMappingURL=accountFetchCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accountFetchCache.js","sourceRoot":"","sources":["../../../../src/accountFetchCache/accountFetchCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,SAAS,EAGT,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAkBhC,SAAS,oBAAoB,CAC3B,YAAsC;IAEtC,OAAO,YAAY;SAChB,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX,MAAM,OAAO,iBAAiB;IAC5B,UAAU,CAAa;IACvB,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,UAAU,CAAa;IACvB,oBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjD,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,OAAO,GAAG,IAAI,GAA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