From 7e08097e9abccf4a57673209751b2cd2fc25b746 Mon Sep 17 00:00:00 2001 From: Atticus Date: Fri, 15 Mar 2024 18:03:06 -0600 Subject: [PATCH 01/31] feat(signer): add arweave signer to ario class --- examples/node/index.cjs | 6 +- examples/node/index.mjs | 7 +- examples/web/index.html | 6 +- package.json | 5 +- src/common/ar-io.ts | 47 ++- src/utils/arweave.ts | 15 + tests/ar-io.test.ts | 23 +- yarn.lock | 619 +++++++++++++++++++++++++++++++++++++++- 8 files changed, 696 insertions(+), 32 deletions(-) diff --git a/examples/node/index.cjs b/examples/node/index.cjs index 37177838..d9b2a298 100644 --- a/examples/node/index.cjs +++ b/examples/node/index.cjs @@ -1,10 +1,14 @@ +const Arweave = require('arweave'); const { ArIO, ARNS_TESTNET_REGISTRY_TX, } = require('../../lib/cjs/node/index.js'); +const { ArweaveSigner } = require('arbundles'); (async () => { - const arIO = new ArIO(); + const jwk = await Arweave.init({}).wallets.generate(); + const signer = new ArweaveSigner(jwk); + const arIO = new ArIO({ signer }); // testnet gateways const testnetGateways = await arIO.getGateways(); const protocolBalance = await arIO.getBalance({ diff --git a/examples/node/index.mjs b/examples/node/index.mjs index 49505151..9082191a 100644 --- a/examples/node/index.mjs +++ b/examples/node/index.mjs @@ -1,7 +1,12 @@ +import { ArweaveSigner } from 'arbundles'; +import Arweave from 'arweave'; + import { ARNS_TESTNET_REGISTRY_TX, ArIO } from '../../lib/esm/node/index.js'; (async () => { - const arIO = new ArIO(); + const jwk = await Arweave.init({}).wallets.generate(); + const signer = new ArweaveSigner(jwk); + const arIO = new ArIO({ signer }); // testnet gateways const testnetGateways = await arIO.getGateways(); const protocolBalance = await arIO.getBalance({ diff --git a/examples/web/index.html b/examples/web/index.html index da0c71b6..37e23fb6 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -131,10 +131,12 @@

View Distribution Data