-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split out sia-central-types
- Loading branch information
1 parent
16a20ef
commit ff7678d
Showing
71 changed files
with
457 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libs/sia-central/CHANGELOG.md → libs/sia-central-js/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# @siafoundation/sia-central | ||
# @siafoundation/sia-central-js | ||
|
||
## 0.3.3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# sia-central-js | ||
|
||
Methods and types for interacting with the Sia Central API. | ||
|
||
## Running unit tests | ||
|
||
Run `nx test sia-central-js` to execute the unit tests via [Jest](https://jestjs.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
libs/sia-central/package.json → libs/sia-central-js/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ | ||
"name": "@siafoundation/sia-central", | ||
"name": "@siafoundation/sia-central-js", | ||
"description": "Methods and types for interacting with the Sia Central API.", | ||
"version": "0.3.3", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@technically/lodash": "^4.17.0" | ||
"@technically/lodash": "^4.17.0", | ||
"@siafoundation/sia-central-types": "0.0.0" | ||
}, | ||
"types": "./src/index.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { runFetch } from './fetch' | ||
import { | ||
api, | ||
SiaCentralAddressParams, | ||
SiaCentralAddressResponse, | ||
} from '@siafoundation/sia-central-types' | ||
|
||
export async function getSiaCentralAddress(args: { | ||
params: SiaCentralAddressParams | ||
config?: { | ||
api: string | ||
} | ||
}) { | ||
const { params, config } = args | ||
return runFetch<SiaCentralAddressResponse>( | ||
`${config?.api || api}/wallet/addresses/${params.id}` | ||
) | ||
} |
15 changes: 5 additions & 10 deletions
15
libs/sia-central/src/siaCentralBlock.tsx → libs/sia-central-js/src/block.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
...sia-central/src/siaCentralBlockLatest.tsx → libs/sia-central-js/src/blockLatest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 5 additions & 11 deletions
16
libs/sia-central/src/siaCentralBlocks.tsx → libs/sia-central-js/src/blocks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
libs/sia-central/src/siaCentralContract.tsx → libs/sia-central-js/src/contract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { runFetch } from './fetch' | ||
import { | ||
api, | ||
SiaCentralExchangeRatesResponse, | ||
} from '@siafoundation/sia-central-types' | ||
|
||
export async function getSiaCentralExchangeRates(args?: { | ||
config?: { | ||
api: string | ||
} | ||
}) { | ||
const { config } = args || {} | ||
return runFetch<SiaCentralExchangeRatesResponse>( | ||
`${config?.api || api}/market/exchange-rate?currencies=sc` | ||
) | ||
} |
File renamed without changes.
16 changes: 5 additions & 11 deletions
16
libs/sia-central/src/siaCentralHost.tsx → libs/sia-central-js/src/host.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
libs/sia-central/src/siaCentralHosts.tsx → libs/sia-central-js/src/hosts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
...al/src/siaCentralHostsNetworkAverages.tsx → ...ia-central-js/src/hostsNetworkAverages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { runFetch } from './fetch' | ||
import { | ||
api, | ||
SiaCentralHostsNetworkMetricsResponse, | ||
} from '@siafoundation/sia-central-types' | ||
|
||
export async function getSiaCentralHostsNetworkMetrics(args?: { | ||
config?: { | ||
api: string | ||
} | ||
}) { | ||
const { config } = args || {} | ||
return runFetch<SiaCentralHostsNetworkMetricsResponse>( | ||
`${config?.api || api}/hosts/network/metrics` | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export * from './address' | ||
export * from './blockLatest' | ||
export * from './block' | ||
export * from './blocks' | ||
export * from './contract' | ||
export * from './host' | ||
export * from './hosts' | ||
export * from './hostsNetworkAverages' | ||
export * from './hostsNetworkMetrics' | ||
export * from './exchangeRates' | ||
export * from './transaction' | ||
export * from './search' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { runFetch } from './fetch' | ||
import { | ||
api, | ||
SiaCentralSearchParams, | ||
SiaCentralSearchResponse, | ||
} from '@siafoundation/sia-central-types' | ||
|
||
export async function getSiaCentralSearch(args: { | ||
params: SiaCentralSearchParams | ||
config?: { | ||
api: string | ||
} | ||
}) { | ||
const { params, config } = args | ||
return runFetch<SiaCentralSearchResponse>( | ||
`${config?.api || api}/explorer/search/${params.query}` | ||
) | ||
} |
16 changes: 5 additions & 11 deletions
16
...sia-central/src/siaCentralTransaction.tsx → libs/sia-central-js/src/transaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.