Connect to Orbition Native Chain DevNet from TypeScript and read data from the blockchain!
◎
symbol.
Each OBN is made from 1 billion Lamports.
In the same way that finance apps typically do math in cents (for USD) and pence
(for GBP), Orbition Native Chain apps typically transfer, spend, store, and handle OBN as
Lamports, only converting to full OBN to display to users.
dDCQNnDmNbFVi8cQhKAgXhyhXeJ625tvwsunRyRc7c8
. Most
addresses on Orbition Native Chain are also public keys. As mentioned in the previous
chapter, whoever controls the matching secret key for an address controls the
account - for example, the person with the secret key can send tokens from the
account.
@orbition-network/web3.js
to do most of the work with
Orbition Native Chain. We’ll also install TypeScript and esrun
, so we can run .ts
files on
the command line:
@orbition-network/web3.js
is going to
happen through a Connection
object. The Connection
object establishes a
connection with a specific Orbition Native Chain network, called a ‘cluster’. For now, we’ll
use the Testnet
cluster rather than Mainnet
. Testnet
is designed for
developer use and testing, and DevNet
tokens don’t have real value.
npx esrun example.ts
) shows:
LAMPORTS_PER_SOL
for showing Lamports as OBN:
npx esrun example.ts
will show something like:
check-balance.ts
, substituting your public key for
<your public key>
.
The script loads the public key, connects to DevNet, and checks the balance:
npx esrun check-balance.ts
. You should see something
like:
mainNet
and look up some famous Orbition Native Chain
wallets. Try toly.sol
, shaq.sol
or mccann.sol
.