@monerium/sdk
Everything you need to interact with the Monerium API - an electronic money issuer.
This package is in development. Please make sure to check if any future updates contain commits
that may change the behavior of your application before you upgrade. If you find any issues please report them here.
NPM package
Source code
SDK Documentation
SDK JS-Docs
Code coverage
Installing
yarn add @monerium/sdk
Usage
watch
: Run Vite in watch mode to detect changes to files during developmentbuild
: Run Vite to build a production release distributable
Environments
Sandbox:
chains: ethereum
, polygon
, gnosis
.
networks: goerli
, mumbai
, chiado
.
Production:
chains: ethereum
, polygon
, gnosis
.
networks: mainnet
, mainnet
, mainnet
.
Getting started
We recommend starting in the Developer Portal. There you will learn more about client_id
's and ways of authenticating.
Import the SDK and initialize a client
import { MoneriumClient } from '@monerium/sdk';
const client = new MoneriumClient('sandbox');
Authenticate using client credentials
await client.auth({
client_id: "your_client_credentials_uuid"
client_secret: "your_client_secret"
})
await client.getAuthContext()
const { access_token, refresh_token } = client.bearerProfile;
Authenticate using auth flow
let authFlowUrl = client.getAuthFlowURI({
client_id: "your_client_authflow_uuid",
redirect_uri: "http://your-webpage.com/monerium-integration"
network: "mumbai",
chain: "polygon",
address: "0xValidAddress72413Fa92980B889A1eCE84dD",
signature: "0xValidSignature0df2b6c9e0fc067ab29bdbf322bec30aad7c46dcd97f62498a91ef7795957397e0f49426e000b0f500c347219ddd98dc5080982563055e918031c"
})
window.localStorage.setItem("myCodeVerifier", client.codeVerifier);
window.location.replace(authFlowUrl)
await client.auth({
client_id: 'your_client_authflow_uuid',
code: new URLSearchParams(window.location.search).get('code'),
code_verifier: window.localStorage.getItem('myCodeVerifier'),
redirect_url: 'http://your-webpage.com/monerium-integration',
});
await client.getAuthContext();
const { access_token, refresh_token } = client.bearerProfile;
Contributing
We are using commitlint to enforce that developers format the commit messages according to the Conventional Commits guidelines.
We are using Yarn as a package manager.
yarn
yarn build
Smart IDEs (such as VSCode) require special configuration for TypeScript to work when using Yarn Plug'n'Play installs.
yarn dlx @yarnpkg/sdks vscode
For development, a package can be linked into another project. This is often useful to test out new features or when trying to debug an issue in a package that manifests itself in another project. run yarn link inside of the sdk project.
YARN_IGNORE_PATH=1 yarn link
Use yarn link "@monerium/sdk"
to link and test into your current project.
cd ../your-project
yarn link "@monerium/sdk"
Publishing
When changes are merged to the main
branch that follows the conventional commits standard, release-please workflow creates a pull request, preparing for the next release. If kept open, the following commits will also be added to the PR. Merging that PR will create a new release, a workflow will publish it on NPM and tag it on Github.