jupiter-node-sdk
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
export {}; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import Encryption from './Encryption'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -18,2 +18,3 @@ /// <reference types="node" /> | ||
jupToNqt(jup: string): string; | ||
calculateMessageFee(encryptedMessageLength: number): number; | ||
decrypt: (text: string) => Promise<string>; | ||
@@ -43,2 +44,3 @@ encrypt: (input: string | Buffer) => Promise<string | Buffer>; | ||
getAllTransactions(withMessage?: boolean, type?: number): Promise<ITransaction[]>; | ||
getTransaction(txId: string): Promise<ITransaction>; | ||
getAllConfirmedTransactions(withMessage?: boolean, type?: number): Promise<ITransaction[]>; | ||
@@ -45,0 +47,0 @@ getAllUnconfirmedTransactions(withMessage?: boolean, type?: number): Promise<ITransaction[]>; |
@@ -47,2 +47,23 @@ "use strict"; | ||
}, | ||
calculateMessageFee(encryptedMessageLength) { | ||
let fee = CONF.feeNQT; | ||
if (!encryptedMessageLength) | ||
return fee; | ||
if (encryptedMessageLength <= 10000) { | ||
fee = 4000; | ||
} | ||
else if (encryptedMessageLength <= 20000) { | ||
fee = 7000; | ||
} | ||
else if (encryptedMessageLength <= 30000) { | ||
fee = 10000; | ||
} | ||
else if (encryptedMessageLength <= 40000) { | ||
fee = 13000; | ||
} | ||
else { | ||
fee = 16000; | ||
} | ||
return fee; | ||
}, | ||
decrypt: encryption.decrypt.bind(encryption), | ||
@@ -156,2 +177,3 @@ encrypt: encryption.encrypt.bind(encryption), | ||
: record; | ||
const encryptedMessage = await this.encrypt(JSON.stringify(finalRecordToStore)); | ||
const { data } = await this.request('post', '/nxt', { | ||
@@ -163,4 +185,4 @@ params: { | ||
recipientPublicKey: opts.publicKey, | ||
messageToEncrypt: await this.encrypt(JSON.stringify(finalRecordToStore)), | ||
feeNQT: CONF.feeNQT, | ||
messageToEncrypt: encryptedMessage, | ||
feeNQT: this.calculateMessageFee(encryptedMessage.length), | ||
deadline: CONF.deadline, | ||
@@ -193,6 +215,13 @@ compressMessageToEncrypt: true, | ||
}, | ||
async getTransaction(txId) { | ||
const { data: { transaction, }, } = await this.request('post', '/nxt', { | ||
params: { | ||
requestType: 'getTransaction', | ||
transaction: txId | ||
}, | ||
}); | ||
return transaction; | ||
}, | ||
async getAllConfirmedTransactions(withMessage = true, type = 1) { | ||
const { data: { | ||
/* requestProcessingTime, */ | ||
transactions, }, } = await this.request('get', '/nxt', { | ||
const { data: { transactions, }, } = await this.request('get', '/nxt', { | ||
params: { | ||
@@ -208,5 +237,3 @@ requestType: 'getBlockchainTransactions', | ||
async getAllUnconfirmedTransactions(withMessage = true, type = 1) { | ||
const { data: { | ||
/* requestProcessingTime, */ | ||
unconfirmedTransactions, }, } = await this.request('post', '/nxt', { | ||
const { data: { unconfirmedTransactions, }, } = await this.request('post', '/nxt', { | ||
params: { | ||
@@ -213,0 +240,0 @@ requestType: 'getUnconfirmedTransactions', |
export {}; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function sleep(milliseconds?: number): Promise<unknown>; | ||
export declare function generatePassphrase(): string; | ||
export declare function generateKeywords(): string; |
@@ -0,0 +0,0 @@ "use strict"; |
export {}; |
@@ -0,0 +0,0 @@ "use strict"; |
export default function WordList(): string[]; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "jupiter-node-sdk", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A thin wrapper around the Jupiter blockchain APIs.", | ||
@@ -8,3 +8,3 @@ "main": "./dist/index.js", | ||
"type": "git", | ||
"url": "https://github.com/moontography/jupiter-node-sdk" | ||
"url": "https://github.com/jupiter-project/jupiter-node-sdk" | ||
}, | ||
@@ -11,0 +11,0 @@ "scripts": { |
@@ -60,10 +60,1 @@ # jupiter-node-sdk | ||
``` | ||
# Tips w/ cryptocurrency | ||
I love FOSS (free and open source software) and for the most part don't want to charge for the software I build. It does however take a good bit of time keeping up with feature requests and bug fixes, so if you have the desire and ability to send me a free coffee, it would be greatly appreciated! | ||
- Bitcoin (BTC): `3D779dP5SZo4szHivWHyFd6J2ESumwDmph` | ||
- Ethereum (ETH and ERC-20 tokens): `0xF3ffa9706b3264EDd1DAa93D5F5D70C8f71fAc99` | ||
- Stellar (XLM): `GACH6YMYFZ574FSGCV7IJXTGETEQL3DLQK64Z6DFGD57PZL5RH6LYOJT` | ||
- Jupiter (JUP) mainnet: `JUP-TUWZ-4B8Z-9REP-2YVH5` |
@@ -0,0 +0,0 @@ import path from 'path' |
@@ -0,0 +0,0 @@ import crypto from "crypto"; |
@@ -0,0 +0,0 @@ import Encryption from './Encryption' |
@@ -0,0 +0,0 @@ import assert from 'assert' |
@@ -51,2 +51,20 @@ import assert from 'assert' | ||
calculateMessageFee(encryptedMessageLength: number): number { | ||
let fee = CONF.feeNQT | ||
if (!encryptedMessageLength) | ||
return fee | ||
if (encryptedMessageLength <= 10000) { | ||
fee = 4000 | ||
} else if (encryptedMessageLength <= 20000) { | ||
fee = 7000 | ||
} else if (encryptedMessageLength <= 30000) { | ||
fee = 10000 | ||
} else if (encryptedMessageLength <= 40000) { | ||
fee = 13000 | ||
} else { | ||
fee = 16000 | ||
} | ||
return fee | ||
}, | ||
decrypt: encryption.decrypt.bind(encryption), | ||
@@ -183,2 +201,7 @@ encrypt: encryption.encrypt.bind(encryption), | ||
: record | ||
const encryptedMessage = await this.encrypt( | ||
JSON.stringify(finalRecordToStore) | ||
) | ||
const { data } = await this.request('post', '/nxt', { | ||
@@ -190,6 +213,4 @@ params: { | ||
recipientPublicKey: opts.publicKey, | ||
messageToEncrypt: await this.encrypt( | ||
JSON.stringify(finalRecordToStore) | ||
), | ||
feeNQT: CONF.feeNQT, | ||
messageToEncrypt: encryptedMessage, | ||
feeNQT: this.calculateMessageFee(encryptedMessage.length), | ||
deadline: CONF.deadline, | ||
@@ -221,2 +242,4 @@ compressMessageToEncrypt: true, | ||
async getAllTransactions( | ||
@@ -233,2 +256,18 @@ withMessage: boolean = true, | ||
async getTransaction( | ||
txId: string | ||
): Promise<ITransaction> { | ||
const { | ||
data: { | ||
transaction, | ||
}, | ||
} = await this.request('post', '/nxt', { | ||
params: { | ||
requestType: 'getTransaction', | ||
transaction: txId | ||
}, | ||
}) | ||
return transaction | ||
}, | ||
async getAllConfirmedTransactions( | ||
@@ -240,3 +279,2 @@ withMessage: boolean = true, | ||
data: { | ||
/* requestProcessingTime, */ | ||
transactions, | ||
@@ -261,3 +299,2 @@ }, | ||
data: { | ||
/* requestProcessingTime, */ | ||
unconfirmedTransactions, | ||
@@ -264,0 +301,0 @@ }, |
@@ -0,0 +0,0 @@ import assert from 'assert' |
@@ -0,0 +0,0 @@ import WordList from './WordList' |
@@ -0,0 +0,0 @@ export default function WordList() { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
110679
29
4561
60
1