Skip to content

Commit

Permalink
Create index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 27, 2024
1 parent 94c19fc commit 4aeedad
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pi-nexus-sdk/examples/hello-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import PiNexus from '../lib/pi-nexus';

const piNexus = new PiNexus('https://api.pi-nexus.io', 'YOUR_API_KEY');

async function main() {
try {
const wallets = await piNexus.getWallets();
console.log(wallets);

const wallet = await piNexus.getWallet('0x1234567890abcdef');
console.log(wallet);

const transaction = await piNexus.createTransaction({
from: '0x1234567890abcdef',
to: '0x9876543210fedcba',
amount: 1.0
});
console.log(transaction);

const contract = await piNexus.createContract({
bytecode: '0x1234567890abcdef',
abi: ['function foo() public']
});
console.log(contract);
} catch (err) {
console.error(err);
}
}

main();

0 comments on commit 4aeedad

Please sign in to comment.