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
cea66c7e
Commit
cea66c7e
authored
Sep 14, 2023
by
Will Cory
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(indexer): Fix uri util
parent
0bf53e73
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
224 additions
and
28 deletions
+224
-28
config.yml
.circleci/config.yml
+4
-0
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
+8
-2
tsconfig.json
indexer/api-ts/tsconfig.json
+1
-1
pnpm-lock.yaml
pnpm-lock.yaml
+190
-16
pnpm-workspace.yaml
pnpm-workspace.yaml
+1
-1
No files found.
.circleci/config.yml
View file @
cea66c7e
...
...
@@ -887,6 +887,10 @@ jobs:
name
:
Build
command
:
make indexer
working_directory
:
indexer
-
run
:
name
:
Install node_modules
command
:
pnpm install --frozen-lockfile --offline
working_directory
:
indexer/api-ts
-
run
:
name
:
Install tygo
command
:
go install github.com/gzuidhof/tygo@latest
...
...
indexer/api-ts/indexer.cjs
View file @
cea66c7e
...
...
@@ -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 @
cea66c7e
{"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 @
cea66c7e
...
...
@@ -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 @
cea66c7e
{"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 @
cea66c7e
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 @
cea66c7e
...
...
@@ -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 @
cea66c7e
...
...
@@ -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 @
cea66c7e
...
...
@@ -4,7 +4,7 @@
"strict"
:
true
,
"skipLibCheck"
:
true
,
"module"
:
"ESNext"
,
"moduleResolution"
:
"
bundler
"
,
"moduleResolution"
:
"
NodeNext
"
,
"jsx"
:
"react"
,
"target"
:
"ESNext"
,
"noEmit"
:
true
...
...
pnpm-lock.yaml
View file @
cea66c7e
This diff is collapsed.
Click to expand it.
pnpm-workspace.yaml
View file @
cea66c7e
...
...
@@ -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