kasbah 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +126 -2
- package/dist/abi/abi.d.ts +86 -0
- package/dist/abi/abi.d.ts.map +1 -0
- package/dist/abi/abi.js +2 -0
- package/dist/abi/abi.js.map +1 -0
- package/dist/abi/codec.d.ts +26 -0
- package/dist/abi/codec.d.ts.map +1 -0
- package/dist/abi/codec.js +448 -0
- package/dist/abi/codec.js.map +1 -0
- package/dist/abi/events.d.ts +20 -0
- package/dist/abi/events.d.ts.map +1 -0
- package/dist/abi/events.js +142 -0
- package/dist/abi/events.js.map +1 -0
- package/dist/abi/functions.d.ts +15 -0
- package/dist/abi/functions.d.ts.map +1 -0
- package/dist/abi/functions.js +56 -0
- package/dist/abi/functions.js.map +1 -0
- package/dist/abi/history.d.ts +24 -0
- package/dist/abi/history.d.ts.map +1 -0
- package/dist/abi/history.js +81 -0
- package/dist/abi/history.js.map +1 -0
- package/dist/abi/selector.d.ts +7 -0
- package/dist/abi/selector.d.ts.map +1 -0
- package/dist/abi/selector.js +16 -0
- package/dist/abi/selector.js.map +1 -0
- package/dist/abi/types.d.ts +161 -0
- package/dist/abi/types.d.ts.map +1 -0
- package/dist/abi/types.js +2 -0
- package/dist/abi/types.js.map +1 -0
- package/dist/api/graphql.d.ts +44 -0
- package/dist/api/graphql.d.ts.map +1 -0
- package/dist/api/graphql.js +469 -0
- package/dist/api/graphql.js.map +1 -0
- package/dist/api/limits.d.ts +8 -0
- package/dist/api/limits.d.ts.map +1 -0
- package/dist/api/limits.js +40 -0
- package/dist/api/limits.js.map +1 -0
- package/dist/api/prometheus.d.ts +10 -0
- package/dist/api/prometheus.d.ts.map +1 -0
- package/dist/api/prometheus.js +15 -0
- package/dist/api/prometheus.js.map +1 -0
- package/dist/api/reader.d.ts +46 -0
- package/dist/api/reader.d.ts.map +1 -0
- package/dist/api/reader.js +157 -0
- package/dist/api/reader.js.map +1 -0
- package/dist/api/routes.d.ts +31 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +39 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/api/server.d.ts +32 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +382 -0
- package/dist/api/server.js.map +1 -0
- package/dist/cli/commands/cache.d.ts +7 -0
- package/dist/cli/commands/cache.d.ts.map +1 -0
- package/dist/cli/commands/cache.js +29 -0
- package/dist/cli/commands/cache.js.map +1 -0
- package/dist/cli/commands/clean.d.ts +3 -0
- package/dist/cli/commands/clean.d.ts.map +1 -0
- package/dist/cli/commands/clean.js +25 -0
- package/dist/cli/commands/clean.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +10 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +76 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/init.d.ts +42 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +402 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +2 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +12 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +31 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/devdb.d.ts +22 -0
- package/dist/cli/devdb.d.ts.map +1 -0
- package/dist/cli/devdb.js +108 -0
- package/dist/cli/devdb.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +126 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/project.d.ts +26 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +64 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/ui/dashboard.d.ts +23 -0
- package/dist/cli/ui/dashboard.d.ts.map +1 -0
- package/dist/cli/ui/dashboard.js +376 -0
- package/dist/cli/ui/dashboard.js.map +1 -0
- package/dist/cli/ui/prompt.d.ts +31 -0
- package/dist/cli/ui/prompt.d.ts.map +1 -0
- package/dist/cli/ui/prompt.js +194 -0
- package/dist/cli/ui/prompt.js.map +1 -0
- package/dist/config/app.d.ts +236 -0
- package/dist/config/app.d.ts.map +1 -0
- package/dist/config/app.js +75 -0
- package/dist/config/app.js.map +1 -0
- package/dist/config/errors.d.ts +8 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/errors.js +8 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/network.d.ts +11 -0
- package/dist/config/network.d.ts.map +1 -0
- package/dist/config/network.js +22 -0
- package/dist/config/network.js.map +1 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resolve.js +67 -0
- package/dist/config/resolve.js.map +1 -0
- package/dist/config/rpc.d.ts +10 -0
- package/dist/config/rpc.d.ts.map +1 -0
- package/dist/config/rpc.js +21 -0
- package/dist/config/rpc.js.map +1 -0
- package/dist/config/schema.d.ts +55 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +12 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/db/cache.d.ts +68 -0
- package/dist/db/cache.d.ts.map +1 -0
- package/dist/db/cache.js +339 -0
- package/dist/db/cache.js.map +1 -0
- package/dist/db/copy.d.ts +7 -0
- package/dist/db/copy.d.ts.map +1 -0
- package/dist/db/copy.js +68 -0
- package/dist/db/copy.js.map +1 -0
- package/dist/db/store.d.ts +55 -0
- package/dist/db/store.d.ts.map +1 -0
- package/dist/db/store.js +317 -0
- package/dist/db/store.js.map +1 -0
- package/dist/db/table.d.ts +43 -0
- package/dist/db/table.d.ts.map +1 -0
- package/dist/db/table.js +124 -0
- package/dist/db/table.js.map +1 -0
- package/dist/db/transaction.d.ts +4 -0
- package/dist/db/transaction.d.ts.map +1 -0
- package/dist/db/transaction.js +18 -0
- package/dist/db/transaction.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer/client.d.ts +92 -0
- package/dist/indexer/client.d.ts.map +1 -0
- package/dist/indexer/client.js +162 -0
- package/dist/indexer/client.js.map +1 -0
- package/dist/indexer/commit.d.ts +97 -0
- package/dist/indexer/commit.d.ts.map +1 -0
- package/dist/indexer/commit.js +161 -0
- package/dist/indexer/commit.js.map +1 -0
- package/dist/indexer/events.d.ts +27 -0
- package/dist/indexer/events.d.ts.map +1 -0
- package/dist/indexer/events.js +151 -0
- package/dist/indexer/events.js.map +1 -0
- package/dist/indexer/filters.d.ts +14 -0
- package/dist/indexer/filters.d.ts.map +1 -0
- package/dist/indexer/filters.js +92 -0
- package/dist/indexer/filters.js.map +1 -0
- package/dist/indexer/finality.d.ts +14 -0
- package/dist/indexer/finality.d.ts.map +1 -0
- package/dist/indexer/finality.js +32 -0
- package/dist/indexer/finality.js.map +1 -0
- package/dist/indexer/handle.d.ts +22 -0
- package/dist/indexer/handle.d.ts.map +1 -0
- package/dist/indexer/handle.js +121 -0
- package/dist/indexer/handle.js.map +1 -0
- package/dist/indexer/lock.d.ts +41 -0
- package/dist/indexer/lock.d.ts.map +1 -0
- package/dist/indexer/lock.js +102 -0
- package/dist/indexer/lock.js.map +1 -0
- package/dist/indexer/metrics.d.ts +4 -0
- package/dist/indexer/metrics.d.ts.map +1 -0
- package/dist/indexer/metrics.js +88 -0
- package/dist/indexer/metrics.js.map +1 -0
- package/dist/indexer/open.d.ts +66 -0
- package/dist/indexer/open.d.ts.map +1 -0
- package/dist/indexer/open.js +319 -0
- package/dist/indexer/open.js.map +1 -0
- package/dist/indexer/phases/backfill.d.ts +4 -0
- package/dist/indexer/phases/backfill.d.ts.map +1 -0
- package/dist/indexer/phases/backfill.js +144 -0
- package/dist/indexer/phases/backfill.js.map +1 -0
- package/dist/indexer/phases/factories.d.ts +4 -0
- package/dist/indexer/phases/factories.d.ts.map +1 -0
- package/dist/indexer/phases/factories.js +35 -0
- package/dist/indexer/phases/factories.js.map +1 -0
- package/dist/indexer/phases/keys.d.ts +4 -0
- package/dist/indexer/phases/keys.d.ts.map +1 -0
- package/dist/indexer/phases/keys.js +21 -0
- package/dist/indexer/phases/keys.js.map +1 -0
- package/dist/indexer/phases/live.d.ts +10 -0
- package/dist/indexer/phases/live.d.ts.map +1 -0
- package/dist/indexer/phases/live.js +122 -0
- package/dist/indexer/phases/live.js.map +1 -0
- package/dist/indexer/plan.d.ts +18 -0
- package/dist/indexer/plan.d.ts.map +1 -0
- package/dist/indexer/plan.js +15 -0
- package/dist/indexer/plan.js.map +1 -0
- package/dist/indexer/run.d.ts +16 -0
- package/dist/indexer/run.d.ts.map +1 -0
- package/dist/indexer/run.js +49 -0
- package/dist/indexer/run.js.map +1 -0
- package/dist/indexer/sources.d.ts +124 -0
- package/dist/indexer/sources.d.ts.map +1 -0
- package/dist/indexer/sources.js +337 -0
- package/dist/indexer/sources.js.map +1 -0
- package/dist/indexer/status.d.ts +270 -0
- package/dist/indexer/status.d.ts.map +1 -0
- package/dist/indexer/status.js +282 -0
- package/dist/indexer/status.js.map +1 -0
- package/dist/rpc/client.d.ts +77 -0
- package/dist/rpc/client.d.ts.map +1 -0
- package/dist/rpc/client.js +403 -0
- package/dist/rpc/client.js.map +1 -0
- package/dist/rpc/methods.d.ts +58 -0
- package/dist/rpc/methods.d.ts.map +1 -0
- package/dist/rpc/methods.js +21 -0
- package/dist/rpc/methods.js.map +1 -0
- package/dist/rpc/probe.d.ts +13 -0
- package/dist/rpc/probe.d.ts.map +1 -0
- package/dist/rpc/probe.js +59 -0
- package/dist/rpc/probe.js.map +1 -0
- package/dist/sync/extras.d.ts +28 -0
- package/dist/sync/extras.d.ts.map +1 -0
- package/dist/sync/extras.js +69 -0
- package/dist/sync/extras.js.map +1 -0
- package/dist/sync/fetch.d.ts +55 -0
- package/dist/sync/fetch.d.ts.map +1 -0
- package/dist/sync/fetch.js +267 -0
- package/dist/sync/fetch.js.map +1 -0
- package/dist/sync/heads.d.ts +29 -0
- package/dist/sync/heads.d.ts.map +1 -0
- package/dist/sync/heads.js +118 -0
- package/dist/sync/heads.js.map +1 -0
- package/dist/sync/live.d.ts +52 -0
- package/dist/sync/live.d.ts.map +1 -0
- package/dist/sync/live.js +130 -0
- package/dist/sync/live.js.map +1 -0
- package/dist/types/block.d.ts +37 -0
- package/dist/types/block.d.ts.map +1 -0
- package/dist/types/block.js +28 -0
- package/dist/types/block.js.map +1 -0
- package/dist/types/felt.d.ts +11 -0
- package/dist/types/felt.d.ts.map +1 -0
- package/dist/types/felt.js +14 -0
- package/dist/types/felt.js.map +1 -0
- package/dist/types/transaction.d.ts +167 -0
- package/dist/types/transaction.d.ts.map +1 -0
- package/dist/types/transaction.js +69 -0
- package/dist/types/transaction.js.map +1 -0
- package/dist/utils/chunks.d.ts +3 -0
- package/dist/utils/chunks.d.ts.map +1 -0
- package/dist/utils/chunks.js +6 -0
- package/dist/utils/chunks.js.map +1 -0
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +3 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/sleep.d.ts +3 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +15 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/time.d.ts +3 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +3 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +77 -4
- package/src/abi/abi.ts +97 -0
- package/src/abi/codec.ts +474 -0
- package/src/abi/events.ts +171 -0
- package/src/abi/functions.ts +65 -0
- package/src/abi/history.ts +114 -0
- package/src/abi/selector.ts +17 -0
- package/src/abi/types.ts +282 -0
- package/src/api/graphql.ts +611 -0
- package/src/api/limits.ts +45 -0
- package/src/api/prometheus.ts +18 -0
- package/src/api/reader.ts +183 -0
- package/src/api/routes.ts +56 -0
- package/src/api/server.ts +425 -0
- package/src/cli/commands/cache.ts +35 -0
- package/src/cli/commands/clean.ts +29 -0
- package/src/cli/commands/dev.ts +82 -0
- package/src/cli/commands/init.ts +543 -0
- package/src/cli/commands/serve.ts +12 -0
- package/src/cli/commands/start.ts +32 -0
- package/src/cli/devdb.ts +127 -0
- package/src/cli/main.ts +119 -0
- package/src/cli/project.ts +68 -0
- package/src/cli/ui/dashboard.ts +499 -0
- package/src/cli/ui/prompt.ts +228 -0
- package/src/config/app.ts +305 -0
- package/src/config/errors.ts +7 -0
- package/src/config/network.ts +26 -0
- package/src/config/resolve.ts +111 -0
- package/src/config/rpc.ts +28 -0
- package/src/config/schema.ts +13 -0
- package/src/db/cache.ts +463 -0
- package/src/db/copy.ts +71 -0
- package/src/db/store.ts +403 -0
- package/src/db/table.ts +145 -0
- package/src/db/transaction.ts +24 -0
- package/src/index.ts +118 -0
- package/src/indexer/client.ts +270 -0
- package/src/indexer/commit.ts +221 -0
- package/src/indexer/events.ts +178 -0
- package/src/indexer/filters.ts +114 -0
- package/src/indexer/finality.ts +36 -0
- package/src/indexer/handle.ts +133 -0
- package/src/indexer/lock.ts +148 -0
- package/src/indexer/metrics.ts +105 -0
- package/src/indexer/open.ts +490 -0
- package/src/indexer/phases/backfill.ts +164 -0
- package/src/indexer/phases/factories.ts +36 -0
- package/src/indexer/phases/keys.ts +24 -0
- package/src/indexer/phases/live.ts +135 -0
- package/src/indexer/plan.ts +38 -0
- package/src/indexer/run.ts +61 -0
- package/src/indexer/sources.ts +456 -0
- package/src/indexer/status.ts +415 -0
- package/src/rpc/client.ts +466 -0
- package/src/rpc/methods.ts +85 -0
- package/src/rpc/probe.ts +75 -0
- package/src/sync/extras.ts +91 -0
- package/src/sync/fetch.ts +334 -0
- package/src/sync/heads.ts +135 -0
- package/src/sync/live.ts +192 -0
- package/src/types/block.ts +62 -0
- package/src/types/felt.ts +16 -0
- package/src/types/transaction.ts +228 -0
- package/src/utils/chunks.ts +4 -0
- package/src/utils/errors.ts +3 -0
- package/src/utils/sleep.ts +13 -0
- package/src/utils/time.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kasbah
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A minimal, fast Starknet indexer in TypeScript.
|
|
4
|
+
|
|
5
|
+
Write handlers for your contracts' events, and kasbah stores what they write in Postgres and serves it over SQL,
|
|
6
|
+
GraphQL and your own routes. If you've used [Ponder](https://ponder.sh), you already know how it works.
|
|
7
|
+
|
|
8
|
+
- **Fast backfills**: parallel `getEvents` windows, one ordered stream, writes with `COPY`.
|
|
9
|
+
- **Live and reorg-safe**: follows the head, undoes reorgs with a journal, or waits for L1 finality.
|
|
10
|
+
- **Starknet-native**: Cairo 0 and Cairo 1 ABIs, decoding with the class a contract had at each block, factories.
|
|
11
|
+
- **Typed end to end**: handlers, tables and contract reads are typed from your config, with no code generation.
|
|
12
|
+
- **Ready to deploy**: one indexer per schema, `/ready` for zero-downtime deploys, Prometheus metrics.
|
|
13
|
+
|
|
14
|
+
> [!NOTE]
|
|
15
|
+
> kasbah is early (0.x): a minor version may still change the config or the API.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm create kasbah my-indexer # asks for an RPC and a contract address, writes the project
|
|
21
|
+
cd my-indexer
|
|
22
|
+
pnpm install
|
|
23
|
+
pnpm dev # backfills, follows the head, restarts on every change
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then open [localhost:42069/graphql](http://localhost:42069/graphql), or query with SQL:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
curl localhost:42069/sql -d '{"sql": "SELECT * FROM swapped ORDER BY block DESC LIMIT 5"}'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## A project
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
my-indexer/
|
|
36
|
+
├── kasbah.config.ts network, RPC, contracts
|
|
37
|
+
├── kasbah.schema.ts your tables
|
|
38
|
+
├── abis/ contract ABIs
|
|
39
|
+
└── src/
|
|
40
|
+
├── index.ts event handlers
|
|
41
|
+
└── api/index.ts your API routes (optional)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// kasbah.config.ts
|
|
46
|
+
export default kasbah({
|
|
47
|
+
network: "mainnet",
|
|
48
|
+
rpc: process.env.KASBAH_RPC_URL!,
|
|
49
|
+
contracts: { Core: { abi: coreAbi, address: "0x…", startBlock: "deployment" } },
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// kasbah.schema.ts
|
|
55
|
+
export const swapped = pgTable("swapped", {
|
|
56
|
+
id: text().primaryKey(),
|
|
57
|
+
block: integer().notNull(),
|
|
58
|
+
locker: hex().notNull(),
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// src/index.ts
|
|
64
|
+
app.on("Core:Swapped", async ({ event, context }) => {
|
|
65
|
+
await context.db.insert(swapped).values({
|
|
66
|
+
id: `${event.transaction.hash}:${event.index}`,
|
|
67
|
+
block: event.block.number,
|
|
68
|
+
locker: event.args.locker,
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Commands
|
|
74
|
+
|
|
75
|
+
| Command | What it does |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `kasbah init <dir>` | a new project from a contract address |
|
|
78
|
+
| `kasbah dev` | index and serve, restarting on every change |
|
|
79
|
+
| `kasbah start --schema <name>` | index and serve, for production |
|
|
80
|
+
| `kasbah serve --schema <name>` | the API alone, over what an indexer stored |
|
|
81
|
+
| `kasbah cache info` | the raw-event cache and its size |
|
|
82
|
+
|
|
83
|
+
## Docs
|
|
84
|
+
|
|
85
|
+
**[swan-of-bodom.github.io/kasbah](https://swan-of-bodom.github.io/kasbah/)**: configuration, handlers, the API,
|
|
86
|
+
and deploying to Railway, Render or a VPS. The source is in [`documentation/`](documentation); the design and its
|
|
87
|
+
reasoning are in [DESIGN.md](DESIGN.md).
|
|
88
|
+
|
|
89
|
+
## From source
|
|
90
|
+
|
|
91
|
+
Node 22.18+ and pnpm. To use a local checkout instead of the npm package:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/swan-of-bodom/kasbah
|
|
95
|
+
cd kasbah && pnpm install
|
|
96
|
+
pnpm pack # writes kasbah-<version>.tgz
|
|
97
|
+
cd ../my-indexer && pnpm add ../kasbah/kasbah-*.tgz
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pnpm test # all tests; the Postgres ones need DATABASE_URL in .env
|
|
104
|
+
pnpm typecheck
|
|
105
|
+
pnpm lint:fix # Biome; a pre-commit hook refuses unformatted commits
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A local Postgres for the tests:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
docker run -d --name kasbah-pg -e POSTGRES_PASSWORD=kasbah -e POSTGRES_DB=kasbah \
|
|
112
|
+
-p 127.0.0.1:5544:5432 docker.io/library/postgres:17
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Contributors and agents: see [AGENTS.md](AGENTS.md).
|
|
116
|
+
|
|
117
|
+
## Acknowledgments
|
|
118
|
+
|
|
119
|
+
kasbah's design comes from [Ponder](https://ponder.sh) ([GitHub](https://github.com/ponder-sh/ponder)), the
|
|
120
|
+
open-source TypeScript indexer for EVM chains by the Ponder team (MIT). The code here is written for Starknet, but
|
|
121
|
+
the project layout, the API and many production choices follow Ponder's, and DESIGN.md notes where. Thank you to
|
|
122
|
+
its authors for building it in the open. For EVM chains, use Ponder.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
[Apache-2.0](LICENSE). Versions follow semver: while at 0.x, a minor version may break things and a patch never
|
|
127
|
+
does. See [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** A Starknet contract ABI as returned by `starknet_getClassAt` (Cairo 0 or Cairo 1), declared `as const`. */
|
|
2
|
+
export type Abi = readonly AbiItem[];
|
|
3
|
+
export type AbiItem = AbiEvent | AbiStruct | AbiEnum | AbiFunction | AbiInterface | AbiImpl | AbiConstructor | AbiL1Handler;
|
|
4
|
+
export type AbiMember = {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly type: string;
|
|
7
|
+
};
|
|
8
|
+
/** Cairo 0: `keys[0]` is `sn_keccak(name)`, then the `keys` members, and `data` holds the rest. */
|
|
9
|
+
export type Cairo0Event = {
|
|
10
|
+
readonly type: "event";
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly keys: readonly AbiMember[];
|
|
13
|
+
readonly data: readonly AbiMember[];
|
|
14
|
+
};
|
|
15
|
+
/** Cairo 1 before compiler 2.0: `keys[0]` is `sn_keccak(name)`, every input is in `data`. */
|
|
16
|
+
export type LegacyCairo1Event = {
|
|
17
|
+
readonly type: "event";
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly inputs: readonly AbiMember[];
|
|
20
|
+
};
|
|
21
|
+
export type EventMemberKind = "key" | "data" | "nested" | "flat";
|
|
22
|
+
export type EventMember = AbiMember & {
|
|
23
|
+
readonly kind: EventMemberKind;
|
|
24
|
+
};
|
|
25
|
+
export type Cairo1EventStruct = {
|
|
26
|
+
readonly type: "event";
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly kind: "struct";
|
|
29
|
+
readonly members: readonly EventMember[];
|
|
30
|
+
};
|
|
31
|
+
export type Cairo1EventEnum = {
|
|
32
|
+
readonly type: "event";
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly kind: "enum";
|
|
35
|
+
readonly variants: readonly EventMember[];
|
|
36
|
+
};
|
|
37
|
+
export type AbiEvent = Cairo0Event | LegacyCairo1Event | Cairo1EventStruct | Cairo1EventEnum;
|
|
38
|
+
export type AbiStruct = {
|
|
39
|
+
readonly type: "struct";
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly members: readonly (AbiMember & {
|
|
42
|
+
readonly offset?: number;
|
|
43
|
+
})[];
|
|
44
|
+
readonly size?: number;
|
|
45
|
+
};
|
|
46
|
+
export type AbiEnum = {
|
|
47
|
+
readonly type: "enum";
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly variants: readonly AbiMember[];
|
|
50
|
+
};
|
|
51
|
+
export type AbiFunction = {
|
|
52
|
+
readonly type: "function";
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly inputs: readonly AbiMember[];
|
|
55
|
+
readonly outputs: readonly ({
|
|
56
|
+
readonly type: string;
|
|
57
|
+
} & {
|
|
58
|
+
readonly name?: string;
|
|
59
|
+
})[];
|
|
60
|
+
readonly state_mutability?: "view" | "external";
|
|
61
|
+
readonly stateMutability?: "view";
|
|
62
|
+
};
|
|
63
|
+
export type AbiInterface = {
|
|
64
|
+
readonly type: "interface";
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly items: readonly AbiFunction[];
|
|
67
|
+
};
|
|
68
|
+
export type AbiImpl = {
|
|
69
|
+
readonly type: "impl";
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly interface_name: string;
|
|
72
|
+
};
|
|
73
|
+
export type AbiConstructor = {
|
|
74
|
+
readonly type: "constructor";
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly inputs: readonly AbiMember[];
|
|
77
|
+
readonly outputs?: readonly unknown[];
|
|
78
|
+
};
|
|
79
|
+
export type AbiL1Handler = {
|
|
80
|
+
readonly type: "l1_handler";
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly inputs: readonly AbiMember[];
|
|
83
|
+
readonly outputs: readonly unknown[];
|
|
84
|
+
readonly state_mutability?: string;
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../src/abi/abi.ts"],"names":[],"mappings":"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"}
|
package/dist/abi/abi.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../../src/abi/abi.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Abi, AbiMember } from "./abi.ts";
|
|
2
|
+
/** Reads felts from one array (`keys` or `data`) with a moving index. */
|
|
3
|
+
export type Cursor = {
|
|
4
|
+
felts: readonly string[];
|
|
5
|
+
i: number;
|
|
6
|
+
};
|
|
7
|
+
/** Decodes one value from a cursor. Built once per ABI type, run per event. */
|
|
8
|
+
export type Reader = (c: Cursor) => unknown;
|
|
9
|
+
export declare class DecodeError extends Error {
|
|
10
|
+
}
|
|
11
|
+
/** Encodes one value as felts (calldata). The inverse of `Reader`. */
|
|
12
|
+
export type Writer = (value: unknown, out: string[]) => void;
|
|
13
|
+
/** Splits `A, B<C, D>, (E, F)` on top-level commas. */
|
|
14
|
+
export declare function splitTopLevel(s: string): string[];
|
|
15
|
+
/** Compiles ABI type strings into readers, memoized per ABI. Cairo 0 and Cairo 1 type syntax share one namespace. */
|
|
16
|
+
export declare class Codec {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(abi: Abi);
|
|
19
|
+
reader(type: string): Reader;
|
|
20
|
+
/** Reader for a member list, producing an object. Cairo 0 `x_len` + `x: T*` pairs become one array `x`. */
|
|
21
|
+
members(members: readonly AbiMember[]): Reader;
|
|
22
|
+
writer(type: string): Writer;
|
|
23
|
+
/** Writer for a member list, from an object. Cairo 0 `x_len` is written from the length of `x`. */
|
|
24
|
+
membersWriter(members: readonly AbiMember[]): Writer;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/abi/codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAW,SAAS,EAAa,MAAM,UAAU,CAAC;AAEnE,yEAAyE;AACzE,MAAM,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,+EAA+E;AAC/E,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAO5C,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAsGzC,sEAAsE;AACtE,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AA0F7D,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBjD;AAQD,qHAAqH;AACrH,qBAAa,KAAK;;gBAMJ,GAAG,EAAE,GAAG;IAOpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAS5B,2GAA2G;IAC3G,OAAO,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM;IA+B9C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAa5B,mGAAmG;IACnG,aAAa,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM;CA6KrD"}
|