Workflow updating files of btcwallet

This commit is contained in:
RanchiMall Dev 2024-01-05 15:03:35 +00:00
parent 8d7f3a454b
commit a5e40ed0c8
2 changed files with 24 additions and 24 deletions

View File

@ -1,4 +1,4 @@
(function (EXPORTS) { //btcOperator v1.2.7 (function (EXPORTS) { //btcOperator v1.2.8
/* BTC Crypto and API Operator */ /* BTC Crypto and API Operator */
const btcOperator = EXPORTS; const btcOperator = EXPORTS;
const SATOSHI_IN_BTC = 1e8; const SATOSHI_IN_BTC = 1e8;
@ -22,7 +22,7 @@
try { try {
const response = await fetch(url, { const response = await fetch(url, {
method: 'POST', method: 'POST',
cors: 'no-cors', mode: 'no-cors',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@ -57,7 +57,7 @@
}, },
async broadcast({ rawTxHex, url }) { async broadcast({ rawTxHex, url }) {
try { try {
const result = await post(`${url || this.url}txs/push`, { tx: rawTxHex }) const result = await post(`${url || this.url}pushtx`, { tx: rawTxHex })
return result.hash return result.hash
} catch (e) { } catch (e) {
throw e throw e
@ -79,16 +79,16 @@
latestBlock() { latestBlock() {
return fetch_api(`blocks/tip/height`, { url: this.url }) return fetch_api(`blocks/tip/height`, { url: this.url })
}, },
// tx({ txid, url }) { tx({ txid, url }) {
// return fetch_api(`tx/${txid}`, { url: url || this.url }) return fetch_api(`tx/${txid}`, { url: url || this.url })
// .then(result => formatTx(result)) .then(result => formatTx(result))
// }, },
// txHex({ txid, url }) { txHex({ txid, url }) {
// return fetch_api(`tx/${txid}/hex`, { url: url || this.url, asText: true }) return fetch_api(`tx/${txid}/hex`, { url: url || this.url, asText: true })
// }, },
// txs({ addr, before, after, url }) { txs({ addr, before, after, url }) {
// return fetch_api(`address/${addr}/txs${before ? `?before=${before}` : ''}${after ? `?after=${after}` : ''}`, { url: url || this.url }) return fetch_api(`address/${addr}/txs${before ? `?before=${before}` : ''}${after ? `?after=${after}` : ''}`, { url: url || this.url })
// }, },
async block({ id, url }) { async block({ id, url }) {
// if id is hex string then it is block hash // if id is hex string then it is block hash
try { try {
@ -115,17 +115,17 @@
latestBlock() { latestBlock() {
return fetch_api(`blocks/tip/height`, { url: this.url }) return fetch_api(`blocks/tip/height`, { url: this.url })
}, },
// tx({ txid }) { tx({ txid }) {
// return fetch_api(`tx/${txid}`, { url: this.url }) return fetch_api(`tx/${txid}`, { url: this.url })
// .then(result => formatTx(result)) .then(result => formatTx(result))
// }, },
// txHex({ txid }) { txHex({ txid }) {
// return fetch_api(`tx/${txid}/hex`, { url: this.url, asText: true }) return fetch_api(`tx/${txid}/hex`, { url: this.url, asText: true })
// }, },
// txs({ addr, before, after }) { txs({ addr, before, after }) {
// return fetch_api(`address/${addr}/txs${before ? `?before=${before}` : ''}${after ? `?after=${after}` : ''}`, { url: this.url }) return fetch_api(`address/${addr}/txs${before ? `?before=${before}` : ''}${after ? `?after=${after}` : ''}`, { url: this.url })
// }, },
async block({ id }) { async block({ id }) {
// if id is hex string then it is block hash // if id is hex string then it is block hash
try { try {

File diff suppressed because one or more lines are too long