-
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.
- Loading branch information
1 parent
78fe2e6
commit 9093112
Showing
20 changed files
with
601 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@siafoundation/walletd-js': minor | ||
--- | ||
|
||
Introduced a new walletd-js library. |
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,6 @@ | ||
--- | ||
'@siafoundation/walletd-js': patch | ||
'@siafoundation/walletd-types': patch | ||
--- | ||
|
||
Organized walletd types and constants. |
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,2 +1,6 @@ | ||
siad | ||
sia | ||
renterd | ||
hostd | ||
walletd | ||
js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nx/react/babel", | ||
{ | ||
"runtime": "automatic", | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
], | ||
"plugins": [] | ||
} |
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,21 @@ | ||
{ | ||
"extends": ["plugin:@nx/react", "../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"rules": { | ||
"@nx/dependency-checks": [ | ||
"error", | ||
{ | ||
"ignoredFiles": ["libs/walletd-js/rollup.config.js"] | ||
} | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/dependency-checks": "error" | ||
} | ||
} | ||
] | ||
} |
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,30 @@ | ||
# walletd-js | ||
|
||
SDK for interacting with `walletd`. | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install @siafoundation/walletd-js | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import { Walletd } from '@siafoundation/walletd-js' | ||
|
||
const walletd = Walletd({ | ||
api: 'http://localhost:9980/api', | ||
password: 'password1337', | ||
}) | ||
|
||
const events = await walletd.walletEvents({ | ||
params: { | ||
id: 'wallet-1', | ||
limit: 10, | ||
offset: 0, | ||
}, | ||
}) | ||
const peers = await walletd.syncerPeers() | ||
console.log(events.data, peers.data) | ||
``` |
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,17 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'walletd-js', | ||
preset: '../../jest.preset.js', | ||
transform: { | ||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', | ||
'^.+\\.[tj]sx?$': [ | ||
'babel-jest', | ||
{ | ||
presets: ['@nx/next/babel'], | ||
plugins: ['@babel/plugin-transform-private-methods'], | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage/libs/walletd-js', | ||
} |
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,11 @@ | ||
{ | ||
"name": "@siafoundation/walletd-js", | ||
"description": "SDK for interacting with `walletd`.", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@siafoundation/request": "0.2.0", | ||
"@siafoundation/walletd-types": "0.1.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "walletd-js", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/walletd-js/src", | ||
"projectType": "library", | ||
"tags": [], | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/rollup:rollup", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/libs/walletd-js", | ||
"tsConfig": "libs/walletd-js/tsconfig.lib.json", | ||
"project": "libs/walletd-js/package.json", | ||
"entryFile": "libs/walletd-js/src/index.ts", | ||
"external": ["react/jsx-runtime"], | ||
"compiler": "tsc", | ||
"outputFileName": "index.js", | ||
"rollupConfig": "libs/walletd-js/rollup.config.js", | ||
"assets": [ | ||
{ | ||
"glob": "libs/walletd-js/*.md", | ||
"input": ".", | ||
"output": "." | ||
} | ||
] | ||
}, | ||
"configurations": {} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"] | ||
}, | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/libs/walletd-js"], | ||
"options": { | ||
"jestConfig": "libs/walletd-js/jest.config.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const preserveDirectives = require('rollup-plugin-preserve-directives') | ||
|
||
// https://github.com/rollup/rollup/issues/4699#issuecomment-1465302665 | ||
function getRollupOptions(options) { | ||
return { | ||
...options, | ||
output: { | ||
...options.output, | ||
preserveModules: true, | ||
format: 'esm', | ||
sourcemap: true, | ||
}, | ||
plugins: options.plugins.concat(preserveDirectives.default()), | ||
} | ||
} | ||
|
||
module.exports = getRollupOptions |
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 { Walletd } from '.' | ||
|
||
export async function example() { | ||
const walletd = Walletd({ | ||
api: 'http://localhost:9980/api', | ||
password: 'password1337', | ||
}) | ||
|
||
const events = await walletd.walletEvents({ | ||
params: { | ||
id: 'wallet-1', | ||
limit: 10, | ||
offset: 0, | ||
}, | ||
}) | ||
const peers = await walletd.syncerPeers() | ||
console.log(events.data, peers.data) | ||
} |
Oops, something went wrong.