@ar.io/sdk 3.15.1 → 3.16.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/bundles/web.bundle.min.js +93 -93
- package/lib/cjs/cli/cli.js +1 -0
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +23 -5
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +2 -3
- package/lib/cjs/common/ant.js +12 -1
- package/lib/cjs/common/io.js +20 -0
- package/lib/cjs/constants.js +6 -0
- package/lib/cjs/utils/ao.js +155 -40
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +1 -0
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +23 -5
- package/lib/esm/cli/commands/gatewayWriteCommands.js +2 -3
- package/lib/esm/common/ant.js +13 -2
- package/lib/esm/common/io.js +20 -0
- package/lib/esm/constants.js +6 -0
- package/lib/esm/utils/ao.js +156 -41
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +0 -15
- package/lib/types/cli/commands/gatewayWriteCommands.d.ts +1 -1
- package/lib/types/common/ant.d.ts +12 -2
- package/lib/types/common/io.d.ts +4 -2
- package/lib/types/constants.d.ts +6 -0
- package/lib/types/types/common.d.ts +21 -1
- package/lib/types/types/io.d.ts +1 -1
- package/lib/types/utils/ao.d.ts +11 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1233,10 +1233,18 @@ const record = await ario.resolveArNSName({ name: 'logo_ardrive' });
|
|
|
1233
1233
|
|
|
1234
1234
|
#### `buyRecord({ name, type, years, processId })`
|
|
1235
1235
|
|
|
1236
|
-
Purchases a new ArNS record with the specified name, type, and duration.
|
|
1236
|
+
Purchases a new ArNS record with the specified name, type, processId, and duration.
|
|
1237
1237
|
|
|
1238
1238
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1239
1239
|
|
|
1240
|
+
**Arguments:**
|
|
1241
|
+
|
|
1242
|
+
- `name` - _required_: the name of the ArNS record to purchase
|
|
1243
|
+
- `type` - _required_: the type of ArNS record to purchase
|
|
1244
|
+
- `processId` - _optional_: the process id of an existing ANT process. If not provided, a new ANT process using the provided `signer` will be spawned, and the ArNS record will be assigned to that process.
|
|
1245
|
+
- `years` - _optional_: the duration of the ArNS record in years. If not provided and `type` is `lease`, the record will be leased for 1 year. If not provided and `type` is `permabuy`, the record will be permanently registered.
|
|
1246
|
+
- `referrer` - _optional_: track purchase referrals for analytics (e.g. `my-app.com`)
|
|
1247
|
+
|
|
1240
1248
|
```typescript
|
|
1241
1249
|
const ario = ARIO.mainnet({ signer });
|
|
1242
1250
|
const record = await ario.buyRecord(
|
|
@@ -1244,11 +1252,24 @@ const record = await ario.buyRecord(
|
|
|
1244
1252
|
name: 'ardrive',
|
|
1245
1253
|
type: 'lease',
|
|
1246
1254
|
years: 1,
|
|
1255
|
+
processId: 'bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM', // optional: assign to existing ANT process
|
|
1247
1256
|
referrer: 'my-app.com', // optional: track purchase referrals for analytics
|
|
1248
1257
|
},
|
|
1249
1258
|
{
|
|
1250
1259
|
// optional tags
|
|
1251
1260
|
tags: [{ name: 'App-Name', value: 'ArNS-App' }],
|
|
1261
|
+
onSigningProgress: (step, event) => {
|
|
1262
|
+
console.log(`Signing progress: ${step}`);
|
|
1263
|
+
if (step === 'spawning-ant') {
|
|
1264
|
+
console.log('Spawning ant:', event); // 0-100
|
|
1265
|
+
}
|
|
1266
|
+
if (step === 'registering-ant') {
|
|
1267
|
+
console.log('Registering ant:', event); // 0-100
|
|
1268
|
+
}
|
|
1269
|
+
if (step === 'verifying-state') {
|
|
1270
|
+
console.log('Verifying state:', event); // 0-100
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1252
1273
|
},
|
|
1253
1274
|
);
|
|
1254
1275
|
```
|
|
@@ -1989,6 +2010,56 @@ const ant = ANT.init({
|
|
|
1989
2010
|
|
|
1990
2011
|
```
|
|
1991
2012
|
|
|
2013
|
+
#### `spawn({ signer, module?, ao?, scheduler?, state?, antRegistryId?, logger?, authority? })`
|
|
2014
|
+
|
|
2015
|
+
Spawns a new ANT (Arweave Name Token) process. This static function creates a new ANT process on the AO network and returns the process ID.
|
|
2016
|
+
|
|
2017
|
+
_Note: Requires `signer` to be provided to sign the spawn transaction._
|
|
2018
|
+
|
|
2019
|
+
```typescript
|
|
2020
|
+
import { ANT } from '@ar.io/sdk';
|
|
2021
|
+
import { ArweaveSigner } from '@ar.io/sdk/node';
|
|
2022
|
+
|
|
2023
|
+
const processId = await ANT.spawn({
|
|
2024
|
+
signer: new ArweaveSigner(jwk),
|
|
2025
|
+
state: {
|
|
2026
|
+
name: 'My ANT',
|
|
2027
|
+
ticker: 'MYANT',
|
|
2028
|
+
description: 'My custom ANT token',
|
|
2029
|
+
},
|
|
2030
|
+
});
|
|
2031
|
+
```
|
|
2032
|
+
|
|
2033
|
+
**Parameters:**
|
|
2034
|
+
|
|
2035
|
+
- `signer: AoSigner` - The signer used to authenticate the spawn transaction
|
|
2036
|
+
- `module?: string` - Optional module ID to use; if not provided, gets latest from ANT registry
|
|
2037
|
+
- `ao?: AoClient` - Optional AO client instance (defaults to legacy mode connection)
|
|
2038
|
+
- `scheduler?: string` - Optional scheduler ID
|
|
2039
|
+
- `state?: SpawnANTState` - Optional initial state for the ANT including name, ticker, description, etc.
|
|
2040
|
+
- `antRegistryId?: string` - Optional ANT registry ID
|
|
2041
|
+
- `logger?: Logger` - Optional logger instance
|
|
2042
|
+
- `authority?: string` - Optional authority
|
|
2043
|
+
|
|
2044
|
+
**Returns:** `Promise<ProcessId>` - The process ID of the newly spawned ANT
|
|
2045
|
+
|
|
2046
|
+
#### `versions`
|
|
2047
|
+
|
|
2048
|
+
Returns an ANTVersions instance that provides access to available ANT versions from the ANT registry. This static property allows you to query version information without needing a specific ANT process.
|
|
2049
|
+
|
|
2050
|
+
```typescript
|
|
2051
|
+
import { ANT } from '@ar.io/sdk';
|
|
2052
|
+
|
|
2053
|
+
// Get all available ANT versions
|
|
2054
|
+
const antVersions = ANT.versions;
|
|
2055
|
+
const versions = await antVersions.getANTVersions();
|
|
2056
|
+
|
|
2057
|
+
// Get the latest ANT version
|
|
2058
|
+
const latestVersion = await antVersions.getLatestANTVersion();
|
|
2059
|
+
```
|
|
2060
|
+
|
|
2061
|
+
**Returns:** `AoANTVersionsRead` - A read-only ANT versions client
|
|
2062
|
+
|
|
1992
2063
|
#### `getInfo()`
|
|
1993
2064
|
|
|
1994
2065
|
Retrieves the information of the ANT process.
|