0.5.0 • Published 3 years ago
jupiter-node-sdk v0.5.0
jupiter-node-sdk
A thin wrapper over the Jupiter blockchain API with some utility functions to make doing common tasks like fetching data and encrypting/decrypting data easy.
Install
$ npm install -s jupiter-node-sdk
Usage
import JupiterClient from 'jupiter-node-sdk'
const client = JupiterClient({
server: `https://jpr.gojupiter.tech`,
address: `JUP-XXX-XXX`,
passphrase: `your secret phrase here`,
encryptSecret: `optional alphanumeric password to encrypt data going to blockchain`, // DEFAULT: passphrase
})
const jupAmount = client.nqtToJup(stringOfNqtAmount)
const nqtAmount = client.jupToNqt(stringOfJupAmount)
const cipherText = await client.encrypt(
`plain text to encrypt with AES-256 bit encryption`
)
const plainDecryptedText = await client.decrypt(`cipher text`)
// secretPhrase is basically ERC-20 mnemonic that you can build yourself
const {
address,
publicKey,
requestProcessingTime,
account,
} = await client.createNewAddress(secretPhrase)
const balanceJup = await client.getBalance(`JUP-XXX-XXX`).balanceNQT
// sender is address in constructor above
await client.sendMoney(recipientJupAddress, amountJupToSend)
// store any data you want (object should be a Javascript object) on the blockchain
await client.storeRecord(object)
// gets all confirmed AND unconfirmed transactions
const txns = await client.getAllTransactions()
// to make any generic Jupiter/NXT API request you can use #request as shown below
// which uses axios under the hood
await client.request('get', '/nxt', {
params: {
requestType: 'getBlockchainTransactions',
account: `JUP-XXX-XXX`,
withMessage: true,
type: 1,
},
})
0.5.0
3 years ago
0.4.1
3 years ago
0.4.0
3 years ago
0.3.0
3 years ago
0.3.1
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.1.0
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.0.9
3 years ago
0.1.3
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago