Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release 3.8.1 #425

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ ar.io help <command>

For each command the AR.IO CLI provides a set of options that allow you to customize the behavior of the CLI. Some of the common options include:

- `--dev`: Run against the AR.IO devnet process
- `--dev, --devnet`: Run against the AR.IO devnet process
- `--testnet`: Run against the AR.IO testnet process
- `--mainnet`: Run against the AR.IO mainnet process (default)
- `--debug`: Enable debug log output
- `--skip-confirmation`: Skip confirmation prompts
- `--ario-process-id <arioProcessId>`: Run against a custom AR.IO process id
Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Mainnet and Testnet Process IDs](#mainnet-and-testnet-process-ids)
- [Web](#web)
- [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc)
- [Browser](#browser)
Expand Down Expand Up @@ -208,6 +209,27 @@ const gateways = await ario.getGateways();

The SDK is provided in both CommonJS and ESM formats and is compatible with bundlers such as Webpack, Rollup, and ESbuild. Utilize the appropriately named exports provided by this SDK's [package.json] based on your project's configuration. Refer to the [examples] directory to see how to use the SDK in various environments.

### Mainnet and Testnet Process IDs

The SDK provides the following process IDs for the mainnet and testnet environments:

- `ARIO_MAINNET_PROCESS_ID` - Mainnet ARIO process ID
- `ARIO_TESTNET_PROCESS_ID` - Testnet ARIO process ID

```typescript
import {
ARIO,
ARIO_MAINNET_PROCESS_ID,
ARIO_TESTNET_PROCESS_ID,
} from '@ar.io/sdk';
```

By default, the SDK will use the mainnet process ID. To use the testnet process ID, provide the `ARIO_TESTNET_PROCESS_ID` when initializing the client.

```typescript
const ario = ARIO.init({ processId: ARIO_TESTNET_PROCESS_ID });
```

### Web

#### Bundlers (Webpack, Rollup, ESbuild, etc.)
Expand Down Expand Up @@ -2375,7 +2397,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
```typescript
const { id: txId } = await ant.releaseName({
name: 'permalink',
arioProcessId: ARIO_TESTNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the ARIO contract
arioProcessId: ARIO_MAINNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the ARIO contract
});
```

Expand All @@ -2388,7 +2410,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
```typescript
const { id: txId } = await ant.reassignName({
name: 'ardrive',
arioProcessId: ARIO_TESTNET_PROCESS_ID,
arioProcessId: ARIO_MAINNET_PROCESS_ID,
antProcessId: NEW_ANT_PROCESS_ID, // the new ANT process id that will take over ownership of the name
});
```
Expand All @@ -2403,7 +2425,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
const { id: txId } = await ant.approvePrimaryNameRequest({
name: 'arns',
address: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3', // must match the request initiator address
arioProcessId: ARIO_TESTNET_PROCESS_ID, // the ARIO process id to use for the request
arioProcessId: ARIO_MAINNET_PROCESS_ID, // the ARIO process id to use for the request
});
```

Expand All @@ -2416,7 +2438,7 @@ _Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
```typescript
const { id: txId } = await ant.removePrimaryNames({
names: ['arns', 'test_arns'], // any primary names associated with a base name controlled by this ANT will be removed
arioProcessId: ARIO_TESTNET_PROCESS_ID,
arioProcessId: ARIO_MAINNET_PROCESS_ID,
notifyOwners: true, // if true, the owners of the removed names will be send AO messages to notify them of the removal
});
```
Expand Down
4 changes: 2 additions & 2 deletions examples/cjs/index.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ARIO, Logger, ARIO_TESTNET_PROCESS_ID } = require('@ar.io/sdk');
const { ARIO, Logger, ARIO_MAINNET_PROCESS_ID } = require('@ar.io/sdk');

(async () => {
// set the log level for the SDK
Expand All @@ -8,7 +8,7 @@ const { ARIO, Logger, ARIO_TESTNET_PROCESS_ID } = require('@ar.io/sdk');
// testnet gateways
const testnetGateways = await arIO.getGateways();
const protocolBalance = await arIO.getBalance({
address: ARIO_TESTNET_PROCESS_ID,
address: ARIO_MAINNET_PROCESS_ID,
});
const ardriveRecord = await arIO.getArNSRecord({ name: 'ardrive' });
const partialRecords = await arIO.getArNSRecords({
Expand Down
4 changes: 2 additions & 2 deletions examples/esm/index.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
ANT,
ARIO,
ARIO_TESTNET_PROCESS_ID,
ARIO_MAINNET_PROCESS_ID,
getANTProcessesOwnedByWallet,
} from '@ar.io/sdk';

(async () => {
const arIO = ARIO.init();
const testnetGateways = await arIO.getGateways();
const protocolBalance = await arIO.getBalance({
address: ARIO_TESTNET_PROCESS_ID,
address: ARIO_MAINNET_PROCESS_ID,
});
const contractInfo = await arIO.getInfo();
const ardriveRecord = await arIO.getArNSRecord({ name: 'ardrive' });
Expand Down
6 changes: 1 addition & 5 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export function arioProcessIdFromOptions({
arioProcessId,
devnet,
testnet,
mainnet,
}: GlobalCLIOptions): string {
if (arioProcessId !== undefined) {
return arioProcessId;
Expand All @@ -163,11 +162,8 @@ export function arioProcessIdFromOptions({
if (testnet) {
return ARIO_TESTNET_PROCESS_ID;
}
if (mainnet) {
return ARIO_MAINNET_PROCESS_ID;
}

return ARIO_TESTNET_PROCESS_ID; // TODO(4.0): move to mainnet
return ARIO_MAINNET_PROCESS_ID;
}

function jwkFromOptions({
Expand Down
8 changes: 4 additions & 4 deletions src/common/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.releaseName({ name: "ardrive", arioProcessId: AR_TESTNET_PROCESS_ID });
* ant.releaseName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID });
* ```
*/
async releaseName(
Expand Down Expand Up @@ -675,7 +675,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.reassignName({ name: "ardrive", arioProcessId: ARIO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
* ant.reassignName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
* ```
*/
async reassignName(
Expand Down Expand Up @@ -708,7 +708,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_TESTNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
* ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_MAINNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
* ```
*/
async approvePrimaryNameRequest(
Expand Down Expand Up @@ -741,7 +741,7 @@ export class AoANTWriteable extends AoANTReadable implements AoANTWrite {
* @returns {Promise<AoMessageResult>} The result of the interaction.
* @example
* ```ts
* ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId: ARIO_TESTNET_PROCESS_ID, notifyOwners: true }); // removes the primary names and associated wallet addresses assigned to "ardrive" and "dapp_ardrive"
* ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId: ARIO_MAINNET_PROCESS_ID, notifyOwners: true }); // removes the primary names and associated wallet addresses assigned to "ardrive" and "dapp_ardrive"
* ```
*/
async removePrimaryNames(
Expand Down
6 changes: 3 additions & 3 deletions src/common/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import Arweave from 'arweave';

import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
import { ARIO_MAINNET_PROCESS_ID } from '../constants.js';
import {
AoArNSNameDataWithName,
AoArNSReservedNameData,
Expand Down Expand Up @@ -123,7 +123,7 @@ export class ARIOReadable implements AoARIORead {
this.arweave = config?.arweave ?? defaultArweave;
if (config === undefined || Object.keys(config).length === 0) {
this.process = new AOProcess({
processId: ARIO_TESTNET_PROCESS_ID,
processId: ARIO_MAINNET_PROCESS_ID,
});
} else if (isProcessConfiguration(config)) {
this.process = config.process;
Expand Down Expand Up @@ -816,7 +816,7 @@ export class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
if (config === undefined) {
super({
process: new AOProcess({
processId: ARIO_TESTNET_PROCESS_ID,
processId: ARIO_MAINNET_PROCESS_ID,
}),
});
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/utils/arweave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import Arweave from 'arweave';

import { ARIO_TESTNET_PROCESS_ID, ARWEAVE_TX_REGEX } from '../constants.js';
import { ARIO_MAINNET_PROCESS_ID, ARWEAVE_TX_REGEX } from '../constants.js';
import { BlockHeight } from '../types/common.js';
import {
AoEligibleDistribution,
Expand Down Expand Up @@ -73,7 +73,7 @@
export const getEpochDataFromGql = async ({
arweave,
epochIndex,
processId = ARIO_TESTNET_PROCESS_ID,
processId = ARIO_MAINNET_PROCESS_ID,
retries = 3,
gqlUrl = 'https://arweave-search.goldsky.com/graphql',
}: {
Expand All @@ -94,7 +94,7 @@
headers: {
'Content-Type': 'application/json',
},
}).then((res) => res.json())) as any;

Check warning on line 97 in src/utils/arweave.ts

View workflow job for this annotation

GitHub Actions / build (18.x, lint)

Unexpected any. Specify a different type

Check warning on line 97 in src/utils/arweave.ts

View workflow job for this annotation

GitHub Actions / build (20.x, lint)

Unexpected any. Specify a different type

// parse the nodes to get the id
if (response?.data?.transactions?.edges?.length === 0) {
Expand All @@ -121,12 +121,12 @@
* Get the epoch with distribution data for the current epoch
* @param arweave - The Arweave instance
* @param epochIndex - The index of the epoch
* @param processId - The process ID (optional, defaults to ARIO_TESTNET_PROCESS_ID)
* @param processId - The process ID (optional, defaults to ARIO_MAINNET_PROCESS_ID)
* @returns string - The stringified GQL query
*/
export const epochDistributionNoticeGqlQuery = ({
epochIndex,
processId = ARIO_TESTNET_PROCESS_ID,
processId = ARIO_MAINNET_PROCESS_ID,
authorities = ['fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY'],
}): string => {
// write the query
Expand Down
6 changes: 3 additions & 3 deletions src/utils/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ANT } from '../common/ant.js';
import { AOProcess } from '../common/index.js';
import { ARIO } from '../common/io.js';
import { ILogger, Logger } from '../common/logger.js';
import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
import { ARIO_MAINNET_PROCESS_ID } from '../constants.js';
import { AoANTRegistryRead } from '../types/ant-registry.js';
import { AoANTState } from '../types/ant.js';
import {
Expand Down Expand Up @@ -74,7 +74,7 @@ export class ArNSEventEmitter extends EventEmitter {
private antAoClient: AoClient;
constructor({
contract = ARIO.init({
processId: ARIO_TESTNET_PROCESS_ID,
processId: ARIO_MAINNET_PROCESS_ID,
}),
timeoutMs = 60_000,
concurrency = 30,
Expand Down Expand Up @@ -192,7 +192,7 @@ export class ArNSEventEmitter extends EventEmitter {

export const fetchAllArNSRecords = async ({
contract = ARIO.init({
processId: ARIO_TESTNET_PROCESS_ID,
processId: ARIO_MAINNET_PROCESS_ID,
}),
emitter,
logger = Logger.default,
Expand Down
Loading