Skip to content

πŸ”— NULS Bridge is Browser extension plugin. This extension is for NULS enabled distributed application or Dapps in your browser!

License

Notifications You must be signed in to change notification settings

rohanashik/nulsbridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NULS logo

Welcome to NULS Bridge Browser Plugin πŸ‘‹

Version Documentation Maintenance License: MIT Twitter: NULS

NULS Bridge is Browser extension that supports NULS Blockchain and this extension is for NULS enabled distributed application or Dapps in your browser! The Extension injects NULS API into every website's javascript context, so that dapps can read from the blockchain.

Features

  • Account Management
  • Wallet Docking with Web DApp Applications
  • Main & Test Network Wallets

NULS Bridge

Installation

To Check if Bridge is Installed

if (typeof window.bridge !== 'undefined') {
    console.log('Bridge is installed!');
}

Invoke Bridge Permission

await bridge.enable();

To Check is Bridge connected

await bridge.isConnected();
// Output = true or false

Get Connected Wallet Address

var wallet = await bridge.getDefaultWallet();
console.log("Default Address ---> "+ wallet.address);
console.log("Default Chain ---> "+ wallet.chain_id);

Switch Wallet Address

await bridge.switchAccount();

To Get Wallet Balance

await bridge.getBalance(address="tNULSeBaMhmHrnX4XJHbZxR4ypRun52s1uYnJB", chainid=2, assetChainId=2);

To Get Wallet Token Balance

await bridge.getTokenBalance(address="tNULSeBaMhmHrnX4XJHbZxR4ypRun52s1uYnJB", chainid=2, "tNULSeBaNBWvMJc6RxtwabsDux3mgPjEKtb3Lm");

Write Contract Data into Blockchain

let wallet = await bridge.getDefaultWallet();
var inputs = {
    "contractAddress": "tNULSeBaN2TLFuecRgASzC7KdbfjhbGD9MthHQ",
    "methodName": "issue",
    "args": ["WERTYUI123456"],
    "value":0,
    "sender": wallet.address,
    "chainid": wallet.chain_id
};

txHash = await bridge.contractWrite(inputs);
// Output Tansaction Hash

To Call Contract function from Blockchain

var callargs = {
    "contractAddress": "tNULSeBaN2TLFuecRgASzC7KdbfjhbGD9MthHQ",
    "methodName": "isIssued",
    "args": ["WERTYUI123456"],
    "chainid": 2
};

output = await bridge.contractCall(callargs);
// Output Contract function return value

To Deauthenticate NULS Bridge with your Site

output = await bridge.disable();
// Removes Authentication to NULS Bridge

πŸ‘€ Author

Rohan Ashik

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

πŸ‘ Show your support

Give a ⭐ if this project helped you!

NULS Wallet Address: NULSd6HgTwme2QGaSuJM75XpzfHm5ju33ZCuc

πŸ“ License

Copyright Β© 2020 Rohan Ashik.
This project is MIT licensed.

About

πŸ”— NULS Bridge is Browser extension plugin. This extension is for NULS enabled distributed application or Dapps in your browser!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages