Signer SDK based in module Signer
Handles the storage of wallets and allows to sign messages with them
npm install @koibanx/signer-sdk
NOTE: you must have the npm token in your .npmrc file
Using ES6 import
import SignerSdk from '@koibanx/signer-sdk';
const signer = SignerSdk({
baseURL: 'http://your-url',
apiKey: 'apiKey',
});
With require
exports.__esModule = true;
const SignerSdk = require('@koibanx/signer-sdk')["default"];
const signer = SignerSdk({
baseURL: 'http://your-url',
apiKey: 'apiKey',
});
- Typescript (
@koibanx/signer-sdk/dist/index.d.ts
)
Using ES6 import
import SignerSdk from "@koibanx/signer-sdk";
const signer = SignerSdk({
baseURL: 'http://your-url',
apiKey: 'apiKey',
})
const catchError = (err, modulo) => {
console.log('Modulo: ', modulo);
console.log('details: ', err.details);
console.log('shortMessage: ', err.message);
console.log('errorCode: ', err.code);
}
signer.checkState().then((res) => {
console.log('checkState: ', res);
}).catch((err) => catchError(err, 'checkState'));
signer.wallet.createWallet({
user: 'test',
}).then((res) => {
console.log('createWallet: ', res);
}).catch((err) => catchError(err, 'createWallet'));
signer.wallet.getWallet({
user: 'test',
}).then((resGetWallet) => {
console.log('getWallet: ', resGetWallet);
}).catch((err) => catchError(err, 'createWallet'));
signer.signature.signMessage({
user: 'test1',
unsignedMessage: 'mensaje',
}).then((resSignMessage) => console.log('signMessage: ', resSignMessage))
.catch((err) => catchError(err, 'signMessage'));
signer.wallet.deleteWallet({
user: 'test1',
}).then((resDeleteWallet) => {
console.log('deleteWallet: ', resDeleteWallet);
}).catch((err) => catchError(err, 'deleteWallet'));