RPCProvider
scrypt-ts-opcat / RPCProvider
Class: RPCProvider
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:12
The RPCProvider is backed by opcat RPC
Implements
Constructors
new RPCProvider()
new RPCProvider(
network
,url
,walletName
,username
,password
):RPCProvider
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:18
Parameters
network
url
string
walletName
string
username
string
password
string
Returns
Properties
network
readonly
network:SupportedNetwork
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:19
password
readonly
password:string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:23
url
readonly
url:string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:20
username
readonly
username:string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:22
walletName
readonly
walletName:string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:21
Methods
addNewUTXO()
addNewUTXO(
utxo
):void
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:300
Add a UTXO to the provider
Parameters
utxo
Returns
void
Implementation of
broadcast()
broadcast(
txHex
):Promise
\<string
>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:176
Send a raw transaction hex string.
Parameters
txHex
string
Returns
Promise
\<string
>
A promise which resolves to the hash of the transaction that has been sent.
Implementation of
getConfirmations()
getConfirmations(
txId
):Promise
\<number
>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:81
Query a transaction confirmation
Parameters
txId
string
Returns
Promise
\<number
>
Implementation of
ChainProvider
.getConfirmations
getFeeRate()
getFeeRate():
Promise
\<number
>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:30
Query current network fee
Returns
Promise
\<number
>
Implementation of
getNetwork()
getNetwork():
Promise
\<SupportedNetwork
>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:26
Get the current network the provider is connected to.
Returns
Promise
\<SupportedNetwork
>
A promise which resolves to the current network identifier.
Implementation of
getRawTransaction()
getRawTransaction(
txId
):Promise
\<string
>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:185
Get a transaction raw hex from the network.
Parameters
txId
string
Returns
Promise
\<string
>
The query result with the transaction raw hex.
Implementation of
ChainProvider
.getRawTransaction
getRpcPassword()
protected
getRpcPassword():string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:74
Returns
string
getRpcUrl()
protected
getRpcUrl(walletName
):string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:77
Parameters
walletName
string
Returns
string
getRpcUser()
protected
getRpcUser():string
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:71
Returns
string
getUtxos()
getUtxos(
address
,_options
?):Promise
\<UTXO
[]>
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:235
Get a list of the UTXOs.
Parameters
address
string
The address of the returned UTXOs belongs to.
_options?
Returns
Promise
\<UTXO
[]>
A promise which resolves to a list of UTXO for the query options.
Implementation of
markSpent()
markSpent(
txId
,vout
):void
Defined in: packages/scrypt-ts-opcat/src/providers/rpcProvider.ts:293
Mark an outpoint as spent
Parameters
txId
string
vout
number
Returns
void