2020-02-17 12:01:57 +00:00
|
|
|
/*
|
2022-07-21 19:39:53 +00:00
|
|
|
Package rpcclient implements NEO-specific JSON-RPC 2.0 client.
|
2020-02-17 12:01:57 +00:00
|
|
|
|
2022-09-07 19:38:45 +00:00
|
|
|
This package itself is designed to be a thin layer on top of the regular JSON-RPC
|
|
|
|
interface provided by Neo implementations. Therefore the set of methods provided
|
|
|
|
by clients is exactly the same as available from servers and they use data types
|
|
|
|
that directly correspond to JSON data exchanged. While this is the most powerful
|
|
|
|
and direct interface, it at the same time is not very convenient for many
|
|
|
|
purposes, like the most popular one --- performing test invocations and
|
|
|
|
creating/sending transactions that will do something to the chain. Please check
|
|
|
|
subpackages for more convenient APIs.
|
2020-02-17 12:01:57 +00:00
|
|
|
|
2022-09-07 19:38:45 +00:00
|
|
|
# Subpackages
|
|
|
|
|
|
|
|
The overall structure can be seen as a number of layers built on top of rpcclient
|
|
|
|
and on top of each other with each package and each layer solving different
|
|
|
|
problems.
|
|
|
|
|
|
|
|
These layers are:
|
|
|
|
|
|
|
|
- Basic RPC API, rpcclient package itself.
|
|
|
|
|
|
|
|
- Generic invocation/transaction API represented by invoker, unwrap (auxiliary,
|
|
|
|
but very convenient) and actor packages. These allow to perform test
|
|
|
|
invocations with plain Go types, use historic states for these invocations,
|
|
|
|
get the execution results from reader functions and create/send transactions
|
|
|
|
that change something on-chain.
|
2020-02-17 12:01:57 +00:00
|
|
|
|
2022-09-07 19:38:45 +00:00
|
|
|
- Standard-specific wrappers that are implemented in nep11 and nep17 packages
|
|
|
|
(with common methods in neptoken). They implement the respective NEP-11 and
|
|
|
|
NEP-17 APIs both for safe (read-only) and state-changing methods. Safe methods
|
|
|
|
require an Invoker to be called, while Actor is used to create/send
|
|
|
|
transactions.
|
2020-02-17 12:01:57 +00:00
|
|
|
|
2022-09-07 19:38:45 +00:00
|
|
|
- Contract-specific wrappers for native contracts that include management, gas,
|
|
|
|
neo, oracle, policy and rolemgmt packages for the respective native contracts.
|
|
|
|
Complete contract functionality is exposed (reusing nep17 package for gas and
|
|
|
|
neo).
|
2022-08-08 10:23:21 +00:00
|
|
|
|
2022-09-07 19:38:45 +00:00
|
|
|
- Notary actor and contract, a bit special since it's a NeoGo protocol
|
|
|
|
extension, but notary package provides both the notary native contract wrapper
|
|
|
|
and a notary-specific actor implementation that allows to easily wrap any
|
|
|
|
transaction into a notary request.
|
|
|
|
|
|
|
|
- Non-native contract-specific wrappers, currently partially provided only for
|
|
|
|
NNS contract (it's still in development), at the moment that's mostly an
|
|
|
|
example of how contract-specific wrappers can be built for other dApps
|
|
|
|
(reusing invoker/actor layers it's pretty easy).
|
|
|
|
|
|
|
|
# Client
|
|
|
|
|
|
|
|
After creating a client instance with or without a ClientConfig
|
|
|
|
you can interact with the NEO blockchain by its exposed methods.
|
2020-02-17 12:01:57 +00:00
|
|
|
|
|
|
|
Supported methods
|
|
|
|
|
2021-09-08 10:02:14 +00:00
|
|
|
calculatenetworkfee
|
2022-01-17 09:00:56 +00:00
|
|
|
findstates
|
2020-03-11 14:14:05 +00:00
|
|
|
getapplicationlog
|
|
|
|
getbestblockhash
|
2020-03-03 17:26:56 +00:00
|
|
|
getblock
|
2020-03-11 14:14:05 +00:00
|
|
|
getblockcount
|
|
|
|
getblockhash
|
|
|
|
getblockheader
|
2021-09-08 10:02:14 +00:00
|
|
|
getblockheadercount
|
|
|
|
getcommittee
|
2020-03-11 14:14:05 +00:00
|
|
|
getconnectioncount
|
|
|
|
getcontractstate
|
2021-09-08 10:02:14 +00:00
|
|
|
getnativecontracts
|
2021-11-17 21:08:10 +00:00
|
|
|
getnep11balances
|
|
|
|
getnep11properties
|
|
|
|
getnep11transfers
|
2020-11-24 08:14:25 +00:00
|
|
|
getnep17balances
|
|
|
|
getnep17transfers
|
2020-03-11 14:14:05 +00:00
|
|
|
getpeers
|
|
|
|
getrawmempool
|
2020-03-03 17:43:57 +00:00
|
|
|
getrawtransaction
|
2022-01-17 09:00:56 +00:00
|
|
|
getstate
|
2021-09-08 10:02:14 +00:00
|
|
|
getstateheight
|
2022-01-17 08:59:13 +00:00
|
|
|
getstateroot
|
2020-03-11 14:14:05 +00:00
|
|
|
getstorage
|
|
|
|
gettransactionheight
|
2020-06-01 20:27:03 +00:00
|
|
|
getunclaimedgas
|
2021-09-08 10:02:14 +00:00
|
|
|
getnextblockvalidators
|
2020-03-11 14:14:05 +00:00
|
|
|
getversion
|
2020-02-17 12:01:57 +00:00
|
|
|
invokefunction
|
2020-03-03 15:59:21 +00:00
|
|
|
invokescript
|
2021-09-08 10:02:14 +00:00
|
|
|
invokecontractverify
|
2020-02-17 12:01:57 +00:00
|
|
|
sendrawtransaction
|
2020-03-11 14:14:05 +00:00
|
|
|
submitblock
|
2021-09-08 10:02:14 +00:00
|
|
|
submitoracleresponse
|
2022-06-15 18:23:29 +00:00
|
|
|
terminatesession
|
|
|
|
traverseiterator
|
2020-03-11 14:14:05 +00:00
|
|
|
validateaddress
|
2020-02-17 12:01:57 +00:00
|
|
|
|
2021-09-08 10:02:14 +00:00
|
|
|
Extensions:
|
|
|
|
|
|
|
|
getblocksysfee
|
2023-08-27 18:49:46 +00:00
|
|
|
getrawnotarypool
|
|
|
|
getrawnotarytransaction
|
2021-09-08 10:02:14 +00:00
|
|
|
submitnotaryrequest
|
|
|
|
|
2020-02-17 12:01:57 +00:00
|
|
|
Unsupported methods
|
|
|
|
|
2023-11-21 13:10:53 +00:00
|
|
|
canceltransaction
|
2020-03-03 15:59:21 +00:00
|
|
|
claimgas
|
|
|
|
dumpprivkey
|
|
|
|
getbalance
|
|
|
|
getmetricblocktimestamp
|
|
|
|
getnewaddress
|
|
|
|
getwalletheight
|
|
|
|
importprivkey
|
|
|
|
listaddress
|
|
|
|
listplugins
|
|
|
|
sendfrom
|
|
|
|
sendmany
|
|
|
|
sendtoaddress
|
2020-02-17 12:01:57 +00:00
|
|
|
*/
|
2022-07-21 19:39:53 +00:00
|
|
|
package rpcclient
|