From 4aeedad91c79d9272006673f7c8cc3a0d55b3aae Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Tue, 27 Aug 2024 18:44:24 +0700 Subject: [PATCH] Create index.js --- pi-nexus-sdk/examples/hello-world/index.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pi-nexus-sdk/examples/hello-world/index.js diff --git a/pi-nexus-sdk/examples/hello-world/index.js b/pi-nexus-sdk/examples/hello-world/index.js new file mode 100644 index 000000000..323a3f1ea --- /dev/null +++ b/pi-nexus-sdk/examples/hello-world/index.js @@ -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();