@realiotech/client-signer
v1.2.0
Published
Realio SDK for client side cross chain message signing
Readme
Client Signer SDK
A client side cross-chain message signing SDK for Realio, supporting multiple blockchain protocols.
Installation
npm install @realiotech/client-signerDevelopment
Branching Strategy
This project uses a simple branching strategy:
mainis the only permanent branch- All development happens through pull requests to
main - No staging branch is used
- Feature branches should be created from
main
Development Workflow
Create a feature branch from
main:git checkout main git pull origin main git checkout -b feature/your-feature-nameMake your changes and commit them:
git add . git commit -m "feat: your feature description"Push your branch and create a PR:
git push origin feature/your-feature-nameThen create a pull request to merge into
main.After review and approval, your PR will be merged to
main
Development Commands
# Install dependencies
npm install
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Build
npm run build
# Build for development (with sourcemaps)
npm run build:dev
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run formatUsage
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.BITCOIN,
mnemonic: 'your mnemonic here',
options: { mainnet: true },
});
const result = await signer.signTransaction(unsignedTx);Supported Protocols
- Bitcoin
- EVM
- Tendermint
- Stellar
- Algorand
- Solana
API Integration
This SDK is tightly coupled with Realio's core transaction API. Currently it supports signing transactions from the send-token/unsigned API. All other APIs or data formats are not tested and not guaranteed to work.
Supported APIs
Input Data Format
The SDK expects transaction data to be in the format provided by Realio's core transaction API. This means:
- The input transaction data must be obtained by calling the core API's transaction creation methods
- The signer will not validate or modify the transaction structure - it only handles the signing process
API Reference
createSigner
function createSigner<T extends ProtocolOptions>(options: CreateSignerOptions<T>): Signer;Parameters
options: Configuration object containing:protocol: The blockchain protocol to use (fromPROTOCOL_NAMES)mnemonic: BIP39 mnemonic phraseoptions: Protocol-specific options (optional)
Returns
A Signer instance with a signTransaction method.
Signer Interface
interface Signer {
signTransaction(tx: string): Promise<SignedTx>;
}Protocol Options
BitcoinOptions
interface BitcoinOptions {
mainnet: boolean; // true for mainnet, false for testnet
}StellarOptions
interface StellarOptions {
mainnet: boolean; // true for mainnet, false for testnet
}TendermintOptions
interface TendermintOptions {
chain: Chain;
sender: Sender;
}Examples
Bitcoin Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.BITCOIN,
mnemonic: 'your mnemonic here',
options: { mainnet: false }, // Required: true for mainnet, false for testnet
});
const result = await signer.signTransaction(unsignedPsbtHex);EVM Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.EVM,
mnemonic: 'your mnemonic here',
});
const result = await signer.signTransaction(unsignedTxHex);Tendermint Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.TENDERMINT,
mnemonic: 'your mnemonic here',
options: {
chain: {
chainId: 3300,
cosmosChainId: 'realionetwork_3300-4',
},
sender: {
accountAddress: 'realio...',
pubkey: 'AzUx...',
accountNumber: 124,
sequence: 1,
},
},
});
const result = await signer.signTransaction(unsignedTx);Stellar Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.STELLAR,
mnemonic: 'your mnemonic here',
options: { mainnet: false }, // Required: true for mainnet, false for testnet
});
const result = await signer.signTransaction(unsignedXdr);Algorand Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.ALGORAND,
mnemonic: 'your mnemonic here',
});
const result = await signer.signTransaction(unsignedTxBase64);Solana Transaction Signing
import { createSigner, PROTOCOL_NAMES } from 'client-signer';
const signer = createSigner({
protocol: PROTOCOL_NAMES.SOLANA,
mnemonic: 'your mnemonic here',
});
const result = await signer.signTransaction(unsignedTxBase64);Deployment
Versioning
This package follows Semantic Versioning. The version in package.json should be a semantic version number without the 'v' prefix (e.g., "1.0.0").
Release Process
All changes, including releases, should be made through pull requests to the main branch. Never commit directly to main.
Create a new branch for the release:
git checkout -b release/1.0.0Update the version in
package.json:{ "version": "1.0.0" // Update this number }Commit the version change:
git add package.json git commit -m "chore: bump version to 1.0.0"Push the branch and create a PR:
git push origin release/1.0.0Then create a pull request to merge into main.
After the PR is approved and merged to main, create and push a tag (with 'v' prefix):
git checkout main git pull origin main git tag v1.0.0 git push origin v1.0.0
The CI/CD pipeline will automatically:
- Run tests on the PR
- Run tests on merge to main
- When a tag is pushed:
- Verify the version matches package.json
- Build the package
- Publish to npm
Version Format
- Package version (package.json):
1.0.0(no 'v' prefix) - Git tag:
v1.0.0(with 'v' prefix) - CI will ensure they match (ignoring the 'v' prefix)
Tools
- tsup: TypeScript bundler
- Vitest: Testing framework
- ESLint: Code linting
- Prettier: Code formatting
