├── .changeset ├── README.md └── config.json ├── .eslintrc.js ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── README.md ├── assets └── irys-sdk.png ├── cjs.tsconfig.json ├── esm.tsconfig.json ├── examples ├── node │ ├── .gitignore │ ├── package.json │ ├── scripts │ │ ├── test-upload.ts │ │ └── tokens │ │ │ ├── aptos.ts │ │ │ ├── arbitrum.ts │ │ │ ├── avalanche.ts │ │ │ ├── base-ethereum.ts │ │ │ ├── bera.ts │ │ │ ├── bnb.ts │ │ │ ├── chainlink.ts │ │ │ ├── eclipse-ethereum.ts │ │ │ ├── ethereum.ts │ │ │ ├── iotex.ts │ │ │ ├── linea-ethereum.ts │ │ │ ├── polygon.ts │ │ │ ├── scroll-ethereum.ts │ │ │ ├── solana.ts │ │ │ ├── usdcEth.ts │ │ │ └── usdcPolygon.ts │ └── tsconfig.json └── providers │ ├── ethers5 │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── components │ │ │ ├── ConnectIrys.tsx │ │ │ ├── ConnectWallet.tsx │ │ │ └── UploadText.tsx │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── next.config.mjs │ ├── package.json │ ├── postcss.config.mjs │ ├── tailwind.config.ts │ └── tsconfig.json │ ├── ethers6 │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── components │ │ │ ├── ConnectIrys.tsx │ │ │ ├── ConnectWallet.tsx │ │ │ └── UploadText.tsx │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── next.config.mjs │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── tailwind.config.ts │ └── tsconfig.json │ └── viemv2 │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── app │ ├── components │ │ ├── ConnectIrys.tsx │ │ ├── ConnectWallet.tsx │ │ └── UploadText.tsx │ ├── globals.css │ ├── layout.tsx │ └── page.tsx │ ├── next.config.mjs │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ ├── next.svg │ └── vercel.svg │ ├── tailwind.config.ts │ └── tsconfig.json ├── package.json ├── packages ├── aptos-node │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── irys.ts │ │ └── token.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── aptos-web │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── irys.ts │ │ └── token.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── cli │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ └── token.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── ethereum-ethers-v6 │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── adapter.ts │ │ ├── index.ts │ │ └── irys.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── ethereum-viem-v2 │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── adapter.ts │ │ ├── index.ts │ │ └── irys.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── ethereum-web │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── clients.ts │ │ ├── erc20.ts │ │ ├── ethereum.ts │ │ ├── index.ts │ │ └── irys.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── ethereum │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── clients.ts │ │ ├── erc20.ts │ │ ├── ethereum.ts │ │ ├── index.ts │ │ └── irys.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── readme.md ├── solana-node │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── solana.ts │ │ ├── spl.ts │ │ └── token.ts │ ├── test │ │ ├── exports.test.ts │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ └── tsconfig.json │ └── tsconfig.json ├── solana-web │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── solana.ts │ │ ├── spl.ts │ │ └── token.ts │ ├── test │ │ ├── exports.test.ts │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ └── tsconfig.json │ ├── tsconfig-webpack.json │ └── tsconfig.json ├── starknet-node │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── client.ts │ │ ├── erc20.abi.ts │ │ ├── index.ts │ │ ├── irys.ts │ │ ├── token.ts │ │ └── walletConfig.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── upload-core │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── api.ts │ │ ├── approval.ts │ │ ├── builder.ts │ │ ├── chunkingUploader.ts │ │ ├── fund.ts │ │ ├── hack.ts │ │ ├── index.ts │ │ ├── irys.ts │ │ ├── s2ai.ts │ │ ├── transaction.ts │ │ ├── transactions.ts │ │ ├── types.ts │ │ ├── upload.ts │ │ ├── utils.ts │ │ └── withdrawal.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json ├── upload-node │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ │ ├── base.ts │ │ ├── builder.ts │ │ ├── index.ts │ │ ├── tokens │ │ │ └── base.ts │ │ ├── types.ts │ │ ├── upload.ts │ │ └── utils.ts │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts │ │ └── tsconfig.json │ └── tsconfig.json └── upload-web │ ├── CHANGELOG.md │ ├── README.md │ ├── cjs.tsconfig.json │ ├── package.json │ ├── src │ ├── base.ts │ ├── builder.ts │ ├── index.ts │ ├── tokens │ │ └── base.ts │ ├── types.ts │ ├── upload.ts │ └── utils.ts │ ├── test │ ├── modules │ │ ├── cjs.test.cjs │ │ └── esm.test.mjs │ ├── someFeature.test.ts │ └── tsconfig.json │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── readme.md ├── scripts ├── fix-pkg.sh ├── generate-new-package.mjs ├── get-latest-version.sh ├── new-package-template │ ├── README.md │ ├── cjs.tsconfig.json.stub │ ├── package.json.stub │ ├── src │ │ ├── index.ts.stub │ │ └── token.ts.stub │ ├── test │ │ ├── modules │ │ │ ├── cjs.test.cjs │ │ │ └── esm.test.mjs │ │ ├── someFeature.test.ts.stub │ │ └── tsconfig.json.stub │ └── tsconfig.json.stub └── webpack │ ├── package.json │ └── webpack.config.js ├── tsconfig.json └── turbo.json /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { 6 | "repo": "irys-xyz/js-sdk" 7 | } 8 | ], 9 | "commit": false, 10 | "fixed": [], 11 | "linked": [], 12 | "access": "public", 13 | "baseBranch": "master", 14 | "updateInternalDependencies": "patch", 15 | "ignore": [] 16 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | typedoc 15 | 16 | # Editor directories and files 17 | .vscode/* 18 | !.vscode/extensions.json 19 | .idea 20 | .DS_Store 21 | *.suo 22 | *.ntvs* 23 | *.njsproj 24 | *.sln 25 | *.sw? 26 | 27 | # Bundle stats file 28 | stats.html 29 | .vercel 30 | .turbo 31 | 32 | examples/node/test 33 | .devcontainer/devcontainer.json -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | node-linker=hoisted -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/.git 2 | **/.github 3 | **/node_modules 4 | **/dist 5 | **/configs 6 | **/docs 7 | 8 | .prettierrc 9 | package.json 10 | tsconfig.cjs.json 11 | tsconfig.json 12 | README.md 13 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "trailingComma": "es5", 5 | "useTabs": false, 6 | "tabWidth": 2, 7 | "arrowParens": "always", 8 | "printWidth": 80 9 | } 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Irys JS SDK 3 | 4 | ![](/assets/irys-sdk.png) 5 | 6 | ## What is Irys? 7 | 8 | 9 | [Irys](https://irys.xyz/) is the world's first L1 programmable datachain. On Irys, you can upload onchain data, deploy smart contracts, and those smart contracts can access and perform verifiable computations on onchain data. 10 | 11 | This Irys JS SDK is for uploading onchain data. 12 | 13 | ## Docs 14 | https://docs.irys.xyz 15 | 16 | ## Migrating 17 | 18 | Migrating from our old SDK? We've got a handy guide for you. 19 | 20 | https://migrate-to.irys.xyz 21 | 22 | ## Repos 23 | 24 | The Irys JS SDK reduces dependency bloat by providing dedicated packages for each [supported token](https://docs.irys.xyz/build/d/features/supported-tokens). 25 | 26 | Install only the specific packages you require. 27 | 28 | ### CLI 29 | 30 | - [cli](/packages/cli/README.md): The Irys storage CLI. 31 | 32 | ### EVM Chains 33 | 34 | - [ethereum](/packages/ethereum/README.md): Use with NodeJS, contains token-specific packages for all supported EVM tokens. 35 | - [ethereum-web](/packages/ethereum-web/README.md): Use in the browser, contains token-specific packages for all supported EVM tokens. 36 | - [ethereum-ethers-v5](/packages/ethereum-ethers-v5/README.md): Use with the ethers v5 browser provider. 37 | - [ethereum-ethers-v6](/packages/ethereum-ethers-v6/README.md): Use with the ethers v6 browser provider. 38 | - [ethereum-viem-v2](/packages/ethereum-viem-v2/README.md): Use with the viem v2 browser provider. 39 | 40 | ### Solana 41 | 42 | - [solana-node](/packages/solana-node/README.md): Use with NodeJS, contains token-specific packages for all supported Solana tokens. 43 | - [solana-web](/packages/solana-web/README.md): Use in the browser, contains token-specific packages for all supported Solana tokens. 44 | 45 | ### Aptos 46 | 47 | - [aptos-node](/packages/aptos-node/README.md): Use with NodeJS and the Aptos token. 48 | - [aptos-web](/packages/aptos-web/README.md): Use in the browser with the Aptos token. 49 | 50 | ### Core 51 | 52 | The Irys core packages are used internally, most users will not need to install them directly. 53 | 54 | - [client-core](/packages/client-core/README.md) 55 | - [client-node](/packages/client-node/README.md) 56 | - [client-web](/packages/client-web/README.md) 57 | -------------------------------------------------------------------------------- /assets/irys-sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Irys-xyz/js-sdk/4f9cfcd3707bad14c5446197d714570ebedc5a79/assets/irys-sdk.png -------------------------------------------------------------------------------- /cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "Node16", 5 | "target": "es2021", 6 | "moduleResolution": "Node16" 7 | }, 8 | "include": [ 9 | "src/**/*" 10 | ], 11 | "exclude": [ 12 | "**/__tests__/**/*", 13 | "tests/**/*" 14 | ] 15 | } -------------------------------------------------------------------------------- /esm.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "module": "esnext", 6 | "target": "esnext", 7 | "moduleResolution": "bundler", 8 | "outDir": "./build/esm", 9 | "rootDir": "./src", 10 | "composite": false 11 | }, 12 | "include": [ 13 | "src/**/*" 14 | ], 15 | "exclude": [ 16 | "./src/cjsIndex.ts", 17 | "**/__tests__/**/*", 18 | "tests/**/*" 19 | ] 20 | } -------------------------------------------------------------------------------- /examples/node/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | test -------------------------------------------------------------------------------- /examples/node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examples", 3 | "private": true, 4 | "dependencies": { 5 | "@irys/upload": "workspace:^", 6 | "@irys/upload-ethereum": "workspace:^", 7 | "@irys/upload-solana": "workspace:^", 8 | "@irys/upload-aptos": "workspace:^", 9 | "@irys/web-upload": "workspace:^", 10 | "@irys/web-upload-ethereum": "workspace:^", 11 | "@irys/web-upload-ethereum-ethers-v6": "workspace:^", 12 | "@irys/web-upload-ethereum-viem-v2": "workspace:^", 13 | "@irys/upload-starknet": "workspace:^" 14 | }, 15 | "version": "1.0.2", 16 | "scripts": {}, 17 | "keywords": [], 18 | "author": "", 19 | "license": "ISC", 20 | "description": "" 21 | } -------------------------------------------------------------------------------- /examples/node/scripts/tokens/aptos.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Aptos } from "@irys/upload-aptos"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Aptos. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadAptos = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Aptos wallet 13 | const irysUploader = await Uploader(Aptos).withWallet(process.env.APTOS_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/arbitrum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Arbitrum } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Arbitrum. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadArbitrum = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Arbitrum).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/avalanche.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Avalanche } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Avalanche. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadAvalanche = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Avalanche).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/base-ethereum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { BaseEth } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using BaseEth. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadBaseEthereum = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(BaseEth).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/bera.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Bera } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Bera. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadBera = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Bera).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/bnb.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { BNB } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using BNB. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadBnb = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(BNB).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/chainlink.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Chainlink } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | 6 | /** 7 | * Tests if data can be uploaded to Irys using Chainlink. 8 | * 9 | * @returns {Promise} Returns true if upload is successful, otherwise false. 10 | */ 11 | export const canUploadChainlink = async (): Promise => { 12 | try { 13 | // Initialize the Irys Uploader with the Ethereum wallet 14 | const irysUploader = await Uploader(Chainlink).withWallet(process.env.EVM_PRIVATE_KEY); 15 | 16 | // Attempt to upload data to Irys 17 | //@ts-ignore 18 | const receipt = await irysUploader.upload("hirys", { 19 | tags: [{ name: "Content-Type", value: "text/plain" }], 20 | }); 21 | 22 | // If an exception is not thrown, the upload was successful 23 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 24 | return true; 25 | } catch (error) { 26 | console.error("Error during upload:", error); 27 | return false; 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/eclipse-ethereum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { EclipseEth } from "@irys/upload-solana"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Eclipse. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadEclipseEth = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Solana wallet 13 | const irysUploader = await Uploader(EclipseEth).withWallet(process.env.SOLANA_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/ethereum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Ethereum } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Ethereum. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadEthereum = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Ethereum).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/iotex.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Iotex } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Iotex. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadIotex = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Iotex).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/linea-ethereum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { LineaEth } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using LineaEth. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadLineaEthereum = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(LineaEth).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/polygon.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Matic } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Matic. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadPolygon = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(Matic).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/scroll-ethereum.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { ScrollEth } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using ScrollEth. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadScrollEthereum = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(ScrollEth).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/solana.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { Solana } from "@irys/upload-solana"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using Solana. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadSolana = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Solana wallet 13 | const irysUploader = await Uploader(Solana).withWallet(process.env.SOLANA_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/usdcEth.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { USDCEth } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using USDCEth. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadUsdcEth = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(USDCEth).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/scripts/tokens/usdcPolygon.ts: -------------------------------------------------------------------------------- 1 | import { Uploader } from "@irys/upload"; 2 | import { USDCPolygon } from "@irys/upload-ethereum"; 3 | import "dotenv/config"; 4 | 5 | /** 6 | * Tests if data can be uploaded to Irys using USDCPolygon. 7 | * 8 | * @returns {Promise} Returns true if upload is successful, otherwise false. 9 | */ 10 | export const canUploadUsdcPolygon = async (): Promise => { 11 | try { 12 | // Initialize the Irys Uploader with the Ethereum wallet 13 | const irysUploader = await Uploader(USDCPolygon).withWallet(process.env.EVM_PRIVATE_KEY); 14 | 15 | // Attempt to upload data to Irys 16 | //@ts-ignore 17 | const receipt = await irysUploader.upload("hirys", { 18 | tags: [{ name: "Content-Type", value: "text/plain" }], 19 | }); 20 | 21 | // If an exception is not thrown, the upload was successful 22 | // console.log(`Upload successful https://gateway.irys.xyz/${receipt.id}`); 23 | return true; 24 | } catch (error) { 25 | console.error("Error during upload:", error); 26 | return false; 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /examples/node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "./**/*", 5 | ], 6 | "exclude": [ 7 | "node_modules" 8 | ], 9 | "compilerOptions": { 10 | "noEmit": true, 11 | "moduleResolution": "NodeNext", 12 | "outDir": "dist/esm", 13 | "declarationDir": "dist/types", 14 | "rootDir": "./src" 15 | } 16 | } -------------------------------------------------------------------------------- /examples/providers/ethers5/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /examples/providers/ethers5/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 37 | -------------------------------------------------------------------------------- /examples/providers/ethers5/app/components/ConnectIrys.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { SiRetroarch } from "react-icons/si"; 4 | import { WebUploader } from "@irys/web-upload"; 5 | import { WebEthereum } from "@irys/web-upload-ethereum"; 6 | import { ethers } from "ethers"; 7 | 8 | const connectIrys = async () => { 9 | try { 10 | //@ts-ignore 11 | const provider = new ethers.providers.Web3Provider(window.ethereum); 12 | const irysUploader = await WebUploader(WebEthereum).withProvider(provider); 13 | 14 | //@ts-ignore 15 | console.log(`Connected to Irys from ${irysUploader.address}`); 16 | //@ts-ignore 17 | return `Connected to Irys from ${irysUploader.address}`; 18 | } catch (error) { 19 | console.error("Error connecting to WebIrys:", error); 20 | throw new Error("Error connecting to WebIrys"); 21 | } 22 | }; 23 | 24 | const ConnectIrys = (): JSX.Element => { 25 | const [isConnected, setIsConnected] = useState(false); 26 | const [statusMessage, setStatusMessage] = useState("Not connected"); 27 | const [isConnecting, setIsConnecting] = useState(false); 28 | 29 | const connectToIrys = async () => { 30 | setIsConnecting(true); 31 | try { 32 | const message = await connectIrys(); 33 | setStatusMessage(message); 34 | setIsConnected(true); 35 | } catch (error) { 36 | console.log(error); 37 | setStatusMessage("Error connecting to Irys"); 38 | } finally { 39 | setIsConnecting(false); 40 | } 41 | }; 42 | 43 | const disconnectFromIrys = () => { 44 | setIsConnected(false); 45 | setStatusMessage("Not connected"); 46 | }; 47 | 48 | return ( 49 |
50 | 62 |
{statusMessage}
63 |
64 | ); 65 | }; 66 | 67 | export default ConnectIrys; 68 | -------------------------------------------------------------------------------- /examples/providers/ethers5/app/components/ConnectWallet.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { ethers } from "ethers"; 4 | import { SiRetroarch } from "react-icons/si"; 5 | 6 | const ConnectWallet = (): JSX.Element => { 7 | const [isConnected, setIsConnected] = useState(false); 8 | const [statusMessage, setStatusMessage] = useState("Not connected"); 9 | const [walletAddress, setWalletAddress] = useState(null); 10 | const [isConnecting, setIsConnecting] = useState(false); 11 | 12 | const connectWallet = async () => { 13 | //@ts-ignore 14 | if (typeof window.ethereum !== "undefined") { 15 | try { 16 | setIsConnecting(true); 17 | //@ts-ignore 18 | const provider = new ethers.providers.Web3Provider(window.ethereum); 19 | await provider.send("eth_requestAccounts", []); 20 | const signer = provider.getSigner(); 21 | const address = await signer.getAddress(); 22 | setWalletAddress(address); 23 | setStatusMessage(`Connected from ${address}`); 24 | setIsConnected(true); 25 | } catch (error) { 26 | console.error("Error connecting to wallet:", error); 27 | } finally { 28 | setIsConnecting(false); 29 | } 30 | } else { 31 | console.error("No wallet provider found"); 32 | } 33 | }; 34 | 35 | const disconnectWallet = () => { 36 | setIsConnected(false); 37 | setStatusMessage("Not connected"); 38 | setWalletAddress(null); 39 | }; 40 | 41 | return ( 42 |
43 | 55 |
{statusMessage}
56 |
57 | ); 58 | }; 59 | 60 | export default ConnectWallet; 61 | -------------------------------------------------------------------------------- /examples/providers/ethers5/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer utilities { 6 | .animate-typing { 7 | overflow: hidden; 8 | border-right: 0.15em solid #00FF00; /* Cursor effect */ 9 | white-space: nowrap; 10 | letter-spacing: 0.15em; 11 | animation: typing 1.75s steps(40, end), blink-caret 0.75s step-end infinite; 12 | } 13 | 14 | @keyframes typing { 15 | from { 16 | width: 0; 17 | } 18 | to { 19 | width: 100%; 20 | } 21 | } 22 | 23 | @keyframes blink-caret { 24 | from, to { 25 | border-color: transparent; 26 | } 27 | 50% { 28 | border-color: #00FF00; /* Green blink */ 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/providers/ethers5/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const inter = Inter({ subsets: ["latin"] }); 6 | 7 | export const metadata: Metadata = { 8 | title: "Irys Provider Test: Ethers 5", 9 | description: "Example repo to help test different providers", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /examples/providers/ethers5/app/page.tsx: -------------------------------------------------------------------------------- 1 | import ConnectIrys from "./components/ConnectIrys"; 2 | import ConnectWallet from "./components/ConnectWallet"; 3 | import UploadText from "./components/UploadText"; 4 | 5 | export default function Home() { 6 | return ( 7 |
8 | Ethers5 9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /examples/providers/ethers5/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /examples/providers/ethers5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethers5", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@irys/web-upload": "workspace:^", 13 | "@irys/web-upload-ethereum": "workspace:^", 14 | "ethers": "^5.7.2", 15 | "next": "14.2.7", 16 | "react": "^18", 17 | "react-dom": "^18", 18 | "react-icons": "^5.3.0" 19 | }, 20 | "devDependencies": { 21 | "@types/node": "^20", 22 | "@types/react": "^18", 23 | "@types/react-dom": "^18", 24 | "eslint": "^8", 25 | "eslint-config-next": "14.2.7", 26 | "postcss": "^8", 27 | "tailwindcss": "^3.4.1", 28 | "typescript": "^5" 29 | } 30 | } -------------------------------------------------------------------------------- /examples/providers/ethers5/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /examples/providers/ethers5/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | const config: Config = { 4 | content: [ 5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | primary: "#FF8451", 13 | secondary: "#000000", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | }; 19 | export default config; 20 | -------------------------------------------------------------------------------- /examples/providers/ethers5/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "dom", 5 | "dom.iterable", 6 | "esnext" 7 | ], 8 | "allowJs": true, 9 | "skipLibCheck": true, 10 | "strict": false, 11 | "noEmit": true, 12 | "incremental": true, 13 | "module": "esnext", 14 | "esModuleInterop": true, 15 | "moduleResolution": "node", 16 | "resolveJsonModule": true, 17 | "isolatedModules": true, 18 | "jsx": "preserve", 19 | "plugins": [ 20 | { 21 | "name": "next" 22 | } 23 | ] 24 | }, 25 | "include": [ 26 | "next-env.d.ts", 27 | ".next/types/**/*.ts", 28 | "**/*.ts", 29 | "**/*.tsx" 30 | ], 31 | "exclude": [ 32 | "node_modules" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /examples/providers/ethers6/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /examples/providers/ethers6/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /examples/providers/ethers6/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 37 | -------------------------------------------------------------------------------- /examples/providers/ethers6/app/components/ConnectIrys.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { SiRetroarch } from "react-icons/si"; 4 | import { ethers } from "ethers"; 5 | 6 | import { WebUploader } from "@irys/web-upload"; 7 | import { WebEthereum } from "@irys/web-upload-ethereum"; 8 | import { EthersV6Adapter } from "@irys/web-upload-ethereum-ethers-v6"; 9 | 10 | const doConnectIrys = async (): Promise => { 11 | try { 12 | //@ts-ignore 13 | const provider = new ethers.BrowserProvider(window.ethereum); 14 | // Use .withAdapter() as it's a wrapper around providers 15 | const irysUploader = await WebUploader(WebEthereum).withAdapter(EthersV6Adapter(provider)); 16 | 17 | console.log(`Connected to Irys from ${irysUploader.address}`); 18 | return `Connected to WebIrys from ${irysUploader.address}`; 19 | } catch (error) { 20 | console.error("Error connecting to Irys:", error); 21 | throw new Error("Error connecting to Irys"); 22 | } 23 | }; 24 | 25 | const ConnectIrys = (): JSX.Element => { 26 | const [isConnected, setIsConnected] = useState(false); 27 | const [statusMessage, setStatusMessage] = useState("Not connected"); 28 | const [isConnecting, setIsConnecting] = useState(false); 29 | 30 | const connectToIrys = async () => { 31 | setIsConnecting(true); 32 | try { 33 | const message = await doConnectIrys(); 34 | setStatusMessage(message); 35 | setIsConnected(true); 36 | } catch (error) { 37 | setStatusMessage("Error connecting to Irys"); 38 | } finally { 39 | setIsConnecting(false); 40 | } 41 | }; 42 | 43 | const disconnectFromIrys = () => { 44 | setIsConnected(false); 45 | setStatusMessage("Not connected"); 46 | }; 47 | 48 | return ( 49 |
50 | 62 |
{statusMessage}
63 |
64 | ); 65 | }; 66 | 67 | export default ConnectIrys; 68 | -------------------------------------------------------------------------------- /examples/providers/ethers6/app/components/ConnectWallet.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { ethers } from "ethers"; 4 | import { SiRetroarch } from "react-icons/si"; 5 | 6 | const ConnectWallet = (): JSX.Element => { 7 | const [isConnected, setIsConnected] = useState(false); 8 | const [statusMessage, setStatusMessage] = useState("Not connected"); 9 | const [walletAddress, setWalletAddress] = useState(null); 10 | const [isConnecting, setIsConnecting] = useState(false); 11 | 12 | const connectWallet = async () => { 13 | //@ts-ignore 14 | if (typeof window.ethereum !== "undefined") { 15 | try { 16 | setIsConnecting(true); 17 | //@ts-ignore 18 | const provider = new ethers.BrowserProvider(window.ethereum); 19 | const accounts = await provider.send("eth_requestAccounts", []); 20 | const signer = await provider.getSigner(); 21 | const address = await signer.getAddress(); 22 | setWalletAddress(address); 23 | setStatusMessage(`Connected from ${address}`); 24 | setIsConnected(true); 25 | } catch (error) { 26 | console.error("Error connecting to wallet:", error); 27 | } finally { 28 | setIsConnecting(false); 29 | } 30 | } else { 31 | console.error("No wallet provider found"); 32 | } 33 | }; 34 | 35 | const disconnectWallet = () => { 36 | setIsConnected(false); 37 | setStatusMessage("Not connected"); 38 | setWalletAddress(null); 39 | }; 40 | 41 | return ( 42 |
43 | 55 |
{statusMessage}
56 |
57 | ); 58 | }; 59 | 60 | export default ConnectWallet; 61 | -------------------------------------------------------------------------------- /examples/providers/ethers6/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Irys-xyz/js-sdk/4f9cfcd3707bad14c5446197d714570ebedc5a79/examples/providers/ethers6/app/favicon.ico -------------------------------------------------------------------------------- /examples/providers/ethers6/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --foreground-rgb: 0, 0, 0; 7 | --background-start-rgb: 214, 219, 220; 8 | --background-end-rgb: 255, 255, 255; 9 | } 10 | 11 | @media (prefers-color-scheme: dark) { 12 | :root { 13 | --foreground-rgb: 255, 255, 255; 14 | --background-start-rgb: 0, 0, 0; 15 | --background-end-rgb: 0, 0, 0; 16 | } 17 | } 18 | 19 | body { 20 | color: rgb(var(--foreground-rgb)); 21 | background: linear-gradient( 22 | to bottom, 23 | transparent, 24 | rgb(var(--background-end-rgb)) 25 | ) 26 | rgb(var(--background-start-rgb)); 27 | } 28 | 29 | @layer utilities { 30 | .text-balance { 31 | text-wrap: balance; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/providers/ethers6/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const inter = Inter({ subsets: ["latin"] }); 6 | 7 | export const metadata: Metadata = { 8 | title: "Irys Provider Test: Ethers 6", 9 | description: "Example repo to help test Irys + Ethers6", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /examples/providers/ethers6/app/page.tsx: -------------------------------------------------------------------------------- 1 | import ConnectWallet from "@/app/components/ConnectWallet"; 2 | import ConnectIrys from "@/app/components/ConnectIrys"; 3 | import UploadText from "@/app/components/UploadText"; 4 | 5 | export default function Home() { 6 | return ( 7 |
8 | Ethers6 9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /examples/providers/ethers6/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /examples/providers/ethers6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethers6", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@irys/web-upload": "workspace:^", 13 | "@irys/web-upload-ethereum": "workspace:^", 14 | "@irys/web-upload-ethereum-ethers-v6": "workspace:^", 15 | "ethers": "^6.13.2", 16 | "next": "14.2.7", 17 | "react": "^18", 18 | "react-dom": "^18", 19 | "react-icons": "^5.3.0" 20 | }, 21 | "devDependencies": { 22 | "@types/node": "^20", 23 | "@types/react": "^18", 24 | "@types/react-dom": "^18", 25 | "eslint": "^8", 26 | "eslint-config-next": "14.2.7", 27 | "postcss": "^8", 28 | "tailwindcss": "^3.4.1", 29 | "typescript": "^5" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/providers/ethers6/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /examples/providers/ethers6/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | const config: Config = { 4 | content: [ 5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | primary: "#FF8451", 13 | secondary: "#000000", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | }; 19 | export default config; 20 | -------------------------------------------------------------------------------- /examples/providers/ethers6/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /examples/providers/viemv2/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /examples/providers/viemv2/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /examples/providers/viemv2/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 37 | -------------------------------------------------------------------------------- /examples/providers/viemv2/app/components/ConnectIrys.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { SiRetroarch } from "react-icons/si"; 4 | import { sepolia } from "viem/chains"; 5 | import { createWalletClient, createPublicClient, custom } from "viem"; 6 | 7 | import { WebUploader } from "@irys/web-upload"; 8 | import { WebEthereum } from "@irys/web-upload-ethereum"; 9 | import { ViemV2Adapter } from "@irys/web-upload-ethereum-viem-v2"; 10 | 11 | // Function to connect to WebIrys 12 | const doConnectIrys = async (): Promise => { 13 | try { 14 | //@ts-ignore 15 | const [account] = await window.ethereum.request({ method: "eth_requestAccounts" }); 16 | console.log({account}) 17 | const provider = createWalletClient({ 18 | account, 19 | chain: sepolia, 20 | //@ts-ignore 21 | transport: custom(window.ethereum), 22 | }); 23 | console.log({provider}) 24 | 25 | const publicClient = createPublicClient({ 26 | chain: sepolia, 27 | //@ts-ignore 28 | transport: custom(window.ethereum) 29 | }); 30 | console.log({publicClient}) 31 | 32 | const irysUploader = await WebUploader(WebEthereum).withAdapter(ViemV2Adapter(provider, { publicClient })); 33 | 34 | console.log(`Connected to Irys from ${irysUploader.address}`); 35 | return `Connected to Irys from ${irysUploader.address}`; 36 | } catch (error) { 37 | console.error("Error connecting to Irys:", error); 38 | throw new Error("Error connecting to Irys"); 39 | } 40 | }; 41 | 42 | const ConnectIrys = (): JSX.Element => { 43 | const [isConnected, setIsConnected] = useState(false); 44 | const [statusMessage, setStatusMessage] = useState("Not connected"); 45 | const [isConnecting, setIsConnecting] = useState(false); 46 | 47 | const connectToIrys = async () => { 48 | setIsConnecting(true); 49 | try { 50 | const message = await doConnectIrys(); 51 | setStatusMessage(message); 52 | setIsConnected(true); 53 | } catch (error) { 54 | setStatusMessage("Error connecting to WebIrys"); 55 | } finally { 56 | setIsConnecting(false); 57 | } 58 | }; 59 | 60 | const disconnectFromIrys = () => { 61 | setIsConnected(false); 62 | setStatusMessage("Not connected"); 63 | }; 64 | 65 | return ( 66 |
67 | 79 |
{statusMessage}
80 |
81 | ); 82 | }; 83 | 84 | export default ConnectIrys; 85 | -------------------------------------------------------------------------------- /examples/providers/viemv2/app/components/ConnectWallet.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useState } from "react"; 3 | import { SiRetroarch } from "react-icons/si"; 4 | import { createWalletClient, custom } from "viem"; 5 | import { sepolia } from "viem/chains"; 6 | 7 | const ConnectWallet = (): JSX.Element => { 8 | const [isConnected, setIsConnected] = useState(false); 9 | const [statusMessage, setStatusMessage] = useState("Not connected"); 10 | const [walletAddress, setWalletAddress] = useState(null); 11 | const [isConnecting, setIsConnecting] = useState(false); 12 | 13 | const connectWallet = async () => { 14 | try { 15 | setIsConnecting(true); 16 | //@ts-ignore 17 | const [account] = await window.ethereum.request({ method: "eth_requestAccounts" }); 18 | const provider = createWalletClient({ 19 | account, 20 | chain: sepolia, 21 | //@ts-ignore 22 | transport: custom(window.ethereum), 23 | }); 24 | 25 | setWalletAddress(account); 26 | setStatusMessage(`Connected from ${account}`); 27 | setIsConnected(true); 28 | } catch (error) { 29 | console.error("Error connecting to wallet:", error); 30 | setStatusMessage("Error connecting to wallet"); 31 | } finally { 32 | setIsConnecting(false); 33 | } 34 | }; 35 | 36 | const disconnectWallet = () => { 37 | setIsConnected(false); 38 | setStatusMessage("Not connected"); 39 | setWalletAddress(null); 40 | }; 41 | 42 | return ( 43 |
44 | 56 |
{statusMessage}
57 |
58 | ); 59 | }; 60 | 61 | export default ConnectWallet; 62 | -------------------------------------------------------------------------------- /examples/providers/viemv2/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --foreground-rgb: 0, 0, 0; 7 | --background-start-rgb: 214, 219, 220; 8 | --background-end-rgb: 255, 255, 255; 9 | } 10 | 11 | @media (prefers-color-scheme: dark) { 12 | :root { 13 | --foreground-rgb: 255, 255, 255; 14 | --background-start-rgb: 0, 0, 0; 15 | --background-end-rgb: 0, 0, 0; 16 | } 17 | } 18 | 19 | body { 20 | color: rgb(var(--foreground-rgb)); 21 | background: linear-gradient( 22 | to bottom, 23 | transparent, 24 | rgb(var(--background-end-rgb)) 25 | ) 26 | rgb(var(--background-start-rgb)); 27 | } 28 | 29 | @layer utilities { 30 | .text-balance { 31 | text-wrap: balance; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/providers/viemv2/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Inter } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const inter = Inter({ subsets: ["latin"] }); 6 | 7 | export const metadata: Metadata = { 8 | title: "Irys Provider Test: Viem", 9 | description: "Example repo to help test different providers", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | {children} 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /examples/providers/viemv2/app/page.tsx: -------------------------------------------------------------------------------- 1 | import ConnectWallet from "@/app/components/ConnectWallet"; 2 | import ConnectIrys from "@/app/components/ConnectIrys"; 3 | import UploadText from "./components/UploadText"; 4 | 5 | export default function Home() { 6 | return ( 7 |
8 | Viem v2 9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /examples/providers/viemv2/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /examples/providers/viemv2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "viemv2", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@irys/web-upload": "workspace:^", 13 | "@irys/web-upload-ethereum": "workspace:^", 14 | "@irys/web-upload-ethereum-viem-v2": "workspace:^", 15 | "next": "14.2.7", 16 | "react": "^18", 17 | "react-dom": "^18", 18 | "react-icons": "^5.3.0", 19 | "viem": "^2.21.1" 20 | }, 21 | "devDependencies": { 22 | "@types/node": "^20", 23 | "@types/react": "^18", 24 | "@types/react-dom": "^18", 25 | "eslint": "^8", 26 | "eslint-config-next": "14.2.7", 27 | "postcss": "^8", 28 | "tailwindcss": "^3.4.1", 29 | "typescript": "^5" 30 | } 31 | } -------------------------------------------------------------------------------- /examples/providers/viemv2/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /examples/providers/viemv2/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/providers/viemv2/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/providers/viemv2/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | const config: Config = { 4 | content: [ 5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | primary: "#FF8451", 13 | secondary: "#000000", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | }; 19 | export default config; 20 | -------------------------------------------------------------------------------- /examples/providers/viemv2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/sdk-monorepo", 3 | "private": true, 4 | "description": "A JavaScript Framework for the Irys Network", 5 | "keywords": [ 6 | "irys", 7 | "framework" 8 | ], 9 | "homepage": "https://irys.xyz", 10 | "repository": { 11 | "url": "https://github.com/irys-xyz/js-sdk.git" 12 | }, 13 | "license": "MIT", 14 | "author": "Jesse ", 15 | "workspaces": [ 16 | "packages/*", 17 | "examples" 18 | ], 19 | "scripts": { 20 | "build": "turbo run build", 21 | "build:nocache": "turbo run build --no-cache", 22 | "build:docs": "typedoc", 23 | "clean": "turbo run clean", 24 | "format": "prettier --check packages/", 25 | "format:fix": "prettier --write packages/", 26 | "lint": "turbo run lint", 27 | "lint:fix": "turbo run lint:fix", 28 | "packages:new": "node scripts/generate-new-package.mjs", 29 | "packages:change": "changeset", 30 | "packages:version": "changeset version", 31 | "packages:publish": "turbo run build && changeset publish --no-git-tag", 32 | "test": "turbo run test" 33 | }, 34 | "browserslist": [ 35 | "defaults", 36 | "not IE 11", 37 | "maintained node versions" 38 | ], 39 | "devDependencies": { 40 | "@ava/typescript": "^5.0.0", 41 | "@babel/core": "^7.25.2", 42 | "@babel/preset-env": "^7.25.4", 43 | "@babel/preset-typescript": "^7.24.7", 44 | "@changesets/changelog-github": "^0.5.0", 45 | "@changesets/cli": "^2.27.7", 46 | "@rollup/plugin-babel": "^6.0.4", 47 | "@rollup/plugin-commonjs": "^26.0.1", 48 | "@rollup/plugin-json": "^6.1.0", 49 | "@rollup/plugin-node-resolve": "^15.2.3", 50 | "@rollup/plugin-replace": "^5.0.7", 51 | "@rollup/plugin-terser": "^0.4.4", 52 | "@rollup/plugin-typescript": "^11.1.6", 53 | "@types/node": "^22.5.3", 54 | "@typescript-eslint/eslint-plugin": "^8.3.0", 55 | "@typescript-eslint/parser": "^8.3.0", 56 | "ava": "^6.1.3", 57 | "chalk": "^5.3.0", 58 | "concurrently": "^8.2.2", 59 | "depcheck": "^1.4.7", 60 | "eslint": "^9.9.1", 61 | "eslint-plugin-prettier": "^5.2.1", 62 | "prettier": "^3.3.3", 63 | "prettier-eslint": "^16.3.0", 64 | "rimraf": "^6.0.1", 65 | "rollup": "^4.21.1", 66 | "rollup-plugin-polyfill-node": "^0.13.0", 67 | "ts-node": "^10.9.2", 68 | "tsc-esm-fix": "^3.0.2", 69 | "tsconfig-paths": "^4.2.0", 70 | "turbo": "^2.1.0", 71 | "typedoc": "^0.26.6", 72 | "typescript": "^5.5.4" 73 | }, 74 | "packageManager": "pnpm@9.1.1", 75 | "engines": { 76 | "node": ">=18.0" 77 | }, 78 | "dependencies": { 79 | "tslib": "^2.7.0" 80 | } 81 | } -------------------------------------------------------------------------------- /packages/aptos-node/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload-aptos 2 | 3 | ## 0.0.15 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/upload@0.0.15 12 | 13 | ## 0.0.14 14 | 15 | ### Patch Changes 16 | 17 | - Updated dependencies []: 18 | - @irys/upload-core@0.0.9 19 | - @irys/upload@0.0.14 20 | 21 | ## 0.0.13 22 | 23 | ### Patch Changes 24 | 25 | - Updated dependencies []: 26 | - @irys/upload@0.0.13 27 | 28 | ## 0.0.12 29 | 30 | ### Patch Changes 31 | 32 | - Updated dependencies []: 33 | - @irys/upload-core@0.0.8 34 | - @irys/upload@0.0.12 35 | 36 | ## 0.0.11 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies []: 41 | - @irys/upload-core@0.0.7 42 | - @irys/upload@0.0.11 43 | 44 | ## 0.0.10 45 | 46 | ### Patch Changes 47 | 48 | - Updated dependencies []: 49 | - @irys/upload-core@0.0.6 50 | - @irys/upload@0.0.10 51 | 52 | ## 0.0.9 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies []: 57 | - @irys/upload@0.0.9 58 | 59 | ## 0.0.8 60 | 61 | ### Patch Changes 62 | 63 | - Updated dependencies []: 64 | - @irys/upload@0.0.8 65 | 66 | ## 0.0.7 67 | 68 | ### Patch Changes 69 | 70 | - Updated dependencies []: 71 | - @irys/upload@0.0.7 72 | 73 | ## 0.0.6 74 | 75 | ### Patch Changes 76 | 77 | - Updated dependencies []: 78 | - @irys/upload-core@0.0.5 79 | - @irys/upload@0.0.6 80 | 81 | ## 0.0.5 82 | 83 | ### Patch Changes 84 | 85 | - Updated dependencies []: 86 | - @irys/upload-core@0.0.4 87 | - @irys/upload@0.0.5 88 | 89 | ## 0.0.4 90 | 91 | ### Patch Changes 92 | 93 | - Updated dependencies []: 94 | - @irys/upload-core@0.0.3 95 | - @irys/upload@0.0.4 96 | 97 | ## 0.0.3 98 | 99 | ### Patch Changes 100 | 101 | - Updated dependencies []: 102 | - @irys/upload-core@0.0.2 103 | - @irys/upload@0.0.3 104 | 105 | ## 0.0.2 106 | 107 | ### Patch Changes 108 | 109 | - Updated dependencies []: 110 | - @irys/upload@0.0.2 111 | 112 | ## 0.0.1 113 | 114 | ### Patch Changes 115 | 116 | - v1 117 | 118 | - Updated dependencies []: 119 | - @irys/upload-core@0.0.1 120 | - @irys/upload@0.0.1 121 | -------------------------------------------------------------------------------- /packages/aptos-node/README.md: -------------------------------------------------------------------------------- 1 | # aptos-node 2 | 3 | Aptos NodeJS token client for Irys network bundlers. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/upload-aptos 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/aptos-node/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/aptos-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-aptos", 3 | "version": "0.0.15", 4 | "description": "Aptos NodeJS token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/upload-core": "workspace:^", 51 | "@irys/upload": "workspace:^", 52 | "@aptos-labs/ts-sdk": "^1.27.1", 53 | "@irys/bundles": "^0.0.3", 54 | "bignumber.js": "^9.1.2", 55 | "js-sha3": "^0.9.3", 56 | "async-retry": "^1.3.3" 57 | }, 58 | "devDependencies": { 59 | "@ava/typescript": "^5.0.0", 60 | "ava": "^6.1.3", 61 | "@types/async-retry": "^1.4.8" 62 | }, 63 | "publishConfig": { 64 | "access": "public" 65 | }, 66 | "author": "Irys maintainers ", 67 | "homepage": "https://irys.xyz", 68 | "repository": { 69 | "url": "https://github.com/irys-xyz/js-sdk.git" 70 | }, 71 | "typedoc": { 72 | "entryPoint": "./src/index.ts", 73 | "readmeFile": "./README.md", 74 | "displayName": "aptos-node" 75 | }, 76 | "ava": { 77 | "typescript": { 78 | "compile": false, 79 | "rewritePaths": { 80 | "src/": "dist/test/src/", 81 | "test/": "dist/test/test/" 82 | } 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /packages/aptos-node/src/index.ts: -------------------------------------------------------------------------------- 1 | import Aptos from './irys'; 2 | export { Aptos }; 3 | export default Aptos; 4 | -------------------------------------------------------------------------------- /packages/aptos-node/src/irys.ts: -------------------------------------------------------------------------------- 1 | import { Network } from '@aptos-labs/ts-sdk'; 2 | import BaseAptosToken from './token'; 3 | import { Constructable, type TokenConfigTrimmed } from '@irys/upload/builder'; 4 | import { BaseNodeToken } from '@irys/upload/esm/tokens/base'; 5 | 6 | export class AptosToken extends BaseAptosToken { 7 | constructor(config: TokenConfigTrimmed) { 8 | super({ 9 | name: 'aptos', 10 | ticker: 'APT', 11 | ...config, 12 | providerUrl: config.providerUrl ?? Network.MAINNET, 13 | }); 14 | } 15 | } 16 | 17 | // export function AptosBundlerIrys() { 18 | // return new Builder(AptosToken)/* .withTokenOptions(opts) */ 19 | // } 20 | // export default AptosBundlerIrys 21 | 22 | export const Aptos: Constructable<[TokenConfigTrimmed], BaseNodeToken> = 23 | AptosToken; 24 | export default Aptos; 25 | -------------------------------------------------------------------------------- /packages/aptos-node/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/aptos-node/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/aptos-node/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { Aptos } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof Aptos, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/aptos-node/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/aptos-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/aptos-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/web-upload-aptos 2 | 3 | ## 0.0.15 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/web-upload@0.0.15 12 | 13 | ## 0.0.14 14 | 15 | ### Patch Changes 16 | 17 | - Updated dependencies []: 18 | - @irys/upload-core@0.0.9 19 | - @irys/web-upload@0.0.14 20 | 21 | ## 0.0.13 22 | 23 | ### Patch Changes 24 | 25 | - Updated dependencies []: 26 | - @irys/web-upload@0.0.13 27 | 28 | ## 0.0.12 29 | 30 | ### Patch Changes 31 | 32 | - Updated dependencies []: 33 | - @irys/upload-core@0.0.8 34 | - @irys/web-upload@0.0.12 35 | 36 | ## 0.0.11 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies []: 41 | - @irys/upload-core@0.0.7 42 | - @irys/web-upload@0.0.11 43 | 44 | ## 0.0.10 45 | 46 | ### Patch Changes 47 | 48 | - Updated dependencies []: 49 | - @irys/upload-core@0.0.6 50 | - @irys/web-upload@0.0.10 51 | 52 | ## 0.0.9 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies []: 57 | - @irys/web-upload@0.0.9 58 | 59 | ## 0.0.8 60 | 61 | ### Patch Changes 62 | 63 | - Updated dependencies []: 64 | - @irys/web-upload@0.0.8 65 | 66 | ## 0.0.7 67 | 68 | ### Patch Changes 69 | 70 | - Updated dependencies []: 71 | - @irys/web-upload@0.0.7 72 | 73 | ## 0.0.6 74 | 75 | ### Patch Changes 76 | 77 | - Updated dependencies []: 78 | - @irys/upload-core@0.0.5 79 | - @irys/web-upload@0.0.6 80 | 81 | ## 0.0.5 82 | 83 | ### Patch Changes 84 | 85 | - Updated dependencies []: 86 | - @irys/upload-core@0.0.4 87 | - @irys/web-upload@0.0.5 88 | 89 | ## 0.0.4 90 | 91 | ### Patch Changes 92 | 93 | - Updated dependencies []: 94 | - @irys/upload-core@0.0.3 95 | - @irys/web-upload@0.0.4 96 | 97 | ## 0.0.3 98 | 99 | ### Patch Changes 100 | 101 | - Updated dependencies []: 102 | - @irys/upload-core@0.0.2 103 | - @irys/web-upload@0.0.3 104 | 105 | ## 0.0.2 106 | 107 | ### Patch Changes 108 | 109 | - Fix use of export paths for TypeScript 110 | 111 | - Updated dependencies []: 112 | - @irys/web-upload@0.0.2 113 | 114 | ## 0.0.1 115 | 116 | ### Patch Changes 117 | 118 | - v1 119 | 120 | - Updated dependencies []: 121 | - @irys/upload-core@0.0.1 122 | - @irys/web-upload@0.0.1 123 | -------------------------------------------------------------------------------- /packages/aptos-web/README.md: -------------------------------------------------------------------------------- 1 | # aptos-web 2 | 3 | Aptos web token client for Irys network bundlers. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/irys-in-the-browser#aptos 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/upload-aptos-web 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/aptos-web/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/aptos-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload-aptos", 3 | "version": "0.0.15", 4 | "description": "Aptos web token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/upload-core": "workspace:^", 51 | "@irys/web-upload": "workspace:^", 52 | "@aptos-labs/ts-sdk": "^1.27.1", 53 | "@irys/bundles": "^0.0.3", 54 | "bignumber.js": "^9.1.2", 55 | "js-sha3": "^0.9.3", 56 | "async-retry": "^1.3.3" 57 | }, 58 | "devDependencies": { 59 | "@ava/typescript": "^5.0.0", 60 | "ava": "^6.1.3", 61 | "@types/async-retry": "^1.4.8" 62 | }, 63 | "publishConfig": { 64 | "access": "public" 65 | }, 66 | "author": "Irys maintainers ", 67 | "homepage": "https://irys.xyz", 68 | "repository": { 69 | "url": "https://github.com/irys-xyz/js-sdk.git" 70 | }, 71 | "typedoc": { 72 | "entryPoint": "./src/index.ts", 73 | "readmeFile": "./README.md", 74 | "displayName": "aptos-node" 75 | }, 76 | "ava": { 77 | "typescript": { 78 | "compile": false, 79 | "rewritePaths": { 80 | "src/": "dist/test/src/", 81 | "test/": "dist/test/test/" 82 | } 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /packages/aptos-web/src/index.ts: -------------------------------------------------------------------------------- 1 | import WebAptos from './irys'; 2 | export { WebAptos }; 3 | export default WebAptos; 4 | -------------------------------------------------------------------------------- /packages/aptos-web/src/irys.ts: -------------------------------------------------------------------------------- 1 | import { Network } from '@aptos-labs/ts-sdk'; 2 | import BaseAptosToken from './token'; 3 | import { 4 | ConstructableWebToken, 5 | type TokenConfigTrimmed, 6 | } from '@irys/web-upload/builder'; 7 | 8 | export class AptosToken extends BaseAptosToken { 9 | constructor(config: TokenConfigTrimmed) { 10 | super({ 11 | name: 'aptos', 12 | ticker: 'APT', 13 | ...config, 14 | providerUrl: config.providerUrl ?? Network.MAINNET, 15 | }); 16 | } 17 | } 18 | 19 | // export function AptosBundlerWebIrys() { 20 | // return new Builder(AptosToken)/* .withTokenOptions(opts) */ 21 | // } 22 | // export default AptosBundlerWebIrys 23 | 24 | export const WebAptos: ConstructableWebToken = AptosToken; 25 | export default WebAptos; 26 | -------------------------------------------------------------------------------- /packages/aptos-web/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/aptos-web/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/aptos-web/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { WebAptos } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof WebAptos, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/aptos-web/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/aptos-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/cli/README.md: -------------------------------------------------------------------------------- 1 | # CLI 2 | 3 | NodeJS multi-token CLI for Irys network bundlers. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/storage-cli/installation 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/upload-cli 13 | ``` 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/cli/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/cli", 3 | "version": "0.0.18", 4 | "description": "NodeJS multi-token CLI for the Irys network", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": "./dist/esm/*.js", 27 | "require": "./dist/cjs/*.js" 28 | } 29 | }, 30 | "files": [ 31 | "dist/cjs", 32 | "dist/esm", 33 | "dist/types", 34 | "src" 35 | ], 36 | "scripts": { 37 | "lint": "eslint --ext js,ts,tsx src", 38 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 39 | "clean": "rimraf dist", 40 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix && chmod +x ./dist/esm/cli.js \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs && chmod +x ./dist/cjs/cli.js \"", 41 | "test": "ava" 42 | }, 43 | "bin": { 44 | "irys": "./dist/cjs/cli.js", 45 | "irys-esm": "./dist/esm/cli.js" 46 | }, 47 | "dependencies": { 48 | "@irys/bundles": "^0.0.3", 49 | "async-retry": "^1.3.3", 50 | "axios": "^1.7.5", 51 | "base64url": "^3.0.1", 52 | "bignumber.js": "^9.1.2", 53 | "commander": "^12.1.0", 54 | "inquirer": "^8.2.0", 55 | "@irys/upload-core": "workspace:^", 56 | "@irys/upload": "workspace:^", 57 | "@irys/upload-ethereum": "workspace:^", 58 | "@irys/upload-solana": "workspace:^", 59 | "@irys/upload-aptos": "workspace:^" 60 | }, 61 | "devDependencies": { 62 | "@ava/typescript": "^5.0.0", 63 | "@types/async-retry": "^1.4.8", 64 | "@types/bn.js": "^5.1.5", 65 | "@types/inquirer": "8", 66 | "@types/mime-types": "^2.1.4", 67 | "ava": "^6.1.3" 68 | }, 69 | "publishConfig": { 70 | "access": "public" 71 | }, 72 | "author": "Irys maintainers ", 73 | "homepage": "https://irys.xyz", 74 | "repository": { 75 | "url": "https://github.com/irys-xyz/js-sdk.git" 76 | }, 77 | "typedoc": { 78 | "entryPoint": "./src/index.ts", 79 | "readmeFile": "./README.md", 80 | "displayName": "cli" 81 | }, 82 | "ava": { 83 | "typescript": { 84 | "compile": false, 85 | "rewritePaths": { 86 | "src/": "dist/test/src/", 87 | "test/": "dist/test/test/" 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /packages/cli/src/token.ts: -------------------------------------------------------------------------------- 1 | import Aptos from '@irys/upload-aptos'; 2 | import Ethereum, { 3 | Arbitrum, 4 | Avalanche, 5 | BaseEth, 6 | Bera, 7 | BNB, 8 | Chainlink, 9 | Iotex, 10 | LineaEth, 11 | Matic, 12 | ScrollEth, 13 | USDCEth, 14 | USDCPolygon, 15 | } from '@irys/upload-ethereum'; 16 | import Solana, { USDCSolana } from '@irys/upload-solana'; 17 | import { Constructable, TokenConfigTrimmed } from '@irys/upload/builder'; 18 | import { BaseNodeToken } from '@irys/upload/tokens/base'; 19 | 20 | export function getToken( 21 | token: string 22 | ): Constructable<[TokenConfigTrimmed], BaseNodeToken> { 23 | switch (token) { 24 | case 'ethereum': 25 | return Ethereum; 26 | case 'matic': 27 | return Matic; 28 | case 'bnb': 29 | return BNB; 30 | case 'solana': 31 | return Solana; 32 | case 'avalanche': 33 | return Avalanche; 34 | case 'base-eth': 35 | return BaseEth; 36 | case 'usdc-eth': 37 | return USDCEth; 38 | case 'arbitrum': 39 | return Arbitrum; 40 | case 'chainlink': 41 | return Chainlink; 42 | case 'aptos': 43 | return Aptos; 44 | case 'usdc-polygon': 45 | return USDCPolygon; 46 | case 'bera': 47 | return Bera; 48 | case 'scroll-eth': 49 | return ScrollEth; 50 | case 'linea-eth': 51 | return LineaEth; 52 | case 'iotex': 53 | return Iotex; 54 | case 'usdc-solana': 55 | return USDCSolana; 56 | default: 57 | throw new Error(`Unknown/Unsupported token ${token}`); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /packages/cli/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/token.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/cli/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/token.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/cli/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { getToken } from '../src/token'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof getToken, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/cli/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "declaration": false, 13 | "emitDeclarationOnly": false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/README.md: -------------------------------------------------------------------------------- 1 | # ethereum-ethers-v6 2 | 3 | Provider adapter library for adapting ethersv5 providers for use with the web Ethereum Irys bundler token client. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/irys-in-the-browser#ethers-v6 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/web-upload-ethereum-ethers-v6 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload-ethereum-ethers-v6", 3 | "version": "0.0.16", 4 | "description": "Provider adapter library for adapting ethersv6 providers for use with the web Ethereum Irys bundler token client", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@ethersproject/bignumber": "^5.7.0", 51 | "@irys/upload-core": "workspace:^", 52 | "@irys/web-upload": "workspace:^", 53 | "@irys/web-upload-ethereum": "workspace:^", 54 | "@irys/bundles": "^0.0.3", 55 | "bignumber.js": "^9.1.2", 56 | "ethers": "6.7.1" 57 | }, 58 | "devDependencies": { 59 | "@ava/typescript": "^5.0.0", 60 | "ava": "^6.1.3" 61 | }, 62 | "publishConfig": { 63 | "access": "public" 64 | }, 65 | "author": "Irys maintainers ", 66 | "homepage": "https://irys.xyz", 67 | "repository": { 68 | "url": "https://github.com/irys-xyz/js-sdk.git" 69 | }, 70 | "typedoc": { 71 | "entryPoint": "./src/index.ts", 72 | "readmeFile": "./README.md", 73 | "displayName": "ethereum-ethers-v6" 74 | }, 75 | "ava": { 76 | "typescript": { 77 | "compile": false, 78 | "rewritePaths": { 79 | "src/": "dist/test/src/", 80 | "test/": "dist/test/test/" 81 | } 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/src/index.ts: -------------------------------------------------------------------------------- 1 | import { EthersV6Adapter } from './irys'; 2 | export { EthersV6Adapter }; 3 | export default EthersV6Adapter; 4 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/src/irys.ts: -------------------------------------------------------------------------------- 1 | import type EthereumConfig from '@irys/web-upload-ethereum/ethereum'; 2 | import { getV6Adapter } from './adapter'; 3 | import { type Adapter } from '@irys/web-upload/builder'; 4 | 5 | export function EthersV6Adapter(provider: any): Adapter { 6 | return { 7 | phase: 'pre', 8 | adaptTokenPre(builder, tokenConfig) { 9 | builder.withProvider(provider); 10 | // todo: add validation here 11 | builder.token = getV6Adapter( 12 | tokenConfig as { new (...args: any): EthereumConfig } 13 | ); 14 | }, 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { EthersV6Adapter } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof EthersV6Adapter, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/ethereum-ethers-v6/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/README.md: -------------------------------------------------------------------------------- 1 | # ethereum-viem-v2 2 | 3 | Provider adapter library for adapting Viem v2 providers for use with the web Ethereum Irys bundler token client. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/irys-in-the-browser#viem-v2 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/web-upload-ethereum-viem-v2 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload-ethereum-viem-v2", 3 | "version": "0.0.17", 4 | "description": "Provider adapter library for adapting Viem v2 providers for use with the web Ethereum Irys bundler token client", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@ethersproject/bignumber": "^5.7.0", 51 | "@irys/upload-core": "workspace:^", 52 | "@irys/web-upload": "workspace:^", 53 | "@irys/web-upload-ethereum": "workspace:^", 54 | "@irys/bundles": "^0.0.3", 55 | "bignumber.js": "^9.1.2" 56 | }, 57 | "devDependencies": { 58 | "@ava/typescript": "^5.0.0", 59 | "ava": "^6.1.3", 60 | "viem": "^2.7.1" 61 | }, 62 | "publishConfig": { 63 | "access": "public" 64 | }, 65 | "author": "Irys maintainers ", 66 | "homepage": "https://irys.xyz", 67 | "repository": { 68 | "url": "https://github.com/irys-xyz/js-sdk.git" 69 | }, 70 | "typedoc": { 71 | "entryPoint": "./src/index.ts", 72 | "readmeFile": "./README.md", 73 | "displayName": "ethereum-ethers-v6" 74 | }, 75 | "ava": { 76 | "typescript": { 77 | "compile": false, 78 | "rewritePaths": { 79 | "src/": "dist/test/src/", 80 | "test/": "dist/test/test/" 81 | } 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/src/index.ts: -------------------------------------------------------------------------------- 1 | import { ViemV2Adapter } from './irys'; 2 | export { ViemV2Adapter }; 3 | export default ViemV2Adapter; 4 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/src/irys.ts: -------------------------------------------------------------------------------- 1 | import type EthereumConfig from '@irys/web-upload-ethereum/ethereum'; 2 | import { getV2Adapter } from './adapter'; 3 | import { type Adapter } from '@irys/web-upload/builder'; 4 | import type { PublicClient } from 'viem'; 5 | 6 | export function ViemV2Adapter( 7 | provider: any, 8 | opts: { publicClient: PublicClient; accountIndex?: number } 9 | ): Adapter { 10 | return { 11 | phase: 'pre', 12 | adaptTokenPre(builder, tokenConfig) { 13 | builder.withProvider(provider); 14 | // todo: add validation here 15 | builder.token = getV2Adapter( 16 | tokenConfig as { new (...args: any): EthereumConfig }, 17 | // @ts-expect-error types 18 | opts 19 | ); 20 | }, 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { ViemV2Adapter } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof ViemV2Adapter, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/ethereum-viem-v2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/ethereum-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/web-upload-ethereum 2 | 3 | ## 0.0.16 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/web-upload@0.0.15 12 | 13 | ## 0.0.15 14 | 15 | ### Patch Changes 16 | 17 | - Update the bera RPC to mainnet 18 | 19 | ## 0.0.14 20 | 21 | ### Patch Changes 22 | 23 | - Updated dependencies []: 24 | - @irys/upload-core@0.0.9 25 | - @irys/web-upload@0.0.14 26 | 27 | ## 0.0.13 28 | 29 | ### Patch Changes 30 | 31 | - Updated dependencies []: 32 | - @irys/web-upload@0.0.13 33 | 34 | ## 0.0.12 35 | 36 | ### Patch Changes 37 | 38 | - Updated dependencies []: 39 | - @irys/upload-core@0.0.8 40 | - @irys/web-upload@0.0.12 41 | 42 | ## 0.0.11 43 | 44 | ### Patch Changes 45 | 46 | - Updated dependencies []: 47 | - @irys/upload-core@0.0.7 48 | - @irys/web-upload@0.0.11 49 | 50 | ## 0.0.10 51 | 52 | ### Patch Changes 53 | 54 | - Updated dependencies []: 55 | - @irys/upload-core@0.0.6 56 | - @irys/web-upload@0.0.10 57 | 58 | ## 0.0.9 59 | 60 | ### Patch Changes 61 | 62 | - Updated dependencies []: 63 | - @irys/web-upload@0.0.9 64 | 65 | ## 0.0.8 66 | 67 | ### Patch Changes 68 | 69 | - Updated dependencies []: 70 | - @irys/web-upload@0.0.8 71 | 72 | ## 0.0.7 73 | 74 | ### Patch Changes 75 | 76 | - Updated dependencies []: 77 | - @irys/web-upload@0.0.7 78 | 79 | ## 0.0.6 80 | 81 | ### Patch Changes 82 | 83 | - Updated dependencies []: 84 | - @irys/upload-core@0.0.5 85 | - @irys/web-upload@0.0.6 86 | 87 | ## 0.0.5 88 | 89 | ### Patch Changes 90 | 91 | - Updated dependencies []: 92 | - @irys/upload-core@0.0.4 93 | - @irys/web-upload@0.0.5 94 | 95 | ## 0.0.4 96 | 97 | ### Patch Changes 98 | 99 | - Updated dependencies []: 100 | - @irys/upload-core@0.0.3 101 | - @irys/web-upload@0.0.4 102 | 103 | ## 0.0.3 104 | 105 | ### Patch Changes 106 | 107 | - Updated dependencies []: 108 | - @irys/upload-core@0.0.2 109 | - @irys/web-upload@0.0.3 110 | 111 | ## 0.0.2 112 | 113 | ### Patch Changes 114 | 115 | - Fix use of export paths for TypeScript 116 | 117 | - Updated dependencies []: 118 | - @irys/web-upload@0.0.2 119 | 120 | ## 0.0.1 121 | 122 | ### Patch Changes 123 | 124 | - v1 125 | 126 | - Updated dependencies []: 127 | - @irys/upload-core@0.0.1 128 | - @irys/web-upload@0.0.1 129 | -------------------------------------------------------------------------------- /packages/ethereum-web/README.md: -------------------------------------------------------------------------------- 1 | # ethereum-web 2 | 3 | Ethereum web token client for Irys network bundlers. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/irys-in-the-browser 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/web-upload-ethereum 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/ethereum-web/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/ethereum-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload-ethereum", 3 | "version": "0.0.16", 4 | "description": "Ethereum web token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": "./dist/esm/*.js", 27 | "require": "./dist/cjs/*.js" 28 | } 29 | }, 30 | "files": [ 31 | "/dist/cjs", 32 | "/dist/esm", 33 | "/dist/types", 34 | "/src" 35 | ], 36 | "scripts": { 37 | "lint": "eslint --ext js,ts,tsx src", 38 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 39 | "clean": "rimraf dist", 40 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 41 | "test": "ava" 42 | }, 43 | "dependencies": { 44 | "@ethersproject/bignumber": "^5.7.0", 45 | "@ethersproject/contracts": "^5.7.0", 46 | "@ethersproject/providers": "^5.7.2", 47 | "@irys/upload-core": "workspace:^", 48 | "@irys/web-upload": "workspace:^", 49 | "@irys/bundles": "^0.0.3", 50 | "bignumber.js": "^9.1.2" 51 | }, 52 | "devDependencies": { 53 | "@ava/typescript": "^5.0.0", 54 | "ava": "^6.1.3" 55 | }, 56 | "publishConfig": { 57 | "access": "public" 58 | }, 59 | "author": "Irys maintainers ", 60 | "homepage": "https://irys.xyz", 61 | "repository": { 62 | "url": "https://github.com/irys-xyz/js-sdk.git" 63 | }, 64 | "typedoc": { 65 | "entryPoint": "./src/index.ts", 66 | "readmeFile": "./README.md", 67 | "displayName": "ethereum-web" 68 | }, 69 | "ava": { 70 | "typescript": { 71 | "compile": false, 72 | "rewritePaths": { 73 | "src/": "dist/test/src/", 74 | "test/": "dist/test/test/" 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /packages/ethereum-web/src/index.ts: -------------------------------------------------------------------------------- 1 | import { WebEthereum } from './clients'; 2 | export default WebEthereum; 3 | export * from './clients'; 4 | -------------------------------------------------------------------------------- /packages/ethereum-web/src/irys.ts: -------------------------------------------------------------------------------- 1 | import BaseWebIrys from '@irys/web-upload/base'; 2 | import BaseEthereumToken from './ethereum'; 3 | import type { WebIrysConfig } from '@irys/web-upload/types'; 4 | 5 | export class EthereumIrys extends BaseWebIrys { 6 | constructor({ url, provider, config }: WebIrysConfig) { 7 | super({ 8 | url, 9 | config, 10 | getTokenConfig: (irys) => 11 | new BaseEthereumToken({ 12 | irys, 13 | name: 'ethereum', 14 | ticker: 'ETH', 15 | providerUrl: config?.providerUrl ?? 'https://cloudflare-eth.com/', 16 | wallet: provider, 17 | opts: config?.tokenOpts, 18 | }), 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/ethereum-web/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-web/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum-web/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { WebEthereum } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof WebEthereum, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/ethereum-web/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "declaration": false, 13 | "emitDeclarationOnly": false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/ethereum-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/ethereum/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload-ethereum 2 | 3 | ## 0.0.16 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/upload@0.0.15 12 | 13 | ## 0.0.15 14 | 15 | ### Patch Changes 16 | 17 | - Update the bera RPC to mainnet 18 | 19 | ## 0.0.14 20 | 21 | ### Patch Changes 22 | 23 | - Improve transaction polling logic 24 | 25 | - Updated dependencies []: 26 | - @irys/upload-core@0.0.9 27 | - @irys/upload@0.0.14 28 | 29 | ## 0.0.13 30 | 31 | ### Patch Changes 32 | 33 | - Updated dependencies []: 34 | - @irys/upload@0.0.13 35 | 36 | ## 0.0.12 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies []: 41 | - @irys/upload-core@0.0.8 42 | - @irys/upload@0.0.12 43 | 44 | ## 0.0.11 45 | 46 | ### Patch Changes 47 | 48 | - Updated dependencies []: 49 | - @irys/upload-core@0.0.7 50 | - @irys/upload@0.0.11 51 | 52 | ## 0.0.10 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies []: 57 | - @irys/upload-core@0.0.6 58 | - @irys/upload@0.0.10 59 | 60 | ## 0.0.9 61 | 62 | ### Patch Changes 63 | 64 | - Updated dependencies []: 65 | - @irys/upload@0.0.9 66 | 67 | ## 0.0.8 68 | 69 | ### Patch Changes 70 | 71 | - Updated dependencies []: 72 | - @irys/upload@0.0.8 73 | 74 | ## 0.0.7 75 | 76 | ### Patch Changes 77 | 78 | - Updated dependencies []: 79 | - @irys/upload@0.0.7 80 | 81 | ## 0.0.6 82 | 83 | ### Patch Changes 84 | 85 | - Updated dependencies []: 86 | - @irys/upload-core@0.0.5 87 | - @irys/upload@0.0.6 88 | 89 | ## 0.0.5 90 | 91 | ### Patch Changes 92 | 93 | - Updated dependencies []: 94 | - @irys/upload-core@0.0.4 95 | - @irys/upload@0.0.5 96 | 97 | ## 0.0.4 98 | 99 | ### Patch Changes 100 | 101 | - Updated dependencies []: 102 | - @irys/upload-core@0.0.3 103 | - @irys/upload@0.0.4 104 | 105 | ## 0.0.3 106 | 107 | ### Patch Changes 108 | 109 | - Updated dependencies []: 110 | - @irys/upload-core@0.0.2 111 | - @irys/upload@0.0.3 112 | 113 | ## 0.0.2 114 | 115 | ### Patch Changes 116 | 117 | - Fix use of export paths for TypeScript 118 | 119 | - Updated dependencies []: 120 | - @irys/upload@0.0.2 121 | 122 | ## 0.0.1 123 | 124 | ### Patch Changes 125 | 126 | - v1 127 | 128 | - Updated dependencies []: 129 | - @irys/upload-core@0.0.1 130 | - @irys/upload@0.0.1 131 | -------------------------------------------------------------------------------- /packages/ethereum/README.md: -------------------------------------------------------------------------------- 1 | # ethereum 2 | 3 | Ethereum NodeJS token client for Irys network bundlers. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/sdk/install-configure 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/upload-ethereum 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/ethereum/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["./src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/ethereum/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-ethereum", 3 | "version": "0.0.16", 4 | "description": "Ethereum NodeJS token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": "./dist/esm/*.js", 27 | "require": "./dist/cjs/*.js" 28 | } 29 | }, 30 | "files": [ 31 | "/dist/cjs", 32 | "/dist/esm", 33 | "/dist/types", 34 | "/src" 35 | ], 36 | "scripts": { 37 | "lint": "eslint --ext js,ts,tsx src", 38 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 39 | "clean": "rimraf dist", 40 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 41 | "test": "ava" 42 | }, 43 | "dependencies": { 44 | "@ethersproject/bignumber": "^5.7.0", 45 | "@ethersproject/contracts": "^5.7.0", 46 | "@ethersproject/providers": "^5.7.2", 47 | "@ethersproject/wallet": "^5.7.0", 48 | "@irys/upload-core": "workspace:^", 49 | "@irys/upload": "workspace:^", 50 | "@irys/bundles": "^0.0.3", 51 | "bignumber.js": "^9.1.2" 52 | }, 53 | "devDependencies": { 54 | "@ava/typescript": "^5.0.0", 55 | "ava": "^6.1.3" 56 | }, 57 | "publishConfig": { 58 | "access": "public" 59 | }, 60 | "author": "Irys maintainers ", 61 | "homepage": "https://irys.xyz", 62 | "repository": { 63 | "url": "https://github.com/irys-xyz/js-sdk.git" 64 | }, 65 | "typedoc": { 66 | "entryPoint": "./src/index.ts", 67 | "readmeFile": "./README.md", 68 | "displayName": "ethereum-node" 69 | }, 70 | "ava": { 71 | "typescript": { 72 | "compile": false, 73 | "rewritePaths": { 74 | "src/": "dist/test/src/", 75 | "test/": "dist/test/test/" 76 | } 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /packages/ethereum/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Ethereum } from './clients'; 2 | export * from './clients'; 3 | export default Ethereum; 4 | -------------------------------------------------------------------------------- /packages/ethereum/src/irys.ts: -------------------------------------------------------------------------------- 1 | import BaseNodeIrys from '@irys/upload/base'; 2 | import BaseEthereumToken from './ethereum'; 3 | import type { NodeIrysConfig } from '@irys/upload/types'; 4 | 5 | export class EthereumIrys extends BaseNodeIrys { 6 | constructor({ url, key, config }: NodeIrysConfig) { 7 | super({ 8 | url, 9 | config, 10 | getTokenConfig: (irys) => 11 | new BaseEthereumToken({ 12 | irys, 13 | name: 'ethereum', 14 | ticker: 'ETH', 15 | providerUrl: config?.providerUrl ?? 'https://cloudflare-eth.com/', 16 | wallet: key, 17 | opts: config?.tokenOpts, 18 | }), 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/ethereum/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/ethereum/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | 3 | test('example test', async (t) => { 4 | t.is(typeof {}, 'object'); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/ethereum/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "declaration": false, 13 | "emitDeclarationOnly": false 14 | } 15 | } -------------------------------------------------------------------------------- /packages/ethereum/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "./src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/readme.md: -------------------------------------------------------------------------------- 1 | # Irys JS SDK monorepository 2 | This monorepo contains all the packages that comprise the Irys JS SDK 3 | 4 | 5 | 6 | ## Developer notes 7 | 8 | Some important 'gotchas': 9 | - While Node.JS/bundlers will resolve code through package.json export paths, Typescript *will NOT if it's moduleResolution is node* - so make sure all public facing types are exported/imported through index.ts barrel files. -------------------------------------------------------------------------------- /packages/solana-node/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload-solana 2 | 3 | ## 0.1.8 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/upload@0.0.15 12 | 13 | ## 0.1.7 14 | 15 | ### Patch Changes 16 | 17 | - Updated dependencies []: 18 | - @irys/upload-core@0.0.9 19 | - @irys/upload@0.0.14 20 | 21 | ## 0.1.6 22 | 23 | ### Patch Changes 24 | 25 | - Updated dependencies []: 26 | - @irys/upload@0.0.13 27 | 28 | ## 0.1.5 29 | 30 | ### Patch Changes 31 | 32 | - Updated dependencies []: 33 | - @irys/upload-core@0.0.8 34 | - @irys/upload@0.0.12 35 | 36 | ## 0.1.4 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies []: 41 | - @irys/upload-core@0.0.7 42 | - @irys/upload@0.0.11 43 | 44 | ## 0.1.3 45 | 46 | ### Patch Changes 47 | 48 | - Updated dependencies []: 49 | - @irys/upload-core@0.0.6 50 | - @irys/upload@0.0.10 51 | 52 | ## 0.1.2 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies []: 57 | - @irys/upload@0.0.9 58 | 59 | ## 0.1.1 60 | 61 | ### Patch Changes 62 | 63 | - Updated dependencies []: 64 | - @irys/upload@0.0.8 65 | 66 | ## 0.1.0 67 | 68 | ### Minor Changes 69 | 70 | - Rename eclipse to eclipse-eth 71 | 72 | ## 0.0.8 73 | 74 | ### Patch Changes 75 | 76 | - Rename exports, add explicit SPL initializer for contractAddress 77 | 78 | ## 0.0.7 79 | 80 | ### Patch Changes 81 | 82 | - Add SPL support to web-solana + misc fixes 83 | 84 | - Updated dependencies []: 85 | - @irys/upload@0.0.7 86 | 87 | ## 0.0.6 88 | 89 | ### Patch Changes 90 | 91 | - Updated dependencies []: 92 | - @irys/upload-core@0.0.5 93 | - @irys/upload@0.0.6 94 | 95 | ## 0.0.5 96 | 97 | ### Patch Changes 98 | 99 | - Add support for SPL tokens 100 | 101 | - Updated dependencies []: 102 | - @irys/upload-core@0.0.4 103 | - @irys/upload@0.0.5 104 | 105 | ## 0.0.4 106 | 107 | ### Patch Changes 108 | 109 | - Updated dependencies []: 110 | - @irys/upload-core@0.0.3 111 | - @irys/upload@0.0.4 112 | 113 | ## 0.0.3 114 | 115 | ### Patch Changes 116 | 117 | - Updated dependencies []: 118 | - @irys/upload-core@0.0.2 119 | - @irys/upload@0.0.3 120 | 121 | ## 0.0.2 122 | 123 | ### Patch Changes 124 | 125 | - Fix use of export paths for TypeScript 126 | 127 | - Updated dependencies []: 128 | - @irys/upload@0.0.2 129 | 130 | ## 0.0.1 131 | 132 | ### Patch Changes 133 | 134 | - v1 135 | 136 | - Updated dependencies []: 137 | - @irys/upload-core@0.0.1 138 | - @irys/upload@0.0.1 139 | -------------------------------------------------------------------------------- /packages/solana-node/README.md: -------------------------------------------------------------------------------- 1 | # solana-node 2 | 3 | Solana NodeJS token client for Irys network bundlers. 4 | 5 | ## Docs 6 | 7 | https://docs.irys.xyz/build/d/irys-in-the-browser#solana 8 | 9 | ## Installation 10 | 11 | ```sh 12 | npm install @irys/upload-solana 13 | ``` 14 | -------------------------------------------------------------------------------- /packages/solana-node/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/solana-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-solana", 3 | "version": "0.1.8", 4 | "description": "Solana NodeJS token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/bundles": "^0.0.3", 51 | "@irys/upload": "workspace:^", 52 | "@irys/upload-core": "workspace:^", 53 | "@solana/spl-token": "^0.4.8", 54 | "@solana/web3.js": "^1.95.3", 55 | "async-retry": "^1.3.3", 56 | "bignumber.js": "^9.1.2", 57 | "bs58": "5.0.0", 58 | "tweetnacl": "^1.0.3" 59 | }, 60 | "devDependencies": { 61 | "@ava/typescript": "^5.0.0", 62 | "@types/async-retry": "^1.4.8", 63 | "@types/bn.js": "^5.1.5", 64 | "ava": "^6.1.3" 65 | }, 66 | "publishConfig": { 67 | "access": "public" 68 | }, 69 | "author": "Irys maintainers ", 70 | "homepage": "https://irys.xyz", 71 | "repository": { 72 | "url": "https://github.com/irys-xyz/js-sdk.git" 73 | }, 74 | "typedoc": { 75 | "entryPoint": "./src/index.ts", 76 | "readmeFile": "./README.md", 77 | "displayName": "solana-node" 78 | }, 79 | "ava": { 80 | "typescript": { 81 | "compile": false, 82 | "rewritePaths": { 83 | "src/": "dist/test/src/", 84 | "test/": "dist/test/test/" 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /packages/solana-node/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Solana } from './solana'; 2 | export * from './solana'; 3 | export default Solana; 4 | -------------------------------------------------------------------------------- /packages/solana-node/src/solana.ts: -------------------------------------------------------------------------------- 1 | import BaseSolanaToken from './token'; 2 | import { Constructable, type TokenConfigTrimmed } from '@irys/upload'; 3 | import { BaseNodeToken } from '@irys/upload/tokens/base'; 4 | import BaseSPLToken from './spl'; 5 | 6 | export class SolanaToken extends BaseSolanaToken { 7 | constructor(config: TokenConfigTrimmed) { 8 | super({ 9 | name: 'solana', 10 | ticker: 'SOL', 11 | ...config, 12 | providerUrl: config.providerUrl ?? 'https://api.mainnet-beta.solana.com/', 13 | }); 14 | } 15 | } 16 | 17 | function getBoundSolana({ 18 | name, 19 | ticker, 20 | providerUrl, 21 | }: { 22 | name: string; 23 | ticker: string; 24 | providerUrl: string; 25 | }) { 26 | return class SolanaToken extends BaseSolanaToken { 27 | constructor(config: TokenConfigTrimmed) { 28 | super({ 29 | name, 30 | ticker, 31 | ...config, 32 | providerUrl: config.providerUrl ?? providerUrl, 33 | }); 34 | } 35 | }; 36 | } 37 | 38 | // export function SolanaBundlerIrys(opts?: { finality?: Finality; disablePriorityFees?: boolean } ) { 39 | // // return a builder 40 | // return new Builder(SolanaToken).withTokenOptions(opts) 41 | // } 42 | // export default SolanaBundlerIrys 43 | 44 | // export function EclipseBundlerIrys(opts?: { finality?: Finality; disablePriorityFees?: boolean } ) { 45 | // return new Builder(getBoundSolana({name: "eclipse", ticker: "ETH", providerUrl: "https://mainnetbeta-rpc.eclipse.xyz"})) 46 | // .withTokenOptions(opts) 47 | // } 48 | 49 | export const Solana: Constructable<[TokenConfigTrimmed], BaseNodeToken> = 50 | SolanaToken; 51 | export default Solana; 52 | 53 | export const EclipseEth: Constructable<[TokenConfigTrimmed], BaseNodeToken> = 54 | getBoundSolana({ 55 | name: 'eclipse-eth', 56 | ticker: 'ETH', 57 | providerUrl: 'https://mainnetbeta-rpc.eclipse.xyz', 58 | }); 59 | 60 | function getBoundSPL({ 61 | name, 62 | ticker, 63 | providerUrl, 64 | contractAddress, 65 | }: { 66 | name: string; 67 | ticker: string; 68 | providerUrl: string; 69 | contractAddress: string; 70 | }) { 71 | return class SPLToken extends BaseSPLToken { 72 | constructor(config: TokenConfigTrimmed) { 73 | super({ 74 | name, 75 | ticker, 76 | ...config, 77 | providerUrl: config.providerUrl ?? providerUrl, 78 | contractAddress: config?.opts?.contractAddress ?? contractAddress, 79 | }); 80 | } 81 | }; 82 | } 83 | 84 | export const USDCSolana: Constructable<[TokenConfigTrimmed], BaseNodeToken> = 85 | getBoundSPL({ 86 | name: 'usdc-solana', 87 | ticker: 'USDC', 88 | providerUrl: 'https://api.mainnet-beta.solana.com/', 89 | contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', 90 | }); 91 | -------------------------------------------------------------------------------- /packages/solana-node/test/exports.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { Solana, USDCSolana } from '../src'; 3 | 4 | test('exports tokens', async (t) => { 5 | t.is(typeof Solana, 'function'); 6 | t.is(typeof USDCSolana, 'function'); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/solana-node/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/solana-node/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/solana-node/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/solana-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/solana-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/web-upload-solana 2 | 3 | ## 0.1.8 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/web-upload@0.0.15 12 | 13 | ## 0.1.7 14 | 15 | ### Patch Changes 16 | 17 | - Updated dependencies []: 18 | - @irys/upload-core@0.0.9 19 | - @irys/web-upload@0.0.14 20 | 21 | ## 0.1.6 22 | 23 | ### Patch Changes 24 | 25 | - Updated dependencies []: 26 | - @irys/web-upload@0.0.13 27 | 28 | ## 0.1.5 29 | 30 | ### Patch Changes 31 | 32 | - Updated dependencies []: 33 | - @irys/upload-core@0.0.8 34 | - @irys/web-upload@0.0.12 35 | 36 | ## 0.1.4 37 | 38 | ### Patch Changes 39 | 40 | - Updated dependencies []: 41 | - @irys/upload-core@0.0.7 42 | - @irys/web-upload@0.0.11 43 | 44 | ## 0.1.3 45 | 46 | ### Patch Changes 47 | 48 | - Updated dependencies []: 49 | - @irys/upload-core@0.0.6 50 | - @irys/web-upload@0.0.10 51 | 52 | ## 0.1.2 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies []: 57 | - @irys/web-upload@0.0.9 58 | 59 | ## 0.1.1 60 | 61 | ### Patch Changes 62 | 63 | - Updated dependencies []: 64 | - @irys/web-upload@0.0.8 65 | 66 | ## 0.1.0 67 | 68 | ### Minor Changes 69 | 70 | - Rename eclipse to eclipse-eth 71 | 72 | ## 0.0.8 73 | 74 | ### Patch Changes 75 | 76 | - Rename exports, add explicit SPL initializer for contractAddress 77 | 78 | ## 0.0.7 79 | 80 | ### Patch Changes 81 | 82 | - Add SPL support to web-solana + misc fixes 83 | 84 | - Updated dependencies []: 85 | - @irys/web-upload@0.0.7 86 | 87 | ## 0.0.6 88 | 89 | ### Patch Changes 90 | 91 | - Updated dependencies []: 92 | - @irys/upload-core@0.0.5 93 | - @irys/web-upload@0.0.6 94 | 95 | ## 0.0.5 96 | 97 | ### Patch Changes 98 | 99 | - Updated dependencies []: 100 | - @irys/upload-core@0.0.4 101 | - @irys/web-upload@0.0.5 102 | 103 | ## 0.0.4 104 | 105 | ### Patch Changes 106 | 107 | - Updated dependencies []: 108 | - @irys/upload-core@0.0.3 109 | - @irys/web-upload@0.0.4 110 | 111 | ## 0.0.3 112 | 113 | ### Patch Changes 114 | 115 | - Updated dependencies []: 116 | - @irys/upload-core@0.0.2 117 | - @irys/web-upload@0.0.3 118 | 119 | ## 0.0.2 120 | 121 | ### Patch Changes 122 | 123 | - Updated dependencies []: 124 | - @irys/web-upload@0.0.2 125 | 126 | ## 0.0.1 127 | 128 | ### Patch Changes 129 | 130 | - v1 131 | 132 | - Updated dependencies []: 133 | - @irys/upload-core@0.0.1 134 | - @irys/web-upload@0.0.1 135 | -------------------------------------------------------------------------------- /packages/solana-web/README.md: -------------------------------------------------------------------------------- 1 | # solana-web 2 | 3 | Solana web token client for Irys network bundlers. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/web-upload-solana 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/solana-web/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/solana-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload-solana", 3 | "version": "0.1.8", 4 | "description": "Solana web token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/upload-core": "workspace:^", 51 | "@irys/web-upload": "workspace:^", 52 | "@irys/bundles": "^0.0.3", 53 | "bignumber.js": "^9.1.2", 54 | "@solana/spl-token": "^0.4.8", 55 | "bs58": "5.0.0", 56 | "tweetnacl": "^1.0.3", 57 | "async-retry": "^1.3.3", 58 | "@solana/web3.js": "^1.95.3" 59 | }, 60 | "devDependencies": { 61 | "@types/async-retry": "^1.4.8", 62 | "@types/bn.js": "^5.1.5", 63 | "@ava/typescript": "^5.0.0", 64 | "ava": "^6.1.3" 65 | }, 66 | "publishConfig": { 67 | "access": "public" 68 | }, 69 | "author": "Irys maintainers ", 70 | "homepage": "https://irys.xyz", 71 | "repository": { 72 | "url": "https://github.com/irys-xyz/js-sdk.git" 73 | }, 74 | "typedoc": { 75 | "entryPoint": "./src/index.ts", 76 | "readmeFile": "./README.md", 77 | "displayName": "solana-web" 78 | }, 79 | "ava": { 80 | "typescript": { 81 | "compile": false, 82 | "rewritePaths": { 83 | "src/": "dist/test/src/", 84 | "test/": "dist/test/test/" 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /packages/solana-web/src/index.ts: -------------------------------------------------------------------------------- 1 | import WebSolana from './solana'; 2 | export { WebSolana }; 3 | export * from './solana'; 4 | export default WebSolana; 5 | -------------------------------------------------------------------------------- /packages/solana-web/src/solana.ts: -------------------------------------------------------------------------------- 1 | import BaseSolanaToken from './token'; 2 | import { 3 | type ConstructableWebToken, 4 | type TokenConfigTrimmed, 5 | } from '@irys/web-upload'; 6 | import BaseSPLToken from './spl'; 7 | 8 | export class SolanaToken extends BaseSolanaToken { 9 | constructor(config: TokenConfigTrimmed) { 10 | super({ 11 | name: 'solana', 12 | ticker: 'SOL', 13 | ...config, 14 | providerUrl: config.providerUrl ?? 'https://api.mainnet-beta.solana.com/', 15 | }); 16 | } 17 | } 18 | 19 | function getBoundSolana({ 20 | name, 21 | ticker, 22 | providerUrl, 23 | }: { 24 | name: string; 25 | ticker: string; 26 | providerUrl: string; 27 | }) { 28 | return class SolanaToken extends BaseSolanaToken { 29 | constructor(config: TokenConfigTrimmed) { 30 | super({ 31 | name, 32 | ticker, 33 | ...config, 34 | providerUrl: config.providerUrl ?? providerUrl, 35 | }); 36 | } 37 | }; 38 | } 39 | 40 | // export function SolanaBundlerWebIrys(opts?: { finality?: Finality; disablePriorityFees?: boolean } ) { 41 | // // return a builder 42 | // return new Builder(SolanaToken).withTokenOptions(opts) 43 | // } 44 | // export default SolanaBundlerWebIrys 45 | 46 | // export function EclipseBundlerWebIrys(opts?: { finality?: Finality; disablePriorityFees?: boolean } ) { 47 | // return new Builder(getBoundSolana({name: "eclipse", ticker: "ETH", providerUrl: "https://mainnetbeta-rpc.eclipse.xyz"})) 48 | // .withTokenOptions(opts) 49 | // } 50 | 51 | export const WebSolana: ConstructableWebToken = SolanaToken; 52 | export default WebSolana; 53 | export const WebEclipseEth: ConstructableWebToken = getBoundSolana({ 54 | name: 'eclipse-eth', 55 | ticker: 'ETH', 56 | providerUrl: 'https://mainnetbeta-rpc.eclipse.xyz', 57 | }); 58 | 59 | function getBoundSPL({ 60 | name, 61 | ticker, 62 | providerUrl, 63 | contractAddress, 64 | }: { 65 | name: string; 66 | ticker: string; 67 | providerUrl: string; 68 | contractAddress: string; 69 | }) { 70 | return class SPLToken extends BaseSPLToken { 71 | constructor(config: TokenConfigTrimmed) { 72 | super({ 73 | name, 74 | ticker, 75 | ...config, 76 | providerUrl: config.providerUrl ?? providerUrl, 77 | contractAddress: config?.opts?.contractAddress ?? contractAddress, 78 | }); 79 | } 80 | }; 81 | } 82 | 83 | export const WebUSDCSolana: ConstructableWebToken = getBoundSPL({ 84 | name: 'usdc-solana', 85 | ticker: 'USDC', 86 | providerUrl: 'https://api.mainnet-beta.solana.com/', 87 | contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', 88 | }); 89 | -------------------------------------------------------------------------------- /packages/solana-web/test/exports.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { WebSolana, WebUSDCSolana } from '../src'; 3 | 4 | test('exports tokens', async (t) => { 5 | t.is(typeof WebSolana, 'function'); 6 | t.is(typeof WebUSDCSolana, 'function'); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/solana-web/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/solana-web/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/solana-web/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/solana-web/tsconfig-webpack.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": false, 4 | "module": "esnext", 5 | "target": "esnext", 6 | "moduleResolution": "bundler", 7 | "composite": false, 8 | "outDir": "dist/esm", 9 | "rootDir": "./src", 10 | "sourceMap": true, 11 | "noEmit": false, 12 | "noEmitOnError": true, 13 | // "emitDeclarationOnly": true, 14 | "allowJs": false, 15 | "alwaysStrict": true, 16 | "skipLibCheck": true, 17 | "noUnusedLocals": true, 18 | "strictNullChecks": true, 19 | "noImplicitAny": true, 20 | "noImplicitThis": true, 21 | "noImplicitReturns": false, 22 | "importHelpers": true, 23 | "strict": true, 24 | "isolatedModules": true, 25 | "resolveJsonModule": true, 26 | "esModuleInterop": true, 27 | "removeComments": false 28 | }, 29 | "include": ["src/**/*"] 30 | } 31 | -------------------------------------------------------------------------------- /packages/solana-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src/**/*", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/starknet-node/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload-starknet 2 | 3 | ## 0.0.1 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | - @irys/upload@0.0.15 12 | -------------------------------------------------------------------------------- /packages/starknet-node/README.md: -------------------------------------------------------------------------------- 1 | # starknet 2 | 3 | TODO 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/upload-starknet 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/starknet-node/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/starknet-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-starknet", 3 | "version": "0.0.1", 4 | "description": "Starknet NodeJS token client for Irys network bundlers", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/bundles": "^0.0.3", 51 | "@irys/upload": "workspace:^", 52 | "@irys/upload-core": "workspace:^", 53 | "bignumber.js": "^9.1.2", 54 | "starknet": "^6.21.0" 55 | }, 56 | "devDependencies": { 57 | "@ava/typescript": "^5.0.0", 58 | "ava": "^6.1.3" 59 | }, 60 | "publishConfig": { 61 | "access": "public" 62 | }, 63 | "author": "Irys maintainers ", 64 | "homepage": "https://irys.xyz", 65 | "repository": { 66 | "url": "https://github.com/irys-xyz/js-sdk.git" 67 | }, 68 | "typedoc": { 69 | "entryPoint": "./src/index.ts", 70 | "readmeFile": "./README.md", 71 | "displayName": "starknet-node" 72 | }, 73 | "ava": { 74 | "typescript": { 75 | "compile": false, 76 | "rewritePaths": { 77 | "src/": "dist/test/src/", 78 | "test/": "dist/test/test/" 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /packages/starknet-node/src/client.ts: -------------------------------------------------------------------------------- 1 | import { BaseNodeToken } from '@irys/upload/tokens/base'; 2 | import { Constructable, type TokenConfigTrimmed } from '@irys/upload/builder'; 3 | import BaseSTRK20Token from './token'; 4 | 5 | const STARKNET_PROVIDER_URL = 'https://starknet-mainnet.public.blastapi.io'; 6 | const KNOWN_CONTRACTS: { 7 | [key: string]: { address: string; base: [string, number] }; 8 | } = { 9 | ETH: { 10 | address: 11 | '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', 12 | base: ['wei', 10 ** 18], 13 | }, 14 | STRK: { 15 | address: 16 | '0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d', 17 | base: ['fri', 10 ** 18], 18 | }, 19 | }; 20 | 21 | // set stark token as default 22 | 23 | // function getBoundERC20(name: string, ticker: string, contractAddress: string, contractBase: STRKTokenConfig["contractBase"]) { 24 | // // address is a required parameter, as we can't derive it from the private key 25 | // const a = (address: string): Constructable<[TokenConfigTrimmed], BaseSTRK20Token> => { 26 | // return class extends BaseSTRK20Token { 27 | // constructor(config: TokenConfigTrimmed) { 28 | // super({ 29 | // name, 30 | // ticker, 31 | // ...config, 32 | // providerUrl: config.providerUrl ?? STARKNET_PROVIDER_URL, 33 | // contractAddress: config.opts?.contractAddress ?? contractAddress, 34 | // address, 35 | // contractBase 36 | // }); 37 | // } 38 | // }; 39 | // } 40 | // return a 41 | // } 42 | 43 | // // config to use starknetETH 44 | // export const StarknetEth = getBoundERC20("starknet-eth", "ETH", KNOWN_CONTRACTS.ETH.address, KNOWN_CONTRACTS.ETH.base); 45 | 46 | export const Starknet = ( 47 | address: string 48 | ): Constructable<[TokenConfigTrimmed], BaseNodeToken> => { 49 | return class StarknetToken extends BaseSTRK20Token { 50 | constructor(config: TokenConfigTrimmed) { 51 | super({ 52 | name: 'starknet', 53 | ticker: 'STRK', 54 | ...config, 55 | contractAddress: 56 | config.opts?.contractAddress ?? KNOWN_CONTRACTS.STRK.address, 57 | address, 58 | providerUrl: config.providerUrl ?? STARKNET_PROVIDER_URL, 59 | contractBase: KNOWN_CONTRACTS.STRK.base, 60 | }); 61 | } 62 | }; 63 | }; 64 | 65 | export default Starknet; 66 | -------------------------------------------------------------------------------- /packages/starknet-node/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './token'; 2 | export * from './client'; 3 | import { Starknet } from './client'; 4 | export { Starknet }; 5 | export default Starknet; 6 | -------------------------------------------------------------------------------- /packages/starknet-node/src/irys.ts: -------------------------------------------------------------------------------- 1 | import BaseNodeIrys from '@irys/upload/base'; 2 | import BaseStarknetToken from './token'; 3 | import type { IrysConfig } from '@irys/upload-core'; 4 | 5 | type TokenOptions = { 6 | privateKey?: string; 7 | address?: string; 8 | tokenBase: [string, number | undefined]; 9 | }; 10 | 11 | // Update the NodeIrysConfig type to include TokenOptions for tokenOpts 12 | interface NodeIrysConfig { 13 | url: string; 14 | key: string; 15 | config?: IrysConfig; 16 | tokenOpts: TokenOptions; 17 | } 18 | export default class StarknetIrys extends BaseNodeIrys { 19 | constructor({ url, key, config, tokenOpts }: NodeIrysConfig) { 20 | super({ 21 | url, 22 | config, 23 | getTokenConfig: (irys) => 24 | new BaseStarknetToken({ 25 | irys, 26 | name: 'starknet', 27 | ticker: 'STRK', 28 | providerUrl: config?.providerUrl ?? '', 29 | wallet: key, 30 | opts: config?.tokenOpts, 31 | address: tokenOpts?.address ?? '', 32 | contractAddress: config?.contractAddress ?? '', 33 | contractBase: tokenOpts.tokenBase, 34 | }), 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/starknet-node/src/walletConfig.ts: -------------------------------------------------------------------------------- 1 | import { Result } from 'starknet'; 2 | 3 | const hexStringPostProcessor = (result: Result): Buffer => { 4 | const result2 = (result as any[])[0]; 5 | if (!(typeof result2 === 'string')) 6 | throw new Error(`Incorrect result ${result2}, expected hex string`); 7 | return Buffer.from( 8 | result2.startsWith('0x') ? result2.slice(2) : result2, 9 | 'hex' 10 | ); 11 | }; 12 | 13 | export const KnownAccountContracts = new Map([ 14 | [ 15 | 1, 16 | { 17 | name: 'Argent', 18 | abi: [ 19 | { 20 | name: 'argent::account::interface::IArgentUserAccount', 21 | type: 'interface', 22 | items: [ 23 | { 24 | name: 'get_owner', 25 | type: 'function', 26 | inputs: [], 27 | outputs: [ 28 | { 29 | type: 'core::felt252', 30 | }, 31 | ], 32 | state_mutability: 'view', 33 | }, 34 | ], 35 | }, 36 | ], 37 | selector: 'get_owner', 38 | version: '1.0.0', 39 | postProcessor: hexStringPostProcessor, 40 | }, 41 | ], 42 | [ 43 | 2, 44 | { 45 | name: 'Braavos', 46 | abi: [ 47 | { 48 | name: 'braavos_account::signers::interface::ISignerManagement', 49 | type: 'interface', 50 | items: [ 51 | { 52 | name: 'get_public_key', 53 | type: 'function', 54 | inputs: [], 55 | outputs: [ 56 | { 57 | type: 'core::felt252', 58 | }, 59 | ], 60 | state_mutability: 'view', 61 | }, 62 | ], 63 | }, 64 | ], 65 | selector: 'get_public_key', 66 | version: '1.0.0', 67 | postProcessor: hexStringPostProcessor, 68 | }, 69 | ], 70 | ]); 71 | -------------------------------------------------------------------------------- /packages/starknet-node/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/starknet-node/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/starknet-node/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { Starknet } from '../src/client'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof Starknet, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/starknet-node/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/starknet-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/upload-core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload-core 2 | 3 | ## 0.0.10 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | ## 0.0.9 10 | 11 | ### Patch Changes 12 | 13 | - Improve transaction polling logic 14 | 15 | ## 0.0.8 16 | 17 | ### Patch Changes 18 | 19 | - Expose IrysTransaction.getPrice 20 | 21 | ## 0.0.7 22 | 23 | ### Patch Changes 24 | 25 | - Update SDK methods 26 | 27 | ## 0.0.6 28 | 29 | ### Patch Changes 30 | 31 | - Add tags support to getPrice 32 | 33 | ## 0.0.5 34 | 35 | ### Patch Changes 36 | 37 | - Fix uploadBundle and CLI default network 38 | 39 | ## 0.0.4 40 | 41 | ### Patch Changes 42 | 43 | - Add support for SPL tokens 44 | 45 | ## 0.0.3 46 | 47 | ### Patch Changes 48 | 49 | - Streamline Network and URL logic 50 | 51 | ## 0.0.2 52 | 53 | ### Patch Changes 54 | 55 | - Fix remaining non-index exports for TS when moduleResolution = node 56 | 57 | ## 0.0.1 58 | 59 | ### Patch Changes 60 | 61 | - v1 62 | -------------------------------------------------------------------------------- /packages/upload-core/README.md: -------------------------------------------------------------------------------- 1 | # client-core 2 | 3 | Core multi-platform Irys network bundler client library. 4 | 5 | ## Installation 6 | 7 | You shouldn't need to install this package directly, but if you must: 8 | 9 | ```sh 10 | npm install @irys/upload-core 11 | ``` 12 | -------------------------------------------------------------------------------- /packages/upload-core/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/upload-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-core", 3 | "version": "0.0.10", 4 | "description": "Core multiplatform Irys network bundler client library", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "./dist/esm/index.js", 8 | "main": "./dist/cjs/index.js", 9 | "types": "./dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "./dist/cjs", 38 | "./dist/esm", 39 | "./dist/types", 40 | "./src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "devDependencies": { 50 | "@ava/typescript": "^5.0.0", 51 | "@types/async-retry": "^1.4.8", 52 | "ava": "^6.1.3" 53 | }, 54 | "publishConfig": { 55 | "access": "public" 56 | }, 57 | "author": "Irys maintainers ", 58 | "homepage": "https://irys.xyz", 59 | "repository": { 60 | "url": "https://github.com/irys-xyz/js-sdk.git" 61 | }, 62 | "typedoc": { 63 | "entryPoint": "./src/index.ts", 64 | "readmeFile": "./README.md", 65 | "displayName": "core" 66 | }, 67 | "ava": { 68 | "typescript": { 69 | "compile": false, 70 | "rewritePaths": { 71 | "src/": "dist/test/src/", 72 | "test/": "dist/test/test/" 73 | } 74 | } 75 | }, 76 | "dependencies": { 77 | "@irys/query": "^0.0.9", 78 | "@supercharge/promise-pool": "^3.1.1", 79 | "@irys/bundles": "^0.0.3", 80 | "async-retry": "^1.3.3", 81 | "axios": "^1.7.5", 82 | "base64url": "^3.0.1", 83 | "bignumber.js": "^9.1.2" 84 | } 85 | } -------------------------------------------------------------------------------- /packages/upload-core/src/builder.ts: -------------------------------------------------------------------------------- 1 | // import Irys from "./irys"; 2 | 3 | // export class IrysBuilder { 4 | // protected irysClass: TReturn; 5 | 6 | // public async build(): Promise { 7 | // return new this.irysClass() 8 | // } 9 | 10 | // // Promise contract functions, so users can `await` a builder instance to resolve the built client. 11 | // // very cool, thanks Knex. 12 | // /** 13 | // * Resolves `this` by building & initializing all the registered components 14 | // * @param onFulfilled - optional onFulfilled callback 15 | // * @returns - all results for built query 16 | // */ 17 | // public async then( 18 | // onFulfilled?: ((value: TReturn) => any | PromiseLike) | undefined | null, 19 | // onRejected?: (value: Error) => any | PromiseLike | undefined | null, 20 | // ): Promise { 21 | // return this.build().then(onFulfilled, onRejected); 22 | // } 23 | 24 | // public async catch(onReject?: ((value: TReturn) => any | PromiseLike) | undefined | null): Promise { 25 | // return this.then().catch(onReject); 26 | // } 27 | 28 | // public async finally(onFinally?: (() => void) | null | undefined): Promise { 29 | // return this.then().finally(onFinally); 30 | // } 31 | // } 32 | -------------------------------------------------------------------------------- /packages/upload-core/src/hack.ts: -------------------------------------------------------------------------------- 1 | // crypto hack - this is to stop arweave-js's import time(!!!) check for `subtleCrypto` - which occurs if you try to use the root import of this SDK. 2 | const hack = (): void => { 3 | throw new Error(`Unimplemented`); 4 | }; 5 | // @ts-expect-error hack 6 | globalThis.crypto ??= {}; 7 | // @ts-expect-error hack 8 | globalThis.crypto.subtle ??= {}; 9 | // @ts-expect-error hack 10 | globalThis.crypto.subtle.generateKey ??= hack; 11 | // @ts-expect-error hack 12 | globalThis.crypto.subtle.importKey ??= hack; 13 | // @ts-expect-error hack 14 | globalThis.crypto.subtle.exportKey ??= hack; 15 | // @ts-expect-error hack 16 | globalThis.crypto.subtle.digest ??= hack; 17 | // @ts-expect-error hack 18 | globalThis.crypto.subtle.sign ??= hack; 19 | 20 | export default hack; 21 | -------------------------------------------------------------------------------- /packages/upload-core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './api'; 2 | export * from './approval'; 3 | export * from './chunkingUploader'; 4 | export * from './fund'; 5 | export * from './irys'; 6 | export * from './transaction'; 7 | export * from './transactions'; 8 | export * from './types'; 9 | export * from './upload'; 10 | export * from './utils'; 11 | export * from './withdrawal'; 12 | -------------------------------------------------------------------------------- /packages/upload-core/src/transactions.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosResponse } from 'axios'; 2 | import type Irys from './irys'; 3 | import type { TxGqlNode, TxGqlResponse } from './types'; 4 | 5 | export class Transaction { 6 | protected irys: Irys; 7 | constructor(irys: Irys) { 8 | this.irys = irys; 9 | } 10 | 11 | public async getById(id: string): Promise { 12 | const res = (await this.query({ ids: [id], limit: 1 })).at(0); 13 | if (!res) throw new Error(`Unable to locate tx with id ${id}`); 14 | return res; 15 | } 16 | 17 | public async getByOwner(owner: string): Promise { 18 | const res = (await this.query({ owners: [owner], limit: 1 })).at(0); 19 | if (!res) throw new Error(`Unable to locate tx with owner ${owner}`); 20 | return res; 21 | } 22 | 23 | public async getByTag(name: string, value: string): Promise { 24 | const res = ( 25 | await this.query({ tags: [{ name, values: [value] }], limit: 1 }) 26 | ).at(0); 27 | if (!res) throw new Error(`Unable to locate tx with tag ${name}:${value}`); 28 | return res; 29 | } 30 | 31 | public async query(parameters: { 32 | order?: 'desc' | 'asc'; 33 | ids?: string[]; 34 | limit?: number; 35 | after?: string; 36 | currency?: string; 37 | owners?: string[]; 38 | hasTags?: boolean; 39 | tags?: { name: string; values: string[] }[]; 40 | }): Promise { 41 | // full bundler node GQL query 42 | const query = ` 43 | query ($ids: [String!], $after: String, $currency: String, $owners: [String!], $limit: Int, $order: SortOrder, $hasTags: Boolean, $tags: [TagFilter!]) { 44 | transactions(ids: $ids, after: $after, currency: $currency, owners: $owners, limit: $limit, order: $order, hasTags: $hasTags, tags: $tags) { 45 | edges { 46 | cursor 47 | node { 48 | address 49 | currency 50 | id 51 | receipt { 52 | deadlineHeight 53 | signature 54 | timestamp 55 | version 56 | } 57 | signature 58 | tags { 59 | name 60 | value 61 | } 62 | timestamp 63 | } 64 | } 65 | pageInfo { 66 | endCursor 67 | hasNextPage 68 | } 69 | } 70 | } 71 | `; 72 | const txs: TxGqlNode[] = []; 73 | let endCursor: string | null = null; 74 | do { 75 | const gqlRes: AxiosResponse = await this.irys.api.post( 76 | '/graphql', 77 | { 78 | query, 79 | variables: { ...parameters, after: endCursor ?? parameters.after }, 80 | }, 81 | undefined 82 | ); 83 | endCursor = gqlRes.data.data.transactions?.pageInfo?.hasNextPage 84 | ? gqlRes.data.data.transactions.pageInfo.endCursor 85 | : null; 86 | txs.push(...gqlRes.data.data.transactions.edges.map((t) => t.node)); 87 | } while (endCursor); 88 | 89 | return txs; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /packages/upload-core/src/withdrawal.ts: -------------------------------------------------------------------------------- 1 | import Utils from './utils'; 2 | import BigNumber from 'bignumber.js'; 3 | import type Api from './api'; 4 | import base64url from 'base64url'; 5 | import type { WithdrawalResponse } from './types'; 6 | 7 | /** 8 | * Create and send a withdrawal request 9 | * @param utils Instance of Utils 10 | * @param api Instance of API 11 | * @param wallet Wallet to use 12 | * @param amount amount to withdraw in winston 13 | * @returns the response from the bundler 14 | */ 15 | export async function withdrawBalance( 16 | utils: Utils, 17 | api: Api, 18 | amount: BigNumber.Value | 'all' 19 | ): Promise { 20 | const c = utils.tokenConfig; 21 | const { deepHash, stringToBuffer } = c.irys.bundles; 22 | const pkey = await c.getPublicKey(); 23 | const withdrawAll = amount === 'all'; 24 | const data = { 25 | publicKey: pkey, 26 | currency: utils.token, 27 | amount: withdrawAll ? 'all' : new BigNumber(amount).toString(), 28 | nonce: await utils.getNonce(), 29 | signature: '', 30 | sigType: c.getSigner().signatureType, 31 | }; 32 | const deephash = await deepHash([ 33 | stringToBuffer(data.currency), 34 | stringToBuffer(data.amount.toString()), 35 | stringToBuffer(data.nonce.toString()), 36 | ]); 37 | if (!Buffer.isBuffer(data.publicKey)) { 38 | data.publicKey = Buffer.from(data.publicKey); 39 | } 40 | 41 | const signature = await c.sign(deephash); 42 | const isValid = await c.verify(data.publicKey, deephash, signature); 43 | 44 | data.publicKey = base64url.encode(data.publicKey); 45 | data.signature = base64url.encode(Buffer.from(signature)); 46 | 47 | const cpk = base64url.toBuffer(data.publicKey); 48 | const csig = base64url.toBuffer(data.signature); 49 | 50 | // should match opk and csig 51 | const dh2 = await deepHash([ 52 | stringToBuffer(data.currency), 53 | stringToBuffer(data.amount.toString()), 54 | stringToBuffer(data.nonce.toString()), 55 | ]); 56 | 57 | const isValid2 = await c.verify(cpk, dh2, csig); 58 | const isValid3 = 59 | (await c.ownerToAddress( 60 | c.name == 'arweave' 61 | ? base64url.decode(data.publicKey) 62 | : base64url.toBuffer(data.publicKey) 63 | )) === c.address; 64 | 65 | if (!(isValid || isValid2 || isValid3)) { 66 | throw new Error( 67 | `Internal withdrawal validation failed - please report this!\nDebug Info:${JSON.stringify(data)}` 68 | ); 69 | } 70 | 71 | const res = await api.post('/account/withdraw', data); 72 | 73 | if (res.status === 202) { 74 | // node has timed/erroed out confirming the withdrawal 75 | const txId = res.data.tx_id; 76 | const withdrawalConfirmed = await utils.confirmationPoll(txId); 77 | if (!(withdrawalConfirmed === true)) 78 | throw new Error( 79 | `Unable to confirm withdrawal tx ${txId} ${withdrawalConfirmed ? withdrawalConfirmed?.toString() : ''}` 80 | ); 81 | } else { 82 | Utils.checkAndThrow(res, 'Withdrawing balance'); 83 | } 84 | return res.data; 85 | } 86 | -------------------------------------------------------------------------------- /packages/upload-core/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs named exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | 9 | t.true(exportedKeys.includes('sleep')); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/upload-core/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm named exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | 9 | t.true(exportedKeys.includes('sleep')); 10 | }); 11 | -------------------------------------------------------------------------------- /packages/upload-core/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | // import { MySigner } from '../src'; 3 | import { Irys } from '../src'; 4 | test('example test', async (t) => { 5 | t.is(typeof Irys, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/upload-core/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "include": [ 4 | "./**/*" 5 | ], 6 | "compilerOptions": { 7 | "module": "Node16", 8 | "moduleResolution": "Node16", 9 | "outDir": "../dist/test", 10 | "declarationDir": null, 11 | "declaration": false, 12 | "emitDeclarationOnly": false 13 | } 14 | } -------------------------------------------------------------------------------- /packages/upload-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/upload-node/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/upload 2 | 3 | ## 0.0.15 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | 12 | ## 0.0.14 13 | 14 | ### Patch Changes 15 | 16 | - Updated dependencies []: 17 | - @irys/upload-core@0.0.9 18 | 19 | ## 0.0.13 20 | 21 | ### Patch Changes 22 | 23 | - Correct the documentation link in the error message shown for using devnet without a defined RPC 24 | 25 | ## 0.0.12 26 | 27 | ### Patch Changes 28 | 29 | - Updated dependencies []: 30 | - @irys/upload-core@0.0.8 31 | 32 | ## 0.0.11 33 | 34 | ### Patch Changes 35 | 36 | - Update SDK methods 37 | 38 | - Updated dependencies []: 39 | - @irys/upload-core@0.0.7 40 | 41 | ## 0.0.10 42 | 43 | ### Patch Changes 44 | 45 | - Updated dependencies []: 46 | - @irys/upload-core@0.0.6 47 | 48 | ## 0.0.9 49 | 50 | ### Patch Changes 51 | 52 | - Fix withIrysConfig, add explicit timeout builder arg 53 | 54 | ## 0.0.8 55 | 56 | ### Patch Changes 57 | 58 | - Add withIrysConfig builder arg 59 | 60 | ## 0.0.7 61 | 62 | ### Patch Changes 63 | 64 | - Add SPL support to web-solana + misc fixes 65 | 66 | ## 0.0.6 67 | 68 | ### Patch Changes 69 | 70 | - Updated dependencies []: 71 | - @irys/upload-core@0.0.5 72 | 73 | ## 0.0.5 74 | 75 | ### Patch Changes 76 | 77 | - Add support for SPL tokens 78 | 79 | - Updated dependencies []: 80 | - @irys/upload-core@0.0.4 81 | 82 | ## 0.0.4 83 | 84 | ### Patch Changes 85 | 86 | - Streamline Network and URL logic 87 | 88 | - Updated dependencies []: 89 | - @irys/upload-core@0.0.3 90 | 91 | ## 0.0.3 92 | 93 | ### Patch Changes 94 | 95 | - Fix remaining non-index exports for TS when moduleResolution = node 96 | 97 | - Updated dependencies []: 98 | - @irys/upload-core@0.0.2 99 | 100 | ## 0.0.2 101 | 102 | ### Patch Changes 103 | 104 | - Fix use of export paths for TypeScript 105 | 106 | ## 0.0.1 107 | 108 | ### Patch Changes 109 | 110 | - v1 111 | 112 | - Updated dependencies []: 113 | - @irys/upload-core@0.0.1 114 | -------------------------------------------------------------------------------- /packages/upload-node/README.md: -------------------------------------------------------------------------------- 1 | # client-node 2 | 3 | NodeJS token-agnostic library for Irys network bundler clients. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/upload 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/upload-node/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["./src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/upload-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload", 3 | "version": "0.0.15", 4 | "description": "NodeJS token-agnostic library for Irys network bundler clients", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/upload-core": "workspace:^", 51 | "@irys/bundles": "^0.0.3", 52 | "async-retry": "^1.3.3", 53 | "axios": "^1.7.5", 54 | "base64url": "^3.0.1", 55 | "bignumber.js": "^9.1.2", 56 | "csv-parse": "^5.5.6", 57 | "csv-stringify": "^6.5.1", 58 | "inquirer": "^8.2.0", 59 | "mime-types": "^2.1.35" 60 | }, 61 | "devDependencies": { 62 | "@ava/typescript": "^5.0.0", 63 | "@types/async-retry": "^1.4.8", 64 | "@types/bn.js": "^5.1.5", 65 | "@types/inquirer": "8", 66 | "@types/mime-types": "^2.1.4", 67 | "ava": "^6.1.3" 68 | }, 69 | "publishConfig": { 70 | "access": "public" 71 | }, 72 | "author": "Irys maintainers ", 73 | "homepage": "https://irys.xyz", 74 | "repository": { 75 | "url": "https://github.com/irys-xyz/js-sdk.git" 76 | }, 77 | "typedoc": { 78 | "entryPoint": "./src/index.ts", 79 | "readmeFile": "./README.md", 80 | "displayName": "node" 81 | }, 82 | "ava": { 83 | "typescript": { 84 | "compile": false, 85 | "rewritePaths": { 86 | "src/": "dist/test/src/", 87 | "test/": "dist/test/test/" 88 | } 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /packages/upload-node/src/index.ts: -------------------------------------------------------------------------------- 1 | // export { default } from "./irys"; 2 | // export { default as NodeIrys } from "./irys"; 3 | import { Builder } from './builder'; 4 | export default Builder; 5 | export { Builder as Uploader }; 6 | 7 | export type * from './builder'; 8 | -------------------------------------------------------------------------------- /packages/upload-node/src/tokens/base.ts: -------------------------------------------------------------------------------- 1 | import type { Signer } from '@irys/bundles'; 2 | import type BigNumber from 'bignumber.js'; 3 | import type { Tx, TokenConfig } from '@irys/upload-core'; 4 | import axios from 'axios'; 5 | import type { NodeToken } from '../types'; 6 | import { Utils } from '@irys/upload-core'; 7 | import type BaseNodeIrys from '../base'; 8 | export abstract class BaseNodeToken implements NodeToken { 9 | public base!: [string, number]; 10 | protected wallet: any; 11 | protected _address: string | undefined; 12 | protected providerUrl: any; 13 | protected providerInstance?: any; 14 | public ticker!: string; 15 | public name!: string; 16 | protected minConfirm = 5; 17 | public isSlow = false; 18 | public needsFee = true; 19 | protected opts?: any; 20 | protected utils!: Utils; 21 | public irys!: BaseNodeIrys; 22 | 23 | constructor(config: TokenConfig) { 24 | Object.assign(this, config); 25 | this.initializeAddress(); 26 | // this._address = this.wallet ? this.ownerToAddress(this.getPublicKey()) : undefined; 27 | } 28 | 29 | // common methods 30 | 31 | get address(): string | undefined { 32 | return this._address; 33 | } 34 | 35 | private async initializeAddress() { 36 | if (this.wallet) { 37 | this._address = await this.ownerToAddress(this.getPublicKey()); 38 | } 39 | } 40 | 41 | async price(): Promise { 42 | return getRedstonePrice(this.ticker); 43 | } 44 | abstract getTx(_txId: string): Promise; 45 | abstract ownerToAddress(_owner: any): Promise; 46 | abstract sign(_data: Uint8Array): Promise; 47 | abstract getSigner(): Signer; 48 | abstract verify( 49 | _pub: any, 50 | _data: Uint8Array, 51 | _signature: Uint8Array 52 | ): Promise; 53 | abstract getCurrentHeight(): Promise; 54 | abstract getFee( 55 | _amount: BigNumber.Value, 56 | _to?: string, 57 | _multiplier?: BigNumber.Value 58 | ): Promise; 59 | abstract sendTx(_data: any): Promise; 60 | abstract createTx( 61 | _amount: BigNumber.Value, 62 | _to: string, 63 | _fee?: string | object 64 | ): Promise<{ txId: string | undefined; tx: any }>; 65 | abstract getPublicKey(): string | Buffer; 66 | } 67 | 68 | export async function getRedstonePrice(token: string): Promise { 69 | const res = await axios.get( 70 | `https://api.redstone.finance/prices?symbol=${token}&provider=redstone&limit=1` 71 | ); 72 | await Utils.checkAndThrow(res, 'Getting price data'); 73 | return res.data[0].value; 74 | } 75 | -------------------------------------------------------------------------------- /packages/upload-node/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { IrysConfig, Network, Token } from '@irys/upload-core'; 2 | import BaseNodeIrys from './base'; 3 | export interface NodeToken extends Token { 4 | getPublicKey(): string | Buffer; 5 | } 6 | 7 | export type NodeIrysConfig = { 8 | url: Network | string; 9 | key: Key; 10 | config?: IrysConfig; 11 | }; 12 | 13 | export type GetToken = ({ 14 | irys, 15 | wallet, 16 | url, 17 | providerUrl, 18 | contractAddress, 19 | opts, 20 | }: { 21 | irys: BaseNodeIrys; 22 | wallet: any; 23 | url: string; 24 | providerUrl?: string; 25 | contractAddress?: string; 26 | opts?: any; 27 | }) => Promise; 28 | -------------------------------------------------------------------------------- /packages/upload-node/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { 2 | createData, 3 | DataItem, 4 | deepHash, 5 | stringToBuffer, 6 | getCryptoDriver, 7 | bundleAndSignData, 8 | Arweave, 9 | } from '@irys/bundles/node'; 10 | export { 11 | createData, 12 | DataItem, 13 | deepHash, 14 | stringToBuffer, 15 | getCryptoDriver, 16 | bundleAndSignData, 17 | Arweave, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/upload-node/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/upload-node/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/upload-node/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | // import { MyToken } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof {}, 'object'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/upload-node/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } -------------------------------------------------------------------------------- /packages/upload-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "./src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /packages/upload-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @irys/web-upload 2 | 3 | ## 0.0.15 4 | 5 | ### Patch Changes 6 | 7 | - [#24](https://github.com/Irys-xyz/js-sdk/pull/24) [`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04) Thanks [@JesseTheRobot](https://github.com/JesseTheRobot)! - Update bundles, release starknet integration 8 | 9 | - Updated dependencies [[`2410aef`](https://github.com/Irys-xyz/js-sdk/commit/2410aefea6d2d508b4279f2ab1b66bd12cf3ad04)]: 10 | - @irys/upload-core@0.0.10 11 | 12 | ## 0.0.14 13 | 14 | ### Patch Changes 15 | 16 | - Updated dependencies []: 17 | - @irys/upload-core@0.0.9 18 | 19 | ## 0.0.13 20 | 21 | ### Patch Changes 22 | 23 | - Correct the documentation link in the error message shown for using devnet without a defined RPC 24 | 25 | ## 0.0.12 26 | 27 | ### Patch Changes 28 | 29 | - Updated dependencies []: 30 | - @irys/upload-core@0.0.8 31 | 32 | ## 0.0.11 33 | 34 | ### Patch Changes 35 | 36 | - Update SDK methods 37 | 38 | - Updated dependencies []: 39 | - @irys/upload-core@0.0.7 40 | 41 | ## 0.0.10 42 | 43 | ### Patch Changes 44 | 45 | - Updated dependencies []: 46 | - @irys/upload-core@0.0.6 47 | 48 | ## 0.0.9 49 | 50 | ### Patch Changes 51 | 52 | - Fix withIrysConfig, add explicit timeout builder arg 53 | 54 | ## 0.0.8 55 | 56 | ### Patch Changes 57 | 58 | - Add withIrysConfig builder arg 59 | 60 | ## 0.0.7 61 | 62 | ### Patch Changes 63 | 64 | - Add SPL support to web-solana + misc fixes 65 | 66 | ## 0.0.6 67 | 68 | ### Patch Changes 69 | 70 | - Updated dependencies []: 71 | - @irys/upload-core@0.0.5 72 | 73 | ## 0.0.5 74 | 75 | ### Patch Changes 76 | 77 | - Add support for SPL tokens 78 | 79 | - Updated dependencies []: 80 | - @irys/upload-core@0.0.4 81 | 82 | ## 0.0.4 83 | 84 | ### Patch Changes 85 | 86 | - Streamline Network and URL logic 87 | 88 | - Updated dependencies []: 89 | - @irys/upload-core@0.0.3 90 | 91 | ## 0.0.3 92 | 93 | ### Patch Changes 94 | 95 | - Fix remaining non-index exports for TS when moduleResolution = node 96 | 97 | - Updated dependencies []: 98 | - @irys/upload-core@0.0.2 99 | 100 | ## 0.0.2 101 | 102 | ### Patch Changes 103 | 104 | - Fix use of export paths for TypeScript 105 | 106 | ## 0.0.1 107 | 108 | ### Patch Changes 109 | 110 | - v1 111 | 112 | - Updated dependencies []: 113 | - @irys/upload-core@0.0.1 114 | -------------------------------------------------------------------------------- /packages/upload-web/README.md: -------------------------------------------------------------------------------- 1 | # client-web 2 | 3 | Web token-agnostic library for Irys network bundler clients. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/web-upload 9 | ``` 10 | -------------------------------------------------------------------------------- /packages/upload-web/cjs.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "outDir": "dist/cjs", 6 | "rootDir": "./src", 7 | "declaration": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/upload-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/web-upload", 3 | "version": "0.0.15", 4 | "description": "Web token-agnostic library for Irys network bundler clients", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": "./dist/esm/*.js", 27 | "require": "./dist/cjs/*.js" 28 | } 29 | }, 30 | "files": [ 31 | "/dist/cjs", 32 | "/dist/esm", 33 | "/dist/types", 34 | "/src" 35 | ], 36 | "scripts": { 37 | "lint": "eslint --ext js,ts,tsx src", 38 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 39 | "clean": "rimraf dist", 40 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 41 | "test": "ava" 42 | }, 43 | "dependencies": { 44 | "@irys/upload-core": "workspace:^", 45 | "@irys/bundles": "^0.0.3", 46 | "async-retry": "^1.3.3", 47 | "axios": "^1.7.5", 48 | "base64url": "^3.0.1", 49 | "bignumber.js": "^9.1.2", 50 | "mime-types": "^2.1.35" 51 | }, 52 | "devDependencies": { 53 | "@ava/typescript": "^5.0.0", 54 | "@types/async-retry": "^1.4.8", 55 | "@types/mime-types": "^2.1.4", 56 | "ava": "^6.1.3" 57 | }, 58 | "publishConfig": { 59 | "access": "public" 60 | }, 61 | "author": "Irys maintainers ", 62 | "homepage": "https://irys.xyz", 63 | "repository": { 64 | "url": "https://github.com/irys-xyz/js-sdk.git" 65 | }, 66 | "typedoc": { 67 | "entryPoint": "./src/index.ts", 68 | "readmeFile": "./README.md", 69 | "displayName": "web" 70 | }, 71 | "ava": { 72 | "typescript": { 73 | "compile": false, 74 | "rewritePaths": { 75 | "src/": "dist/test/src/", 76 | "test/": "dist/test/test/" 77 | } 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /packages/upload-web/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Builder } from './builder'; 2 | export default Builder; 3 | export { Builder as WebUploader }; 4 | 5 | export type * from './builder'; 6 | -------------------------------------------------------------------------------- /packages/upload-web/src/tokens/base.ts: -------------------------------------------------------------------------------- 1 | import type { Signer } from '@irys/bundles'; 2 | import type BigNumber from 'bignumber.js'; 3 | import type { Tx, TokenConfig } from '@irys/upload-core'; 4 | import axios from 'axios'; 5 | import type { WebToken } from '../types'; 6 | import { Utils } from '@irys/upload-core'; 7 | import type { BaseWebIrys } from '../base'; 8 | 9 | export abstract class BaseWebToken implements WebToken { 10 | public base!: [string, number]; 11 | protected wallet: any; 12 | protected _address: string | undefined; 13 | protected providerUrl: any; 14 | protected providerInstance?: any; 15 | public ticker!: string; 16 | public name!: string; 17 | public irys!: BaseWebIrys; 18 | public config!: TokenConfig; 19 | protected opts?: any; 20 | public minConfirm = 5; 21 | public isSlow = false; 22 | public needsFee = true; 23 | public inheritsRPC = false; 24 | 25 | constructor(config: TokenConfig) { 26 | Object.assign(this, config); 27 | this.config = config; 28 | } 29 | 30 | // common methods 31 | 32 | get address(): string | undefined { 33 | return this._address; 34 | } 35 | 36 | public async ready(): Promise { 37 | if (this.wallet) { 38 | this._address = await this.ownerToAddress(await this.getPublicKey()); 39 | } else { 40 | this._address = undefined; 41 | } 42 | } 43 | 44 | async price(): Promise { 45 | return getRedstonePrice(this.ticker); 46 | } 47 | abstract getTx(_txId: string): Promise; 48 | abstract ownerToAddress(_owner: any): Promise; 49 | abstract sign(_data: Uint8Array): Promise; 50 | abstract getSigner(): Signer; 51 | abstract verify( 52 | _pub: any, 53 | _data: Uint8Array, 54 | _signature: Uint8Array 55 | ): Promise; 56 | abstract getCurrentHeight(): Promise; 57 | abstract getFee( 58 | _amount: BigNumber.Value, 59 | _to?: string 60 | ): Promise; 61 | abstract sendTx(_data: any): Promise; 62 | abstract createTx( 63 | _amount: BigNumber.Value, 64 | _to: string, 65 | _fee?: any 66 | ): Promise<{ txId: string | undefined; tx: any }>; 67 | abstract getPublicKey(): Promise; 68 | } 69 | 70 | export default BaseWebToken; 71 | 72 | export async function getRedstonePrice(token: string): Promise { 73 | const res = await axios.get( 74 | `https://api.redstone.finance/prices?symbol=${token}&provider=redstone&limit=1` 75 | ); 76 | await Utils.checkAndThrow(res, 'Getting price data'); 77 | return res.data[0].value; 78 | } 79 | -------------------------------------------------------------------------------- /packages/upload-web/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { IrysConfig, Network, Token } from '@irys/upload-core'; 2 | 3 | export interface WebToken extends Token { 4 | getPublicKey(): Promise; 5 | ready(): Promise; 6 | inheritsRPC: boolean; 7 | } 8 | 9 | export type WebIrysConfig = { 10 | url: Network | string; 11 | provider: Provider; 12 | config?: IrysConfig; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/upload-web/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { 2 | createData, 3 | DataItem, 4 | deepHash, 5 | stringToBuffer, 6 | getCryptoDriver, 7 | bundleAndSignData, 8 | Arweave, 9 | } from '@irys/bundles/web'; 10 | export { 11 | createData, 12 | DataItem, 13 | deepHash, 14 | stringToBuffer, 15 | getCryptoDriver, 16 | bundleAndSignData, 17 | Arweave, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/upload-web/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/upload-web/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/upload-web/test/someFeature.test.ts: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { BaseWebIrys } from '../src/base'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof BaseWebIrys, 'function'); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/upload-web/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "include": ["./**/*"], 4 | "compilerOptions": { 5 | "module": "Node16", 6 | "outDir": "../dist/test", 7 | "declarationDir": null, 8 | "declaration": false, 9 | "emitDeclarationOnly": false 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/upload-web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'examples/**/*' 4 | - 'scripts/**/*' 5 | - '!examples/umi/**/*' -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Irys JS SDK 3 | 4 | ![](/assets/irys-sdk.png) 5 | 6 | ## What is Irys? 7 | 8 | 9 | [Irys](https://irys.xyz/) is the world's first L1 programmable datachain. On Irys, you can upload onchain data, deploy smart contracts, and those smart contracts can access and perform verifiable computations on onchain data. 10 | 11 | This Irys JS SDK is for uploading onchain data. 12 | 13 | ## Docs 14 | https://docs.irys.xyz 15 | 16 | ## Migrating 17 | 18 | Migrating from our old SDK? We've got a handy guide for you. 19 | 20 | https://migrate-to.irys.xyz 21 | 22 | ## What is a Bundler? 23 | 24 | Bundlers enable any number of data transactions to be uploaded at once. To upload data to Irys, start by connecting to a bundler and then use one of its upload functions. 25 | 26 | ## Repos 27 | 28 | The Irys JS SDK reduces dependency bloat by providing dedicated packages for each [supported token](https://docs.irys.xyz/build/d/features/supported-tokens). 29 | 30 | Install only the specific packages you require. 31 | 32 | ### CLI 33 | 34 | - [cli](/packages/cli/README.md): The Irys storage CLI. 35 | 36 | ### EVM Chains 37 | 38 | - [ethereum](/packages/ethereum/README.md): Use with NodeJS, contains token-specific packages for all supported EVM tokens. 39 | - [ethereum-web](/packages/ethereum-web/README.md): Use in the browser, contains token-specific packages for all supported EVM tokens. 40 | - [ethereum-ethers-v5](/packages/ethereum-ethers-v5/README.md): Use with the ethers v5 browser provider. 41 | - [ethereum-ethers-v6](/packages/ethereum-ethers-v6/README.md): Use with the ethers v6 browser provider. 42 | - [ethereum-viem-v2](/packages/ethereum-viem-v2/README.md): Use with the viem v2 browser provider. 43 | 44 | ### Solana 45 | 46 | - [solana-node](/packages/solana-node/README.md): Use with NodeJS, contains token-specific packages for all supported Solana tokens. 47 | - [solana-web](/packages/solana-web/README.md): Use in the browser, contains token-specific packages for all supported Solana tokens. 48 | 49 | ### Aptos 50 | 51 | - [aptos-node](/packages/aptos-node/README.md): Use with NodeJS and the Aptos token. 52 | - [aptos-web](/packages/aptos-web/README.md): Use in the browser with the Aptos token. 53 | 54 | ### Core 55 | 56 | The Irys core packages are used internally, most users will not need to install them directly. 57 | 58 | - [client-core](/packages/client-core/README.md) 59 | - [client-node](/packages/client-node/README.md) 60 | - [client-web](/packages/client-web/README.md) 61 | -------------------------------------------------------------------------------- /scripts/fix-pkg.sh: -------------------------------------------------------------------------------- 1 | cat > dist/"$1"/package.json < { 33 | const newPath = currentPath + '/' + dirent.name; 34 | const newPathWithoutStubExtension = newPath.replace(/\.stub$/, ''); 35 | 36 | if (dirent.isDirectory()) { 37 | fs.mkdirSync(packageFolder + newPath); 38 | generateFilesRecursively(templateFolder, packageFolder, newPath); 39 | } else { 40 | let stub = fs.readFileSync(templateFolder + newPath, 'utf8'); 41 | stub = stub.replace(/{{package-name}}/g, packageName); 42 | fs.writeFileSync( 43 | packageFolder + newPathWithoutStubExtension, 44 | stub, 45 | 'utf8' 46 | ); 47 | } 48 | }); 49 | } 50 | 51 | function error(message) { 52 | console.error(chalk.bold.red(message)); 53 | process.exit(1); 54 | } 55 | 56 | function success(message) { 57 | console.log(chalk.bold.green(message)); 58 | process.exit(0); 59 | } 60 | -------------------------------------------------------------------------------- /scripts/get-latest-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pnpm ls -r --depth -1 | grep -v '(PRIVATE)' | sed '/^$/d' | awk '{print $1}' | awk -F '@' '{print $NF}' | sort -V | tail -1 4 | -------------------------------------------------------------------------------- /scripts/new-package-template/README.md: -------------------------------------------------------------------------------- 1 | # {{package-name}} 2 | 3 | TODO 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install @irys/upload-{{package-name}} 9 | ``` 10 | -------------------------------------------------------------------------------- /scripts/new-package-template/cjs.tsconfig.json.stub: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../cjs.tsconfig.json", 3 | "include": [ 4 | "src" 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/cjs", 8 | "rootDir": "./src", 9 | "declaration": false 10 | } 11 | } -------------------------------------------------------------------------------- /scripts/new-package-template/package.json.stub: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@irys/upload-{{package-name}}", 3 | "version": "0.0.0", 4 | "description": "TODO", 5 | "license": "MIT", 6 | "sideEffects": false, 7 | "module": "dist/esm/index.js", 8 | "main": "dist/cjs/index.js", 9 | "types": "dist/types/index.d.ts", 10 | "exports": { 11 | ".": { 12 | "types": "./dist/types/index.d.ts", 13 | "import": "./dist/esm/index.js", 14 | "require": "./dist/cjs/index.js" 15 | }, 16 | "./esm/*": { 17 | "types": "./dist/types/*.d.ts", 18 | "default": "./dist/esm/*.js" 19 | }, 20 | "./cjs/*": { 21 | "types": "./dist/types/*.d.ts", 22 | "default": "./dist/cjs/*.js" 23 | }, 24 | "./*": { 25 | "types": "./dist/types/*.d.ts", 26 | "import": { 27 | "types": "./dist/types/*.d.ts", 28 | "default": "./dist/esm/*.js" 29 | }, 30 | "require": { 31 | "types": "./dist/types/*.d.ts", 32 | "default": "./dist/cjs/*.js" 33 | } 34 | } 35 | }, 36 | "files": [ 37 | "/dist/cjs", 38 | "/dist/esm", 39 | "/dist/types", 40 | "/src" 41 | ], 42 | "scripts": { 43 | "lint": "eslint --ext js,ts,tsx src", 44 | "lint:fix": "eslint --fix --ext js,ts,tsx src", 45 | "clean": "rimraf dist", 46 | "build": "pnpm clean && concurrently \" tsc && sh ../../scripts/fix-pkg.sh esm module && tsc-esm-fix \" \" tsc -p test/tsconfig.json \" \"tsc -p cjs.tsconfig.json && sh ../../scripts/fix-pkg.sh cjs commonjs \"", 47 | "test": "ava" 48 | }, 49 | "dependencies": { 50 | "@irys/upload-core": "workspace:^" 51 | }, 52 | "devDependencies": { 53 | "@ava/typescript": "^5.0.0", 54 | "ava": "^6.1.3" 55 | }, 56 | "publishConfig": { 57 | "access": "public" 58 | }, 59 | "author": "Irys maintainers ", 60 | "homepage": "https://irys.xyz", 61 | "repository": { 62 | "url": "https://github.com/irys-xyz/js-sdk.git" 63 | }, 64 | "typedoc": { 65 | "entryPoint": "./src/index.ts", 66 | "readmeFile": "./README.md", 67 | "displayName": "{{package-name}}" 68 | }, 69 | "ava": { 70 | "typescript": { 71 | "compile": false, 72 | "rewritePaths": { 73 | "src/": "dist/test/src/", 74 | "test/": "dist/test/test/" 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /scripts/new-package-template/src/index.ts.stub: -------------------------------------------------------------------------------- 1 | export * from './token'; 2 | -------------------------------------------------------------------------------- /scripts/new-package-template/src/token.ts.stub: -------------------------------------------------------------------------------- 1 | export const MyToken = {}; 2 | -------------------------------------------------------------------------------- /scripts/new-package-template/test/modules/cjs.test.cjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies */ 2 | const test = require('ava'); 3 | 4 | const exported = require('../../dist/cjs/index.js'); 5 | 6 | test('it successfully exports commonjs exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | 11 | -------------------------------------------------------------------------------- /scripts/new-package-template/test/modules/esm.test.mjs: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/extensions */ 2 | /* eslint-disable import/no-extraneous-dependencies */ 3 | import test from 'ava'; 4 | import * as exported from '../../dist/esm/index.js'; 5 | 6 | test('it successfully exports esm exports', (t) => { 7 | const exportedKeys = Object.keys(exported); 8 | t.true(exportedKeys.length > 0); 9 | }); 10 | 11 | -------------------------------------------------------------------------------- /scripts/new-package-template/test/someFeature.test.ts.stub: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import { MyToken } from '../src'; 3 | 4 | test('example test', async (t) => { 5 | t.is(typeof MyToken, 'object'); 6 | }); 7 | -------------------------------------------------------------------------------- /scripts/new-package-template/test/tsconfig.json.stub: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../cjs.tsconfig.json", 3 | "include": [ 4 | "../src", 5 | "../test" 6 | ], 7 | "compilerOptions": { 8 | "module": "Node16", 9 | "rootDir": "../", 10 | "outDir": "../dist/test", 11 | "declarationDir": null, 12 | "moduleResolution": "Node16", 13 | "declaration": false, 14 | "emitDeclarationOnly": false 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /scripts/new-package-template/tsconfig.json.stub: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../esm.tsconfig.json", 3 | "include": [ 4 | "src", 5 | ], 6 | "compilerOptions": { 7 | "outDir": "dist/esm", 8 | "declarationDir": "dist/types", 9 | "rootDir": "./src" 10 | } 11 | } -------------------------------------------------------------------------------- /scripts/webpack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack", 3 | "version": "1.0.0", 4 | "description": "", 5 | "devDependencies": { 6 | "crypto-browserify": "^3.12.1", 7 | "inspectpack": "^4.7.1", 8 | "process": "^0.11.10", 9 | "stream-browserify": "^3.0.0", 10 | "webpack": "^5.65.0", 11 | "webpack-bundle-analyzer": "^4.5.0", 12 | "webpack-cli": "^4.9.1", 13 | "webpack-node-externals": "^3.0.0", 14 | "ts-loader": "^9.2.6" 15 | } 16 | } -------------------------------------------------------------------------------- /scripts/webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | const { DuplicatesPlugin } = require("inspectpack/plugin"); 4 | // const ForkTsCheckerNotifierWebpackPlugin = require("fork-ts-checker-notifier-webpack-plugin"); 5 | // const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); 6 | 7 | module.exports = { 8 | // entry: "../../packages/solana-web/dist/esm/index.js", 9 | entry: "../../packages/solana-web/src/index.ts", 10 | 11 | devtool: "source-map", 12 | mode: "production", 13 | target: "web", 14 | module: { 15 | rules: [ 16 | { 17 | test: /\.ts$/, 18 | use: { loader: "ts-loader", options: { configFile: /* path.resolve(__dirname,"tsconfig.json") */ path.resolve(__dirname,"../../packages/solana-web/tsconfig-webpack.json")} }, 19 | exclude: [/node_modules/, /* path.resolve(__dirname, "src/node/"), path.resolve(__dirname, "build/") */], 20 | }, 21 | { 22 | test: /\.mjs$/, 23 | include: /node_modules/, 24 | type: 'javascript/auto', 25 | resolve: { 26 | fullySpecified: false 27 | } 28 | }, 29 | { 30 | test: /\.js$/, 31 | include: /node_modules/, 32 | type: 'javascript/auto', 33 | resolve: { 34 | fullySpecified: false 35 | } 36 | } 37 | ], 38 | }, 39 | 40 | resolve: { 41 | symlinks: true, 42 | extensions: [".ts", ".js"], 43 | alias: { 44 | process: "process/browser", 45 | crypto: "crypto-browserify", 46 | stream: "stream-browserify", 47 | vm: false 48 | // "$/utils": path.resolve(__dirname, "./src/web/utils.ts"), 49 | }, 50 | fallback: { 51 | crypto: require.resolve("crypto-browserify"), 52 | stream: require.resolve("stream-browserify"), 53 | process: require.resolve("process/browser"), 54 | events: require.resolve("events/"), 55 | buffer: require.resolve("buffer/"), 56 | }, 57 | }, 58 | plugins: [ 59 | new webpack.ProvidePlugin({ 60 | process: "process/browser", 61 | Buffer: ["buffer", "Buffer"], 62 | }), 63 | new DuplicatesPlugin({ 64 | emitErrors: false, 65 | verbose: true, 66 | }), 67 | // new ForkTsCheckerWebpackPlugin(), 68 | // new ForkTsCheckerNotifierWebpackPlugin({ 69 | // title: "TypeScript", 70 | // excludeWarnings: false, 71 | // }), 72 | ], 73 | output: { 74 | filename: "bundle.js", 75 | path: path.resolve(__dirname, "build"), 76 | libraryTarget: "umd", 77 | library: "WebIrys", 78 | }, 79 | stats: { 80 | // Display bailout reasons 81 | optimizationBailout: true, 82 | }, 83 | }; 84 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "packages/*/src", 4 | "packages/*/test" 5 | ], 6 | "exclude": [ 7 | "node_modules", 8 | "packages/*/node_modules" 9 | ], 10 | "compilerOptions": { 11 | "baseUrl": ".", 12 | // "declaration": true, 13 | "sourceMap": true, 14 | "noEmit": false, 15 | "noEmitOnError": true, 16 | // "emitDeclarationOnly": true, 17 | "target": "ES2022", 18 | "module": "NodeNext", 19 | "moduleResolution": "NodeNext", 20 | "allowJs": false, 21 | "alwaysStrict": true, 22 | "skipLibCheck": true, 23 | "noUnusedLocals": true, 24 | "strictNullChecks": true, 25 | "noImplicitAny": true, 26 | "noImplicitThis": true, 27 | "noImplicitReturns": false, 28 | "importHelpers": true, 29 | "strict": true, 30 | "isolatedModules": true, 31 | "resolveJsonModule": true, 32 | "esModuleInterop": true, 33 | "removeComments": false, 34 | // "stripInternal": true 35 | }, 36 | "ts-node": { 37 | "require": [ 38 | "tsconfig-paths/register" 39 | ], 40 | "esm": false, 41 | "transpileOnly": false, 42 | "compilerOptions": { 43 | "module": "node16", 44 | "target": "es2021", 45 | "moduleResolution": "node16" 46 | } 47 | }, 48 | "typedocOptions": { 49 | "entryPoints": ".", 50 | "entryPointStrategy": "packages", 51 | "out": "typedoc", 52 | "readme": "README.md", 53 | "name": "Irys network SDK — API References", 54 | "includeVersion": true, 55 | "excludeNotDocumented": false, 56 | "categorizeByGroup": false, 57 | "defaultCategory": "Other", 58 | "categoryOrder": [ 59 | "*" 60 | ] 61 | } 62 | } -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "tasks": { 4 | "clean": { 5 | "outputs": [] 6 | }, 7 | "build": { 8 | "dependsOn": [ 9 | "^build" 10 | ], 11 | "outputs": [ 12 | "dist/**" 13 | ] 14 | }, 15 | "lint": { 16 | "outputs": [] 17 | }, 18 | "lint:fix": { 19 | "outputs": [] 20 | }, 21 | "test": { 22 | "dependsOn": [ 23 | "build" 24 | ], 25 | "outputs": [] 26 | } 27 | } 28 | } --------------------------------------------------------------------------------