1.0.7 • Published 3 months 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 calledclientAuthPubKey
andclientAuthPrivKey
in wallaby. To differentiate them from wallaby’s key pair. Which are calledwallabyAuthPubKey
andwallabyAuthPrivKey
hash
: It useskeccak256
function 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 keyencryptWithPublicKey
Encrypts 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:************
AES
used 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
3 months ago
1.0.6
4 months ago
1.0.5
4 months ago
1.0.4
4 months ago
1.0.3
5 months ago
1.0.2
11 months ago
1.0.1
12 months ago
1.0.0
12 months ago
0.5.0
11 months ago
0.3.9
1 year ago
0.3.10
1 year ago
0.4.5
12 months ago
0.4.4
12 months ago
0.3.2
1 year ago
0.2.12
1 year ago
0.1.10
1 year ago
0.1.9
1 year ago
0.1.8
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago