Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Commit 0e7a23e

Browse files
committed
feat: new hooks; dep updates
1 parent 9d44429 commit 0e7a23e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+7715
-12209
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
refs:
44
container: &container
55
docker:
6-
- image: node:14.21.2
6+
- image: node:18.12.1
77
working_directory: ~/repo
88
steps:
99
- &Versions

.eslintrc.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
module.exports = {
2-
extends: ['react-app', 'prettier'],
2+
extends: ['react-app', 'prettier', 'plugin:storybook/recommended'],
33
plugins: ['prettier'],
44
rules: {
5-
'prettier/prettier': [
6-
'error',
7-
{
8-
singleQuote: true,
9-
trailingComma: 'all',
10-
tabWidth: 2,
11-
printWidth: 100,
12-
semicolons: true,
13-
quoteProps: 'as-needed',
14-
jsxSingleQuote: false,
15-
bracketSpacing: true,
16-
jsxBracketSameLine: true,
17-
arrowParens: 'always',
18-
endOfLine: 'lf',
19-
},
20-
],
21-
},
22-
};
5+
'prettier/prettier': ['error', {
6+
singleQuote: true,
7+
trailingComma: 'all',
8+
tabWidth: 2,
9+
printWidth: 100,
10+
semicolons: true,
11+
quoteProps: 'as-needed',
12+
jsxSingleQuote: false,
13+
bracketSpacing: true,
14+
jsxBracketSameLine: true,
15+
arrowParens: 'always',
16+
endOfLine: 'lf'
17+
}]
18+
}
19+
};

.github/workflows/check-codebase.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup node
2020
uses: actions/setup-node@v3
2121
with:
22-
node-version: 14
22+
node-version: 18
2323

2424
- name: Install dependencies
2525
run: yarn install --frozen-lockfile
@@ -37,7 +37,7 @@ jobs:
3737
- name: Setup node
3838
uses: actions/setup-node@v3
3939
with:
40-
node-version: 14
40+
node-version: 18
4141

4242
- name: Install dependencies
4343
run: yarn install --frozen-lockfile
@@ -55,7 +55,7 @@ jobs:
5555
- name: Setup node
5656
uses: actions/setup-node@v3
5757
with:
58-
node-version: 14
58+
node-version: 18
5959

6060
- name: Install dependencies
6161
run: yarn install --frozen-lockfile
@@ -73,7 +73,7 @@ jobs:
7373
strategy:
7474
matrix:
7575
os: [macos-latest, ubuntu-latest]
76-
node: [14, 16]
76+
node: [18, 19]
7777
exclude:
7878
- os: macos-latest
7979
node: 12

.storybook/addons.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

.storybook/config.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { StorybookConfig } from '@storybook/react-webpack5';
2+
const config: StorybookConfig = {
3+
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
4+
addons: [
5+
'@storybook/addon-links',
6+
'@storybook/addon-essentials',
7+
'@storybook/addon-interactions',
8+
],
9+
framework: {
10+
name: '@storybook/react-webpack5',
11+
options: {},
12+
},
13+
docs: {
14+
autodocs: 'tag',
15+
},
16+
};
17+
export default config;

.storybook/manager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { addons } from '@storybook/manager-api';
2+
import { themes } from '@storybook/theming';
3+
4+
addons.setConfig({
5+
theme: themes.dark,
6+
});

.storybook/preview.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { Preview } from '@storybook/react';
2+
import { themes } from '@storybook/theming';
3+
4+
const preview: Preview = {
5+
parameters: {
6+
docs: {
7+
theme: themes.dark,
8+
},
9+
actions: { argTypesRegex: '^on[A-Z].*' },
10+
controls: {
11+
matchers: {
12+
color: /(background|color)$/i,
13+
date: /Date$/,
14+
},
15+
},
16+
},
17+
};
18+
19+
export default preview;

.storybook/webpack.config.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
<br />
3232

