Skip to content

Commit

Permalink
Add submitRawTx
Browse files Browse the repository at this point in the history
  • Loading branch information
gitzhou committed Dec 7, 2023
1 parent 7eb320a commit cf102e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/1satApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,15 @@ export class OneSatApis {
return
})
}

static async submitRawTx(txHex: string): Promise<void> {
try {
const url = `${this.apiBase}/tx`
await superagent
.post(url)
.send({ rawtx: Buffer.from(txHex, 'hex').toString('base64') })
} catch {
// do nothing
}
}
}
1 change: 1 addition & 0 deletions src/ordiProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class OrdiProvider extends Provider {
try {
const txid = await this._provider.sendRawTransaction(rawTxHex)

await OneSatApis.submitRawTx(rawTxHex)
await OneSatApis.submitTx(txid)

return txid
Expand Down

0 comments on commit cf102e0

Please sign in to comment.