Skip to content

Commit

Permalink
Use REST's local validator via slpjs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Cardona committed May 3, 2019
1 parent d93f1cf commit cc210e9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 46 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const repl = require("repl")
const SLP = require("./lib/SLP")
const clone = require("git-clone")

program.version("3.5.0", "-v, --version")
program.version("3.6.0", "-v, --version")

program
.command("new <name>")
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slp-sdk",
"version": "3.5.0",
"version": "3.6.0",
"description": "SLP SDK powered by BITBOX",
"main": "lib/SLP",
"scripts": {
Expand Down
47 changes: 4 additions & 43 deletions src/TokenType1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,7 @@ class TokenType1 {
const tmpBITBOX: any = this.returnBITBOXInstance(
createConfig.fundingAddress
)

const getRawTransactions = async (txids: any) =>
await tmpBITBOX.RawTransactions.getRawTransaction(txids)

const slpValidator: any = new slpjs.LocalValidator(
tmpBITBOX,
getRawTransactions
)
const bitboxNetwork: any = new slpjs.BitboxNetwork(
tmpBITBOX,
slpValidator
)
const bitboxNetwork: any = new slpjs.BitboxNetwork(tmpBITBOX)
const fundingAddress: string = addy.toSLPAddress(
createConfig.fundingAddress
)
Expand Down Expand Up @@ -104,18 +93,7 @@ class TokenType1 {
const tmpBITBOX: any = this.returnBITBOXInstance(
mintConfig.fundingAddress
)

const getRawTransactions = async (txids: any) =>
await tmpBITBOX.RawTransactions.getRawTransaction(txids)

const slpValidator: any = new slpjs.LocalValidator(
tmpBITBOX,
getRawTransactions
)
const bitboxNetwork: any = new slpjs.BitboxNetwork(
tmpBITBOX,
slpValidator
)
const bitboxNetwork: any = new slpjs.BitboxNetwork(tmpBITBOX)
const fundingAddress: string = addy.toSLPAddress(
mintConfig.fundingAddress
)
Expand Down Expand Up @@ -178,14 +156,7 @@ class TokenType1 {
sendConfig.fundingAddress
)

const getRawTransactions = async (txids: any) =>
await tmpBITBOX.RawTransactions.getRawTransaction(txids)

const slpValidator: any = new slpjs.LocalValidator(
tmpBITBOX,
getRawTransactions
)
const bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX, slpValidator)
const bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX)

const fundingAddress: string = addy.toSLPAddress(
sendConfig.fundingAddress
Expand Down Expand Up @@ -224,8 +195,6 @@ class TokenType1 {

// 6) Set the proper private key for each Utxo
inputUtxos.forEach((txo: any) => (txo.wif = fundingWif))
console.log("AMOUNT", amount.length)
console.log("tokenReceiverAddress", tokenReceiverAddress.length)

const sendTxid = await bitboxNetwork.simpleTokenSend(
tokenId,
Expand All @@ -248,15 +217,7 @@ class TokenType1 {
const tmpBITBOX: any = this.returnBITBOXInstance(
burnConfig.fundingAddress
)

const getRawTransactions = async (txids: any) =>
await tmpBITBOX.RawTransactions.getRawTransaction(txids)

const slpValidator: any = new slpjs.LocalValidator(
tmpBITBOX,
getRawTransactions
)
const bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX, slpValidator)
const bitboxNetwork = new slpjs.BitboxNetwork(tmpBITBOX)
const fundingAddress: string = addy.toSLPAddress(
burnConfig.fundingAddress
)
Expand Down

0 comments on commit cc210e9

Please sign in to comment.