1.2.1 • Published 10 months ago
crestal-js-sdk v1.2.1
Crestal JavaScript SDK
JavaScript SDK for Crestal's services.
Installation
npm install crestal-js-sdk
OR
yarn add crestal-js-sdk
Configuration
JavaScript Projects
No additional configuration needed. You can start using the SDK right away:
// Using ESM (import)
import { login } from 'crestal-js-sdk/utils';
// OR using CommonJS (require)
const { login } = require('crestal-js-sdk/utils');
TypeScript Projects
Add these essential compiler options to your tsconfig.json
:
{
"compilerOptions": {
"moduleResolution": "node",
"module": "ESNext",
"esModuleInterop": true,
"paths": {
"crestal-js-sdk/*": [
"./node_modules/crestal-js-sdk/dist/types/*"
]
}
}
}
Usage Examples
Generate Login Details
import { login } from 'crestal-js-sdk/utils';
const privateKey = "0x702b31e07df61a323ae6f55db2253164a4b050158496aa9191df818f380dbb3d";
const userAddress = "0xBB900BbE1A20dA4d474666B79a5fa6CE12629733";
const chainId = 80084;
if (privateKey && userAddress && chainId) {
login(privateKey, userAddress, chainId);
} else {
console.error("Missing required variables.");
}
Then run it with: npx ts-node --esm YOUR_SCRIPT.ts
or node YOUR_SCRIPT.js
.
Chain Validation
For a full list of supported networks and their chain Ids, please check here.
import { isChainSupported, supportedChainIds } from 'crestal-js-sdk/utils';
// Validate a specific chain
const isValid = isChainSupported(80084); // true
Then run it with: npx ts-node --esm YOUR_SCRIPT.ts
or node YOUR_SCRIPT.js
.
1.2.0
10 months ago
1.1.9
10 months ago
1.1.8
10 months ago
1.1.7
10 months ago
1.1.6
10 months ago
1.1.5
10 months ago
1.1.4
10 months ago
1.1.3
10 months ago
1.2.1
10 months ago
1.1.2
10 months ago
1.1.1
10 months ago
1.1.0
10 months ago
1.0.8
10 months ago
1.0.7
10 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
11 months ago
1.0.3
11 months ago
1.0.2
11 months ago
1.0.1
11 months ago
1.0.0
11 months ago