3333
- [**Integrations**](./docs/Integrations.md)
34-
- [`useNfd`](./docs/useNfd.md) - [🚀🚀🚀](https://codesandbox.io/s/awesomealgo-hook-usenfd-example-23bnq4) - fetches NFD metadata from [NFD API](https://api-docs.nf.domains/).
34+
- [`useNfdLookup`](./docs/useNfdLookup.md) - [🚀🚀🚀](https://aorumbayev.github.io/awesomealgo-hooks/?path=/docs/example-usenfddemo--docs) - fetches NFD metadata from [NFD API](https://api-docs.nf.domains/).
35+
- [`useSubtopiaSubLookup`](./docs/useSubtopiaSubLookup.md) - [🚀🚀🚀](https://aorumbayev.github.io/awesomealgo-hooks/?path=/docs/example-usesubptopiasublookupdemo--docs) - fetches Subtopia subscription record from [Subtopia Platform](https://subtopia.io).
3536
- [**Helpers**](./docs/Helpers.md)
36-
- [`useShortAddress`](./docs/useShortAddress.md) - [🚀🚀🚀](https://codesandbox.io/s/awesomealgo-hook-useshortaddress-example-r30poo) - shortens a wallet address string.
37+
- [`useShortAddress`](./docs/useShortAddress.md) - [🚀🚀🚀](https://aorumbayev.github.io/awesomealgo-hooks/?path=/docs/example-useshortaddressdemo--docs) - shortens a wallet address string.
38+
- [`useExplorerUrl`](./docs/useExplorerUrl.md) - [🚀🚀🚀](https://aorumbayev.github.io/awesomealgo-hooks/?path=/docs/example-useexplorerurldemo--docs) - generates an explorer URL for a given address. Currently supports [AlgoScan](https://algoscan.app) and [AlgoExplorer](https://algoexplorer.io).
3739

3840
<br />
3941

docs/useExplorerUrl.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# `useExplorerUrl`
2+
3+
React hook that generates an explorer URL based on the given chain, input, type, and explorer type.
4+
5+
## Usage
6+
7+
```jsx
8+
import { useExplorerUrl } from 'LIBRARY_NAME';
9+
import { ExplorerUrlType, ChainType, ExplorerType } from 'PATH_TO_MISC_ENUMS';
10+
11+
const Demo = () => {
12+
const explorerUrl = useExplorerUrl(
13+
ChainType.MainNet,
14+
'ADDRESS_OR_TX_ID',
15+
ExplorerUrlType.Transaction,
16+
ExplorerType.AlgoScan,
17+
);
18+
19+
return <div>Explorer URL: {explorerUrl}</div>;
20+
};
21+
```
22+
23+
## Call signature
24+
25+
```jsx
26+
function useExplorerUrl = (
27+
chain: ChainType,
28+
input: string | number,
29+
type: ExplorerUrlType,
30+
explorerType: ExplorerType = ExplorerType.AlgoScan,
31+
): string;
32+
```

docs/useSubtopiaSubLookup.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# `useSubscriptionLookup`
2+
3+
React hook that fetches a subscription record based on the given address, SMI ID, and chain type.
4+
5+
## Usage
6+
7+
```jsx
8+
import { useSubscriptionLookup } from 'LIBRARY_NAME';
9+
import { ChainType } from 'PATH_TO_MISC_ENUMS';
10+
11+
const Demo = () => {
12+
const [subscriptionRecord, error, refresh] = useSubscriptionLookup(
13+
'ADDRESS',
14+
SMI_ID,
15+
ChainType.MainNet,
16+
);
17+
18+
return (
19+
<div>
20+
{error ? (
21+
<div>Error: {error.message}</div>
22+
) : (
23+
<div>Subscription Record: {JSON.stringify(subscriptionRecord)}</div>
24+
)}
25+
<button onClick={refresh}>Refresh</button>
26+
</div>
27+
);
28+
};
29+
```
30+
31+
## Call signature
32+
33+
```jsx
34+
function useSubscriptionLookup = (
35+
address: string,
36+
smiId: number,
37+
chain: ChainType,
38+
): [SubscriptionRecord | null, any, () => void];
39+
```

0 commit comments

Comments
 (0)