Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ jobs:
strategy: all
tag: ${{ env.TAG }}

- name: Publish SDK Portal package
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/portal/package.json
access: public
provenance: false
strategy: all
tag: ${{ env.TAG }}

- name: Publish SDK The Graph package
uses: JS-DevTools/npm-publish@v3
with:
Expand Down Expand Up @@ -193,6 +203,7 @@ jobs:
| ------- | -------------------- |
| SDK Cli | `@settlemint/sdk-cli@${{ env.VERSION }}` |
| SDK The Graph | `@settlemint/sdk-thegraph@${{ env.VERSION }}` |
| SDK Portal | `@settlemint/sdk-portal@${{ env.VERSION }}` |
| SDK Hasura | `@settlemint/sdk-hasura@${{ env.VERSION }}` |
| SDK JS | `@settlemint/sdk-js@${{ env.VERSION }}` |
| SDK Utils | `@settlemint/sdk-utils@${{ env.VERSION }}` |
Expand Down
11 changes: 8 additions & 3 deletions packages/hasura/src/hasura.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { ensureServer } from "@settlemint/sdk-utils/runtime";
import { validate } from "@settlemint/sdk-utils/validation";
import { type AbstractSetupSchema, initGraphQLTada } from "gql.tada";
import { GraphQLClient } from "graphql-request";
import { type ClientOptions, ClientOptionsSchema, ServerClientOptionsSchema } from "./helpers/client-options.schema.js";
import {
type ClientOptions,
ClientOptionsSchema,
type ServerClientOptions,
ServerClientOptionsSchema,
} from "./helpers/client-options.schema.js";

export type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];

