diff --git a/docs/src/guides/sdk-release-notes.md b/docs/src/guides/sdk-release-notes.md index c88e31a9..b27b0213 100644 --- a/docs/src/guides/sdk-release-notes.md +++ b/docs/src/guides/sdk-release-notes.md @@ -4,6 +4,57 @@ Welcome to the documentation page for the ar.io SDK release notes. Here, you will find detailed information about each version of the ar.io SDK, including the enhancements, bug fixes, and any other changes introduced in every release. This page serves as a comprehensive resource to keep you informed about the latest developments and updates in the ar.io SDK. For those interested in exploring the source code, each release's code is readily accessible at our GitHub repository: ar.io SDK [change logs](https://github.com/ar-io/ar-io-sdk/blob/main/CHANGELOG.md). Stay updated with the continuous improvements and advancements in the ar.io SDK by referring to this page for all release-related information. +# [3.0.0](https://github.com/ar-io/ar-io-sdk/compare/v2.6.0...v3.0.0) (2024-12-10) + + +### Bug Fixes + +* **ar.io cli:** use global program from cli.ts scope for ar.io command PE-5854 ([3e83298](https://github.com/ar-io/ar-io-sdk/commit/3e83298bf07bd2ca0eb800ac74ab675bdbb766d0)) +* expose instant param for decreaseOperatorStake function arg type ([2fd1f5d](https://github.com/ar-io/ar-io-sdk/commit/2fd1f5df34b9c8f3a7d62d9fea56d5399c53f3b8)) +* **lua id:** change lua id ([d4907db](https://github.com/ar-io/ar-io-sdk/commit/d4907db2b74be1ddc8d61ecd2b24944654a2e1b5)) +* remove un-used import ([5db9ac0](https://github.com/ar-io/ar-io-sdk/commit/5db9ac07f690231c326ca68ac91d14cae2329c1a)) +* **spawn-ant:** use a valid default ttlSeconds ([aea4aa7](https://github.com/ar-io/ar-io-sdk/commit/aea4aa7bc61a1af644f8215b75f5eef82e5c9480)) +* use `Keywords` for setKeywords ([19ab3ad](https://github.com/ar-io/ar-io-sdk/commit/19ab3adaa58f0b322261ca5ed4b4cc6174cc66ad)) + + +### Features + +* **ar-io cli:** init balance command and CLI setup ([94c630b](https://github.com/ar-io/ar-io-sdk/commit/94c630b3b89fb3cf1d58afadcf424d2c464a39b3)) +* **ar-io cli:** init join-network command ([fc9dc07](https://github.com/ar-io/ar-io-sdk/commit/fc9dc07d331677af8e88ada479d833757001abc8)) +* **ar.io cli:** add --cu-url global parameter PE-5854 ([2346f5b](https://github.com/ar-io/ar-io-sdk/commit/2346f5bca1b51ef9893447d1e86fd6dfc57302cb)) +* **ar.io cli:** enable confirmation prompts on each write action PE-5854 ([9ac88bb](https://github.com/ar-io/ar-io-sdk/commit/9ac88bb73f6a386d3b0989e2ca8678d83399af82)) +* **ar.io cli:** include --tags input in write actions PE-5854 ([4b9d03e](https://github.com/ar-io/ar-io-sdk/commit/4b9d03e81839dc618b9adc8f9919929530bae504)) +* **ar.io cli:** init buy/upgrade/extend-record, inc-undernames, sub-auc-bid, req-prim-name PE-5854 ([5eb3df2](https://github.com/ar-io/ar-io-sdk/commit/5eb3df2dc89c4176b35b4d84747920c917d35dde)) +* **ar.io cli:** init decrease-delegate-stake instant/cancel-withdraw commands PE-5854 ([f0e7b9e](https://github.com/ar-io/ar-io-sdk/commit/f0e7b9e5e5525ce99c570ceb315cf09eb1ff7d33)) +* **ar.io cli:** init epoch read commands PE-5854 ([61e0fc3](https://github.com/ar-io/ar-io-sdk/commit/61e0fc3606a6b0f0b24fd82c212a2875bb421b57)) +* **ar.io cli:** init get token cost and auction prices PE-5854 ([867807d](https://github.com/ar-io/ar-io-sdk/commit/867807da1c9689d7372a91046139ee79552084c3)) +* **ar.io cli:** init get-delegations, get-arns-record, list-arns-records commands PE-5854 ([d7cbde3](https://github.com/ar-io/ar-io-sdk/commit/d7cbde356e620d2cf074ede94031e231ec5e2a6a)) +* **ar.io cli:** init get-gateway-delegates and get-gateways commands PE-5854 ([35a33ef](https://github.com/ar-io/ar-io-sdk/commit/35a33efca920fbad3ee3aa93e051acaa1a854927)) +* **ar.io cli:** init get-vault and get-gateway commands ([d262243](https://github.com/ar-io/ar-io-sdk/commit/d262243bde31d68cab0a6efaa2ada6795cdf14f1)) +* **ar.io cli:** init increase/decrease-operator-stake commands PE-5854 ([1312860](https://github.com/ar-io/ar-io-sdk/commit/131286024b18c86eabab0a326d3f42dd27ce63b6)) +* **ar.io cli:** init info command ([c721374](https://github.com/ar-io/ar-io-sdk/commit/c7213740954a2d5a15742a756aae8ac79497a5d9)) +* **ar.io cli:** init leave-network, delegate-stake PE-5854 ([40ebe06](https://github.com/ar-io/ar-io-sdk/commit/40ebe065673b881a3e23b275ea29423aa260259f)) +* **ar.io cli:** init pagination from CLI layer PE-5854 ([f52ce1f](https://github.com/ar-io/ar-io-sdk/commit/f52ce1fbb8bda21b35b985d21b3fa3fa9a6e825d)) +* **ar.io cli:** init read/write ANT commands PE-5854 ([392a9ef](https://github.com/ar-io/ar-io-sdk/commit/392a9ef5d20bd77809ee3a6a2bbac909739189eb)) +* **ar.io cli:** init redelegate-stake PE-5854 ([7bf4a8e](https://github.com/ar-io/ar-io-sdk/commit/7bf4a8e49b4e7e319dd013632db0dbd8ca2c1eaf)) +* **ar.io cli:** init save-observations PE-5854 ([f80bb8c](https://github.com/ar-io/ar-io-sdk/commit/f80bb8c607d67bb37278c9e600cee1c1493f3ea1)) +* **ar.io cli:** init spawn-ant and get-ant-state PE-5854 ([119c765](https://github.com/ar-io/ar-io-sdk/commit/119c765a866c385688b92eacc13b6cefdb4eb341)) +* **ar.io cli:** init token-supply command ([b58d782](https://github.com/ar-io/ar-io-sdk/commit/b58d782462e8725ef10686a13e4f52be69894741)) +* **ar.io cli:** init transfer command ([5553584](https://github.com/ar-io/ar-io-sdk/commit/5553584811cae1d9eb9ac12dbfa77734e5c80892)) +* **ar.io cli:** init update-gateway-settings PE-5854 ([7a6aa4b](https://github.com/ar-io/ar-io-sdk/commit/7a6aa4b0d3f7e1ade858b561f438d85b663f7a5c)) +* **ar.io cli:** stringify outputs for command line compatibility ([3c04cac](https://github.com/ar-io/ar-io-sdk/commit/3c04cac952189cc3c8265327bec6362616bea3b4)) +* **ARIO token:** change all IO references to ARIO ([4f8135d](https://github.com/ar-io/ar-io-sdk/commit/4f8135d53912c1156dc43c21686207820883e445)) +* **ARIO token:** update all IO refernces to ARIO ([8fb2188](https://github.com/ar-io/ar-io-sdk/commit/8fb2188fecd673ed6ad1c66fc710f2fdc6cc70eb)) +* **returned names:** remove/replace auction APIs in favor returned names ([2c9826f](https://github.com/ar-io/ar-io-sdk/commit/2c9826fd1e3c3d4534ba2d50e650affa5d7a35aa)) + + +### BREAKING CHANGES + +* **ARIO token:** All exported IO and IOToken are now replaced with +ARIO and ARIOToken respectively + +PE-7225 + # [2.6.0](https://github.com/ar-io/ar-io-sdk/compare/v2.5.5...v2.6.0) (2024-12-05) diff --git a/docs/src/guides/sdk.md b/docs/src/guides/sdk.md index 0c913f84..f013495e 100644 --- a/docs/src/guides/sdk.md +++ b/docs/src/guides/sdk.md @@ -33,10 +33,10 @@ yarn add @ar.io/sdk --ignore-engines Loading the gateway list in NodeJS. ```typescript -import { IO } from '@ar.io/sdk'; +import { ARIO } from '@ar.io/sdk'; -const io = IO.init(); -const gateways = await io.getGateways(); +const ario = ARIO.init(); +const gateways = await ario.getGateways(); console.log(gateways); ``` @@ -90,12 +90,12 @@ The SDK is provided in both CommonJS and ESM formats and is compatible with bund #### Bundlers (Webpack, Rollup, ESbuild, etc.) ```javascript -import { IO } from '@ar.io/sdk/web'; +import { ARIO } from '@ar.io/sdk/web'; // set up client -const io = IO.init(); +const ario = ARIO.init(); // fetch gateways -const gateways = await io.getGateways(); +const gateways = await ario.getGateways(); ``` **Note**: polyfills are only provided when using the named `@ar.io/sdk/web` export (which requires `moduleResolution: nodenext` in `tsconfig.json`). If you are using the default export within a Typescript project (e.g. `moduleResolution: node`), you will need to provide your own polyfills - specifically `crypto`, `fs` and `buffer`. Refer to [examples/webpack](https://github.com/ar-io/ar-io-sdk/blob/main/examples/webpack) and [examples/vite](https://github.com/ar-io/ar-io-sdk/blob/main/examples/vite) for references in how to properly provide those polyfills. For other project configurations, refer to your bundler's documentation for more information on how to provide the necessary polyfills. @@ -104,12 +104,12 @@ const gateways = await io.getGateways(); ```html ``` @@ -118,23 +118,23 @@ const gateways = await io.getGateways(); ##### ESM (NodeNext) ```javascript -import { IO } from '@ar.io/sdk/node'; +import { ARIO } from '@ar.io/sdk/node'; // set up client -const io = IO.init(); +const ario = ARIO.init(); // fetch gateways -const gateways = await io.getGateways(); +const gateways = await ario.getGateways(); ``` ##### CJS ```javascript -import { IO } from '@ar.io/sdk'; +import { ARIO } from '@ar.io/sdk'; // set up client -const io = IO.init(); +const ario = ARIO.init(); // fetch gateways -const gateways = await io.getGateways(); +const gateways = await ario.getGateways(); ``` ## Typescript @@ -152,15 +152,15 @@ The ArIO contract stores all values as mARIO (milli-ARIO) to avoid floating-poin ### Converting ARIO to mARIO ```typescript -import { IOToken, mIOToken } from '@ar.io/sdk'; +import { ARIOToken, mARIOToken } from '@ar.io/sdk'; -const ioValue = 1; -const mIOValue = new IOToken(ioValue).toMIO(); -console.log(mIOValue); // 1000000 (mARIO) +const arioValue = 1; +const mARIOValue = new ARIOToken(arioValue).toMARIO(); +console.log(mARIOValue); // 1000000 (mARIO) -const mIOValue = 1_000_000; -const ioValue = new mIOToken(mIOValue).toIO(); -console.log(ioValue); // 1 (IO) +const mARIOValue = 1_000_000; +const arioValue = new mARIOToken(mARIOValue).toARIO(); +console.log(arioValue); // 1 (ARIO) ``` ## ARIO Process @@ -173,13 +173,13 @@ Factory function to that creates a read-only or writeable client. By providing a ```typescript // read-only client -const io = IO.init() +const ario = ARIO.init() // read-write client for browser environments -const io = IO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))}); +const ario = ARIO.init({ signer: new ArConnectSigner(window.arweaveWallet, Arweave.init({}))}); // read-write client for node environments -const io = IO.init({ signer: new ArweaveSigner(JWK) }); +const ario = ARIO.init({ signer: new ArweaveSigner(JWK) }); ``` #### `getInfo()` @@ -187,16 +187,16 @@ const io = IO.init({ signer: new ArweaveSigner(JWK) }); Retrieves the information of the ARIO process. ```typescript -const io = IO.init(); -const info = await io.getInfo(); +const ario = ARIO.init(); +const info = await ario.getInfo(); ```
Output ```json { - "Name": "Testnet IO", - "Ticker": "tIO", + "Name": "Testnet ARIO", + "Ticker": "tARIO", "Owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ", "Denomination": 6, "Handlers": ["_eval", "_default_"], // full list of handlers, useful for debugging @@ -218,8 +218,8 @@ Retrieves the total supply of tokens, returned in mARIO. The total supply includ - `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply ```typescript -const io = IO.init(); -const supply = await io.getTokenSupply(); +const ario = ARIO.init(); +const supply = await ario.getTokenSupply(); ```
Output @@ -242,13 +242,13 @@ const supply = await io.getTokenSupply(); Retrieves the balance of the specified wallet address. ```typescript -const io = IO.init(); +const ario = ARIO.init(); // the balance will be returned in mARIO as a value -const balance = await io +const balance = await ario .getBalance({ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ', }) - .then((balance: number) => new mIOToken(balance).toIO()); // convert it to ARIO for readability + .then((balance: number) => new mARIOToken(balance).toARIO()); // convert it to ARIO for readability ```
Output @@ -264,8 +264,8 @@ const balance = await io Retrieves the balances of the ARIO process in `mARIO`, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request. ```typescript -const io = IO.init(); -const balances = await io.getBalances({ +const ario = ARIO.init(); +const balances = await ario.getBalances({ cursor: '-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA', limit: 1, sortBy: 'balance', @@ -297,8 +297,8 @@ const balances = await io.getBalances({ Retrieves a gateway's info by its staking wallet address. ```typescript -const io = IO.init(); -const gateway = await io.getGateway({ +const ario = ARIO.init(); +const gateway = await ario.getGateway({ address: 'INSERT_GATEWAY_ADDRESS', }); ``` @@ -344,8 +344,8 @@ const gateway = await io.getGateway({ Retrieves registered gateways of the ARIO process, using pagination and sorting by the specified criteria. The `cursor` used for pagination is the last gateway address from the previous request. ```typescript -const io = IO.init(); -const gateways = await io.getGateways({ +const ario = ARIO.init(); +const gateways = await ario.getGateways({ limit: 1, sortOrder: 'desc', sortBy: 'operatorStake', @@ -405,8 +405,8 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper Retrieves the record info of the specified ArNS name. ```typescript -const io = IO.init(); -const record = await io.getArNSRecord({ name: 'ardrive' }); +const ario = ARIO.init(); +const record = await ario.getArNSRecord({ name: 'ardrive' }); ```
Output @@ -427,9 +427,9 @@ const record = await io.getArNSRecord({ name: 'ardrive' }); Retrieves all registered ArNS records of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last ArNS name from the previous request. ```typescript -const io = IO.init(); +const ario = ARIO.init(); // get the 5 newest names -const records = await io.getArNSRecords({ +const records = await ario.getArNSRecords({ limit: 5, sortBy: 'startTimestamp', sortOrder: 'desc', @@ -498,8 +498,8 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name` Retrieves the current demand factor of the network. The demand factor is a multiplier applied to the cost of ArNS interactions based on the current network demand. ```typescript -const io = IO.init(); -const demandFactor = await io.getDemandFactor(); +const ario = ARIO.init(); +const demandFactor = await ario.getDemandFactor(); ```
Output @@ -508,14 +508,86 @@ const demandFactor = await io.getDemandFactor(); ```
+#### `getArNSReturnedNames({ cursor, limit, sortyBy, sortOrder })` + +Retrieves all active returned names of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last returned name from the previous request. + +```typescript +const ario = ARIO.init(); +const returnedNames = await ario.getArNSReturnedNames({ + limit: 100, + sortBy: 'endTimestamp', + sortOrder: 'asc', // return the returned names ending soonest first +}); +``` + +
Output + +```json +{ + "items": [ + { + "name": "permalink", + "endTimestamp": 1730985241349, + "startTimestamp": 1729775641349, + "baseFee": 250000000, + "demandFactor": 1.05256, + "initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc", + "settings": { + "durationMs": 1209600000, + "decayRate": 0.000000000016847809193121693, + "scalingExponent": 190, + "startPriceMultiplier": 50 + } + } + ], + "hasMore": false, + "totalItems": 1, + "sortBy": "endTimestamp", + "sortOrder": "asc" +} +``` + +
+ +#### `getArNSReturnedName({ name })` + +Retrieves the returned name data for the specified returned name. + +```typescript +const ario = ARIO.init(); +const returnedName = await ario.getArNSReturnedName({ name: 'permalink' }); +``` + +
Output + +```json +{ + "name": "permalink", + "endTimestamp": 1730985241349, + "startTimestamp": 1729775641349, + "baseFee": 250000000, + "demandFactor": 1.05256, + "initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc", + "settings": { + "durationMs": 1209600000, + "decayRate": 0.000000000016847809193121693, + "scalingExponent": 190, + "startPriceMultiplier": 50 + } +} +``` + +
+ #### `getObservations({ epochIndex })` Returns the epoch-indexed observation list. ```typescript -const io = IO.init(); -const observations = await io.getObservations(); +const ario = ARIO.init(); +const observations = await ario.getObservations(); ```
Output @@ -545,8 +617,8 @@ const observations = await io.getObservations(); Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used. ```typescript -const io = IO.init(); -const distributions = await io.getDistributions({ epochIndex: 0 }); +const ario = ARIO.init(); +const distributions = await ario.getDistributions({ epochIndex: 0 }); ```
Output @@ -579,8 +651,8 @@ const distributions = await io.getDistributions({ epochIndex: 0 }); Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used. ```typescript -const io = IO.init(); -const epoch = await io.getEpoch({ epochIndex: 0 }); +const ario = ARIO.init(); +const epoch = await ario.getEpoch({ epochIndex: 0 }); ```
Output @@ -645,8 +717,8 @@ const epoch = await io.getEpoch({ epochIndex: 0 }); Returns the current epoch data. ```typescript -const io = IO.init(); -const epoch = await io.getCurrentEpoch(); +const ario = ARIO.init(); +const epoch = await ario.getCurrentEpoch(); ```
Output @@ -699,8 +771,8 @@ const epoch = await io.getCurrentEpoch(); Retrieves the prescribed observers of the ARIO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch. ```typescript -const io = IO.init(); -const observers = await io.getPrescribedObservers({ epochIndex: 0 }); +const ario = ARIO.init(); +const observers = await ario.getPrescribedObservers({ epochIndex: 0 }); ```
Output @@ -728,13 +800,13 @@ const observers = await io.getPrescribedObservers({ epochIndex: 0 }); Calculates the price in mARIO to perform the interaction in question, e.g. a `Buy-record` interaction, where args are the specific params for that interaction. ```typescript -const price = await io +const price = await ario .getTokenCost({ intent: 'Buy-Record', name: 'ar-io', type: 'permabuy', }) - .then((p) => new mIOToken(p).toIO()); // convert to ARIO for readability + .then((p) => new mARIOToken(p).toARIO()); // convert to ARIO for readability ```
Output @@ -749,16 +821,16 @@ const price = await io Joins a gateway to the ar.io network via its associated wallet. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); const { id: txId } = await io.joinNetwork( { - qty: new IOToken(10_000).toMIO(), // minimum operator stake allowed + qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed autoStake: true, // auto-stake operator rewards to the gateway allowDelegatedStaking: true, // allows delegated staking - minDelegatedStake: new IOToken(100).toMIO(), // minimum delegated stake allowed + minDelegatedStake: new ARIOToken(100).toMARIO(), // minimum delegated stake allowed delegateRewardShareRatio: 10, // percentage of rewards to share with delegates (e.g. 10%) label: 'john smith', // min 1, max 64 characters note: 'The example gateway', // max 256 characters @@ -777,12 +849,12 @@ const { id: txId } = await io.joinNetwork( Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be provided on `IO.init` to sign the transaction. The gateway's operator and delegated stakes are vaulted and will be returned after the leave periods. The gateway will be removed from the network after the leave period. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.leaveNetwork( +const { id: txId } = await ario.leaveNetwork( // optional additional tags { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] }, ); @@ -792,14 +864,14 @@ const { id: txId } = await io.leaveNetwork( Writes new gateway settings to the caller's gateway configuration. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.updateGatewaySettings( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.updateGatewaySettings( { // any other settings you want to update - minDelegatedStake: new IOToken(100).toMIO(), + minDelegatedStake: new ARIOToken(100).toMARIO(), }, // optional additional tags { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] }, @@ -810,14 +882,14 @@ const { id: txId } = await io.updateGatewaySettings( Increases the caller's stake on the target gateway. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); const { id: txId } = await io.increaseDelegateStake( { target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', - qty: new IOToken(100).toMIO(), + qty: new ARIOToken(100).toMARIO(), }, // optional additional tags { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] }, @@ -828,14 +900,14 @@ const { id: txId } = await io.increaseDelegateStake( Decrease the caller's stake on the target gateway. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.decreaseDelegateStake( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.decreaseDelegateStake( { target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', - qty: new IOToken(100).toMIO(), + qty: new ARIOToken(100).toMARIO(), }, { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }], @@ -848,8 +920,8 @@ const { id: txId } = await io.decreaseDelegateStake( Retrieves all active and vaulted stakes across all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last delegationId (concatenated gateway and startTimestamp of the delegation) from the previous request. ```typescript -const io = IO.init(); -const vaults = await io.getDelegations({ +const ario = ARIO.init(); +const vaults = await ario.getDelegations({ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', cursor: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789', limit: 2, @@ -895,12 +967,12 @@ const vaults = await io.getDelegations({ Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is provided, the signer's address will be used. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); // removes a delegated vault from a gateway -const { id: txId } = await io.instantWithdrawal( +const { id: txId } = await ario.instantWithdrawal( { // gateway address where delegate vault exists gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', @@ -913,7 +985,7 @@ const { id: txId } = await io.instantWithdrawal( }, ); // removes an operator vault from a gateway -const { id: txId } = await io.instantWithdrawal( +const { id: txId } = await ario.instantWithdrawal( { vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3', }, @@ -924,12 +996,12 @@ const { id: txId } = await io.instantWithdrawal( Cancels an existing vault on a gateway. The vaulted stake will be returned to the caller's stake. if no `gatewayAddress` is provided, the signer's address will be used. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); // cancels a delegated vault from a gateway -const { id: txId } = await io.cancelWithdrawal( +const { id: txId } = await ario.cancelWithdrawal( { // gateway address where vault exists gatewayAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', @@ -940,7 +1012,7 @@ const { id: txId } = await io.cancelWithdrawal( { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] }, ); // cancels an operator vault from a gateway -const { id: txId } = await io.cancelWithdrawal( +const { id: txId } = await ario.cancelWithdrawal( { // operator vault id to cancel vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3', @@ -953,8 +1025,8 @@ const { id: txId } = await io.cancelWithdrawal( Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request. ```typescript -const io = IO.init(); -const allowedDelegates = await io.getAllowedDelegates({ +const ario = ARIO.init(); +const allowedDelegates = await ario.getAllowedDelegates({ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ', }); ``` @@ -983,8 +1055,8 @@ const allowedDelegates = await io.getAllowedDelegates({ Retrieves all vaults accross all gateways for a specific address, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last vaultId from the previous request. ```typescript -const io = IO.init(); -const vaults = await io.getGatewayVaults({ +const ario = ARIO.init(); +const vaults = await ario.getGatewayVaults({ address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM', }); ``` @@ -1016,13 +1088,13 @@ const vaults = await io.getGatewayVaults({ Increases the caller's operator stake. Must be executed with a wallet registered as a gateway operator. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.increaseOperatorStake( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.increaseOperatorStake( { - qty: new IOToken(100).toMIO(), + qty: new ARIOToken(100).toMARIO(), }, { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }], @@ -1034,13 +1106,13 @@ const { id: txId } = await io.increaseOperatorStake( Decreases the caller's operator stake. Must be executed with a wallet registered as a gateway operator. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.decreaseOperatorStake( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.decreaseOperatorStake( { - qty: new IOToken(100).toMIO(), + qty: new ARIOToken(100).toMARIO(), }, { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }], @@ -1055,12 +1127,12 @@ Redelegates the stake of a specific address to a new gateway. Vault ID may be op e.g: If 1000 mARIO is redelegated and the fee rate is 10%, the fee will be 100 mARIO. Resulting in 900 mARIO being redelegated to the new gateway and 100 mARIO being deducted back to the protocol balance. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); const { id: txId } = await io.redelegateStake({ target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', source: 'HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA', - stakeQty: new IOToken(1000).toMIO(), + stakeQty: new ARIOToken(1000).toMARIO(), vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3', }); ``` @@ -1070,9 +1142,9 @@ const { id: txId } = await io.redelegateStake({ Retrieves the fee rate as percentage required to redelegate the stake of a specific address. Fee rate ranges from 0% to 60% based on the number of redelegations since the last fee reset. ```typescript -const io = IO.init(); +const ario = ARIO.init(); -const fee = await io.getRedelegationFee({ +const fee = await ario.getRedelegationFee({ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', }); ``` @@ -1092,11 +1164,11 @@ const fee = await io.getRedelegationFee({ Saves the observations of the current epoch. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.saveObservations( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.saveObservations( { reportTxId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3', failedGateways: ['t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3'], @@ -1111,14 +1183,14 @@ const { id: txId } = await io.saveObservations( Transfers `mARIO` to the designated `target` recipient address. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.transfer( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.transfer( { target: '-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5', - qty: new IOToken(1000).toMIO(), + qty: new ARIOToken(1000).toMARIO(), }, // optional additional tags { tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] }, @@ -1129,11 +1201,11 @@ const { id: txId } = await io.transfer( Increases the undername support of a domain up to a maximum of 10k. Domains, by default, support up to 10 undernames. -**NOTE**: Requires `signer` to be provided on `IO.init` to sign the transaction. +**NOTE**: Requires `signer` to be provided on `ARIO.init` to sign the transaction. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.increaseUndernameLimit( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.increaseUndernameLimit( { name: 'ar-io', qty: 420, @@ -1148,8 +1220,8 @@ const { id: txId } = await io.increaseUndernameLimit( Extends the lease of a registered ArNS domain, with an extension of 1-5 years depending on grace period status. Permanently registered domains cannot be extended. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.extendLease( +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.extendLease( { name: 'ar-io', years: 1, @@ -1164,7 +1236,7 @@ const { id: txId } = await io.extendLease( Retrieves the locked-balance user vault of the ARIO process by the specified wallet address and vault ID. ```typescript -const io = IO.init(); +const ario = ARIO.init(); const vault = await io.getVault({ address: 'QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ', vaultId: 'vaultIdOne', @@ -1188,8 +1260,8 @@ const vault = await io.getVault({ Retrieves all locked-balance user vaults of the ARIO process, paginated and sorted by the specifed criteria. The `cursor` used for pagination is the last wallet address from the previous request. ```typescript -const io = IO.init(); -const vaults = await io.getVaults({ +const ario = ARIO.init(); +const vaults = await ario.getVaults({ cursor: '0', limit: 100, sortBy: 'balance', @@ -1233,8 +1305,8 @@ const vaults = await io.getVaults({ Purchases a new ArNS record with the specified name, type, and duration. ```typescript -const io = IO.init({ processId: IO_DEVNET_PROCESS_ID, signer }); -const record = await io.buyRecord( +const ario = ARIO.init({ processId: ARIO_DEVNET_PROCESS_ID, signer }); +const record = await ario.buyRecord( { name: 'ardrive', type: 'lease', years: 1 }, { // optional tags @@ -1248,8 +1320,8 @@ const record = await io.buyRecord( Retrieves all active auctions of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last auction name from the previous request. ```typescript -const io = IO.init(); -const auctions = await io.getArNSAuctions({ +const ario = ARIO.init(); +const auctions = await ario.getArNSAuctions({ limit: 100, sortBy: 'endTimestamp', sortOrder: 'asc', // return the auctions ending soonest first @@ -1290,8 +1362,8 @@ const auctions = await io.getArNSAuctions({ Retrieves the auction data for the specified auction name. ```typescript -const io = IO.init(); -const auction = await io.getArNSAuction({ name: 'permalink' }); +const ario = ARIO.init(); +const auction = await ario.getArNSAuction({ name: 'permalink' }); ```
Output @@ -1320,8 +1392,8 @@ const auction = await io.getArNSAuction({ name: 'permalink' }); Retrieves the auction price curve of the specified auction name for the specified type, duration, and interval. The `intervalMs` is the number of miliseconds between price points on the curve. The default interval is 15 minutes. ```typescript -const io = IO.init(); -const priceCurve = await io.getArNSAuctionPrices({ +const ario = ARIO.init(); +const priceCurve = await ario.getArNSAuctionPrices({ name: 'permalink', type: 'lease', years: 1, @@ -1373,13 +1445,13 @@ const priceCurve = await io.getArNSAuctionPrices({ Submit a bid for the current auction. If the bid is accepted, the name will be leased for the specified duration and assigned the specified type and processId. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); -const auction = await io.getArNSAuction({ name: 'permalink' }); +const auction = await ario.getArNSAuction({ name: 'permalink' }); // check the current price is under some threshold -if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) { - const { id: txId } = await io.submitAuctionBid( +if (auction && auction.currentPrice <= new ARIOToken(20_000).toMARIO().valueOf()) { + const { id: txId } = await ario.submitAuctionBid( { name: 'permalink', type: 'lease', @@ -1397,8 +1469,8 @@ if (auction && auction.currentPrice <= new IOToken(20_000).toMIO().valueOf()) { Retrieves all primary names paginated and sorted by the specified criteria. the `cursor` used for pagination is the last name from the previous request. ```typescript -const io = IO.init(); -const names = await io.getPrimaryNames({ +const ario = ARIO.init(); +const names = await ario.getPrimaryNames({ cursor: 'ao', // this is the last name from the previous request limit: 1, sortBy: 'startTimestamp', @@ -1431,12 +1503,12 @@ const names = await io.getPrimaryNames({ Retrieves the primary name for a given name or address. ```typescript -const io = IO.init(); -const name = await io.getPrimaryName({ +const ario = ARIO.init(); +const name = await ario.getPrimaryName({ name: 'arns', }); // or -const name = await io.getPrimaryName({ +const name = await ario.getPrimaryName({ address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', }); ``` @@ -1456,8 +1528,8 @@ const name = await io.getPrimaryName({ Requests a primary name for the caller's address. The request must be approved b the new owner of the requested name via the `approvePrimaryNameRequest` API. ```typescript -const io = IO.init({ signer: new ArweaveSigner(jwk) }); -const { id: txId } = await io.requestPrimaryName({ +const ario = ARIO.init({ signer: new ArweaveSigner(jwk) }); +const { id: txId } = await ario.requestPrimaryName({ name: 'arns', }); ``` @@ -1467,8 +1539,8 @@ const { id: txId } = await io.requestPrimaryName({ Retrieves the primary name request for a wallet address. ```typescript -const io = IO.init(); -const request = await io.getPrimaryNameRequest({ +const ario = ARIO.init(); +const request = await ario.getPrimaryNameRequest({ initiator: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', }); ``` @@ -1493,9 +1565,9 @@ The ARIO client class exposes APIs relevenat to the ar.io process. It can be con ```typescript // provide a custom ao infrastructure and process id -const io = IO.init({ +const ario = ARIO.init({ process: new AoProcess({ - processId: 'IO_PROCESS_ID' + processId: 'ARIO_PROCESS_ID' ao: connect({ MU_URL: 'https://mu-testnet.xyz', CU_URL: 'https://cu-testnet.xyz',