From 13357cfa0477575874d7471e296481c1c55b31c0 Mon Sep 17 00:00:00 2001 From: fukaoi Date: Fri, 22 Sep 2023 11:09:27 +0900 Subject: [PATCH 1/2] updated --- packages/core/dist/cjs/memo/history.d.ts | 9 ++-- packages/core/dist/cjs/memo/history.d.ts.map | 2 +- packages/core/dist/cjs/memo/history.js | 5 +- packages/core/dist/cjs/memo/history.js.map | 2 +- packages/core/dist/cjs/memo/index.d.ts | 5 +- packages/core/dist/cjs/memo/index.d.ts.map | 2 +- packages/core/dist/cjs/signatures.js | 24 ++------- packages/core/dist/cjs/signatures.js.map | 2 +- .../core/dist/cjs/sol-native/history.d.ts | 6 +-- .../core/dist/cjs/sol-native/history.d.ts.map | 2 +- packages/core/dist/cjs/sol-native/history.js | 10 ++-- .../core/dist/cjs/sol-native/history.js.map | 2 +- packages/core/dist/cjs/sol-native/index.d.ts | 2 +- packages/core/dist/cjs/spl-token/history.d.ts | 6 +-- .../core/dist/cjs/spl-token/history.d.ts.map | 2 +- packages/core/dist/cjs/spl-token/history.js | 14 +++-- .../core/dist/cjs/spl-token/history.js.map | 2 +- packages/core/dist/cjs/spl-token/index.d.ts | 2 +- packages/core/dist/cjs/types/index.d.ts | 15 +++--- packages/core/dist/cjs/types/index.d.ts.map | 2 +- packages/core/dist/cjs/types/index.js | 1 + packages/core/dist/cjs/types/index.js.map | 2 +- .../dist/cjs/types/spl-token/history.d.ts | 5 ++ .../dist/cjs/types/spl-token/history.d.ts.map | 1 + .../core/dist/cjs/types/spl-token/history.js | 3 ++ .../dist/cjs/types/spl-token/history.js.map | 1 + .../core/dist/cjs/types/spl-token/index.d.ts | 2 + .../dist/cjs/types/spl-token/index.d.ts.map | 1 + .../core/dist/cjs/types/spl-token/index.js | 18 +++++++ .../dist/cjs/types/spl-token/index.js.map | 1 + packages/core/dist/esm/memo/history.d.ts | 9 ++-- packages/core/dist/esm/memo/history.d.ts.map | 2 +- packages/core/dist/esm/memo/history.js | 11 ++-- packages/core/dist/esm/memo/history.js.map | 2 +- packages/core/dist/esm/memo/index.d.ts | 5 +- packages/core/dist/esm/memo/index.d.ts.map | 2 +- packages/core/dist/esm/signatures.js | 26 +++------ packages/core/dist/esm/signatures.js.map | 2 +- .../core/dist/esm/sol-native/history.d.ts | 6 +-- .../core/dist/esm/sol-native/history.d.ts.map | 2 +- packages/core/dist/esm/sol-native/history.js | 16 +++--- .../core/dist/esm/sol-native/history.js.map | 2 +- packages/core/dist/esm/sol-native/index.d.ts | 2 +- packages/core/dist/esm/spl-token/history.d.ts | 6 +-- .../core/dist/esm/spl-token/history.d.ts.map | 2 +- packages/core/dist/esm/spl-token/history.js | 24 +++++---- .../core/dist/esm/spl-token/history.js.map | 2 +- packages/core/dist/esm/spl-token/index.d.ts | 2 +- packages/core/dist/esm/types/index.d.ts | 15 +++--- packages/core/dist/esm/types/index.d.ts.map | 2 +- packages/core/dist/esm/types/index.js | 11 ++-- packages/core/dist/esm/types/index.js.map | 2 +- .../dist/esm/types/spl-token/history.d.ts | 5 ++ .../dist/esm/types/spl-token/history.d.ts.map | 1 + .../core/dist/esm/types/spl-token/history.js | 2 + .../dist/esm/types/spl-token/history.js.map | 1 + .../core/dist/esm/types/spl-token/index.d.ts | 2 + .../dist/esm/types/spl-token/index.d.ts.map | 1 + .../core/dist/esm/types/spl-token/index.js | 2 + .../dist/esm/types/spl-token/index.js.map | 1 + packages/core/src/memo/history.ts | 26 ++++++--- packages/core/src/signatures.ts | 41 ++++++-------- packages/core/src/sol-native/history.ts | 25 ++++++--- packages/core/src/spl-token/history.ts | 36 +++++++++---- packages/core/src/types/index.ts | 15 +++--- packages/core/src/types/spl-token/history.ts | 4 ++ packages/core/src/types/spl-token/index.ts | 1 + packages/core/test/memo/history.test.ts | 15 +++--- packages/core/test/sol-native/history.test.ts | 28 +++++----- packages/core/test/spl-token/history.test.ts | 25 ++++----- packages/core/test/transaction-filter.test.ts | 53 ++++++++++--------- packages/shared/dist/cjs/node.d.ts | 4 +- packages/shared/dist/cjs/node.d.ts.map | 2 +- packages/shared/dist/cjs/node.js | 15 +++--- packages/shared/dist/cjs/node.js.map | 2 +- packages/shared/dist/esm/node.d.ts | 4 +- packages/shared/dist/esm/node.d.ts.map | 2 +- packages/shared/dist/esm/node.js | 23 ++++---- packages/shared/dist/esm/node.js.map | 2 +- packages/shared/src/node.ts | 35 +++++------- 80 files changed, 376 insertions(+), 301 deletions(-) create mode 100644 packages/core/dist/cjs/types/spl-token/history.d.ts create mode 100644 packages/core/dist/cjs/types/spl-token/history.d.ts.map create mode 100644 packages/core/dist/cjs/types/spl-token/history.js create mode 100644 packages/core/dist/cjs/types/spl-token/history.js.map create mode 100644 packages/core/dist/cjs/types/spl-token/index.d.ts create mode 100644 packages/core/dist/cjs/types/spl-token/index.d.ts.map create mode 100644 packages/core/dist/cjs/types/spl-token/index.js create mode 100644 packages/core/dist/cjs/types/spl-token/index.js.map create mode 100644 packages/core/dist/esm/types/spl-token/history.d.ts create mode 100644 packages/core/dist/esm/types/spl-token/history.d.ts.map create mode 100644 packages/core/dist/esm/types/spl-token/history.js create mode 100644 packages/core/dist/esm/types/spl-token/history.js.map create mode 100644 packages/core/dist/esm/types/spl-token/index.d.ts create mode 100644 packages/core/dist/esm/types/spl-token/index.d.ts.map create mode 100644 packages/core/dist/esm/types/spl-token/index.js create mode 100644 packages/core/dist/esm/types/spl-token/index.js.map create mode 100644 packages/core/src/types/spl-token/history.ts create mode 100644 packages/core/src/types/spl-token/index.ts diff --git a/packages/core/dist/cjs/memo/history.d.ts b/packages/core/dist/cjs/memo/history.d.ts index dc6545ffe..1fe66dcdd 100644 --- a/packages/core/dist/cjs/memo/history.d.ts +++ b/packages/core/dist/cjs/memo/history.d.ts @@ -1,6 +1,9 @@ -import { Pubkey } from '@solana-suite/shared'; -import { History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { History, OnErr, OnOk } from "../types/"; export declare namespace Memo { - const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, option?: { + waitTime: 0.04; + narrowDown: 1000; + }) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/history.d.ts.map b/packages/core/dist/cjs/memo/history.d.ts.map index e35042bcf..d6cf6c2bf 100644 --- a/packages/core/dist/cjs/memo/history.d.ts.map +++ b/packages/core/dist/cjs/memo/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,WACH;QACP,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KAClB,KACA,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/history.js b/packages/core/dist/cjs/memo/history.js index c19cbb298..9740d36e1 100644 --- a/packages/core/dist/cjs/memo/history.js +++ b/packages/core/dist/cjs/memo/history.js @@ -15,11 +15,10 @@ const transaction_filter_1 = require("../transaction-filter"); const signatures_1 = require("../signatures"); var Memo; (function (Memo) { - Memo.getHistory = (target, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + Memo.getHistory = (target, onOk, onErr, option) => __awaiter(this, void 0, void 0, function* () { try { const parser = transaction_filter_1.TransactionFilter.parse(types_1.FilterType.OnlyMemo, types_1.ModuleName.SolNative); - yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), narrowDown); + yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), option); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/cjs/memo/history.js.map b/packages/core/dist/cjs/memo/history.js.map index 11ca16a0b..261534c1c 100644 --- a/packages/core/dist/cjs/memo/history.js.map +++ b/packages/core/dist/cjs/memo/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAyE;AACzE,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,IAAI,CAwBpB;AAxBD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CACpC,kBAAU,CAAC,QAAQ,EACnB,kBAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EAxBgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAwBpB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAyE;AACzE,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,IAAI,CA2BpB;AA3BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,MAGC,EACc,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CACpC,kBAAU,CAAC,QAAQ,EACnB,kBAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,MAAO,CACR,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA3BgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QA2BpB"} \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/index.d.ts b/packages/core/dist/cjs/memo/index.d.ts index 3c5fe9e6f..6bba5277b 100644 --- a/packages/core/dist/cjs/memo/index.d.ts +++ b/packages/core/dist/cjs/memo/index.d.ts @@ -1,6 +1,9 @@ /// export declare const Memo: { - getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, option?: { + waitTime: 0.04; + narrowDown: 1000; + } | undefined) => Promise; decode: (encoded: string) => string; encode: (data: string) => Buffer; create: (data: string, owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Instruction; diff --git a/packages/core/dist/cjs/memo/index.d.ts.map b/packages/core/dist/cjs/memo/index.d.ts.map index ed238f8b9..8c505697c 100644 --- a/packages/core/dist/cjs/memo/index.d.ts.map +++ b/packages/core/dist/cjs/memo/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;CAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;;;;CAA4B,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/signatures.js b/packages/core/dist/cjs/signatures.js index 921737b06..0f1e37575 100644 --- a/packages/core/dist/cjs/signatures.js +++ b/packages/core/dist/cjs/signatures.js @@ -21,27 +21,13 @@ var Signatures; } return res; }); - Signatures.getForAdress = (pubkey, parser, callback, narrowDown = 1000) => __awaiter(this, void 0, void 0, function* () { + Signatures.getForAdress = (pubkey, parser, callback, options, histories = []) => __awaiter(this, void 0, void 0, function* () { try { + (0, shared_1.debugLog)("# options: ", options); const transactions = yield shared_1.Node.getConnection().getSignaturesForAddress(pubkey.toPublicKey(), { - limit: narrowDown, + limit: options.narrowDown, }); - (0, shared_1.debugLog)('# transactions count:', transactions.length); - const histories = []; - // don't use Promise.all, this is sync action - // let i = 1; - // for (const transaction of transactions) { - // const signature = await parseForTransaction(transaction.signature); - // const history = parser(signature); - // if (history) { - // histories.push(history); - // callback(Result.ok(histories)); - // i++; - // } - // if (receiveLimit && i > receiveLimit) { - // break; - // } - // } + (0, shared_1.debugLog)("# transactions count:", transactions.length); for (const transaction of transactions) { parseForTransaction(transaction.signature) .then((signature) => { @@ -52,7 +38,7 @@ var Signatures; } }) .catch((e) => callback(shared_1.Result.err(e))); - yield (0, shared_1.sleep)(0.05); // avoid 429 error + yield (0, shared_1.sleep)(options.waitTime); // avoid 429 error } } catch (e) { diff --git a/packages/core/dist/cjs/signatures.js.map b/packages/core/dist/cjs/signatures.js.map index 1159fea82..a680f135e 100644 --- a/packages/core/dist/cjs/signatures.js.map +++ b/packages/core/dist/cjs/signatures.js.map @@ -1 +1 @@ -{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAA6E;AAG7E,WAAW;AACX,IAAiB,UAAU,CA+D1B;AA/DD,WAAiB,UAAU;IACzB,MAAM,mBAAmB,GAAG,CAC1B,SAAiB,EACmB,EAAE;QACtC,MAAM,GAAG,GAAG,MAAM,aAAI,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,EAA+B,CAAC;SACxC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAA,CAAC;IAEW,uBAAY,GAAG,CAC1B,MAAc,EACd,MAEuC,EACvC,QAAoE,EACpE,UAAU,GAAG,IAAI,EACF,EAAE;QACjB,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,aAAI,CAAC,aAAa,EAAE,CAAC,uBAAuB,CACrE,MAAM,CAAC,WAAW,EAAE,EACpB;gBACE,KAAK,EAAE,UAAU;aAClB,CACF,CAAC;YAEF,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,SAAS,GAA6B,EAAE,CAAC;YAE/C,8CAA8C;YAC9C,aAAa;YACb,4CAA4C;YAC5C,wEAAwE;YACxE,uCAAuC;YACvC,mBAAmB;YACnB,+BAA+B;YAC/B,sCAAsC;YACtC,WAAW;YACX,MAAM;YACN,4CAA4C;YAC5C,aAAa;YACb,MAAM;YACN,IAAI;YAEJ,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;gBACtC,mBAAmB,CAAC,WAAW,CAAC,SAAS,CAAC;qBACvC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;oBAClB,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;oBAClC,IAAI,OAAO,EAAE;wBACX,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBACxB,QAAQ,CAAC,eAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;qBAChC;gBACH,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,MAAM,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB;aACtC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,QAAQ,CAAC,eAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aACzB;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA/DgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA+D1B"} \ No newline at end of file +{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iDAA6E;AAG7E,WAAW;AACX,IAAiB,UAAU,CAoD1B;AApDD,WAAiB,UAAU;IACzB,MAAM,mBAAmB,GAAG,CAC1B,SAAiB,EACmB,EAAE;QACtC,MAAM,GAAG,GAAG,MAAM,aAAI,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,EAA+B,CAAC;SACxC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAA,CAAC;IAEW,uBAAY,GAAG,CAC1B,MAAc,EACd,MAEuC,EACvC,QAAoE,EACpE,OAGC,EACD,YAAsC,EAAE,EACzB,EAAE;QACjB,IAAI;YACF,IAAA,iBAAQ,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YACjC,MAAM,YAAY,GAAG,MAAM,aAAI,CAAC,aAAa,EAAE,CAAC,uBAAuB,CACrE,MAAM,CAAC,WAAW,EAAE,EACpB;gBACE,KAAK,EAAE,OAAO,CAAC,UAAU;aAC1B,CACF,CAAC;YAEF,IAAA,iBAAQ,EAAC,uBAAuB,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;YAEvD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;gBACtC,mBAAmB,CAAC,WAAW,CAAC,SAAS,CAAC;qBACvC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;oBAClB,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;oBAClC,IAAI,OAAO,EAAE;wBACX,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBACxB,QAAQ,CAAC,eAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;qBAChC;gBACH,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,MAAM,IAAA,cAAK,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,kBAAkB;aAClD;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,QAAQ,CAAC,eAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aACzB;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EApDgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAoD1B"} \ No newline at end of file diff --git a/packages/core/dist/cjs/sol-native/history.d.ts b/packages/core/dist/cjs/sol-native/history.d.ts index e1a9c1ca0..7e52ca8e0 100644 --- a/packages/core/dist/cjs/sol-native/history.d.ts +++ b/packages/core/dist/cjs/sol-native/history.d.ts @@ -1,6 +1,6 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { FilterType, History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace SolNative { - const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/sol-native/history.d.ts.map b/packages/core/dist/cjs/sol-native/history.d.ts.map index bb637a04c..c7e550654 100644 --- a/packages/core/dist/cjs/sol-native/history.d.ts.map +++ b/packages/core/dist/cjs/sol-native/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,SAAS,CAAC;IAClB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAcd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EACL,MAAM,WAAW,CAAC;AAInB,yBAAiB,SAAS,CAAC;IAClB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CAoBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/cjs/sol-native/history.js b/packages/core/dist/cjs/sol-native/history.js index 9bef08c01..becd26707 100644 --- a/packages/core/dist/cjs/sol-native/history.js +++ b/packages/core/dist/cjs/sol-native/history.js @@ -15,11 +15,15 @@ const transaction_filter_1 = require("../transaction-filter"); const signatures_1 = require("../signatures"); var SolNative; (function (SolNative) { - SolNative.getHistory = (target, filterType, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + SolNative.getHistory = (target, filterType, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); const parser = transaction_filter_1.TransactionFilter.parse(filterType, types_1.ModuleName.SolNative); - yield signatures_1.Signatures.getForAdress(target, parser, (result) => __awaiter(this, void 0, void 0, function* () { return yield result.match(onOk, onErr); }), narrowDown); + yield signatures_1.Signatures.getForAdress(target, parser, (result) => __awaiter(this, void 0, void 0, function* () { return yield result.match(onOk, onErr); }), mergedOptions); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/cjs/sol-native/history.js.map b/packages/core/dist/cjs/sol-native/history.js.map index 76fe135d1..07fba4f8e 100644 --- a/packages/core/dist/cjs/sol-native/history.js.map +++ b/packages/core/dist/cjs/sol-native/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAyE;AACzE,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,SAAS,CAsBzB;AAtBD,WAAiB,SAAS;IACX,oBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,kBAAU,CAAC,SAAS,CAAC,CAAC;YACzE,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAO,MAAM,EAAE,EAAE,gDAAC,OAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA,GAAA,EACjD,UAAU,CACX,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EAtBgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAsBzB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAOmB;AACnB,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,SAAS,CA4BzB;AA5BD,WAAiB,SAAS;IACX,oBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAmC,EAAE,EACtB,EAAE;QACjB,IAAI;YACF,MAAM,aAAa,GAAmB;gBACpC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,GAAG;aAChB,CAAC;YACF,MAAM,aAAa,mCAAQ,aAAa,GAAK,OAAO,CAAE,CAAC;YAEvD,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,kBAAU,CAAC,SAAS,CAAC,CAAC;YACzE,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAO,MAAM,EAAE,EAAE,gDAAC,OAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA,GAAA,EACjD,aAAa,CACd,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA5BgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA4BzB"} \ No newline at end of file diff --git a/packages/core/dist/cjs/sol-native/index.d.ts b/packages/core/dist/cjs/sol-native/index.d.ts index a027a348c..aa43b06b6 100644 --- a/packages/core/dist/cjs/sol-native/index.d.ts +++ b/packages/core/dist/cjs/sol-native/index.d.ts @@ -1,7 +1,7 @@ export declare const SolNative: { transferWithMultisig: (owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer?: import("@solana-suite/shared").Secret | undefined) => Promise>; transfer: (source: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Result; - getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; feePayerPartialSignTransfer: (owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer: import("@solana-suite/shared").Pubkey) => Promise>; findByOwner: (owner: import("@solana-suite/shared").Pubkey) => Promise>; }; diff --git a/packages/core/dist/cjs/spl-token/history.d.ts b/packages/core/dist/cjs/spl-token/history.d.ts index 8b860b88d..7502812ea 100644 --- a/packages/core/dist/cjs/spl-token/history.d.ts +++ b/packages/core/dist/cjs/spl-token/history.d.ts @@ -1,6 +1,6 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { FilterType, History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace SplToken { - const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/spl-token/history.d.ts.map b/packages/core/dist/cjs/spl-token/history.d.ts.map index b676bb9ff..4ff064211 100644 --- a/packages/core/dist/cjs/spl-token/history.d.ts.map +++ b/packages/core/dist/cjs/spl-token/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,QAAQ,CAAC;IACjB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAqCd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EAEL,MAAM,WAAW,CAAC;AAInB,yBAAiB,QAAQ,CAAC;IACjB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CA6Cd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/cjs/spl-token/history.js b/packages/core/dist/cjs/spl-token/history.js index 7a0bbd43e..af6fe72ce 100644 --- a/packages/core/dist/cjs/spl-token/history.js +++ b/packages/core/dist/cjs/spl-token/history.js @@ -17,20 +17,26 @@ const signatures_1 = require("../signatures"); const transaction_filter_1 = require("../transaction-filter"); var SplToken; (function (SplToken) { - SplToken.getHistory = (target, filterType, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + SplToken.getHistory = (target, filterType, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); if (filterType === types_1.FilterType.Memo) { const parser = transaction_filter_1.TransactionFilter.parse(filterType, types_1.ModuleName.SplToken); - yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), narrowDown); + yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), mergedOptions); } else { const tokenAccounts = yield shared_1.Node.getConnection().getParsedTokenAccountsByOwner(target.toPublicKey(), { programId: spl_token_1.TOKEN_PROGRAM_ID, }); + const storedHistories = []; + (0, shared_1.debugLog)('# tokenAccounts size: ', tokenAccounts.value.length); for (const account of tokenAccounts.value) { const parser = transaction_filter_1.TransactionFilter.parse(filterType, types_1.ModuleName.SplToken); - yield signatures_1.Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), narrowDown); + yield signatures_1.Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), mergedOptions, storedHistories); } } } diff --git a/packages/core/dist/cjs/spl-token/history.js.map b/packages/core/dist/cjs/spl-token/history.js.map index 1700ba8cd..91045fefa 100644 --- a/packages/core/dist/cjs/spl-token/history.js.map +++ b/packages/core/dist/cjs/spl-token/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAqD;AACrD,iDAAoD;AACpD,qCAAyE;AACzE,8CAA2C;AAC3C,8DAA0D;AAE1D,IAAiB,QAAQ,CA6CxB;AA7CD,WAAiB,QAAQ;IACV,mBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,IAAI,UAAU,KAAK,kBAAU,CAAC,IAAI,EAAE;gBAClC,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,kBAAU,CAAC,QAAQ,CAAC,CAAC;gBACxE,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;aACH;iBAAM;gBACL,MAAM,aAAa,GACjB,MAAM,aAAI,CAAC,aAAa,EAAE,CAAC,6BAA6B,CACtD,MAAM,CAAC,WAAW,EAAE,EACpB;oBACE,SAAS,EAAE,4BAAgB;iBAC5B,CACF,CAAC;gBAEJ,KAAK,MAAM,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE;oBACzC,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CACpC,UAAU,EACV,kBAAU,CAAC,QAAQ,CACpB,CAAC;oBACF,MAAM,uBAAU,CAAC,YAAY,CAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;iBACH;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA7CgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA6CxB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":";;;;;;;;;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EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,aAAa,EACb,eAAe,CAChB,CAAC;iBACH;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EArDgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAqDxB"} \ No newline at end of file diff --git a/packages/core/dist/cjs/spl-token/index.d.ts b/packages/core/dist/cjs/spl-token/index.d.ts index 41a17d903..fab91a345 100644 --- a/packages/core/dist/cjs/spl-token/index.d.ts +++ b/packages/core/dist/cjs/spl-token/index.d.ts @@ -5,7 +5,7 @@ export declare const SplToken: { createFreezeAuthority: (mint: import("@solana/web3.js").PublicKey, owner: import("@solana/web3.js").PublicKey, freezeAuthority: import("@solana/web3.js").PublicKey) => import("@solana/web3.js").TransactionInstruction; createMintInstructions: (mint: import("@solana/web3.js").PublicKey, owner: import("@solana/web3.js").PublicKey, totalAmount: number, mintDecimal: number, tokenMetadata: import("@metaplex-foundation/mpl-token-metadata").DataV2, feePayer: import("@solana/web3.js").PublicKey, isMutable: boolean) => Promise; mint: (owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, totalAmount: number, mintDecimal: number, input: import("@solana-suite/shared-metaplex").UserSideInput.TokenMetadata, feePayer?: import("@solana-suite/shared").Secret | undefined, freezeAuthority?: import("@solana-suite/shared").Pubkey | undefined) => Promise>; - getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; feePayerPartialSignTransfer: (mint: import("@solana-suite/shared").Pubkey, owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, mintDecimal: number, feePayer: import("@solana-suite/shared").Pubkey) => Promise>; freeze: (mint: import("@solana-suite/shared").Pubkey, owner: import("@solana-suite/shared").Pubkey, freezeAuthority: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Result; genericFindByOwner: (owner: import("@solana-suite/shared").Pubkey, callback: (result: import("@solana-suite/shared").Result) => void, tokenStandard: import("@solana-suite/shared-metaplex").UserSideInput.TokenStandard, sortable?: import("..").Sortable | undefined, isHolder?: boolean | undefined) => Promise; diff --git a/packages/core/dist/cjs/types/index.d.ts b/packages/core/dist/cjs/types/index.d.ts index 7c0f46b29..7cb89dee8 100644 --- a/packages/core/dist/cjs/types/index.d.ts +++ b/packages/core/dist/cjs/types/index.d.ts @@ -1,10 +1,11 @@ -import { UserSideOutput as SharendMetaplex } from '@solana-suite/shared-metaplex'; -import { UserSideOutput as Internal } from './user-side/output'; -export * from './find'; -export * from './infra-side/output'; -export * from './user-side/output'; -export * from './sol-native'; -export * from './transaction-filter'; +import { UserSideOutput as SharendMetaplex } from "@solana-suite/shared-metaplex"; +import { UserSideOutput as Internal } from "./user-side/output"; +export * from "./find"; +export * from "./infra-side/output"; +export * from "./user-side/output"; +export * from "./sol-native"; +export * from "./spl-token"; +export * from "./transaction-filter"; export type Find = SharendMetaplex.TokenMetadata; export type History = Internal.History; export type OnOk = (ok: T[]) => void; diff --git a/packages/core/dist/cjs/types/index.d.ts.map b/packages/core/dist/cjs/types/index.d.ts.map index 1a819acae..180b213e6 100644 --- a/packages/core/dist/cjs/types/index.d.ts.map +++ b/packages/core/dist/cjs/types/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AAErC,MAAM,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAEvC,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;AAC/D,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AAErC,MAAM,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAEvC,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;AAC/D,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/types/index.js b/packages/core/dist/cjs/types/index.js index b190ca39a..6894cf6b9 100644 --- a/packages/core/dist/cjs/types/index.js +++ b/packages/core/dist/cjs/types/index.js @@ -18,5 +18,6 @@ __exportStar(require("./find"), exports); __exportStar(require("./infra-side/output"), exports); __exportStar(require("./user-side/output"), exports); __exportStar(require("./sol-native"), exports); +__exportStar(require("./spl-token"), exports); __exportStar(require("./transaction-filter"), exports); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/core/dist/cjs/types/index.js.map b/packages/core/dist/cjs/types/index.js.map index fc2eee6b2..4956b5b8b 100644 --- a/packages/core/dist/cjs/types/index.js.map +++ b/packages/core/dist/cjs/types/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,yCAAuB;AACvB,sDAAoC;AACpC,qDAAmC;AACnC,+CAA6B;AAC7B,uDAAqC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,yCAAuB;AACvB,sDAAoC;AACpC,qDAAmC;AACnC,+CAA6B;AAC7B,8CAA4B;AAC5B,uDAAqC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/history.d.ts b/packages/core/dist/cjs/types/spl-token/history.d.ts new file mode 100644 index 000000000..edce1c30d --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/history.d.ts @@ -0,0 +1,5 @@ +export type HistoryOptions = { + waitTime: number; + narrowDown: number; +}; +//# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/history.d.ts.map b/packages/core/dist/cjs/types/spl-token/history.d.ts.map new file mode 100644 index 000000000..7a2305c0b --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/history.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/types/spl-token/history.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/history.js b/packages/core/dist/cjs/types/spl-token/history.js new file mode 100644 index 000000000..dc2af7658 --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/history.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=history.js.map \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/history.js.map b/packages/core/dist/cjs/types/spl-token/history.js.map new file mode 100644 index 000000000..4f74bf7d8 --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/history.js.map @@ -0,0 +1 @@ +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../../src/types/spl-token/history.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/index.d.ts b/packages/core/dist/cjs/types/spl-token/index.d.ts new file mode 100644 index 000000000..04849b8bf --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/index.d.ts @@ -0,0 +1,2 @@ +export * from './history'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/index.d.ts.map b/packages/core/dist/cjs/types/spl-token/index.d.ts.map new file mode 100644 index 000000000..898fc30c6 --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/spl-token/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/index.js b/packages/core/dist/cjs/types/spl-token/index.js new file mode 100644 index 000000000..f93ff7cf6 --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./history"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/core/dist/cjs/types/spl-token/index.js.map b/packages/core/dist/cjs/types/spl-token/index.js.map new file mode 100644 index 000000000..e113bd94d --- /dev/null +++ b/packages/core/dist/cjs/types/spl-token/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/spl-token/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"} \ No newline at end of file diff --git a/packages/core/dist/esm/memo/history.d.ts b/packages/core/dist/esm/memo/history.d.ts index dc6545ffe..1fe66dcdd 100644 --- a/packages/core/dist/esm/memo/history.d.ts +++ b/packages/core/dist/esm/memo/history.d.ts @@ -1,6 +1,9 @@ -import { Pubkey } from '@solana-suite/shared'; -import { History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { History, OnErr, OnOk } from "../types/"; export declare namespace Memo { - const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, option?: { + waitTime: 0.04; + narrowDown: 1000; + }) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/memo/history.d.ts.map b/packages/core/dist/esm/memo/history.d.ts.map index e35042bcf..d6cf6c2bf 100644 --- a/packages/core/dist/esm/memo/history.d.ts.map +++ b/packages/core/dist/esm/memo/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,WACH;QACP,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KAClB,KACA,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/esm/memo/history.js b/packages/core/dist/esm/memo/history.js index 4d886a7c8..0dbce3a45 100644 --- a/packages/core/dist/esm/memo/history.js +++ b/packages/core/dist/esm/memo/history.js @@ -7,16 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { FilterType, ModuleName } from '../types/'; -import { TransactionFilter } from '../transaction-filter'; -import { Signatures } from '../signatures'; +import { FilterType, ModuleName } from "../types/"; +import { TransactionFilter } from "../transaction-filter"; +import { Signatures } from "../signatures"; export var Memo; (function (Memo) { - Memo.getHistory = (target, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + Memo.getHistory = (target, onOk, onErr, option) => __awaiter(this, void 0, void 0, function* () { try { const parser = TransactionFilter.parse(FilterType.OnlyMemo, ModuleName.SolNative); - yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), narrowDown); + yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), option); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/esm/memo/history.js.map b/packages/core/dist/esm/memo/history.js.map index 9fb39b53d..e6a12779b 100644 --- a/packages/core/dist/esm/memo/history.js.map +++ b/packages/core/dist/esm/memo/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAW,UAAU,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,IAAI,CAwBpB;AAxBD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CACpC,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EAxBgB,IAAI,KAAJ,IAAI,QAwBpB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAW,UAAU,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,IAAI,CA2BpB;AA3BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,MAGC,EACc,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CACpC,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,MAAO,CACR,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA3BgB,IAAI,KAAJ,IAAI,QA2BpB"} \ No newline at end of file diff --git a/packages/core/dist/esm/memo/index.d.ts b/packages/core/dist/esm/memo/index.d.ts index 3c5fe9e6f..6bba5277b 100644 --- a/packages/core/dist/esm/memo/index.d.ts +++ b/packages/core/dist/esm/memo/index.d.ts @@ -1,6 +1,9 @@ /// export declare const Memo: { - getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, option?: { + waitTime: 0.04; + narrowDown: 1000; + } | undefined) => Promise; decode: (encoded: string) => string; encode: (data: string) => Buffer; create: (data: string, owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Instruction; diff --git a/packages/core/dist/esm/memo/index.d.ts.map b/packages/core/dist/esm/memo/index.d.ts.map index ed238f8b9..8c505697c 100644 --- a/packages/core/dist/esm/memo/index.d.ts.map +++ b/packages/core/dist/esm/memo/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;CAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;;;;CAA4B,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/signatures.js b/packages/core/dist/esm/signatures.js index 86aec8909..4f25f5851 100644 --- a/packages/core/dist/esm/signatures.js +++ b/packages/core/dist/esm/signatures.js @@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { debugLog, Node, Result, sleep } from '@solana-suite/shared'; +import { debugLog, Node, Result, sleep } from "@solana-suite/shared"; //@internal export var Signatures; (function (Signatures) { @@ -18,27 +18,13 @@ export var Signatures; } return res; }); - Signatures.getForAdress = (pubkey, parser, callback, narrowDown = 1000) => __awaiter(this, void 0, void 0, function* () { + Signatures.getForAdress = (pubkey, parser, callback, options, histories = []) => __awaiter(this, void 0, void 0, function* () { try { + debugLog("# options: ", options); const transactions = yield Node.getConnection().getSignaturesForAddress(pubkey.toPublicKey(), { - limit: narrowDown, + limit: options.narrowDown, }); - debugLog('# transactions count:', transactions.length); - const histories = []; - // don't use Promise.all, this is sync action - // let i = 1; - // for (const transaction of transactions) { - // const signature = await parseForTransaction(transaction.signature); - // const history = parser(signature); - // if (history) { - // histories.push(history); - // callback(Result.ok(histories)); - // i++; - // } - // if (receiveLimit && i > receiveLimit) { - // break; - // } - // } + debugLog("# transactions count:", transactions.length); for (const transaction of transactions) { parseForTransaction(transaction.signature) .then((signature) => { @@ -49,7 +35,7 @@ export var Signatures; } }) .catch((e) => callback(Result.err(e))); - yield sleep(0.05); // avoid 429 error + yield sleep(options.waitTime); // avoid 429 error } } catch (e) { diff --git a/packages/core/dist/esm/signatures.js.map b/packages/core/dist/esm/signatures.js.map index 42300ddb6..5e32f869f 100644 --- a/packages/core/dist/esm/signatures.js.map +++ b/packages/core/dist/esm/signatures.js.map @@ -1 +1 @@ -{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAU,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7E,WAAW;AACX,MAAM,KAAW,UAAU,CA+D1B;AA/DD,WAAiB,UAAU;IACzB,MAAM,mBAAmB,GAAG,CAC1B,SAAiB,EACmB,EAAE;QACtC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,EAA+B,CAAC;SACxC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAA,CAAC;IAEW,uBAAY,GAAG,CAC1B,MAAc,EACd,MAEuC,EACvC,QAAoE,EACpE,UAAU,GAAG,IAAI,EACF,EAAE;QACjB,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,uBAAuB,CACrE,MAAM,CAAC,WAAW,EAAE,EACpB;gBACE,KAAK,EAAE,UAAU;aAClB,CACF,CAAC;YAEF,QAAQ,CAAC,uBAAuB,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,SAAS,GAA6B,EAAE,CAAC;YAE/C,8CAA8C;YAC9C,aAAa;YACb,4CAA4C;YAC5C,wEAAwE;YACxE,uCAAuC;YACvC,mBAAmB;YACnB,+BAA+B;YAC/B,sCAAsC;YACtC,WAAW;YACX,MAAM;YACN,4CAA4C;YAC5C,aAAa;YACb,MAAM;YACN,IAAI;YAEJ,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;gBACtC,mBAAmB,CAAC,WAAW,CAAC,SAAS,CAAC;qBACvC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;oBAClB,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;oBAClC,IAAI,OAAO,EAAE;wBACX,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;qBAChC;gBACH,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB;aACtC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aACzB;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA/DgB,UAAU,KAAV,UAAU,QA+D1B"} \ No newline at end of file +{"version":3,"file":"signatures.js","sourceRoot":"","sources":["../../src/signatures.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAU,MAAM,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7E,WAAW;AACX,MAAM,KAAW,UAAU,CAoD1B;AApDD,WAAiB,UAAU;IACzB,MAAM,mBAAmB,GAAG,CAC1B,SAAiB,EACmB,EAAE;QACtC,MAAM,GAAG,GAAG,MAAM,IAAI,CAA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IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EApDgB,UAAU,KAAV,UAAU,QAoD1B"} \ No newline at end of file diff --git a/packages/core/dist/esm/sol-native/history.d.ts b/packages/core/dist/esm/sol-native/history.d.ts index e1a9c1ca0..7e52ca8e0 100644 --- a/packages/core/dist/esm/sol-native/history.d.ts +++ b/packages/core/dist/esm/sol-native/history.d.ts @@ -1,6 +1,6 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { FilterType, History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace SolNative { - const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/sol-native/history.d.ts.map b/packages/core/dist/esm/sol-native/history.d.ts.map index bb637a04c..c7e550654 100644 --- a/packages/core/dist/esm/sol-native/history.d.ts.map +++ b/packages/core/dist/esm/sol-native/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,SAAS,CAAC;IAClB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAcd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EACL,MAAM,WAAW,CAAC;AAInB,yBAAiB,SAAS,CAAC;IAClB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CAoBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/esm/sol-native/history.js b/packages/core/dist/esm/sol-native/history.js index 5bd2da71b..ac9052f3e 100644 --- a/packages/core/dist/esm/sol-native/history.js +++ b/packages/core/dist/esm/sol-native/history.js @@ -7,16 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { ModuleName } from '../types/'; -import { TransactionFilter } from '../transaction-filter'; -import { Signatures } from '../signatures'; +import { ModuleName, } from "../types/"; +import { TransactionFilter } from "../transaction-filter"; +import { Signatures } from "../signatures"; export var SolNative; (function (SolNative) { - SolNative.getHistory = (target, filterType, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + SolNative.getHistory = (target, filterType, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); const parser = TransactionFilter.parse(filterType, ModuleName.SolNative); - yield Signatures.getForAdress(target, parser, (result) => __awaiter(this, void 0, void 0, function* () { return yield result.match(onOk, onErr); }), narrowDown); + yield Signatures.getForAdress(target, parser, (result) => __awaiter(this, void 0, void 0, function* () { return yield result.match(onOk, onErr); }), mergedOptions); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/esm/sol-native/history.js.map b/packages/core/dist/esm/sol-native/history.js.map index 2475368bc..fb81c5dd4 100644 --- a/packages/core/dist/esm/sol-native/history.js.map +++ b/packages/core/dist/esm/sol-native/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAuB,UAAU,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,SAAS,CAsBzB;AAtBD,WAAiB,SAAS;IACX,oBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;YACzE,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAO,MAAM,EAAE,EAAE,gDAAC,OAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA,GAAA,EACjD,UAAU,CACX,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EAtBgB,SAAS,KAAT,SAAS,QAsBzB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/sol-native/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAIL,UAAU,GAGX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,SAAS,CA4BzB;AA5BD,WAAiB,SAAS;IACX,oBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAmC,EAAE,EACtB,EAAE;QACjB,IAAI;YACF,MAAM,aAAa,GAAmB;gBACpC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,GAAG;aAChB,CAAC;YACF,MAAM,aAAa,mCAAQ,aAAa,GAAK,OAAO,CAAE,CAAC;YAEvD,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;YACzE,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAO,MAAM,EAAE,EAAE,gDAAC,OAAA,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA,GAAA,EACjD,aAAa,CACd,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA5BgB,SAAS,KAAT,SAAS,QA4BzB"} \ No newline at end of file diff --git a/packages/core/dist/esm/sol-native/index.d.ts b/packages/core/dist/esm/sol-native/index.d.ts index a027a348c..aa43b06b6 100644 --- a/packages/core/dist/esm/sol-native/index.d.ts +++ b/packages/core/dist/esm/sol-native/index.d.ts @@ -1,7 +1,7 @@ export declare const SolNative: { transferWithMultisig: (owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer?: import("@solana-suite/shared").Secret | undefined) => Promise>; transfer: (source: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Result; - getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; feePayerPartialSignTransfer: (owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, feePayer: import("@solana-suite/shared").Pubkey) => Promise>; findByOwner: (owner: import("@solana-suite/shared").Pubkey) => Promise>; }; diff --git a/packages/core/dist/esm/spl-token/history.d.ts b/packages/core/dist/esm/spl-token/history.d.ts index 8b860b88d..7502812ea 100644 --- a/packages/core/dist/esm/spl-token/history.d.ts +++ b/packages/core/dist/esm/spl-token/history.d.ts @@ -1,6 +1,6 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, OnErr, OnOk } from '../types/'; +import { Pubkey } from "@solana-suite/shared"; +import { FilterType, History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace SplToken { - const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, narrowDown?: number) => Promise; + const getHistory: (target: Pubkey, filterType: FilterType, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/spl-token/history.d.ts.map b/packages/core/dist/esm/spl-token/history.d.ts.map index b676bb9ff..4ff064211 100644 --- a/packages/core/dist/esm/spl-token/history.d.ts.map +++ b/packages/core/dist/esm/spl-token/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,QAAQ,CAAC;IACjB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,0BAEX,QAAQ,IAAI,CAqCd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EAEL,MAAM,WAAW,CAAC;AAInB,yBAAiB,QAAQ,CAAC;IACjB,MAAM,UAAU,WACb,MAAM,cACF,UAAU,QAChB,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CA6Cd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/esm/spl-token/history.js b/packages/core/dist/esm/spl-token/history.js index 15e10205d..8c7571941 100644 --- a/packages/core/dist/esm/spl-token/history.js +++ b/packages/core/dist/esm/spl-token/history.js @@ -7,27 +7,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { TOKEN_PROGRAM_ID } from '@solana/spl-token'; -import { Node } from '@solana-suite/shared'; -import { FilterType, ModuleName } from '../types/'; -import { Signatures } from '../signatures'; -import { TransactionFilter } from '../transaction-filter'; +import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; +import { debugLog, Node } from "@solana-suite/shared"; +import { FilterType, ModuleName, } from "../types/"; +import { Signatures } from "../signatures"; +import { TransactionFilter } from "../transaction-filter"; export var SplToken; (function (SplToken) { - SplToken.getHistory = (target, filterType, onOk, onErr, narrowDown = 1000 // Max number: 1000 - ) => __awaiter(this, void 0, void 0, function* () { + SplToken.getHistory = (target, filterType, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); if (filterType === FilterType.Memo) { const parser = TransactionFilter.parse(filterType, ModuleName.SplToken); - yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), narrowDown); + yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), mergedOptions); } else { const tokenAccounts = yield Node.getConnection().getParsedTokenAccountsByOwner(target.toPublicKey(), { programId: TOKEN_PROGRAM_ID, }); + const storedHistories = []; + debugLog('# tokenAccounts size: ', tokenAccounts.value.length); for (const account of tokenAccounts.value) { const parser = TransactionFilter.parse(filterType, ModuleName.SplToken); - yield Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), narrowDown); + yield Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), mergedOptions, storedHistories); } } } diff --git a/packages/core/dist/esm/spl-token/history.js.map b/packages/core/dist/esm/spl-token/history.js.map index 798c2ff2a..4f369c951 100644 --- a/packages/core/dist/esm/spl-token/history.js.map +++ b/packages/core/dist/esm/spl-token/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAU,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAW,UAAU,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,KAAW,QAAQ,CA6CxB;AA7CD,WAAiB,QAAQ;IACV,mBAAU,GAAG,CACxB,MAAc,EACd,UAAsB,EACtB,IAAmB,EACnB,KAAY,EACZ,UAAU,GAAG,IAAI,CAAC,mBAAmB;MACtB,EAAE;QACjB,IAAI;YACF,IAAI,UAAU,KAAK,UAAU,CAAC,IAAI,EAAE;gBAClC,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACxE,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;aACH;iBAAM;gBACL,MAAM,aAAa,GACjB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,6BAA6B,CACtD,MAAM,CAAC,WAAW,EAAE,EACpB;oBACE,SAAS,EAAE,gBAAgB;iBAC5B,CACF,CAAC;gBAEJ,KAAK,MAAM,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE;oBACzC,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CACpC,UAAU,EACV,UAAU,CAAC,QAAQ,CACpB,CAAC;oBACF,MAAM,UAAU,CAAC,YAAY,CAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,UAAU,CACX,CAAC;iBACH;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA7CgB,QAAQ,KAAR,QAAQ,QA6CxB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/spl-token/history.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAU,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,UAAU,EAGV,UAAU,GAIX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAA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AC;iBACH;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EArDgB,QAAQ,KAAR,QAAQ,QAqDxB"} \ No newline at end of file diff --git a/packages/core/dist/esm/spl-token/index.d.ts b/packages/core/dist/esm/spl-token/index.d.ts index 41a17d903..fab91a345 100644 --- a/packages/core/dist/esm/spl-token/index.d.ts +++ b/packages/core/dist/esm/spl-token/index.d.ts @@ -5,7 +5,7 @@ export declare const SplToken: { createFreezeAuthority: (mint: import("@solana/web3.js").PublicKey, owner: import("@solana/web3.js").PublicKey, freezeAuthority: import("@solana/web3.js").PublicKey) => import("@solana/web3.js").TransactionInstruction; createMintInstructions: (mint: import("@solana/web3.js").PublicKey, owner: import("@solana/web3.js").PublicKey, totalAmount: number, mintDecimal: number, tokenMetadata: import("@metaplex-foundation/mpl-token-metadata").DataV2, feePayer: import("@solana/web3.js").PublicKey, isMutable: boolean) => Promise; mint: (owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, totalAmount: number, mintDecimal: number, input: import("@solana-suite/shared-metaplex").UserSideInput.TokenMetadata, feePayer?: import("@solana-suite/shared").Secret | undefined, freezeAuthority?: import("@solana-suite/shared").Pubkey | undefined) => Promise>; - getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, narrowDown?: number) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, filterType: import("..").FilterType, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; feePayerPartialSignTransfer: (mint: import("@solana-suite/shared").Pubkey, owner: import("@solana-suite/shared").Pubkey, dest: import("@solana-suite/shared").Pubkey, signers: import("@solana-suite/shared").Secret[], amount: number, mintDecimal: number, feePayer: import("@solana-suite/shared").Pubkey) => Promise>; freeze: (mint: import("@solana-suite/shared").Pubkey, owner: import("@solana-suite/shared").Pubkey, freezeAuthority: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Result; genericFindByOwner: (owner: import("@solana-suite/shared").Pubkey, callback: (result: import("@solana-suite/shared").Result) => void, tokenStandard: import("@solana-suite/shared-metaplex").UserSideInput.TokenStandard, sortable?: import("..").Sortable | undefined, isHolder?: boolean | undefined) => Promise; diff --git a/packages/core/dist/esm/types/index.d.ts b/packages/core/dist/esm/types/index.d.ts index 7c0f46b29..7cb89dee8 100644 --- a/packages/core/dist/esm/types/index.d.ts +++ b/packages/core/dist/esm/types/index.d.ts @@ -1,10 +1,11 @@ -import { UserSideOutput as SharendMetaplex } from '@solana-suite/shared-metaplex'; -import { UserSideOutput as Internal } from './user-side/output'; -export * from './find'; -export * from './infra-side/output'; -export * from './user-side/output'; -export * from './sol-native'; -export * from './transaction-filter'; +import { UserSideOutput as SharendMetaplex } from "@solana-suite/shared-metaplex"; +import { UserSideOutput as Internal } from "./user-side/output"; +export * from "./find"; +export * from "./infra-side/output"; +export * from "./user-side/output"; +export * from "./sol-native"; +export * from "./spl-token"; +export * from "./transaction-filter"; export type Find = SharendMetaplex.TokenMetadata; export type History = Internal.History; export type OnOk = (ok: T[]) => void; diff --git a/packages/core/dist/esm/types/index.d.ts.map b/packages/core/dist/esm/types/index.d.ts.map index 1a819acae..180b213e6 100644 --- a/packages/core/dist/esm/types/index.d.ts.map +++ b/packages/core/dist/esm/types/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AAErC,MAAM,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAEvC,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;AAC/D,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AAErC,MAAM,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAEvC,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;AAC/D,MAAM,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/types/index.js b/packages/core/dist/esm/types/index.js index 28b6919e3..1b4edf6c2 100644 --- a/packages/core/dist/esm/types/index.js +++ b/packages/core/dist/esm/types/index.js @@ -1,6 +1,7 @@ -export * from './find'; -export * from './infra-side/output'; -export * from './user-side/output'; -export * from './sol-native'; -export * from './transaction-filter'; +export * from "./find"; +export * from "./infra-side/output"; +export * from "./user-side/output"; +export * from "./sol-native"; +export * from "./spl-token"; +export * from "./transaction-filter"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/core/dist/esm/types/index.js.map b/packages/core/dist/esm/types/index.js.map index fa871a0ce..6a673163d 100644 --- a/packages/core/dist/esm/types/index.js.map +++ b/packages/core/dist/esm/types/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/history.d.ts b/packages/core/dist/esm/types/spl-token/history.d.ts new file mode 100644 index 000000000..edce1c30d --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/history.d.ts @@ -0,0 +1,5 @@ +export type HistoryOptions = { + waitTime: number; + narrowDown: number; +}; +//# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/history.d.ts.map b/packages/core/dist/esm/types/spl-token/history.d.ts.map new file mode 100644 index 000000000..7a2305c0b --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/history.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/types/spl-token/history.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/history.js b/packages/core/dist/esm/types/spl-token/history.js new file mode 100644 index 000000000..a770366cf --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/history.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=history.js.map \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/history.js.map b/packages/core/dist/esm/types/spl-token/history.js.map new file mode 100644 index 000000000..4f74bf7d8 --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/history.js.map @@ -0,0 +1 @@ +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../../src/types/spl-token/history.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/index.d.ts b/packages/core/dist/esm/types/spl-token/index.d.ts new file mode 100644 index 000000000..04849b8bf --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/index.d.ts @@ -0,0 +1,2 @@ +export * from './history'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/index.d.ts.map b/packages/core/dist/esm/types/spl-token/index.d.ts.map new file mode 100644 index 000000000..898fc30c6 --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/spl-token/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/index.js b/packages/core/dist/esm/types/spl-token/index.js new file mode 100644 index 000000000..8c494e795 --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/index.js @@ -0,0 +1,2 @@ +export * from './history'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/core/dist/esm/types/spl-token/index.js.map b/packages/core/dist/esm/types/spl-token/index.js.map new file mode 100644 index 000000000..a82e631e3 --- /dev/null +++ b/packages/core/dist/esm/types/spl-token/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/spl-token/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"} \ No newline at end of file diff --git a/packages/core/src/memo/history.ts b/packages/core/src/memo/history.ts index 86163bd0e..544a3493d 100644 --- a/packages/core/src/memo/history.ts +++ b/packages/core/src/memo/history.ts @@ -1,25 +1,37 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, ModuleName, OnErr, OnOk } from '../types/'; -import { TransactionFilter } from '../transaction-filter'; -import { Signatures } from '../signatures'; +import { Pubkey } from "@solana-suite/shared"; +import { + FilterType, + History, + HistoryOptions, + ModuleName, + OnErr, + OnOk, +} from "../types/"; +import { TransactionFilter } from "../transaction-filter"; +import { Signatures } from "../signatures"; export namespace Memo { export const getHistory = async ( target: Pubkey, onOk: OnOk, onErr: OnErr, - narrowDown = 1000 // Max number: 1000 + options: Partial = {}, ): Promise => { try { + const defaultValues: HistoryOptions = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = { ...defaultValues, ...options }; const parser = TransactionFilter.parse( FilterType.OnlyMemo, - ModuleName.SolNative + ModuleName.SolNative, ); await Signatures.getForAdress( target, parser, (result) => result.match(onOk, onErr), - narrowDown + mergedOptions ); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/src/signatures.ts b/packages/core/src/signatures.ts index 1406c3239..e3cb81838 100644 --- a/packages/core/src/signatures.ts +++ b/packages/core/src/signatures.ts @@ -1,11 +1,11 @@ -import { ParsedTransactionWithMeta } from '@solana/web3.js'; -import { debugLog, Node, Pubkey, Result, sleep } from '@solana-suite/shared'; -import { UserSideOutput } from './types/'; +import { ParsedTransactionWithMeta } from "@solana/web3.js"; +import { debugLog, Node, Pubkey, Result, sleep } from "@solana-suite/shared"; +import { UserSideOutput } from "./types/"; //@internal export namespace Signatures { const parseForTransaction = async ( - signature: string + signature: string, ): Promise => { const res = await Node.getConnection().getParsedTransaction(signature); if (!res) { @@ -17,36 +17,25 @@ export namespace Signatures { export const getForAdress = async ( pubkey: Pubkey, parser: ( - transaction: ParsedTransactionWithMeta + transaction: ParsedTransactionWithMeta, ) => UserSideOutput.History | undefined, callback: (history: Result) => void, - narrowDown = 1000 + options: { + waitTime: number; + narrowDown: number; + }, + histories: UserSideOutput.History[] = [], ): Promise => { try { + debugLog("# options: ", options); const transactions = await Node.getConnection().getSignaturesForAddress( pubkey.toPublicKey(), { - limit: narrowDown, - } + limit: options.narrowDown, + }, ); - debugLog('# transactions count:', transactions.length); - const histories: UserSideOutput.History[] = []; - - // don't use Promise.all, this is sync action - // let i = 1; - // for (const transaction of transactions) { - // const signature = await parseForTransaction(transaction.signature); - // const history = parser(signature); - // if (history) { - // histories.push(history); - // callback(Result.ok(histories)); - // i++; - // } - // if (receiveLimit && i > receiveLimit) { - // break; - // } - // } + debugLog("# transactions count:", transactions.length); for (const transaction of transactions) { parseForTransaction(transaction.signature) @@ -58,7 +47,7 @@ export namespace Signatures { } }) .catch((e) => callback(Result.err(e))); - await sleep(0.05); // avoid 429 error + await sleep(options.waitTime); // avoid 429 error } } catch (e) { if (e instanceof Error) { diff --git a/packages/core/src/sol-native/history.ts b/packages/core/src/sol-native/history.ts index d08ae01cc..1905687d8 100644 --- a/packages/core/src/sol-native/history.ts +++ b/packages/core/src/sol-native/history.ts @@ -1,7 +1,14 @@ -import { Pubkey } from '@solana-suite/shared'; -import { FilterType, History, ModuleName, OnErr, OnOk } from '../types/'; -import { TransactionFilter } from '../transaction-filter'; -import { Signatures } from '../signatures'; +import { Pubkey } from "@solana-suite/shared"; +import { + FilterType, + History, + HistoryOptions, + ModuleName, + OnErr, + OnOk, +} from "../types/"; +import { TransactionFilter } from "../transaction-filter"; +import { Signatures } from "../signatures"; export namespace SolNative { export const getHistory = async ( @@ -9,15 +16,21 @@ export namespace SolNative { filterType: FilterType, onOk: OnOk, onErr: OnErr, - narrowDown = 1000 // Max number: 1000 + options: Partial = {}, ): Promise => { try { + const defaultValues: HistoryOptions = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = { ...defaultValues, ...options }; + const parser = TransactionFilter.parse(filterType, ModuleName.SolNative); await Signatures.getForAdress( target, parser, async (result) => await result.match(onOk, onErr), - narrowDown + mergedOptions, ); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/src/spl-token/history.ts b/packages/core/src/spl-token/history.ts index 083298513..a6bdbfbe0 100644 --- a/packages/core/src/spl-token/history.ts +++ b/packages/core/src/spl-token/history.ts @@ -1,8 +1,16 @@ -import { TOKEN_PROGRAM_ID } from '@solana/spl-token'; -import { Node, Pubkey } from '@solana-suite/shared'; -import { FilterType, History, ModuleName, OnErr, OnOk } from '../types/'; -import { Signatures } from '../signatures'; -import { TransactionFilter } from '../transaction-filter'; +import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; +import { debugLog, Node, Pubkey } from "@solana-suite/shared"; +import { + FilterType, + History, + HistoryOptions, + ModuleName, + OnErr, + OnOk, + UserSideOutput, +} from "../types/"; +import { Signatures } from "../signatures"; +import { TransactionFilter } from "../transaction-filter"; export namespace SplToken { export const getHistory = async ( @@ -10,16 +18,21 @@ export namespace SplToken { filterType: FilterType, onOk: OnOk, onErr: OnErr, - narrowDown = 1000 // Max number: 1000 + options: Partial = {}, ): Promise => { try { + const defaultValues: HistoryOptions = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = { ...defaultValues, ...options }; if (filterType === FilterType.Memo) { const parser = TransactionFilter.parse(filterType, ModuleName.SplToken); await Signatures.getForAdress( target, parser, (result) => result.match(onOk, onErr), - narrowDown + mergedOptions, ); } else { const tokenAccounts = @@ -27,19 +40,22 @@ export namespace SplToken { target.toPublicKey(), { programId: TOKEN_PROGRAM_ID, - } + }, ); + const storedHistories: UserSideOutput.History[] = []; + debugLog("# tokenAccounts size: ", tokenAccounts.value.length); for (const account of tokenAccounts.value) { const parser = TransactionFilter.parse( filterType, - ModuleName.SplToken + ModuleName.SplToken, ); await Signatures.getForAdress( account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), - narrowDown + mergedOptions, + storedHistories, ); } } diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index b0df2eee4..95939685d 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -1,11 +1,12 @@ -import { UserSideOutput as SharendMetaplex } from '@solana-suite/shared-metaplex'; -import { UserSideOutput as Internal } from './user-side/output'; +import { UserSideOutput as SharendMetaplex } from "@solana-suite/shared-metaplex"; +import { UserSideOutput as Internal } from "./user-side/output"; -export * from './find'; -export * from './infra-side/output'; -export * from './user-side/output'; -export * from './sol-native'; -export * from './transaction-filter'; +export * from "./find"; +export * from "./infra-side/output"; +export * from "./user-side/output"; +export * from "./sol-native"; +export * from "./spl-token"; +export * from "./transaction-filter"; export type Find = SharendMetaplex.TokenMetadata; export type History = Internal.History; diff --git a/packages/core/src/types/spl-token/history.ts b/packages/core/src/types/spl-token/history.ts new file mode 100644 index 000000000..c8ce6ced8 --- /dev/null +++ b/packages/core/src/types/spl-token/history.ts @@ -0,0 +1,4 @@ +export type HistoryOptions = { + waitTime: number; + narrowDown: number; +}; diff --git a/packages/core/src/types/spl-token/index.ts b/packages/core/src/types/spl-token/index.ts new file mode 100644 index 000000000..1e6079eea --- /dev/null +++ b/packages/core/src/types/spl-token/index.ts @@ -0,0 +1 @@ +export * from './history'; diff --git a/packages/core/test/memo/history.test.ts b/packages/core/test/memo/history.test.ts index 9805b2f73..b3f4516cf 100644 --- a/packages/core/test/memo/history.test.ts +++ b/packages/core/test/memo/history.test.ts @@ -1,9 +1,10 @@ -import { describe, it } from 'mocha'; -import { assert } from 'chai'; -import { History, Memo, OnErr, OnOk } from '../../src/'; +import { describe, it } from "mocha"; +import { assert } from "chai"; +import { History, Memo, OnErr, OnOk } from "../../src/"; -const target = 'Ebq72X3i8ug6AX2G3v2ZoLA4ZcxHurvMuJYorqJ6sALD'; +const target = "Ebq72X3i8ug6AX2G3v2ZoLA4ZcxHurvMuJYorqJ6sALD"; const onOk: OnOk = (ok) => { + console.log("# hisory size: ", ok.length); ok.forEach((res) => { assert.isNotEmpty(res.source); assert.isNotEmpty(res.destination); @@ -16,8 +17,8 @@ const onOk: OnOk = (ok) => { const onErr: OnErr = (err: Error) => assert.fail(err.message); -describe('Memo', () => { - it('Get Only memo history', async () => { - await Memo.getHistory(target, onOk, onErr, 100); +describe("Memo", () => { + it("Get Only memo history", async () => { + await Memo.getHistory(target, onOk, onErr); }); }); diff --git a/packages/core/test/sol-native/history.test.ts b/packages/core/test/sol-native/history.test.ts index 56dd26032..be150c6b1 100644 --- a/packages/core/test/sol-native/history.test.ts +++ b/packages/core/test/sol-native/history.test.ts @@ -1,11 +1,12 @@ -import { describe, it } from 'mocha'; -import { FilterType, History, SolNative, OnErr, OnOk } from '../../src'; -import { assert } from 'chai'; -import { Setup } from '../../../shared/test/testSetup'; -import { Pubkey } from '../../../shared/src'; +import { describe, it } from "mocha"; +import { FilterType, History, OnErr, OnOk, SolNative } from "../../src"; +import { assert } from "chai"; +import { Setup } from "../../../shared/test/testSetup"; +import { Pubkey } from "../../../shared/src"; let target: Pubkey; const onOk: OnOk = (ok) => { + console.log("# hisory size: ", ok.length); ok.forEach((res) => { assert.isNotEmpty(res.source); assert.isNotEmpty(res.destination); @@ -18,26 +19,27 @@ const onOk: OnOk = (ok) => { const onErr: OnErr = (err: Error) => assert.fail(err.message); -describe('SolNative', () => { +describe("SolNative", () => { before(async () => { const obj = await Setup.generateKeyPair(); target = obj.source.pubkey; }); - it('Get transfer history', async () => { - await SolNative.getHistory(target, FilterType.Transfer, onOk, onErr, 100); + it("Get transfer history", async () => { + await SolNative.getHistory(target, FilterType.Transfer, onOk, onErr, { + waitTime: 0, + }); }); - it('Get Memo history', async () => { - await SolNative.getHistory(target, FilterType.Memo, onOk, onErr, 100); + it("Get Memo history", async () => { + await SolNative.getHistory(target, FilterType.Memo, onOk, onErr); - it('[Error]Get Mint history', async () => { + it("[Error]Get Mint history", async () => { await SolNative.getHistory( target, FilterType.Mint, - (_) => assert.fail('Dont go through here'), + (_) => assert.fail("Dont go through here"), (err) => assert.isOk(err.message), - 100 ); }); }); diff --git a/packages/core/test/spl-token/history.test.ts b/packages/core/test/spl-token/history.test.ts index 6c451ec93..6a27a19f7 100644 --- a/packages/core/test/spl-token/history.test.ts +++ b/packages/core/test/spl-token/history.test.ts @@ -1,11 +1,12 @@ -import { describe, it } from 'mocha'; -import { assert } from 'chai'; -import { FilterType, History, OnErr, OnOk, SplToken } from '../../src/'; -import { Setup } from '../../../shared/test/testSetup'; -import { Pubkey } from '../../../shared'; +import { describe, it } from "mocha"; +import { assert } from "chai"; +import { FilterType, History, OnErr, OnOk, SplToken } from "../../src/"; +import { Setup } from "../../../shared/test/testSetup"; +import { Pubkey } from "../../../shared"; let target: Pubkey; const onOk: OnOk = (ok) => { + console.log("# hisory size: ", ok.length); ok.forEach((res) => { assert.isNotEmpty(res.source); assert.isNotEmpty(res.destination); @@ -18,21 +19,13 @@ const onOk: OnOk = (ok) => { const onErr: OnErr = (err: Error) => assert.fail(err.message); -describe('SplToken', () => { +describe("SplToken", () => { before(async () => { const obj = await Setup.generateKeyPair(); target = obj.source.pubkey; }); - it('Get token transfer history', async () => { - await SplToken.getHistory(target, FilterType.Transfer, onOk, onErr, 100); - }); - - it('Get memo history', async () => { - await SplToken.getHistory(target, FilterType.Memo, onOk, onErr, 100); - }); - - it('Get mint history', async () => { - await SplToken.getHistory(target, FilterType.Mint, onOk, onErr, 100); + it("Get mint history", async () => { + await SplToken.getHistory(target, FilterType.Mint, onOk, onErr); }); }); diff --git a/packages/core/test/transaction-filter.test.ts b/packages/core/test/transaction-filter.test.ts index 46d2fd92c..c5d836d80 100644 --- a/packages/core/test/transaction-filter.test.ts +++ b/packages/core/test/transaction-filter.test.ts @@ -1,41 +1,46 @@ -import { describe, it } from 'mocha'; -import { Signatures } from '../src/signatures'; -import { assert } from 'chai'; -import { FilterType, ModuleName } from '../src/'; -import { Setup } from '../../shared/test/testSetup'; -import { Pubkey } from '../../shared/src'; -import { TransactionFilter } from '../src/transaction-filter'; -import { ok } from 'assert'; +import { describe, it } from "mocha"; +import { Signatures } from "../src/signatures"; +import { assert } from "chai"; +import { FilterType, ModuleName } from "../src/"; +import { Setup } from "../../shared/test/testSetup"; +import { Pubkey } from "../../shared/src"; +import { TransactionFilter } from "../src/transaction-filter"; +import { ok } from "assert"; let target: Pubkey; -describe('TransactionFilter', () => { +const options = { + waitTime: 0, + narrowDown: 100, +}; + +describe("TransactionFilter", () => { before(async () => { const obj = await Setup.generateKeyPair(); target = obj.source.pubkey; }); - it('Parse transfer history by SolNative', async () => { + it("Parse transfer history by SolNative", async () => { const parser = TransactionFilter.parse( FilterType.Transfer, - ModuleName.SolNative + ModuleName.SolNative, ); await Signatures.getForAdress( target, parser, (res) => { console.log(res); - console.log('# response size:', res.unwrap().length); + console.log("# response size:", res.unwrap().length); assert.isNotEmpty(res); }, - 100 + options, ); }); - it('Parse memo history by SplToken', async () => { + it("Parse memo history by SplToken", async () => { const parser = TransactionFilter.parse( FilterType.Memo, - ModuleName.SplToken + ModuleName.SplToken, ); await Signatures.getForAdress( target, @@ -44,14 +49,14 @@ describe('TransactionFilter', () => { console.log(res); assert.isNotEmpty(res); }, - 100 + options, ); }); - it('Parse Mint history', async () => { + it("Parse Mint history", async () => { const parser = TransactionFilter.parse( FilterType.Mint, - ModuleName.SplToken + ModuleName.SplToken, ); await Signatures.getForAdress( target, @@ -60,24 +65,24 @@ describe('TransactionFilter', () => { console.log(res); assert.isNotEmpty(res); }, - 100 + options, ); }); -it('[Error]Parse Mint history by SolNative', async () => { + it("[Error]Parse Mint history by SolNative", async () => { const parser = TransactionFilter.parse( FilterType.Mint, - ModuleName.SolNative + ModuleName.SolNative, ); await Signatures.getForAdress( target, parser, (histories) => { histories.match( - (_) => assert.fail('Dont go through here'), - (err) => assert.isOk(err.message) + (_) => assert.fail("Dont go through here"), + (err) => assert.isOk(err.message), ); }, - 100 + options, ); }); }); diff --git a/packages/shared/dist/cjs/node.d.ts b/packages/shared/dist/cjs/node.d.ts index 21d1d0d68..f9b029f48 100644 --- a/packages/shared/dist/cjs/node.d.ts +++ b/packages/shared/dist/cjs/node.d.ts @@ -1,5 +1,5 @@ -import { Result } from './result'; -import { Connection, Commitment } from '@solana/web3.js'; +import { Result } from "./result"; +import { Commitment, Connection } from "@solana/web3.js"; export declare namespace Node { const getConnection: () => Connection; const changeConnection: (param: { diff --git a/packages/shared/dist/cjs/node.d.ts.map b/packages/shared/dist/cjs/node.d.ts.map index 3b2ca14cf..e117850fb 100644 --- a/packages/shared/dist/cjs/node.d.ts.map +++ b/packages/shared/dist/cjs/node.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,IAAI,CAAC;IAOb,MAAM,aAAa,QAAO,UA+BhC,CAAC;IAEK,MAAM,gBAAgB,UAAW;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,KAAG,IA0BH,CAAC;IAEK,MAAM,YAAY,cACZ,MAAM,eACL,UAAU,2RAevB,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,IAAI,CAAC;IAOb,MAAM,aAAa,QAAO,UAsBhC,CAAC;IAEK,MAAM,gBAAgB,UAAW;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,KAAG,IA0BH,CAAC;IAEK,MAAM,YAAY,cACZ,MAAM,eACL,UAAU,2RAevB,CAAC;CACH"} \ No newline at end of file diff --git a/packages/shared/dist/cjs/node.js b/packages/shared/dist/cjs/node.js index f64529dbb..e71b7dbf6 100644 --- a/packages/shared/dist/cjs/node.js +++ b/packages/shared/dist/cjs/node.js @@ -17,13 +17,11 @@ const web3_js_1 = require("@solana/web3.js"); var Node; (function (Node) { const setted = { - clusterUrl: '', + clusterUrl: "", commitment: constants_1.Constants.COMMITMENT, customClusterUrl: [], }; Node.getConnection = () => { - (0, global_1.debugLog)('# [Before] setted:', setted); - (0, global_1.debugLog)('# [Before] Constants.customClusterUrl:', constants_1.Constants.customClusterUrl); if (setted.customClusterUrl.length > 0) { // custom cluster setted.clusterUrl = constants_1.Constants.switchCluster({ @@ -45,28 +43,27 @@ var Node; if (!setted.commitment) { setted.commitment = constants_1.Constants.COMMITMENT; } - (0, global_1.debugLog)('# [After] setted:', setted); return new web3_js_1.Connection(setted.clusterUrl, setted.commitment); }; Node.changeConnection = (param) => { // initialize - setted.clusterUrl = ''; + setted.clusterUrl = ""; setted.customClusterUrl = []; setted.commitment = constants_1.Constants.COMMITMENT; const { cluster, commitment, customClusterUrl } = param; if (commitment) { setted.commitment = commitment; - (0, global_1.debugLog)('# Node change commitment: ', setted.commitment); + (0, global_1.debugLog)("# Node change commitment: ", setted.commitment); } if (cluster) { setted.clusterUrl = constants_1.Constants.switchCluster({ cluster: cluster }); - (0, global_1.debugLog)('# Node change clusterUrl: ', setted.clusterUrl); + (0, global_1.debugLog)("# Node change clusterUrl: ", setted.clusterUrl); } if (customClusterUrl) { - (0, global_1.debugLog)('# customClusterUrl: ', customClusterUrl); + (0, global_1.debugLog)("# customClusterUrl: ", customClusterUrl); setted.clusterUrl = constants_1.Constants.switchCluster({ customClusterUrl }); setted.customClusterUrl = customClusterUrl; - (0, global_1.debugLog)('# Node change cluster, custom cluster url: ', setted.clusterUrl); + (0, global_1.debugLog)("# Node change cluster, custom cluster url: ", setted.clusterUrl); } }; Node.confirmedSig = (signature, commitment = constants_1.Constants.COMMITMENT) => __awaiter(this, void 0, void 0, function* () { diff --git a/packages/shared/dist/cjs/node.js.map b/packages/shared/dist/cjs/node.js.map index 3e1161024..4bdc23a2e 100644 --- a/packages/shared/dist/cjs/node.js.map +++ b/packages/shared/dist/cjs/node.js.map @@ -1 +1 @@ -{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoC;AACpC,qCAAkC;AAClC,2CAAwC;AAExC,6CAAyD;AAEzD,IAAiB,IAAI,CA0FpB;AA1FD,WAAiB,IAAI;IACnB,MAAM,MAAM,GAAG;QACb,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,qBAAS,CAAC,UAAU;QAChC,gBAAgB,EAAE,EAAc;KACjC,CAAC;IAEW,kBAAa,GAAG,GAAe,EAAE;QAC5C,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QACvC,IAAA,iBAAQ,EACN,wCAAwC,EACxC,qBAAS,CAAC,gBAAgB,CAC3B,CAAC;QAEF,IAAI,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YACtC,iBAAiB;YACjB,MAAM,CAAC,UAAU,GAAG,qBAAS,CAAC,aAAa,CAAC;gBAC1C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;aAC1C,CAAC,CAAC;SACJ;aAAM,IAAI,qBAAS,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChD,gCAAgC;YAChC,MAAM,CAAC,UAAU,GAAG,qBAAS,CAAC,aAAa,CAAC;gBAC1C,gBAAgB,EAAE,qBAAS,CAAC,gBAAgB;aAC7C,CAAC,CAAC;SACJ;aAAM,IAAI,CAAC,MAAM,CAAC,UAAU,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AAC;YACnD,MAAM,CAAC,UAAU,GAAG,qBAAS,CAAC,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC;YAClE,MAAM,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;YAC3C,IAAA,iBAAQ,EACN,6CAA6C,EAC7C,MAAM,CAAC,UAAU,CAClB,CAAC;SACH;IACH,CAAC,CAAC;IAEW,iBAAY,GAAG,CAC1B,SAAiB,EACjB,aAAyB,qBAAS,CAAC,UAAU,EAC7C,EAAE;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;QAC9D,OAAO,MAAM,UAAU;aACpB,kBAAkB,CACjB;YACE,SAAS,EAAE,eAAe,CAAC,SAAS;YACpC,oBAAoB,EAAE,eAAe,CAAC,oBAAoB;YAC1D,SAAS;SACV,EACD,UAAU,CACX;aACA,IAAI,CAAC,eAAM,CAAC,EAAE,CAAC;aACf,KAAK,CAAC,eAAM,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAA,CAAC;AACJ,CAAC,EAjFgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAiFpB"} \ No newline at end of file diff --git a/packages/shared/dist/esm/node.d.ts b/packages/shared/dist/esm/node.d.ts index 21d1d0d68..f9b029f48 100644 --- a/packages/shared/dist/esm/node.d.ts +++ b/packages/shared/dist/esm/node.d.ts @@ -1,5 +1,5 @@ -import { Result } from './result'; -import { Connection, Commitment } from '@solana/web3.js'; +import { Result } from "./result"; +import { Commitment, Connection } from "@solana/web3.js"; export declare namespace Node { const getConnection: () => Connection; const changeConnection: (param: { diff --git a/packages/shared/dist/esm/node.d.ts.map b/packages/shared/dist/esm/node.d.ts.map index 3b2ca14cf..e117850fb 100644 --- a/packages/shared/dist/esm/node.d.ts.map +++ b/packages/shared/dist/esm/node.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,IAAI,CAAC;IAOb,MAAM,aAAa,QAAO,UA+BhC,CAAC;IAEK,MAAM,gBAAgB,UAAW;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,KAAG,IA0BH,CAAC;IAEK,MAAM,YAAY,cACZ,MAAM,eACL,UAAU,2RAevB,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEzD,yBAAiB,IAAI,CAAC;IAOb,MAAM,aAAa,QAAO,UAsBhC,CAAC;IAEK,MAAM,gBAAgB,UAAW;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC7B,KAAG,IA0BH,CAAC;IAEK,MAAM,YAAY,cACZ,MAAM,eACL,UAAU,2RAevB,CAAC;CACH"} \ No newline at end of file diff --git a/packages/shared/dist/esm/node.js b/packages/shared/dist/esm/node.js index a2dbae055..488c381c0 100644 --- a/packages/shared/dist/esm/node.js +++ b/packages/shared/dist/esm/node.js @@ -7,20 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { debugLog } from './global'; -import { Result } from './result'; -import { Constants } from './constants'; -import { Connection } from '@solana/web3.js'; +import { debugLog } from "./global"; +import { Result } from "./result"; +import { Constants } from "./constants"; +import { Connection } from "@solana/web3.js"; export var Node; (function (Node) { const setted = { - clusterUrl: '', + clusterUrl: "", commitment: Constants.COMMITMENT, customClusterUrl: [], }; Node.getConnection = () => { - debugLog('# [Before] setted:', setted); - debugLog('# [Before] Constants.customClusterUrl:', Constants.customClusterUrl); if (setted.customClusterUrl.length > 0) { // custom cluster setted.clusterUrl = Constants.switchCluster({ @@ -42,28 +40,27 @@ export var Node; if (!setted.commitment) { setted.commitment = Constants.COMMITMENT; } - debugLog('# [After] setted:', setted); return new Connection(setted.clusterUrl, setted.commitment); }; Node.changeConnection = (param) => { // initialize - setted.clusterUrl = ''; + setted.clusterUrl = ""; setted.customClusterUrl = []; setted.commitment = Constants.COMMITMENT; const { cluster, commitment, customClusterUrl } = param; if (commitment) { setted.commitment = commitment; - debugLog('# Node change commitment: ', setted.commitment); + debugLog("# Node change commitment: ", setted.commitment); } if (cluster) { setted.clusterUrl = Constants.switchCluster({ cluster: cluster }); - debugLog('# Node change clusterUrl: ', setted.clusterUrl); + debugLog("# Node change clusterUrl: ", setted.clusterUrl); } if (customClusterUrl) { - debugLog('# customClusterUrl: ', customClusterUrl); + debugLog("# customClusterUrl: ", customClusterUrl); setted.clusterUrl = Constants.switchCluster({ customClusterUrl }); setted.customClusterUrl = customClusterUrl; - debugLog('# Node change cluster, custom cluster url: ', setted.clusterUrl); + debugLog("# Node change cluster, custom cluster url: ", setted.clusterUrl); } }; Node.confirmedSig = (signature, commitment = Constants.COMMITMENT) => __awaiter(this, void 0, void 0, function* () { diff --git a/packages/shared/dist/esm/node.js.map b/packages/shared/dist/esm/node.js.map index e1acf9e5e..6f36f02a0 100644 --- a/packages/shared/dist/esm/node.js.map +++ b/packages/shared/dist/esm/node.js.map @@ -1 +1 @@ -{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,E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C7C,EAAE;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC;QAC9D,OAAO,MAAM,UAAU;aACpB,kBAAkB,CACjB;YACE,SAAS,EAAE,eAAe,CAAC,SAAS;YACpC,oBAAoB,EAAE,eAAe,CAAC,oBAAoB;YAC1D,SAAS;SACV,EACD,UAAU,CACX;aACA,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;aACf,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAA,CAAC;AACJ,CAAC,EAjFgB,IAAI,KAAJ,IAAI,QAiFpB"} \ No newline at end of file diff --git a/packages/shared/src/node.ts b/packages/shared/src/node.ts index 031a48832..3741440e8 100644 --- a/packages/shared/src/node.ts +++ b/packages/shared/src/node.ts @@ -1,23 +1,17 @@ -import { debugLog } from './global'; -import { Result } from './result'; -import { Constants } from './constants'; +import { debugLog } from "./global"; +import { Result } from "./result"; +import { Constants } from "./constants"; -import { Connection, Commitment } from '@solana/web3.js'; +import { Commitment, Connection } from "@solana/web3.js"; export namespace Node { const setted = { - clusterUrl: '', + clusterUrl: "", commitment: Constants.COMMITMENT, customClusterUrl: [] as string[], }; export const getConnection = (): Connection => { - debugLog('# [Before] setted:', setted); - debugLog( - '# [Before] Constants.customClusterUrl:', - Constants.customClusterUrl - ); - if (setted.customClusterUrl.length > 0) { // custom cluster setted.clusterUrl = Constants.switchCluster({ @@ -38,9 +32,6 @@ export namespace Node { if (!setted.commitment) { setted.commitment = Constants.COMMITMENT; } - - debugLog('# [After] setted:', setted); - return new Connection(setted.clusterUrl, setted.commitment); }; @@ -50,35 +41,35 @@ export namespace Node { customClusterUrl?: string[]; }): void => { // initialize - setted.clusterUrl = ''; + setted.clusterUrl = ""; setted.customClusterUrl = []; setted.commitment = Constants.COMMITMENT; const { cluster, commitment, customClusterUrl } = param; if (commitment) { setted.commitment = commitment; - debugLog('# Node change commitment: ', setted.commitment); + debugLog("# Node change commitment: ", setted.commitment); } if (cluster) { setted.clusterUrl = Constants.switchCluster({ cluster: cluster }); - debugLog('# Node change clusterUrl: ', setted.clusterUrl); + debugLog("# Node change clusterUrl: ", setted.clusterUrl); } if (customClusterUrl) { - debugLog('# customClusterUrl: ', customClusterUrl); + debugLog("# customClusterUrl: ", customClusterUrl); setted.clusterUrl = Constants.switchCluster({ customClusterUrl }); setted.customClusterUrl = customClusterUrl; debugLog( - '# Node change cluster, custom cluster url: ', - setted.clusterUrl + "# Node change cluster, custom cluster url: ", + setted.clusterUrl, ); } }; export const confirmedSig = async ( signature: string, - commitment: Commitment = Constants.COMMITMENT + commitment: Commitment = Constants.COMMITMENT, ) => { const connection = Node.getConnection(); const latestBlockhash = await connection.getLatestBlockhash(); @@ -89,7 +80,7 @@ export namespace Node { lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, signature, }, - commitment + commitment, ) .then(Result.ok) .catch(Result.err); From 5b2dd1954cd0094bf9752813c277ad285b49a2fc Mon Sep 17 00:00:00 2001 From: fukaoi Date: Fri, 22 Sep 2023 11:10:38 +0900 Subject: [PATCH 2/2] Miss compiled files --- packages/core/dist/cjs/memo/history.d.ts | 7 ++----- packages/core/dist/cjs/memo/history.d.ts.map | 2 +- packages/core/dist/cjs/memo/history.js | 9 +++++++-- packages/core/dist/cjs/memo/history.js.map | 2 +- packages/core/dist/cjs/memo/index.d.ts | 5 +---- packages/core/dist/cjs/memo/index.d.ts.map | 2 +- packages/core/dist/cjs/spl-token/history.js | 2 +- packages/core/dist/esm/memo/history.d.ts | 7 ++----- packages/core/dist/esm/memo/history.d.ts.map | 2 +- packages/core/dist/esm/memo/history.js | 11 ++++++++--- packages/core/dist/esm/memo/history.js.map | 2 +- packages/core/dist/esm/memo/index.d.ts | 5 +---- packages/core/dist/esm/memo/index.d.ts.map | 2 +- packages/core/dist/esm/spl-token/history.js | 2 +- 14 files changed, 29 insertions(+), 31 deletions(-) diff --git a/packages/core/dist/cjs/memo/history.d.ts b/packages/core/dist/cjs/memo/history.d.ts index 1fe66dcdd..5a172c336 100644 --- a/packages/core/dist/cjs/memo/history.d.ts +++ b/packages/core/dist/cjs/memo/history.d.ts @@ -1,9 +1,6 @@ import { Pubkey } from "@solana-suite/shared"; -import { History, OnErr, OnOk } from "../types/"; +import { History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace Memo { - const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, option?: { - waitTime: 0.04; - narrowDown: 1000; - }) => Promise; + const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/history.d.ts.map b/packages/core/dist/cjs/memo/history.d.ts.map index d6cf6c2bf..3299ac0fb 100644 --- a/packages/core/dist/cjs/memo/history.d.ts.map +++ b/packages/core/dist/cjs/memo/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,WACH;QACP,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KAClB,KACA,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAEL,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EACL,MAAM,WAAW,CAAC;AAInB,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CAsBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/history.js b/packages/core/dist/cjs/memo/history.js index 9740d36e1..9f20a5b6c 100644 --- a/packages/core/dist/cjs/memo/history.js +++ b/packages/core/dist/cjs/memo/history.js @@ -15,10 +15,15 @@ const transaction_filter_1 = require("../transaction-filter"); const signatures_1 = require("../signatures"); var Memo; (function (Memo) { - Memo.getHistory = (target, onOk, onErr, option) => __awaiter(this, void 0, void 0, function* () { + Memo.getHistory = (target, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); const parser = transaction_filter_1.TransactionFilter.parse(types_1.FilterType.OnlyMemo, types_1.ModuleName.SolNative); - yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), option); + yield signatures_1.Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), mergedOptions); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/cjs/memo/history.js.map b/packages/core/dist/cjs/memo/history.js.map index 261534c1c..62e294216 100644 --- a/packages/core/dist/cjs/memo/history.js.map +++ b/packages/core/dist/cjs/memo/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAyE;AACzE,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,IAAI,CA2BpB;AA3BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,MAGC,EACc,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CACpC,kBAAU,CAAC,QAAQ,EACnB,kBAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,MAAO,CACR,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA3BgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QA2BpB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAOmB;AACnB,8DAA0D;AAC1D,8CAA2C;AAE3C,IAAiB,IAAI,CA6BpB;AA7BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,UAAmC,EAAE,EACtB,EAAE;QACjB,IAAI;YACF,MAAM,aAAa,GAAmB;gBACpC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,GAAG;aAChB,CAAC;YACF,MAAM,aAAa,mCAAQ,aAAa,GAAK,OAAO,CAAE,CAAC;YACvD,MAAM,MAAM,GAAG,sCAAiB,CAAC,KAAK,CACpC,kBAAU,CAAC,QAAQ,EACnB,kBAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,uBAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,aAAa,CACd,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA7BgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QA6BpB"} \ No newline at end of file diff --git a/packages/core/dist/cjs/memo/index.d.ts b/packages/core/dist/cjs/memo/index.d.ts index 6bba5277b..bc0c79f0a 100644 --- a/packages/core/dist/cjs/memo/index.d.ts +++ b/packages/core/dist/cjs/memo/index.d.ts @@ -1,9 +1,6 @@ /// export declare const Memo: { - getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, option?: { - waitTime: 0.04; - narrowDown: 1000; - } | undefined) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; decode: (encoded: string) => string; encode: (data: string) => Buffer; create: (data: string, owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Instruction; diff --git a/packages/core/dist/cjs/memo/index.d.ts.map b/packages/core/dist/cjs/memo/index.d.ts.map index 8c505697c..ed238f8b9 100644 --- a/packages/core/dist/cjs/memo/index.d.ts.map +++ b/packages/core/dist/cjs/memo/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;;;;CAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;CAA4B,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/cjs/spl-token/history.js b/packages/core/dist/cjs/spl-token/history.js index af6fe72ce..99a1a50f3 100644 --- a/packages/core/dist/cjs/spl-token/history.js +++ b/packages/core/dist/cjs/spl-token/history.js @@ -33,7 +33,7 @@ var SplToken; programId: spl_token_1.TOKEN_PROGRAM_ID, }); const storedHistories = []; - (0, shared_1.debugLog)('# tokenAccounts size: ', tokenAccounts.value.length); + (0, shared_1.debugLog)("# tokenAccounts size: ", tokenAccounts.value.length); for (const account of tokenAccounts.value) { const parser = transaction_filter_1.TransactionFilter.parse(filterType, types_1.ModuleName.SplToken); yield signatures_1.Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), mergedOptions, storedHistories); diff --git a/packages/core/dist/esm/memo/history.d.ts b/packages/core/dist/esm/memo/history.d.ts index 1fe66dcdd..5a172c336 100644 --- a/packages/core/dist/esm/memo/history.d.ts +++ b/packages/core/dist/esm/memo/history.d.ts @@ -1,9 +1,6 @@ import { Pubkey } from "@solana-suite/shared"; -import { History, OnErr, OnOk } from "../types/"; +import { History, HistoryOptions, OnErr, OnOk } from "../types/"; export declare namespace Memo { - const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, option?: { - waitTime: 0.04; - narrowDown: 1000; - }) => Promise; + const getHistory: (target: Pubkey, onOk: OnOk, onErr: OnErr, options?: Partial) => Promise; } //# sourceMappingURL=history.d.ts.map \ No newline at end of file diff --git a/packages/core/dist/esm/memo/history.d.ts.map b/packages/core/dist/esm/memo/history.d.ts.map index d6cf6c2bf..3299ac0fb 100644 --- a/packages/core/dist/esm/memo/history.d.ts.map +++ b/packages/core/dist/esm/memo/history.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAc,OAAO,EAAc,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIzE,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,WACH;QACP,QAAQ,EAAE,IAAI,CAAC;QACf,UAAU,EAAE,IAAI,CAAC;KAClB,KACA,QAAQ,IAAI,CAiBd,CAAC;CACH"} \ No newline at end of file +{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAEL,OAAO,EACP,cAAc,EAEd,KAAK,EACL,IAAI,EACL,MAAM,WAAW,CAAC;AAInB,yBAAiB,IAAI,CAAC;IACb,MAAM,UAAU,WACb,MAAM,QACR,KAAK,OAAO,CAAC,SACZ,KAAK,YACH,QAAQ,cAAc,CAAC,KAC/B,QAAQ,IAAI,CAsBd,CAAC;CACH"} \ No newline at end of file diff --git a/packages/core/dist/esm/memo/history.js b/packages/core/dist/esm/memo/history.js index 0dbce3a45..4357b5987 100644 --- a/packages/core/dist/esm/memo/history.js +++ b/packages/core/dist/esm/memo/history.js @@ -7,15 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -import { FilterType, ModuleName } from "../types/"; +import { FilterType, ModuleName, } from "../types/"; import { TransactionFilter } from "../transaction-filter"; import { Signatures } from "../signatures"; export var Memo; (function (Memo) { - Memo.getHistory = (target, onOk, onErr, option) => __awaiter(this, void 0, void 0, function* () { + Memo.getHistory = (target, onOk, onErr, options = {}) => __awaiter(this, void 0, void 0, function* () { try { + const defaultValues = { + waitTime: 0.03, + narrowDown: 100, + }; + const mergedOptions = Object.assign(Object.assign({}, defaultValues), options); const parser = TransactionFilter.parse(FilterType.OnlyMemo, ModuleName.SolNative); - yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), option); + yield Signatures.getForAdress(target, parser, (result) => result.match(onOk, onErr), mergedOptions); } catch (e) { if (e instanceof Error) { diff --git a/packages/core/dist/esm/memo/history.js.map b/packages/core/dist/esm/memo/history.js.map index e6a12779b..d727d6ec5 100644 --- a/packages/core/dist/esm/memo/history.js.map +++ b/packages/core/dist/esm/memo/history.js.map @@ -1 +1 @@ -{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAW,UAAU,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,IAAI,CA2BpB;AA3BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,MAGC,EACc,EAAE;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CACpC,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,MAAO,CACR,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA3BgB,IAAI,KAAJ,IAAI,QA2BpB"} \ No newline at end of file +{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/memo/history.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EACL,UAAU,EAGV,UAAU,GAGX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,KAAW,IAAI,CA6BpB;AA7BD,WAAiB,IAAI;IACN,eAAU,GAAG,CACxB,MAAc,EACd,IAAmB,EACnB,KAAY,EACZ,UAAmC,EAAE,EACtB,EAAE;QACjB,IAAI;YACF,MAAM,aAAa,GAAmB;gBACpC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,GAAG;aAChB,CAAC;YACF,MAAM,aAAa,mCAAQ,aAAa,GAAK,OAAO,CAAE,CAAC;YACvD,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CACpC,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,SAAS,CACrB,CAAC;YACF,MAAM,UAAU,CAAC,YAAY,CAC3B,MAAM,EACN,MAAM,EACN,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EACrC,aAAa,CACd,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,CAAC,CAAC,CAAC,CAAC;aACV;SACF;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA7BgB,IAAI,KAAJ,IAAI,QA6BpB"} \ No newline at end of file diff --git a/packages/core/dist/esm/memo/index.d.ts b/packages/core/dist/esm/memo/index.d.ts index 6bba5277b..bc0c79f0a 100644 --- a/packages/core/dist/esm/memo/index.d.ts +++ b/packages/core/dist/esm/memo/index.d.ts @@ -1,9 +1,6 @@ /// export declare const Memo: { - getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, option?: { - waitTime: 0.04; - narrowDown: 1000; - } | undefined) => Promise; + getHistory: (target: import("@solana-suite/shared").Pubkey, onOk: import("..").OnOk, onErr: import("..").OnErr, options?: Partial) => Promise; decode: (encoded: string) => string; encode: (data: string) => Buffer; create: (data: string, owner: import("@solana-suite/shared").Pubkey, signer: import("@solana-suite/shared").Secret, feePayer?: import("@solana-suite/shared").Secret | undefined) => import("@solana-suite/shared").Instruction; diff --git a/packages/core/dist/esm/memo/index.d.ts.map b/packages/core/dist/esm/memo/index.d.ts.map index 8c505697c..ed238f8b9 100644 --- a/packages/core/dist/esm/memo/index.d.ts.map +++ b/packages/core/dist/esm/memo/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;;;;CAA4B,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memo/index.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,IAAI;;;;;CAA4B,CAAC"} \ No newline at end of file diff --git a/packages/core/dist/esm/spl-token/history.js b/packages/core/dist/esm/spl-token/history.js index 8c7571941..e410d4d4f 100644 --- a/packages/core/dist/esm/spl-token/history.js +++ b/packages/core/dist/esm/spl-token/history.js @@ -30,7 +30,7 @@ export var SplToken; programId: TOKEN_PROGRAM_ID, }); const storedHistories = []; - debugLog('# tokenAccounts size: ', tokenAccounts.value.length); + debugLog("# tokenAccounts size: ", tokenAccounts.value.length); for (const account of tokenAccounts.value) { const parser = TransactionFilter.parse(filterType, ModuleName.SplToken); yield Signatures.getForAdress(account.pubkey.toString(), parser, (result) => result.match(onOk, onErr), mergedOptions, storedHistories);