Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
64cb79e8
Unverified
Commit
64cb79e8
authored
Sep 18, 2023
by
OptimismBot
Committed by
GitHub
Sep 18, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7251 from ethereum-optimism/09-14-fix_indexer_Fix_uri_util
fix(indexer): Fix uri util
parents
873daaff
5fe99534
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
243 additions
and
47 deletions
+243
-47
config.yml
.circleci/config.yml
+4
-0
generated.ts
indexer/api-ts/generated.ts
+9
-9
indexer.cjs
indexer/api-ts/indexer.cjs
+2
-2
indexer.cjs.map
indexer/api-ts/indexer.cjs.map
+1
-1
indexer.js
indexer/api-ts/indexer.js
+2
-2
indexer.js.map
indexer/api-ts/indexer.js.map
+1
-1
indexer.spec.ts
indexer/api-ts/indexer.spec.ts
+12
-0
indexer.ts
indexer/api-ts/indexer.ts
+2
-2
package.json
indexer/api-ts/package.json
+9
-3
tsconfig.json
indexer/api-ts/tsconfig.json
+1
-1
deposits.go
indexer/api/routes/deposits.go
+5
-5
withdrawals.go
indexer/api/routes/withdrawals.go
+4
-4
pnpm-lock.yaml
pnpm-lock.yaml
+190
-16
pnpm-workspace.yaml
pnpm-workspace.yaml
+1
-1
No files found.
.circleci/config.yml
View file @
64cb79e8
...
...
@@ -887,6 +887,10 @@ jobs:
name
:
Build
command
:
make indexer
working_directory
:
indexer
-
run
:
name
:
Install node_modules
command
:
pnpm install --frozen-lockfile --prefer-offline
working_directory
:
indexer/api-ts
-
run
:
name
:
Install tygo
command
:
go install github.com/gzuidhof/tygo@latest
...
...
indexer/api-ts/generated.ts
View file @
64cb79e8
...
...
@@ -8,12 +8,12 @@ export interface DepositItem {
from
:
string
;
to
:
string
;
timestamp
:
number
/* uint64 */
;
L1Tx
Hash
:
string
;
L2
TxHash
:
string
;
Block
:
string
;
l1Block
Hash
:
string
;
l1
TxHash
:
string
;
l2TxHash
:
string
;
amount
:
string
;
l1Token
:
string
;
l2Token
:
string
;
l1Token
Address
:
string
;
l2Token
Address
:
string
;
}
export
interface
DepositResponse
{
cursor
:
string
;
...
...
@@ -41,10 +41,10 @@ export interface WithdrawalItem {
timestamp
:
number
/* uint64 */
;
l2BlockHash
:
string
;
amount
:
string
;
proof
:
string
;
claim
:
string
;
l1Token
:
string
;
l2Token
:
string
;
proof
TransactionHash
:
string
;
claim
TransactionHash
:
string
;
l1Token
Address
:
string
;
l2Token
Address
:
string
;
}
export
interface
WithdrawalResponse
{
cursor
:
string
;
...
...
indexer/api-ts/indexer.cjs
View file @
64cb79e8
...
...
@@ -38,10 +38,10 @@ var createQueryString = ({ cursor, limit }) => {
return `?${queries.join("&")}`;
};
var depositEndpoint = ({ baseUrl = "", address, cursor, limit }) => {
return [baseUrl, "deposits",
address, createQueryString({ cursor, limit })
].join("/");
return [baseUrl, "deposits",
`${address}${createQueryString({ cursor, limit })}`
].join("/");
};
var withdrawalEndoint = ({ baseUrl = "", address, cursor, limit }) => {
return [baseUrl, "withdrawals",
address, createQueryString({ cursor, limit })
].join("/");
return [baseUrl, "withdrawals",
`${address}${createQueryString({ cursor, limit })}`
].join("/");
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...
...
indexer/api-ts/indexer.cjs.map
View file @
64cb79e8
{"version":3,"sources":["indexer.ts"],"sourcesContent":["export * from './generated'\n\ntype PaginationOptions = {\n limit?: number\n cursor?: string\n}\n\ntype Options = {\n baseUrl?: string\n address: `0x${string}`\n} & PaginationOptions\n\nconst createQueryString = ({ cursor, limit }: PaginationOptions): string => {\n if (cursor === undefined && limit === undefined) {\n return ''\n }\n const queries: string[] = []\n if (cursor) {\n queries.push(`cursor=${cursor}`)\n }\n if (limit) {\n queries.push(`limit=${limit}`)\n }\n return `?${queries.join('&')}`\n}\n\nexport const depositEndpoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'deposits', address, createQueryString({ cursor, limit })].join('/')\n}\n\nexport const withdrawalEndoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'withdrawals', address, createQueryString({ cursor, limit })].join('/')\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,IAAM,oBAAoB,CAAC,EAAE,QAAQ,MAAM,MAAiC;AAC1E,MAAI,WAAW,UAAa,UAAU,QAAW;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ;AACV,YAAQ,KAAK,UAAU,MAAM,EAAE;AAAA,EACjC;AACA,MAAI,OAAO;AACT,YAAQ,KAAK,SAAS,KAAK,EAAE;AAAA,EAC/B;AACA,SAAO,IAAI,QAAQ,KAAK,GAAG,CAAC;AAC9B;AAEO,IAAM,kBAAkB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC5F,SAAO,CAAC,SAAS,YAAY,SAAS,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG;AACtF;AAEO,IAAM,oBAAoB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC9F,SAAO,CAAC,SAAS,eAAe,SAAS,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG;AACzF;","names":[]}
\ No newline at end of file
{"version":3,"sources":["indexer.ts"],"sourcesContent":["export * from './generated'\n\ntype PaginationOptions = {\n limit?: number\n cursor?: string\n}\n\ntype Options = {\n baseUrl?: string\n address: `0x${string}`\n} & PaginationOptions\n\nconst createQueryString = ({ cursor, limit }: PaginationOptions): string => {\n if (cursor === undefined && limit === undefined) {\n return ''\n }\n const queries: string[] = []\n if (cursor) {\n queries.push(`cursor=${cursor}`)\n }\n if (limit) {\n queries.push(`limit=${limit}`)\n }\n return `?${queries.join('&')}`\n}\n\nexport const depositEndpoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'deposits', `${address}${createQueryString({ cursor, limit })}`].join('/')\n}\n\nexport const withdrawalEndoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'withdrawals', `${address}${createQueryString({ cursor, limit })}`].join('/')\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,IAAM,oBAAoB,CAAC,EAAE,QAAQ,MAAM,MAAiC;AAC1E,MAAI,WAAW,UAAa,UAAU,QAAW;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ;AACV,YAAQ,KAAK,UAAU,MAAM,EAAE;AAAA,EACjC;AACA,MAAI,OAAO;AACT,YAAQ,KAAK,SAAS,KAAK,EAAE;AAAA,EAC/B;AACA,SAAO,IAAI,QAAQ,KAAK,GAAG,CAAC;AAC9B;AAEO,IAAM,kBAAkB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC5F,SAAO,CAAC,SAAS,YAAY,GAAG,OAAO,GAAG,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG;AAC5F;AAEO,IAAM,oBAAoB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC9F,SAAO,CAAC,SAAS,eAAe,GAAG,OAAO,GAAG,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG;AAC/F;","names":[]}
\ No newline at end of file
indexer/api-ts/indexer.js
View file @
64cb79e8
...
...
@@ -13,10 +13,10 @@ var createQueryString = ({ cursor, limit }) => {
return
`?
${
queries
.
join
(
"
&
"
)}
`
;
};
var
depositEndpoint
=
({
baseUrl
=
""
,
address
,
cursor
,
limit
})
=>
{
return
[
baseUrl
,
"
deposits
"
,
address
,
createQueryString
({
cursor
,
limit
})
].
join
(
"
/
"
);
return
[
baseUrl
,
"
deposits
"
,
`
${
address
}${
createQueryString
({
cursor
,
limit
})}
`
].
join
(
"
/
"
);
};
var
withdrawalEndoint
=
({
baseUrl
=
""
,
address
,
cursor
,
limit
})
=>
{
return
[
baseUrl
,
"
withdrawals
"
,
address
,
createQueryString
({
cursor
,
limit
})
].
join
(
"
/
"
);
return
[
baseUrl
,
"
withdrawals
"
,
`
${
address
}${
createQueryString
({
cursor
,
limit
})}
`
].
join
(
"
/
"
);
};
export
{
depositEndpoint
,
...
...
indexer/api-ts/indexer.js.map
View file @
64cb79e8
{"version":3,"sources":["indexer.ts"],"sourcesContent":["export * from './generated'\n\ntype PaginationOptions = {\n limit?: number\n cursor?: string\n}\n\ntype Options = {\n baseUrl?: string\n address: `0x${string}`\n} & PaginationOptions\n\nconst createQueryString = ({ cursor, limit }: PaginationOptions): string => {\n if (cursor === undefined && limit === undefined) {\n return ''\n }\n const queries: string[] = []\n if (cursor) {\n queries.push(`cursor=${cursor}`)\n }\n if (limit) {\n queries.push(`limit=${limit}`)\n }\n return `?${queries.join('&')}`\n}\n\nexport const depositEndpoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'deposits', address, createQueryString({ cursor, limit })].join('/')\n}\n\nexport const withdrawalEndoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'withdrawals', address, createQueryString({ cursor, limit })].join('/')\n}\n\n"],"mappings":";AAYA,IAAM,oBAAoB,CAAC,EAAE,QAAQ,MAAM,MAAiC;AAC1E,MAAI,WAAW,UAAa,UAAU,QAAW;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ;AACV,YAAQ,KAAK,UAAU,MAAM,EAAE;AAAA,EACjC;AACA,MAAI,OAAO;AACT,YAAQ,KAAK,SAAS,KAAK,EAAE;AAAA,EAC/B;AACA,SAAO,IAAI,QAAQ,KAAK,GAAG,CAAC;AAC9B;AAEO,IAAM,kBAAkB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC5F,SAAO,CAAC,SAAS,YAAY,SAAS,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG;AACtF;AAEO,IAAM,oBAAoB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC9F,SAAO,CAAC,SAAS,eAAe,SAAS,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG;AACzF;","names":[]}
\ No newline at end of file
{"version":3,"sources":["indexer.ts"],"sourcesContent":["export * from './generated'\n\ntype PaginationOptions = {\n limit?: number\n cursor?: string\n}\n\ntype Options = {\n baseUrl?: string\n address: `0x${string}`\n} & PaginationOptions\n\nconst createQueryString = ({ cursor, limit }: PaginationOptions): string => {\n if (cursor === undefined && limit === undefined) {\n return ''\n }\n const queries: string[] = []\n if (cursor) {\n queries.push(`cursor=${cursor}`)\n }\n if (limit) {\n queries.push(`limit=${limit}`)\n }\n return `?${queries.join('&')}`\n}\n\nexport const depositEndpoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'deposits', `${address}${createQueryString({ cursor, limit })}`].join('/')\n}\n\nexport const withdrawalEndoint = ({ baseUrl = '', address, cursor, limit }: Options): string => {\n return [baseUrl, 'withdrawals', `${address}${createQueryString({ cursor, limit })}`].join('/')\n}\n\n"],"mappings":";AAYA,IAAM,oBAAoB,CAAC,EAAE,QAAQ,MAAM,MAAiC;AAC1E,MAAI,WAAW,UAAa,UAAU,QAAW;AAC/C,WAAO;AAAA,EACT;AACA,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ;AACV,YAAQ,KAAK,UAAU,MAAM,EAAE;AAAA,EACjC;AACA,MAAI,OAAO;AACT,YAAQ,KAAK,SAAS,KAAK,EAAE;AAAA,EAC/B;AACA,SAAO,IAAI,QAAQ,KAAK,GAAG,CAAC;AAC9B;AAEO,IAAM,kBAAkB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC5F,SAAO,CAAC,SAAS,YAAY,GAAG,OAAO,GAAG,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG;AAC5F;AAEO,IAAM,oBAAoB,CAAC,EAAE,UAAU,IAAI,SAAS,QAAQ,MAAM,MAAuB;AAC9F,SAAO,CAAC,SAAS,eAAe,GAAG,OAAO,GAAG,kBAAkB,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG;AAC/F;","names":[]}
\ No newline at end of file
indexer/api-ts/indexer.spec.ts
0 → 100644
View file @
64cb79e8
import
{
test
,
expect
}
from
'
vitest
'
import
{
depositEndpoint
,
withdrawalEndoint
}
from
'
./indexer.ts
'
test
(
depositEndpoint
.
name
,
()
=>
{
expect
(
depositEndpoint
({
baseUrl
:
'
http://localhost:8080/api/v0
'
,
address
:
'
0x1234
'
,
cursor
:
'
0x1235
'
,
limit
:
10
})).
toMatchInlineSnapshot
(
'
"http://localhost:8080/api/v0/deposits/0x1234?cursor=0x1235&limit=10"
'
)
expect
(
depositEndpoint
({
baseUrl
:
'
http://localhost:8080/api/v0
'
,
address
:
'
0x1234
'
})).
toMatchInlineSnapshot
(
'
"http://localhost:8080/api/v0/deposits/0x1234"
'
)
})
test
(
withdrawalEndoint
.
name
,
()
=>
{
expect
(
withdrawalEndoint
({
baseUrl
:
'
http://localhost:8080/api/v0
'
,
address
:
'
0x1234
'
,
cursor
:
'
0x1235
'
,
limit
:
10
})).
toMatchInlineSnapshot
(
'
"http://localhost:8080/api/v0/withdrawals/0x1234?cursor=0x1235&limit=10"
'
)
expect
(
withdrawalEndoint
({
baseUrl
:
'
http://localhost:8080/api/v0
'
,
address
:
'
0x1234
'
})).
toMatchInlineSnapshot
(
'
"http://localhost:8080/api/v0/withdrawals/0x1234"
'
)
})
indexer/api-ts/indexer.ts
View file @
64cb79e8
...
...
@@ -25,10 +25,10 @@ const createQueryString = ({ cursor, limit }: PaginationOptions): string => {
}
export
const
depositEndpoint
=
({
baseUrl
=
''
,
address
,
cursor
,
limit
}:
Options
):
string
=>
{
return
[
baseUrl
,
'
deposits
'
,
address
,
createQueryString
({
cursor
,
limit
})
].
join
(
'
/
'
)
return
[
baseUrl
,
'
deposits
'
,
`
${
address
}${
createQueryString
({
cursor
,
limit
})}
`
].
join
(
'
/
'
)
}
export
const
withdrawalEndoint
=
({
baseUrl
=
''
,
address
,
cursor
,
limit
}:
Options
):
string
=>
{
return
[
baseUrl
,
'
withdrawals
'
,
address
,
createQueryString
({
cursor
,
limit
})
].
join
(
'
/
'
)
return
[
baseUrl
,
'
withdrawals
'
,
`
${
address
}${
createQueryString
({
cursor
,
limit
})}
`
].
join
(
'
/
'
)
}
indexer/api-ts/package.json
View file @
64cb79e8
{
"name"
:
"@eth-optimism/indexer-api"
,
"version"
:
"0.0.
1
"
,
"version"
:
"0.0.
3
"
,
"description"
:
"[Optimism] typescript types for the indexer service"
,
"main"
:
"indexer.cjs"
,
"module"
:
"indexer.js"
,
...
...
@@ -17,7 +17,8 @@
],
"scripts"
:
{
"clean"
:
"rm -rf generated.ts indexer.cjs indexer.js"
,
"generate"
:
"npm run clean && tygo generate && mv ../api/routes/index.ts generated.ts && npx tsup"
"generate"
:
"npm run clean && tygo generate && mv ../api/routes/index.ts generated.ts && tsup"
,
"test"
:
"vitest"
},
"keywords"
:
[
"optimism"
,
...
...
@@ -30,4 +31,9 @@
"repository"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/ethereum-optimism/optimism.git"
}}
},
"devDependencies"
:
{
"tsup"
:
"^7.2.0"
,
"vitest"
:
"^0.34.4"
}
}
indexer/api-ts/tsconfig.json
View file @
64cb79e8
...
...
@@ -4,7 +4,7 @@
"strict"
:
true
,
"skipLibCheck"
:
true
,
"module"
:
"ESNext"
,
"moduleResolution"
:
"
bundler
"
,
"moduleResolution"
:
"
NodeNext
"
,
"jsx"
:
"react"
,
"target"
:
"ESNext"
,
"noEmit"
:
true
...
...
indexer/api/routes/deposits.go
View file @
64cb79e8
...
...
@@ -14,12 +14,12 @@ type DepositItem struct {
From
string
`json:"from"`
To
string
`json:"to"`
Timestamp
uint64
`json:"timestamp"`
L1
TxHash
string
`json:"L1Tx
Hash"`
L
2TxHash
string
`json:"L2
TxHash"`
L
1BlockHash
string
`json:"Block
"`
L1
BlockHash
string
`json:"l1Block
Hash"`
L
1TxHash
string
`json:"l1
TxHash"`
L
2TxHash
string
`json:"l2TxHash
"`
Amount
string
`json:"amount"`
L1TokenAddress
string
`json:"l1Token"`
L2TokenAddress
string
`json:"l2Token"`
L1TokenAddress
string
`json:"l1Token
Address
"`
L2TokenAddress
string
`json:"l2Token
Address
"`
}
type
DepositResponse
struct
{
...
...
indexer/api/routes/withdrawals.go
View file @
64cb79e8
...
...
@@ -17,10 +17,10 @@ type WithdrawalItem struct {
Timestamp
uint64
`json:"timestamp"`
L2BlockHash
string
`json:"l2BlockHash"`
Amount
string
`json:"amount"`
ProofTransactionHash
string
`json:"proof"`
ClaimTransactionHash
string
`json:"claim"`
L1TokenAddress
string
`json:"l1Token"`
L2TokenAddress
string
`json:"l2Token"`
ProofTransactionHash
string
`json:"proof
TransactionHash
"`
ClaimTransactionHash
string
`json:"claim
TransactionHash
"`
L1TokenAddress
string
`json:"l1Token
Address
"`
L2TokenAddress
string
`json:"l2Token
Address
"`
}
type
WithdrawalResponse
struct
{
...
...
pnpm-lock.yaml
View file @
64cb79e8
This diff is collapsed.
Click to expand it.
pnpm-workspace.yaml
View file @
64cb79e8
...
...
@@ -2,4 +2,4 @@ packages:
-
'
packages/*'
-
'
endpoint-monitor'
-
'
op-exporter'
-
'
indexer/ts'
-
'
indexer/
api-
ts'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment