Native Ramps SDK
Getting started
Installation
yarn add @consensys/native-ramps-sdk
or
npm install @consensys/native-ramps-sdk
Usage
import { NativeRampsSdk } from '@consensys/native-ramps-sdk'
// Initialize the SDK
const nativeRampsSdk = new NativeRampsSdk()
// Use the SDK methods
Version Management
To update the SDK version:
-
Update the version number in
package.json:{ "version": "1.0.1" } -
Install dependencies to sync the version:
npm install
The SDK automatically uses the version from package.json for all version-related functionality.
Local Development
For local development and testing of the SDK:
Building the SDK
-
Install dependencies:
npm install -
Build the SDK:
npm run buildThis will:
- Compile TypeScript files to JavaScript
- Generate type declarations (
.d.tsfiles) - Output everything to the
dist/directory
Testing Local Changes in Another Project
To test your local changes in another project without publishing:
-
Build the SDK (as shown above)
-
Copy the entire
dist/folder to your target project'snode_modules/@consensys/native-ramps-sdk/directory:# From your target project directory cp -r /path/to/native-ramps-sdk/dist/* ./node_modules/@consensys/native-ramps-sdk/dist/ -
Alternatively, you can use npm link for a more seamless development experience:
# In the SDK directory npm link # In your target project directory npm link @consensys/native-ramps-sdk
Development Workflow
- Make changes to the source code in
src/ - Run
npm run buildto compile your changes - Copy the updated
dist/files to your test project or use npm link - Test your changes in the target project
- Repeat as needed
Other Useful Commands
npm run test- Run testsnpm run lint- Check code stylenpm run prettier- Format codenpm run test:watch- Run tests in watch mode