1.0.7 • Published 2 years ago
ncw-sdk-js v1.0.7
ncw-sdk-js
Client Initialization
To initialize the client, we need to pass an apiKey and baseUrl as required params, and accessToken as an optional one for endpoints that are protected by JWT.
const config = {
apiKey: string,
baseUrl: string,
jwt: string,
userId: string,
accessToken: string, // Optional
};
const wallaby = new Wallaby(config);Example:
import { Wallaby } from '@RCrypto/Wallaby';
const config = {
apiKey: "071b51027b412a1b8fcttt73684d25mi"
baseUrl: "https://dev-testnet.wallaby.cash",
jwt: `eyJhbGciOiJSUzI1NiJ9. eyJleHRlcm5hbFVzZXJJZCI6IjU0MDc1ZWNmLWE3MjktNDUxNy05NmE1LTZkMzcwNzFmYTEzZSIsImV4cGlyYXRpb24iOiIyMDIzLTA0LTI1VDExOjU4OjExLTA1OjAwIiwiaGFzaF9zdHJpbmciOiIxOGU4ZDY1NWJmNjUwYmJkZWFlNWEzNjBkMTU1M2Q5YWVkYjU1MjI4NGYxOWZmMDViMzgxZWI0ZjcxNDA2MjQ2In0.jnsGd-H0rBXLQVHLKq2yMNLcvlDKOg1i863czVPLg0sDaO6hDLIez2zfhsEvGAZQCbYKWIAj7KmuCIFLGL5B74eu-__d_OzO2fTGJthzud-MlWcWAjXYnHjGS6WCZ5M_D_i-kyZow9N9SmSX4ccdFV4yPmQVYojqDqBAWlVXddU`,
userId: "54075ecf-a729-4517-96a5-6d37071fa13e",
}
const wallaby = new Wallaby(config)
/**
* This will return all domains supported by wallaby (i.e auth or wallets)
* Then it can be called like the example below
*/
wallaby.auth.refreshAccessToken(accessTokenparams)
wallaby.wallets.getTokenBalance(tokenBalanceparams)
wallaby.transactions.signTransaction(signTransactionparams)
wallaby.core.getAvailableBlockchains()Dependencies
Required packages and functions used:
- eth-crypto
link: https://www.npmjs.com/package/eth-crypto
**********Version:********** v2.6.0 (latest)
************Functions used:************
createIdentity: Generates public/private key pair. Which are calledclientAuthPubKeyandclientAuthPrivKeyin wallaby. To differentiate them from wallaby’s key pair. Which are calledwallabyAuthPubKeyandwallabyAuthPrivKeyhash: It useskeccak256function to hash the message string coming from wallaby.sign:** It generates a signature from a hashed message (with client public key) and the client private keyencryptWithPublicKeyEncrypts a string (in our case the seed-phrase) using the public key.decryptWithPrivateKey: decrypts a string (in our case the seed-phrase) with the private key.publicKeyByPrivateKey: Generates the public key using the private key.
- crypto-js
link: https://www.npmjs.com/package/crypto-js
**********Version:********** v4.1.1 (latest)
************Functions used:************
AESused to encrypt the private key with the password.
- axios
link: https://www.npmjs.com/package/axios
**********Version:********** v1.3.4 (latest)
************Functions used:************
create: used to instantiate an axios instance.
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
3 years ago
1.0.0
3 years ago
0.5.0
2 years ago
0.3.9
3 years ago
0.3.10
3 years ago
0.4.5
3 years ago
0.4.4
3 years ago
0.3.2
3 years ago
0.2.12
3 years ago
0.1.10
3 years ago
0.1.9
3 years ago
0.1.8
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago