Skip to content

Commit

Permalink
chore: some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ohager committed Dec 28, 2024
1 parent a269be7 commit 5cab6d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 94 deletions.
64 changes: 8 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ technology.
- [X] UTILS
- [X] STANDARDS
- [X] WALLET
- [ ] DOCUMENTATION
- [X] DOCUMENTATION
- [ ] EXAMPLES


Version 2 is now live. There are some major changes especially for the crypto package. Check more details [here](./packages/crypto/README.md)
Consider this version as not stable yet.

----------------------------

Expand All @@ -48,8 +49,6 @@ The SDK is separated in the following packages
- [@signumjs/util](https://signum-network.github.io/signumjs/modules/util.html) A package providing useful functions, e.g. common conversion functions
- [@signumjs/http](https://signum-network.github.io/signumjs/modules/http.html) A package providing a _simplified_ Http layer, with consistent response types,
and exception handling
- [@signumjs/monitor](https://signum-network.github.io/signumjs/modules/monitor.html) A package providing a class to execute recurring async operations with
de/serialization feature, good for listening to blockchain transactions
- [@signumjs/wallets](https://signum-network.github.io/signumjs/modules/wallets.html) This package provides the communication with SIP22 compatible deeplinkable
- [@signumjs/standards](https://signum-network.github.io/signumjs/modules/standards.html) This package provides the communication with SIP22 compatible deeplinkable

Expand All @@ -67,7 +66,6 @@ npm install @signumjs/contracts (optional)
npm install @signumjs/crypto (optional)
npm install @signumjs/util (optional)
npm install @signumjs/http (optional)
npm install @signumjs/monitor (optional)
npm install @signumjs/wallets (optional)
npm install @signumjs/standards (optional)
```
Expand All @@ -80,7 +78,6 @@ yarn add @signumjs/contracts (optional)
yarn add @signumjs/crypto (optional)
yarn add @signumjs/util (optional)
yarn add @signumjs/http (optional)
yarn add @signumjs/monitor (optional)
yarn add @signumjs/wallets (optional)
yarn add @signumjs/standards (optional)
```
Expand All @@ -102,8 +99,6 @@ Just import one of the packages using the HTML `<script>` tag.

`<script src='https://cdn.jsdelivr.net/npm/@signumjs/util/dist/signumjs.util.min.js'></script>`

`<script src='https://cdn.jsdelivr.net/npm/@signumjs/monitor/dist/signumjs.monitor.min.js'></script>`

`<script src='https://cdn.jsdelivr.net/npm/@signumjs/wallets/dist/signumjs.wallets.min.js'></script>`

`<script src='https://cdn.jsdelivr.net/npm/@signumjs/standards/dist/signumjs.standards.min.js'></script>`
Expand All @@ -116,7 +111,6 @@ Due to the way a package is imported following global variables are provided
| contracts | `sig$contracts` |
| crypto | `sig$crypto` |
| http | `sig$http` |
| monitor | `sig$monitor` |
| util | `sig$util` |
| wallets | `sig$wallets` |
| wallets | `sig$standards` |
Expand Down Expand Up @@ -191,48 +185,6 @@ const transaction = await client.setAccountDescriptor({
});
```

```ts
// using monitor

// A method that checks if an account exists
// > IMPORTANT: Do not use closures, when you need to serialize the monitor
import {LedgerClientFactory} from './ledgerClientFactory';

async function tryFetchAccount() {
try {
const ledger = LedgerClientFactory.create({nodeHost: 'https://europe3.testnet.signum.network/'})
const {account} = await ledger.account.getAccount('1234')
return account;
} catch (e) {
// ignore error
return null;
}
}

// A comparing function to check if a certain condition for the returned data from fetch function
// is true. If it's true the monitor stops
function checkIfAccountExists(account) {
return account !== null;
}

// Create your monitor
const monitor = new Monitor<Account>({
asyncFetcherFn: tryFetchAccount,
compareFn: checkIfAccountExists,
intervalSecs: 10, // polling interval in seconds
key: 'monitor-account',
timeoutSecs: 2 * 240 // when reached timeout the monitor stops
})
.onFulfilled(() => {
// called when `checkIfAccountExists` returns true
console.log('Yay, account active');
})
.onTimeout(() => {
// called when `timeoutSecs` is reached
console.log('Hmm, something went wrong');
}).start();
```

## Usage

The following example shows how to interact with the blockchain, i.e. getting the balance of a specific account
Expand Down Expand Up @@ -299,12 +251,12 @@ npm run build
| Keep in mind that these tests are slow as they run against true servers. And therefore, it cannot be guaranteed
that all E2E tests always work

## Publish
## Versioning and Publishing

To publish all packages (using lerna and same version strategy) just run
This monorepo uses [changeset](https://github.com/changesets/changesets) to manage the versions and publish the package. We use one version for all packages.

```bash
npm run publish
```
1. Create a changeset: `npx changeset`
2. Bump version: `npx changeset version`
3. Publish `npx changeset publish`

> Note: Only with a valid npm OTP token
17 changes: 0 additions & 17 deletions jsdoc2md.json

This file was deleted.

21 changes: 0 additions & 21 deletions tsdoc.bak.json

This file was deleted.

0 comments on commit 5cab6d4

Please sign in to comment.