Expand Down Expand Up @@ -63,7 +68,7 @@ export function createHasuraClient<const Setup extends AbstractSetupSchema>(
* });
*/
export function createServerHasuraClient<const Setup extends AbstractSetupSchema>(
options: ClientOptions,
options: ServerClientOptions,
requestConfig?: RequestConfig,
) {
ensureServer();
Expand All @@ -72,7 +77,7 @@ export function createServerHasuraClient<const Setup extends AbstractSetupSchema
const graphql = initGraphQLTada<Setup>();

return {
client: new GraphQLClient(`${validatedOptions.instance}/v1/graphql`, {
client: new GraphQLClient(validatedOptions.instance, {
...requestConfig,
headers: {
...requestConfig?.headers,
Expand Down
Empty file added packages/portal/.gitignore
Empty file.
110 changes: 110 additions & 0 deletions packages/portal/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Functional Source License, Version 1.1, MIT Future License

## Abbreviation

FSL-1.1-MIT

## Notice

Copyright 2024 SettleMint

## Terms and Conditions

### Licensor ("We")

The party offering the Software under these Terms and Conditions.

### The Software

The "Software" is each version of the software that we make available under
these Terms and Conditions, as indicated by our inclusion of these Terms and
Conditions with the Software.

### License Grant

Subject to your compliance with this License Grant and the Patents,
Redistribution and Trademark clauses below, we hereby grant you the right to
use, copy, modify, create derivative works, publicly perform, publicly display
and redistribute the Software for any Permitted Purpose identified below.

### Permitted Purpose

A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
means making the Software available to others in a commercial product or
service that:

1. substitutes for the Software;

2. substitutes for any other product or service we offer using the Software
that exists as of the date we make the Software available; or

3. offers the same or substantially similar functionality as the Software.

Permitted Purposes specifically include using the Software:

1. for your internal use and access;

2. for non-commercial education;

3. for non-commercial research; and

4. in connection with professional services that you provide to a licensee
using the Software in accordance with these Terms and Conditions.

### Patents

To the extent your use for a Permitted Purpose would necessarily infringe our
patents, the license grant above includes a license under our patents. If you
make a claim against any party that the Software infringes or contributes to
the infringement of any patent, then your patent license to the Software ends
immediately.

### Redistribution

The Terms and Conditions apply to all copies, modifications and derivatives of
the Software.

If you redistribute any copies, modifications or derivatives of the Software,
you must include a copy of or a link to these Terms and Conditions and not
remove any copyright notices provided in or with the Software.

### Disclaimer

THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.

IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.

### Trademarks

Except for displaying the License Details and identifying us as the origin of
the Software, you have no right under these Terms and Conditions to use our
trademarks, trade names, service marks or product names.

## Grant of Future License

We hereby irrevocably grant you an additional license to use the Software under
the MIT license that is effective on the second anniversary of the date we make
the Software available. On or after that date, you may use the Software under
the MIT license, in which case the following will apply:

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
172 changes: 172 additions & 0 deletions packages/portal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<p align="center">
<img src="https://github.com/settlemint/sdk/blob/main/logo.svg" width="200px" align="center" alt="SettleMint logo" />
<h1 align="center">SettleMint SDK</h1>
<p align="center">
✨ <a href="https://settlemint.com">https://settlemint.com</a> ✨
<br/>
Integrate SettleMint into your application with ease.
</p>
</p>

<p align="center">
<a href="https://github.com/settlemint/sdk/actions?query=branch%3Amain"><img src="https://github.com/settlemint/sdk/actions/workflows/build.yml/badge.svg?event=push&branch=main" alt="CI status" /></a>
<a href="https://fsl.software" rel="nofollow"><img src="https://img.shields.io/npm/l/@settlemint/sdk-js" alt="License"></a>
<a href="https://www.npmjs.com/package/@settlemint/sdk-js" rel="nofollow"><img src="https://img.shields.io/npm/dw/@settlemint/sdk-js" alt="npm"></a>
<a href="https://github.com/settlemint/sdk" rel="nofollow"><img src="https://img.shields.io/github/stars/settlemint/sdk" alt="stars"></a>
</p>

<div align="center">
<a href="https://console.settlemint.com/documentation/">Documentation</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://discord.com/invite/Mt5yqFrey9">Discord</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/@settlemint/sdk-js">NPM</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
<a href="https://github.com/settlemint/sdk/issues">Issues</a>
<br />
</div>

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Examples](#examples)
- [Contributing](#contributing)
- [License](#license)

## Installation

To install the SettleMint SDK, you can use one of the following package managers:

```bash
# Using npm
npm install @settlemint/sdk

# Using yarn
yarn add @settlemint/sdk

# Using pnpm
pnpm add @settlemint/sdk

# Using Bun
bun add @settlemint/sdk
```

We recommend using Bun for faster installation and better performance.

## Usage

To use the SettleMint SDK in your Node.js application, follow these steps:

1. Import the SDK:

```javascript
import { createSettleMintClient } from '@settlemint/sdk';
```

2. Create a client instance:

```javascript
const client = createSettleMintClient({
accessToken: 'your_access_token',
instance: 'https://console.settlemint.com'
});
```

3. Use the client to interact with SettleMint resources:

```javascript
// Example: List workspaces
const workspaces = await client.workspace.list();
console.log(workspaces);
```

## API Reference

The SettleMint SDK provides access to various resources. Here's an overview of the available methods:

### Workspace

- `workspace.list()`: List all workspaces and their applications
- `workspace.read(workspaceId)`: Read a specific workspace and its applications

### Blockchain Network

- `blockchainNetwork.list(applicationId)`: List blockchain networks for a given application
- `blockchainNetwork.read(blockchainNetworkId)`: Read a specific blockchain network

### Blockchain Node

- `blockchainNode.list(applicationId)`: List blockchain nodes for a given application
- `blockchainNode.read(blockchainNodeId)`: Read a specific blockchain node

### Middleware

- `middleware.list(applicationId)`: List middlewares for a given application
- `middleware.read(middlewareId)`: Read a specific middleware

### Integration Tool

- `integrationTool.list(applicationId)`: List integration tools for a given application
- `integrationTool.read(integrationId)`: Read a specific integration tool

### Storage

- `storage.list(applicationId)`: List storage items for a given application
- `storage.read(storageId)`: Read a specific storage item

### Private Key

- `privateKey.list(applicationId)`: List private keys for a given application
- `privateKey.read(privateKeyId)`: Read a specific private key

### Insights

- `insights.list(applicationId)`: List insights for a given application
- `insights.read(insightsId)`: Read a specific insight

## Examples

Here are some examples of how to use the SettleMint SDK:

### List Workspaces

```javascript
const client = createSettleMintClient({
accessToken: 'your_access_token',
instance: 'https://console.settlemint.com'
});

const workspaces = await client.workspace.list();
console.log(workspaces);
```

### Read a Specific Blockchain Network

```javascript
const client = createSettleMintClient({
accessToken: 'your_access_token',
instance: 'https://console.settlemint.com'
});

const networkId = 'your_network_id';
const network = await client.blockchainNetwork.read(networkId);
console.log(network);
```

## Contributing

We welcome contributions to the SettleMint SDK! If you'd like to contribute, please follow these steps:

1. Fork the repository
2. Create a new branch for your feature or bug fix
3. Make your changes and commit them with a clear commit message
4. Push your changes to your fork
5. Create a pull request to the main repository

Please ensure that your code follows the existing style and includes appropriate tests and documentation.

## License

The SettleMint SDK is released under the [FSL Software License](https://fsl.software). See the [LICENSE](LICENSE) file for more details.
6 changes: 6 additions & 0 deletions packages/portal/knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreDependencies": [],
"ignore": ["dist/**"],
"entry": ["src/settlemint.ts"]
}
Loading