dAPI Integration
General integration methods and functionalities
Primary Functionality
OntCversion = '2.0.0'
from ontology.interop.Ontology.Native import Invoke
from ontology.builtins import state
from ontology.interop.System.Runtime import Notify
from ontology.interop.System.ExecutionEngine import GetExecutingScriptHash
from ontology.interop.Ontology.Runtime import Base58ToAddress,AddressToBase58
# ONG Big endian Script Hash: 0x0200000000000000000000000000000000000000
OngContract = Base58ToAddress("AFmseVrdL9f9oyCzZefL9tG6UbvhfRZMHJ")
def Main(operation, args):
if operation == "transferOng":
if len(args) != 3:
return False
return transferOng(args[0], args[1], args[2])
return False
def transferOng(from_base58, to_base58, ong_amount):
from_acct = Base58ToAddress(from_base58)
to_acct = Base58ToAddress(to_base58)
param = state(from_acct, to_acct, ong_amount)
res = Invoke(0, OngContract, "transfer", [param])
if res and res == b'\x01':
Notify([True,from_base58, to_base58, ong_amount])
return True
else:
Notify([False,from_base58, to_base58, ong_amount])
return FalseIntegration Options
dAPI Compatibility
Wallet Demonstration
1. Open a dApp in the wallet

2. Fetch Account or Identity Information


3. Login into the dApp

4. dApp Contract Deployment

Last updated