ForgeSdk v0.32.2 ForgeSdk.Rpc View Source
The very simple version of the RPC
Link to this section Summary
Functions
Create a transaction
Retrieve Chain information
Retrieve the nonce for an address, usually used for filling the nonce field of a Tx
Subscribe to a specific topic. User must first create their own channel for this
Link to this section Functions
account_migrate(itx, opts) View Source
acquire_asset(itx, opts) View Source
approve_tether(itx, opts) View Source
checkin(opts) View Source
create_asset(itx, opts) View Source
create_asset_factory(moniker, factory, opts) View Source
create_tx(req, name \\ "", opts \\ [])
View Source
create_tx(
ForgeAbi.RequestCreateTx.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.Transaction.t() | {:error, term()}
create_tx( ForgeAbi.RequestCreateTx.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: ForgeAbi.Transaction.t() | {:error, term()}
Create a transaction
iex> {wallet, _token} = ForgeSdk.create_wallet(RequestCreateWallet.new(passphrase: "abcd1234")) {%ForgeAbi.WalletInfo{
address: "f8a5b784376a3ca9119eded5f53edec75a7575975",
pk: <<233, 139, 217, 205, 219, 102, 84, 238, 185, 77, 11, 69, 127, 85, 205,
32, 225, 110, 43, 37, 21, 184, 184, 86, 69, 238, 50, 142, 212, 216, 237,
99>>,
sk: <<111, 149, 26, 101, 189, 95, 253, 194, 136, 143, 44, 231, 32, 88, 165,
120, 163, 50, 11, 199, 150, 29, 162, 241, 219, 176, 172, 135, 137, 20, 16,
222, 233, 139, 217, 205, 219, 102, 84, 238, 185, 77, 11, 69, 127, 85,
...>>,
type: %ForgeAbi.WalletType{address: 0, hash: 0, pk: 0}
}, ""} iex>
create_wallet(req, name \\ "", opts \\ [])
View Source
create_wallet(
ForgeAbi.RequestCreateWallet.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}
create_wallet( ForgeAbi.RequestCreateWallet.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}
declare(itx, opts) View Source
declare_node(req, name \\ "", opts \\ [])
View Source
declare_node(ForgeAbi.RequestDeclareNode.t(), String.t() | atom(), Keyword.t()) ::
ForgeAbi.WalletInfo.t() | {:error, term()}
declare_node(ForgeAbi.RequestDeclareNode.t(), String.t() | atom(), Keyword.t()) :: ForgeAbi.WalletInfo.t() | {:error, term()}
deploy_protocol(itx, opts) View Source
deposit_tether(itx, opts) View Source
exchange_tether(itx, opts) View Source
finalize_consume_asset(tx, asset_address, wallet) View Source
finalize_exchange(tx, wallet) View Source
get_account_state(reqs, name \\ "", opts \\ [])
View Source
get_account_state(
ForgeAbi.RequestGetAccountState.t()
| [ForgeAbi.RequestGetAccountState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) ::
ForgeAbi.AccountState.t()
| nil
| [ForgeAbi.AccountState.t()]
| {:error, term()}
get_account_state( ForgeAbi.RequestGetAccountState.t() | [ForgeAbi.RequestGetAccountState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.AccountState.t() | nil | [ForgeAbi.AccountState.t()] | {:error, term()}
get_address(hash) View Source
get_asset_state(reqs, name \\ "", opts \\ [])
View Source
get_asset_state(
ForgeAbi.RequestGetAssetState.t()
| [ForgeAbi.RequestGetAssetState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.AssetState.t() | [ForgeAbi.AssetState.t()] | {:error, term()}
get_asset_state( ForgeAbi.RequestGetAssetState.t() | [ForgeAbi.RequestGetAssetState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.AssetState.t() | [ForgeAbi.AssetState.t()] | {:error, term()}
get_block(reqs, name \\ "", opts \\ [])
View Source
get_block(
ForgeAbi.RequestGetBlock.t()
| [ForgeAbi.RequestGetBlock.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.BlockInfo.t() | [ForgeAbi.BlockInfo.t()] | {:error, term()}
get_block( ForgeAbi.RequestGetBlock.t() | [ForgeAbi.RequestGetBlock.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.BlockInfo.t() | [ForgeAbi.BlockInfo.t()] | {:error, term()}
get_blocks(req, name \\ "", opts \\ [])
View Source
get_blocks(
ForgeAbi.RequestGetBlocks.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {[ForgeAbi.BlockInfoSimple.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
get_blocks( ForgeAbi.RequestGetBlocks.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.BlockInfoSimple.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
get_chain_info(name \\ "", opts \\ [])
View Source
get_chain_info(String.t() | atom(), Keyword.t()) ::
ForgeAbi.ChainInfo.t() | {:error, term()}
get_chain_info(String.t() | atom(), Keyword.t()) :: ForgeAbi.ChainInfo.t() | {:error, term()}
Retrieve Chain information.
iex> ForgeSdk.get_chain_info() %ForgeAbi.ChainInfo{
address: "DC3ACE418CBD079C564E4D511EE55558B8D67DB3",
app_hash: "1DC64B35F1E539798E722E87270678F7D0B2EA2E046938F0384F4D4D0D73EA56",
block_hash: "155E0733D724AC9814261DEB8E039E1F11048C2635A62F4E84B65D77A94BCCF3",
block_height: 6,
block_time: %Google.Protobuf.Timestamp{nanos: 0, seconds: 1545964437},
id: "335edc03d91161caff9267a107a213cbabb954eb",
moniker: "forge",
network: "1",
synced: true,
version: "0.27.3",
voting_power: 10
}
get_config(req, name \\ "", opts \\ []) View Source
get_forge_state(name \\ "", opts \\ [])
View Source
get_forge_state(String.t() | atom(), Keyword.t()) ::
ForgeAbi.ForgeState.t() | {:error, term()}
get_forge_state(String.t() | atom(), Keyword.t()) :: ForgeAbi.ForgeState.t() | {:error, term()}
get_forge_stats(req, name \\ "", opts \\ [])
View Source
get_forge_stats(
ForgeAbi.RequestGetForgeStats.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.ForgeStats.t() | {:error, term()}
get_forge_stats( ForgeAbi.RequestGetForgeStats.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: ForgeAbi.ForgeStats.t() | {:error, term()}
get_health_status(req, name \\ "", opts \\ []) View Source
get_net_info(name \\ "", opts \\ [])
View Source
get_net_info(String.t() | atom(), Keyword.t()) ::
ForgeAbi.NetInfo.t() | {:error, term()}
get_net_info(String.t() | atom(), Keyword.t()) :: ForgeAbi.NetInfo.t() | {:error, term()}
get_node_info(name \\ "", opts \\ [])
View Source
get_node_info(String.t() | atom(), Keyword.t()) ::
ForgeAbi.NodeInfo.t() | {:error, term()}
get_node_info(String.t() | atom(), Keyword.t()) :: ForgeAbi.NodeInfo.t() | {:error, term()}
get_nonce(address, name \\ "", app_hash \\ "")
View Source
get_nonce(String.t(), String.t() | atom(), String.t()) :: non_neg_integer()
get_nonce(String.t(), String.t() | atom(), String.t()) :: non_neg_integer()
Retrieve the nonce for an address, usually used for filling the nonce field of a Tx.
get_protocol_state(reqs, name \\ "", opts \\ [])
View Source
get_protocol_state(
ForgeAbi.RequestGetProtocolState.t()
| [ForgeAbi.RequestGetProtocolState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) ::
ForgeAbi.ProtocolState.t() | [ForgeAbi.ProtocolState.t()] | {:error, term()}
get_protocol_state( ForgeAbi.RequestGetProtocolState.t() | [ForgeAbi.RequestGetProtocolState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.ProtocolState.t() | [ForgeAbi.ProtocolState.t()] | {:error, term()}
get_stake_state(reqs, name \\ "", opts \\ [])
View Source
get_stake_state(
ForgeAbi.RequestGetStakeState.t()
| [ForgeAbi.RequestGetStakeState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.StakeState.t() | [ForgeAbi.StakeState.t()] | {:error, term()}
get_stake_state( ForgeAbi.RequestGetStakeState.t() | [ForgeAbi.RequestGetStakeState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.StakeState.t() | [ForgeAbi.StakeState.t()] | {:error, term()}
get_swap_state(reqs, name \\ "", opts \\ [])
View Source
get_swap_state(
ForgeAbi.RequestGetSwapState.t()
| [ForgeAbi.RequestGetSwapState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.SwapState.t() | [ForgeAbi.SwapState.t()] | {:error, term()}
get_swap_state( ForgeAbi.RequestGetSwapState.t() | [ForgeAbi.RequestGetSwapState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.SwapState.t() | [ForgeAbi.SwapState.t()] | {:error, term()}
get_tether_state(reqs, name \\ "", opts \\ [])
View Source
get_tether_state(
ForgeAbi.RequestGetTetherState.t()
| [ForgeAbi.RequestGetTetherState.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.TetherState.t() | [ForgeAbi.TetherState.t()] | {:error, term()}
get_tether_state( ForgeAbi.RequestGetTetherState.t() | [ForgeAbi.RequestGetTetherState.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.TetherState.t() | [ForgeAbi.TetherState.t()] | {:error, term()}
get_tx(reqs, name \\ "", opts \\ [])
View Source
get_tx(
ForgeAbi.RequestGetTx.t()
| [ForgeAbi.RequestGetTx.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) ::
ForgeAbi.TransactionInfo.t()
| [ForgeAbi.TransactionInfo.t()]
| {:error, term()}
get_tx( ForgeAbi.RequestGetTx.t() | [ForgeAbi.RequestGetTx.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: ForgeAbi.TransactionInfo.t() | [ForgeAbi.TransactionInfo.t()] | {:error, term()}
get_unconfirmed_txs(req, name \\ "", opts \\ [])
View Source
get_unconfirmed_txs(
ForgeAbi.RequestGetUnconfirmedTxs.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {ForgeAbi.UnconfirmedTxs.t(), ForgeAbi.PageInfo.t()} | {:error, term()}
get_unconfirmed_txs( ForgeAbi.RequestGetUnconfirmedTxs.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {ForgeAbi.UnconfirmedTxs.t(), ForgeAbi.PageInfo.t()} | {:error, term()}
get_validators_info(name \\ "", opts \\ [])
View Source
get_validators_info(String.t() | atom(), Keyword.t()) ::
ForgeAbi.ValidatorsInfo.t() | {:error, term()}
get_validators_info(String.t() | atom(), Keyword.t()) :: ForgeAbi.ValidatorsInfo.t() | {:error, term()}
list_account(req, name \\ "", opts \\ [])
View Source
list_account(
ForgeAbi.RequestListAccount.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.IndexedAccountState.t() | nil | {:error, term()}
list_account( ForgeAbi.RequestListAccount.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: ForgeAbi.IndexedAccountState.t() | nil | {:error, term()}
list_asset_transactions(req, name \\ "", opts \\ [])
View Source
list_asset_transactions(
ForgeAbi.RequestListAssetTransactions.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) ::
{[ForgeAbi.IndexedTransaction.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_asset_transactions( ForgeAbi.RequestListAssetTransactions.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedTransaction.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_assets(req, name \\ "", opts \\ [])
View Source
list_assets(
ForgeAbi.RequestListAssets.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) ::
{[ForgeAbi.IndexedAssetState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_assets( ForgeAbi.RequestListAssets.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedAssetState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_blocks(req, name \\ "", opts \\ [])
View Source
list_blocks(
ForgeAbi.RequestListBlocks.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {[ForgeAbi.IndexedBlock.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_blocks( ForgeAbi.RequestListBlocks.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedBlock.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_stakes(req, name \\ "", opts \\ [])
View Source
list_stakes(
ForgeAbi.RequestListStakes.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) ::
{[ForgeAbi.IndexedStakeState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_stakes( ForgeAbi.RequestListStakes.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedStakeState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_swap(req, name \\ "", opts \\ [])
View Source
list_swap(
ForgeAbi.RequestListSwap.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {[ForgeAbi.SwapState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_swap( ForgeAbi.RequestListSwap.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.SwapState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_tethers(req, name \\ "", opts \\ [])
View Source
list_tethers(
ForgeAbi.RequestListTethers.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: {[ForgeAbi.TetherState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_tethers( ForgeAbi.RequestListTethers.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.TetherState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_top_accounts(req, name \\ "", opts \\ [])
View Source
list_top_accounts(
ForgeAbi.RequestListTopAccounts.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) ::
{[ForgeAbi.IndexedAccountState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_top_accounts( ForgeAbi.RequestListTopAccounts.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedAccountState.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_transactions(req, name \\ "", opts \\ [])
View Source
list_transactions(
ForgeAbi.RequestListTransactions.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) ::
{[ForgeAbi.IndexedTransaction.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_transactions( ForgeAbi.RequestListTransactions.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: {[ForgeAbi.IndexedTransaction.t()], ForgeAbi.PageInfo.t()} | {:error, term()}
list_wallet(name \\ "", opts \\ []) View Source
load_file(req, name \\ "", opts \\ []) View Source
load_wallet(req, name \\ "", opts \\ []) View Source
multisig(req, conn_name \\ "")
View Source
multisig(ForgeAbi.RequestMultisig.t() | Keyword.t(), String.t()) ::
ForgeAbi.Transaction.t() | {:error, term()}
multisig(ForgeAbi.RequestMultisig.t() | Keyword.t(), String.t()) :: ForgeAbi.Transaction.t() | {:error, term()}
multisig_rpc(req, name \\ "", opts \\ [])
View Source
multisig_rpc(
ForgeAbi.RequestMultisig.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: ForgeAbi.Transaction.t() | {:error, term()}
multisig_rpc( ForgeAbi.RequestMultisig.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: ForgeAbi.Transaction.t() | {:error, term()}
pin_file(req, name \\ "", opts \\ []) View Source
poke(itx, opts) View Source
prepare_consume_asset(itx, opts) View Source
prepare_exchange(itx, opts) View Source
recover_wallet(req, name \\ "", opts \\ [])
View Source
recover_wallet(
ForgeAbi.RequestRecoverWallet.t(),
String.t() | atom(),
Keyword.t()
) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}
recover_wallet( ForgeAbi.RequestRecoverWallet.t(), String.t() | atom(), Keyword.t() ) :: {ForgeAbi.WalletInfo.t(), String.t()} | {:error, term()}
remove_wallet(req, name \\ "", opts \\ []) View Source
retrieve_swap(itx, opts) View Source
revoke_swap(itx, opts) View Source
revoke_tether(itx, opts) View Source
search(req, name \\ "", opts \\ [])
View Source
search(
ForgeAbi.RequestSearch.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: [ForgeAbi.Transaction.t()] | {:error, term()}
search( ForgeAbi.RequestSearch.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: [ForgeAbi.Transaction.t()] | {:error, term()}
send_tx(req, name \\ "", opts \\ []) View Source
setup_swap(itx, opts) View Source
stake(itx, opts) View Source
stake_for_node(address, value, opts) View Source
store_file(reqs, name \\ "", opts \\ [])
View Source
store_file(
Enumerable.t()
| ForgeAbi.RequestStoreFile.t()
| [ForgeAbi.RequestStoreFile.t()]
| Keyword.t()
| [Keyword.t()],
String.t() | atom(),
Keyword.t()
) :: String.t() | {:error, term()}
store_file( Enumerable.t() | ForgeAbi.RequestStoreFile.t() | [ForgeAbi.RequestStoreFile.t()] | Keyword.t() | [Keyword.t()], String.t() | atom(), Keyword.t() ) :: String.t() | {:error, term()}
subscribe(req, name \\ "", opts \\ [])
View Source
subscribe(
ForgeAbi.RequestSubscribe.t() | Keyword.t(),
String.t() | atom(),
Keyword.t()
) :: [ForgeAbi.ResponseSubscribe.t()] | {:error, term()}
subscribe( ForgeAbi.RequestSubscribe.t() | Keyword.t(), String.t() | atom(), Keyword.t() ) :: [ForgeAbi.ResponseSubscribe.t()] | {:error, term()}
Subscribe to a specific topic. User must first create their own channel for this.
iex> conn = ForgeSdk.get_conn() iex> req = RequestSubscribe.new() iex> stream = ForgeSdk.subscribe(req, conn) iex> Enum.take(stream, 1) # this will return the topic id of the subscription
transfer(itx, opts) View Source
unsubscribe(req, name \\ "", opts \\ [])
View Source
unsubscribe(ForgeAbi.RequestUnsubscribe.t(), String.t() | atom(), Keyword.t()) ::
ForgeAbi.ResponseUnsubscribe.t() | {:error, term()}
unsubscribe(ForgeAbi.RequestUnsubscribe.t(), String.t() | atom(), Keyword.t()) :: ForgeAbi.ResponseUnsubscribe.t() | {:error, term()}