Skip to content

Commit

Permalink
Update to use latest slpjs version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed Feb 10, 2019
1 parent b06cc61 commit 29b7df4
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 48 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const repl = require("repl")
const SLP = require("./lib/SLP").default
const clone = require("git-clone")

program.version("1.1.6", "-v, --version")
program.version("1.1.7", "-v, --version")

program
.command("new <name>")
Expand Down
2 changes: 1 addition & 1 deletion lib/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var BITBOXAddress = require("bitbox-sdk/lib/Address").default;
var BITBOXSDK = require("bitbox-sdk/lib/bitbox-sdk").default;
var BITBOX = new BITBOXSDK();
var utils = require("slpjs").slpjs.Utils;
var utils = require("slpjs").Utils;
var Address = /** @class */ (function (_super) {
__extends(Address, _super);
function Address(restURL) {
Expand Down
2 changes: 1 addition & 1 deletion lib/TokenType1.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
// require deps
var BITBOXSDK = require("bitbox-sdk/lib/bitbox-sdk").default;
var BigNumber = require("bignumber.js");
var slpjs = require("slpjs").slpjs;
var slpjs = require("slpjs");
// import classes
var Address_1 = require("./Address");
var addy = new Address_1.default();
Expand Down
4 changes: 2 additions & 2 deletions lib/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
Object.defineProperty(exports, "__esModule", { value: true });
// require deps
var BITBOXSDK = require("bitbox-sdk/lib/bitbox-sdk").default;
var utils = require("slpjs").slpjs.Utils;
var slpjs = require("slpjs").slpjs;
var utils = require("slpjs").Utils;
var slpjs = require("slpjs");
var BigNumber = require("bignumber.js");
var axios_1 = require("axios");
// import classes
Expand Down
52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slp-sdk",
"version": "1.1.6",
"version": "1.1.7",
"description": "SLP SDK powered by BITBOX",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"mkdirp": "^0.5.1",
"node-emoji": "^1.8.1",
"repl.history": "^0.1.4",
"slpjs": "0.11.2",
"slpjs": "0.12.2",
"touch": "^3.1.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/Address.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BITBOXAddress = require("bitbox-sdk/lib/Address").default
const BITBOXSDK = require("bitbox-sdk/lib/bitbox-sdk").default
const BITBOX = new BITBOXSDK()
const utils = require("slpjs").slpjs.Utils
const utils = require("slpjs").Utils

class Address extends BITBOXAddress {
restURL: string
Expand Down
2 changes: 1 addition & 1 deletion src/TokenType1.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// require deps
const BITBOXSDK: any = require("bitbox-sdk/lib/bitbox-sdk").default
const BigNumber: any = require("bignumber.js")
const slpjs: any = require("slpjs").slpjs
const slpjs: any = require("slpjs")

// import interfaces
import { ICreateConfig } from "./interfaces/SLPInterfaces"
Expand Down
4 changes: 2 additions & 2 deletions src/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// require deps
const BITBOXSDK = require("bitbox-sdk/lib/bitbox-sdk").default
const utils = require("slpjs").slpjs.Utils
const slpjs = require("slpjs").slpjs
const utils = require("slpjs").Utils
const slpjs = require("slpjs")
const BigNumber: any = require("bignumber.js")
import axios from "axios"

Expand Down
28 changes: 17 additions & 11 deletions test/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ describe("#Utils", () => {
"timestamp",
"symbol",
"name",
"document"
"documentUri",
"documentHash",
"decimals",
"initialTokenQty"
])
} catch (error) {
throw error
Expand All @@ -30,7 +33,10 @@ describe("#Utils", () => {
"timestamp",
"symbol",
"name",
"document"
"documentUri",
"documentHash",
"decimals",
"initialTokenQty"
])
} catch (error) {
throw error
Expand All @@ -39,36 +45,36 @@ describe("#Utils", () => {
})

describe("#balancesForAddress", () => {
it(`should fetch all balances for address: simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk`, async () => {
it(`should fetch all balances for address: simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9`, async () => {
try {
const balances = await SLP.Utils.balancesForAddress(
"simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk"
"simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9"
)
const data = {
tokenId:
"968ff0cc4c93864001e03e9524e351250b94ec56150fa4897f65b0b6477d44d4",
balance: "8987",
decimalCount: 9
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb",
balance: "1",
decimalCount: 8
}
assert.deepEqual(balances[0], data)
assert.deepEqual(balances[1], data)
} catch (error) {
throw error
}
})
})

describe("#balance", () => {
it(`should fetch balance of single token for address: simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk`, async () => {
it(`should fetch balance of single token for address: simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9`, async () => {
try {
const balance = await SLP.Utils.balance(
"simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk",
"simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9",
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
)

const data = {
tokenId:
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb",
balance: "417",
balance: "1",
decimalCount: 8
}
assert.deepEqual(balance, data)
Expand Down

0 comments on commit 29b7df4

Please sign in to comment.