@ar.io/sdk 4.0.0-solana.13 → 4.0.0-solana.15
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 +516 -708
- package/lib/esm/cli/cli.js +14 -150
- package/lib/esm/cli/commands/antCommands.js +1 -62
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +7 -28
- package/lib/esm/cli/commands/gatewayWriteCommands.js +4 -7
- package/lib/esm/cli/commands/pruneCommands.js +0 -16
- package/lib/esm/cli/commands/readCommands.js +0 -1
- package/lib/esm/cli/options.js +2 -75
- package/lib/esm/cli/utils.js +54 -200
- package/lib/esm/common/ant-registry.js +12 -160
- package/lib/esm/common/ant.js +34 -1207
- package/lib/esm/common/faucet.js +11 -6
- package/lib/esm/common/index.js +0 -4
- package/lib/esm/common/io.js +13 -1451
- package/lib/esm/constants.js +0 -18
- package/lib/esm/solana/ant-registry-writeable.js +1 -1
- package/lib/esm/solana/ant-writeable.js +1 -1
- package/lib/esm/solana/clusters.js +6 -10
- package/lib/esm/solana/deserialize.js +8 -8
- package/lib/esm/solana/index.js +15 -1
- package/lib/esm/solana/io-readable.js +156 -20
- package/lib/esm/solana/io-writeable.js +1 -1
- package/lib/esm/types/ant.js +8 -8
- package/lib/esm/types/io.js +0 -10
- package/lib/esm/utils/ant.js +0 -64
- package/lib/esm/utils/index.js +0 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +6 -9
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +27 -13
- package/lib/types/cli/commands/gatewayWriteCommands.d.ts +12 -12
- package/lib/types/cli/commands/pruneCommands.d.ts +11 -11
- package/lib/types/cli/commands/readCommands.d.ts +23 -23
- package/lib/types/cli/commands/transfer.d.ts +9 -9
- package/lib/types/cli/options.d.ts +0 -57
- package/lib/types/cli/types.d.ts +6 -14
- package/lib/types/cli/utils.d.ts +34 -32
- package/lib/types/common/ant-registry.d.ts +35 -74
- package/lib/types/common/ant.d.ts +45 -570
- package/lib/types/common/faucet.d.ts +20 -8
- package/lib/types/common/index.d.ts +0 -3
- package/lib/types/common/io.d.ts +41 -302
- package/lib/types/constants.d.ts +0 -17
- package/lib/types/solana/ant-readable.d.ts +5 -5
- package/lib/types/solana/ant-registry-readable.d.ts +2 -2
- package/lib/types/solana/ant-registry-writeable.d.ts +5 -5
- package/lib/types/solana/ant-writeable.d.ts +24 -24
- package/lib/types/solana/clusters.d.ts +6 -10
- package/lib/types/solana/deserialize.d.ts +10 -10
- package/lib/types/solana/index.d.ts +4 -0
- package/lib/types/solana/io-readable.d.ts +75 -46
- package/lib/types/solana/io-writeable.d.ts +52 -52
- package/lib/types/types/ant-registry.d.ts +4 -4
- package/lib/types/types/ant.d.ts +70 -97
- package/lib/types/types/common.d.ts +18 -74
- package/lib/types/types/faucet.d.ts +2 -2
- package/lib/types/types/io.d.ts +152 -161
- package/lib/types/types/token.d.ts +0 -12
- package/lib/types/utils/ant.d.ts +1 -12
- package/lib/types/utils/index.d.ts +0 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +14 -28
- package/lib/esm/common/ant-versions.js +0 -87
- package/lib/esm/common/arweave.js +0 -21
- package/lib/esm/common/contracts/ao-process.js +0 -218
- package/lib/esm/common/hyperbeam/hb.js +0 -169
- package/lib/esm/common/marketplace.js +0 -669
- package/lib/esm/common/turbo.js +0 -215
- package/lib/esm/node/index.js +0 -20
- package/lib/esm/utils/ao.js +0 -421
- package/lib/esm/utils/arweave.js +0 -271
- package/lib/esm/utils/processes.js +0 -167
- package/lib/esm/web/index.js +0 -20
- package/lib/types/common/ant-versions.d.ts +0 -39
- package/lib/types/common/arweave.d.ts +0 -17
- package/lib/types/common/contracts/ao-process.d.ts +0 -33
- package/lib/types/common/hyperbeam/hb.d.ts +0 -88
- package/lib/types/common/marketplace.d.ts +0 -556
- package/lib/types/common/turbo.d.ts +0 -61
- package/lib/types/node/index.d.ts +0 -20
- package/lib/types/utils/ao.d.ts +0 -80
- package/lib/types/utils/arweave.d.ts +0 -79
- package/lib/types/utils/processes.d.ts +0 -39
- package/lib/types/web/index.d.ts +0 -20
package/README.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://codecov.io/gh/ar-io/ar-io-sdk)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The Solana-native SDK for the AR.IO network. Provides typed
|
|
6
|
+
client classes (`ARIO`, `ANT`, `ANTRegistry`), Codama-generated
|
|
7
|
+
instruction builders, Borsh deserializers, PDA helpers, and event
|
|
8
|
+
decoders for the AR.IO protocol on Solana.
|
|
6
9
|
|
|
7
10
|
## Table of Contents
|
|
8
11
|
|
|
@@ -11,12 +14,21 @@ This is the home of the ar.io SDK. This SDK provides functionality for interacti
|
|
|
11
14
|
- [Table of Contents](#table-of-contents)
|
|
12
15
|
- [Installation](#installation)
|
|
13
16
|
- [Quick Start](#quick-start)
|
|
17
|
+
- [Usage](#usage)
|
|
18
|
+
- [ARIO Contract](#ario-contract)
|
|
19
|
+
- [ANT Contracts](#ant-contracts)
|
|
20
|
+
- [Token Conversion](#token-conversion)
|
|
21
|
+
- [Logging](#logging)
|
|
22
|
+
- [Pagination](#pagination)
|
|
23
|
+
- [Advanced](#advanced)
|
|
24
|
+
- [Resources](#resources)
|
|
25
|
+
- [Developers](#developers)
|
|
14
26
|
|
|
15
27
|
<!-- tocstop -->
|
|
16
28
|
|
|
17
29
|
## Installation
|
|
18
30
|
|
|
19
|
-
Requires `node>=v18.0.0
|
|
31
|
+
Requires `node>=v18.0.0`.
|
|
20
32
|
|
|
21
33
|
```shell
|
|
22
34
|
npm install @ar.io/sdk
|
|
@@ -25,36 +37,48 @@ npm install @ar.io/sdk
|
|
|
25
37
|
or
|
|
26
38
|
|
|
27
39
|
```shell
|
|
28
|
-
yarn add @ar.io/sdk
|
|
40
|
+
yarn add @ar.io/sdk
|
|
29
41
|
```
|
|
30
42
|
|
|
31
|
-
> [!NOTE]
|
|
32
|
-
> The `--ignore-engines` flag is required when using yarn, as [permaweb/aoconnect] recommends only the use of npm. Alternatively, you can add a `.yarnrc.yml` file to your project containing `ignore-engines true` to ignore the engines check.
|
|
33
|
-
|
|
34
43
|
## Quick Start
|
|
35
44
|
|
|
36
45
|
```typescript
|
|
37
|
-
import { ARIO } from
|
|
46
|
+
import { ARIO } from '@ar.io/sdk';
|
|
47
|
+
import { createSolanaRpc } from '@solana/kit';
|
|
38
48
|
|
|
39
|
-
const
|
|
49
|
+
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
|
|
50
|
+
const ario = ARIO.init({ rpc });
|
|
40
51
|
const gateways = await ario.getGateways();
|
|
41
52
|
```
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
Write operations need a `@solana/kit` signer plus an `rpcSubscriptions`
|
|
55
|
+
client (used by kit's `sendAndConfirmTransaction`):
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { ARIO } from '@ar.io/sdk';
|
|
59
|
+
import {
|
|
60
|
+
createSolanaRpc,
|
|
61
|
+
createSolanaRpcSubscriptions,
|
|
62
|
+
createKeyPairSignerFromBytes,
|
|
63
|
+
} from '@solana/kit';
|
|
64
|
+
import { readFileSync } from 'node:fs';
|
|
65
|
+
|
|
66
|
+
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
|
|
67
|
+
const rpcSubscriptions = createSolanaRpcSubscriptions(
|
|
68
|
+
'wss://api.mainnet-beta.solana.com',
|
|
69
|
+
);
|
|
70
|
+
const signer = await createKeyPairSignerFromBytes(
|
|
71
|
+
new Uint8Array(JSON.parse(readFileSync('keypair.json', 'utf8'))),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
75
|
+
await ario.buyRecord({
|
|
76
|
+
name: 'foo',
|
|
77
|
+
type: 'lease',
|
|
78
|
+
years: 1,
|
|
79
|
+
processId: '<ANT mint pubkey>',
|
|
80
|
+
});
|
|
81
|
+
```
|
|
58
82
|
|
|
59
83
|
<details>
|
|
60
84
|
<summary>Output</summary>
|
|
@@ -66,7 +90,13 @@ const gateways = await ario.getGateways();
|
|
|
66
90
|
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
67
91
|
"observerAddress": "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs",
|
|
68
92
|
"operatorStake": 250000000000,
|
|
93
|
+
"totalDelegatedStake": 0,
|
|
69
94
|
"settings": {
|
|
95
|
+
"allowDelegatedStaking": true,
|
|
96
|
+
"allowedDelegates": [],
|
|
97
|
+
"autoStake": false,
|
|
98
|
+
"delegateRewardShareRatio": 10,
|
|
99
|
+
"minDelegatedStake": 100000000,
|
|
70
100
|
"fqdn": "ar-io.dev",
|
|
71
101
|
"label": "ar.io Test",
|
|
72
102
|
"note": "Test Gateway operated by PDS for the ar.io ecosystem.",
|
|
@@ -75,28 +105,33 @@ const gateways = await ario.getGateways();
|
|
|
75
105
|
"protocol": "https"
|
|
76
106
|
},
|
|
77
107
|
"startTimestamp": 1720720621424,
|
|
108
|
+
"endTimestamp": 0,
|
|
78
109
|
"stats": {
|
|
110
|
+
"passedConsecutiveEpochs": 30,
|
|
79
111
|
"failedConsecutiveEpochs": 0,
|
|
80
|
-
"passedEpochCount": 30,
|
|
81
|
-
"submittedEpochCount": 30,
|
|
82
112
|
"totalEpochCount": 31,
|
|
83
|
-
"
|
|
113
|
+
"passedEpochCount": 30,
|
|
114
|
+
"failedEpochCount": 1,
|
|
115
|
+
"observedEpochCount": 30,
|
|
116
|
+
"prescribedEpochCount": 31
|
|
84
117
|
},
|
|
85
118
|
"status": "joined",
|
|
86
|
-
"vaults": {},
|
|
87
119
|
"weights": {
|
|
88
|
-
"
|
|
89
|
-
"gatewayPerformanceRatio": 1,
|
|
120
|
+
"stakeWeight": 5.02400000024,
|
|
90
121
|
"tenureWeight": 0.19444444444444,
|
|
122
|
+
"gatewayPerformanceRatio": 1,
|
|
123
|
+
"observerPerformanceRatio": 1,
|
|
124
|
+
"gatewayRewardRatioWeight": 1,
|
|
91
125
|
"observerRewardRatioWeight": 1,
|
|
92
|
-
"
|
|
93
|
-
"
|
|
126
|
+
"compositeWeight": 0.97688888893556,
|
|
127
|
+
"normalizedCompositeWeight": 0.19247316211083
|
|
94
128
|
}
|
|
95
129
|
}
|
|
96
130
|
],
|
|
97
131
|
"hasMore": true,
|
|
98
132
|
"nextCursor": "-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA",
|
|
99
133
|
"totalItems": 316,
|
|
134
|
+
"limit": 100,
|
|
100
135
|
"sortBy": "startTimestamp",
|
|
101
136
|
"sortOrder": "desc"
|
|
102
137
|
}
|
|
@@ -106,75 +141,95 @@ const gateways = await ario.getGateways();
|
|
|
106
141
|
|
|
107
142
|
## Usage
|
|
108
143
|
|
|
109
|
-
The SDK is published as an ES module (`"type": "module"`) and is
|
|
144
|
+
The SDK is published as an ES module (`"type": "module"`) and is
|
|
145
|
+
compatible with modern bundlers such as Webpack, Rollup, ESbuild, and
|
|
146
|
+
Vite. CommonJS consumers should migrate to ESM (Node 18+ supports ESM
|
|
147
|
+
natively). Refer to the [examples] directory to see how to use the SDK
|
|
148
|
+
in various environments.
|
|
149
|
+
|
|
150
|
+
### Subpath exports
|
|
151
|
+
|
|
152
|
+
- `@ar.io/sdk` — main entry. `ARIO`, `ANT`, `ANTRegistry`, Solana
|
|
153
|
+
client classes, PDA helpers, deserializers, event decoders, escrow
|
|
154
|
+
primitives.
|
|
155
|
+
- `@ar.io/sdk/solana` — alias of the main entry (kept for one release
|
|
156
|
+
while consumers migrate from the previous subpath layout).
|
|
157
|
+
- `@ar.io/sdk/solana/generated` — Codama-emitted typed instruction
|
|
158
|
+
builders / account decoders for low-level transaction construction.
|
|
110
159
|
|
|
111
160
|
### Web
|
|
112
161
|
|
|
113
162
|
> [!WARNING]
|
|
114
|
-
> Polyfills are not provided by default for bundled web projects (Vite,
|
|
115
|
-
|
|
116
|
-
|
|
163
|
+
> Polyfills are not provided by default for bundled web projects (Vite,
|
|
164
|
+
> ESBuild, Webpack, Rollup, etc.). Depending on your bundler config, you
|
|
165
|
+
> will need polyfills for `crypto`, `process` and `buffer`. Refer to
|
|
166
|
+
> [examples/webpack] and [examples/vite] for examples.
|
|
117
167
|
|
|
118
168
|
```javascript
|
|
119
|
-
import { ARIO } from
|
|
169
|
+
import { ARIO } from '@ar.io/sdk';
|
|
170
|
+
import { createSolanaRpc } from '@solana/kit';
|
|
120
171
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
172
|
+
const ario = ARIO.init({
|
|
173
|
+
rpc: createSolanaRpc('https://api.mainnet-beta.solana.com'),
|
|
174
|
+
});
|
|
124
175
|
const gateways = await ario.getGateways();
|
|
125
176
|
```
|
|
126
177
|
|
|
127
|
-
|
|
178
|
+
### Browser bundle
|
|
128
179
|
|
|
129
180
|
```html
|
|
130
181
|
<script type="module">
|
|
131
|
-
// replace <version> with a release version
|
|
132
|
-
import { ARIO } from
|
|
182
|
+
// replace <version> with a release version
|
|
183
|
+
import { ARIO } from 'https://github.com/ar-io/ar-io-sdk/releases/download/v<version>/web.bundle.min.js';
|
|
184
|
+
import { createSolanaRpc } from 'https://esm.sh/@solana/kit@6';
|
|
133
185
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
186
|
+
const ario = ARIO.init({
|
|
187
|
+
rpc: createSolanaRpc('https://api.mainnet-beta.solana.com'),
|
|
188
|
+
});
|
|
137
189
|
const gateways = await ario.getGateways();
|
|
138
190
|
</script>
|
|
139
191
|
```
|
|
140
192
|
|
|
141
|
-
###
|
|
193
|
+
### TypeScript
|
|
142
194
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// set up client
|
|
147
|
-
const ario = ARIO.mainnet();
|
|
148
|
-
// fetch gateways
|
|
149
|
-
const gateways = await ario.getGateways();
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Typescript
|
|
153
|
-
|
|
154
|
-
The SDK provides TypeScript types. When you import the SDK in a TypeScript project types are exported from `./lib/types/[node/web]/index.d.ts` and should be automatically recognized by package managers, offering benefits such as type-checking and autocompletion.
|
|
195
|
+
The SDK ships TypeScript types alongside the JS output. Types are
|
|
196
|
+
exported from `./lib/types/solana/index.d.ts` and resolve automatically
|
|
197
|
+
for ESM consumers.
|
|
155
198
|
|
|
156
199
|
> [!NOTE]
|
|
157
|
-
>
|
|
200
|
+
> TypeScript 5.3+ is recommended (the SDK uses `nodenext` module
|
|
201
|
+
> resolution with `.js` extensions in relative imports).
|
|
158
202
|
|
|
159
203
|
## ARIO Contract
|
|
160
204
|
|
|
161
205
|
### General
|
|
162
206
|
|
|
163
|
-
#### `init({ signer })`
|
|
207
|
+
#### `init({ rpc, rpcSubscriptions?, signer? })`
|
|
164
208
|
|
|
165
|
-
Factory function
|
|
209
|
+
Factory function that creates a read-only or writeable ARIO client.
|
|
210
|
+
Providing `signer` plus `rpcSubscriptions` enables write methods
|
|
211
|
+
(`joinNetwork`, `delegateStake`, `buyRecord`, etc.). Without a signer,
|
|
212
|
+
the client is read-only.
|
|
166
213
|
|
|
167
214
|
```typescript
|
|
168
|
-
|
|
169
|
-
|
|
215
|
+
import { ARIO } from '@ar.io/sdk';
|
|
216
|
+
import {
|
|
217
|
+
createSolanaRpc,
|
|
218
|
+
createSolanaRpcSubscriptions,
|
|
219
|
+
createKeyPairSignerFromBytes,
|
|
220
|
+
} from '@solana/kit';
|
|
170
221
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
});
|
|
222
|
+
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
|
|
223
|
+
|
|
224
|
+
// read-only client
|
|
225
|
+
const ario = ARIO.init({ rpc });
|
|
175
226
|
|
|
176
|
-
// read-write client for
|
|
177
|
-
const
|
|
227
|
+
// read-write client (needs rpcSubscriptions for sendAndConfirm)
|
|
228
|
+
const rpcSubscriptions = createSolanaRpcSubscriptions(
|
|
229
|
+
'wss://api.mainnet-beta.solana.com',
|
|
230
|
+
);
|
|
231
|
+
const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */);
|
|
232
|
+
const arioWrite = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
178
233
|
```
|
|
179
234
|
|
|
180
235
|
#### `getInfo()`
|
|
@@ -182,7 +237,7 @@ const ario = ARIO.init({ signer: new ArweaveSigner(JWK) });
|
|
|
182
237
|
Retrieves the information of the ARIO process.
|
|
183
238
|
|
|
184
239
|
```typescript
|
|
185
|
-
const ario = ARIO.
|
|
240
|
+
const ario = ARIO.init({ rpc });
|
|
186
241
|
const info = await ario.getInfo();
|
|
187
242
|
```
|
|
188
243
|
|
|
@@ -191,16 +246,29 @@ const info = await ario.getInfo();
|
|
|
191
246
|
|
|
192
247
|
```json
|
|
193
248
|
{
|
|
194
|
-
"Name": "
|
|
249
|
+
"Name": "AR.IO",
|
|
195
250
|
"Ticker": "ARIO",
|
|
196
|
-
"
|
|
251
|
+
"Logo": "",
|
|
197
252
|
"Denomination": 6,
|
|
198
|
-
"Handlers": [
|
|
199
|
-
"LastCreatedEpochIndex":
|
|
200
|
-
"LastDistributedEpochIndex":
|
|
253
|
+
"Handlers": [],
|
|
254
|
+
"LastCreatedEpochIndex": 0,
|
|
255
|
+
"LastDistributedEpochIndex": 0,
|
|
256
|
+
"totalSupply": 1000000000000000,
|
|
257
|
+
"protocolBalance": 0,
|
|
258
|
+
"epochSettings": {
|
|
259
|
+
"durationMs": 86400000,
|
|
260
|
+
"prescribedNameCount": 25,
|
|
261
|
+
"maxObservers": 50
|
|
262
|
+
}
|
|
201
263
|
}
|
|
202
264
|
```
|
|
203
265
|
|
|
266
|
+
> **Note**: `Handlers`, `LastCreatedEpochIndex`, and `LastDistributedEpochIndex`
|
|
267
|
+
> are placeholders on Solana (returned for backwards-compatible field shape
|
|
268
|
+
> with consumer code). `totalSupply` / `protocolBalance` are live reads from
|
|
269
|
+
> the `ArioConfig` PDA; `epochSettings` is live from the `EpochSettings`
|
|
270
|
+
> PDA. See `src/solana/io-readable.ts` for the exact projection.
|
|
271
|
+
|
|
204
272
|
</details>
|
|
205
273
|
|
|
206
274
|
#### `getTokenSupply()`
|
|
@@ -216,7 +284,7 @@ Retrieves the total supply of tokens, returned in mARIO. The total supply includ
|
|
|
216
284
|
- `protocolBalance` - tokens that are held in the protocol's treasury. This is included in the circulating supply.
|
|
217
285
|
|
|
218
286
|
```typescript
|
|
219
|
-
const ario = ARIO.
|
|
287
|
+
const ario = ARIO.init({ rpc });
|
|
220
288
|
const supply = await ario.getTokenSupply();
|
|
221
289
|
```
|
|
222
290
|
|
|
@@ -242,7 +310,7 @@ const supply = await ario.getTokenSupply();
|
|
|
242
310
|
Retrieves the balance of the specified wallet address.
|
|
243
311
|
|
|
244
312
|
```typescript
|
|
245
|
-
const ario = ARIO.
|
|
313
|
+
const ario = ARIO.init({ rpc });
|
|
246
314
|
// the balance will be returned in mARIO as a value
|
|
247
315
|
const balance = await ario
|
|
248
316
|
.getBalance({
|
|
@@ -265,7 +333,7 @@ const balance = await ario
|
|
|
265
333
|
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.
|
|
266
334
|
|
|
267
335
|
```typescript
|
|
268
|
-
const ario = ARIO.
|
|
336
|
+
const ario = ARIO.init({ rpc });
|
|
269
337
|
const balances = await ario.getBalances({
|
|
270
338
|
cursor: "-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA",
|
|
271
339
|
limit: 100,
|
|
@@ -307,59 +375,49 @@ Transfers `mARIO` to the designated `target` recipient address. Requires `signer
|
|
|
307
375
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
308
376
|
|
|
309
377
|
```typescript
|
|
310
|
-
const ario = ARIO.
|
|
311
|
-
|
|
378
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
379
|
+
const { id: txId } = await ario.transfer({
|
|
380
|
+
target: 'RecipientSolanaPubkeyBase58',
|
|
381
|
+
qty: new ARIOToken(1000).toMARIO(),
|
|
312
382
|
});
|
|
313
|
-
const { id: txId } = await ario.transfer(
|
|
314
|
-
{
|
|
315
|
-
target: "-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5",
|
|
316
|
-
qty: new ARIOToken(1000).toMARIO(),
|
|
317
|
-
},
|
|
318
|
-
// optional additional tags
|
|
319
|
-
{ tags: [{ name: "App-Name", value: "My-Awesome-App" }] },
|
|
320
|
-
);
|
|
321
383
|
```
|
|
322
384
|
|
|
323
385
|
### Networks
|
|
324
386
|
|
|
325
|
-
The SDK
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
- `ARIO_TESTNET_PROCESS_ID` - Testnet ARIO process ID (testing and development)
|
|
329
|
-
- `ARIO_DEVNET_PROCESS_ID` - Devnet ARIO process ID (development)
|
|
330
|
-
|
|
331
|
-
As of `v3.8.1` the SDK defaults all API interactions to **mainnet**. To use the **testnet** or **devnet** provide the appropriate `ARIO_TESTNET_PROCESS_ID` or `ARIO_DEVNET_PROCESS_ID` when initializing the client.
|
|
332
|
-
|
|
333
|
-
#### Mainnet
|
|
334
|
-
|
|
335
|
-
As of `v3.8.1` the SDK defaults all API interactions to **mainnet**. To use the **testnet** or **devnet** provide the appropriate `ARIO_TESTNET_PROCESS_ID` or `ARIO_DEVNET_PROCESS_ID` when initializing the client.
|
|
387
|
+
The SDK talks to whatever cluster your `@solana/kit` RPC client points
|
|
388
|
+
at — mainnet-beta by default. For devnet or a local validator, override
|
|
389
|
+
the RPC URL and (on any non-mainnet cluster) the per-program addresses:
|
|
336
390
|
|
|
337
391
|
```typescript
|
|
338
|
-
import { ARIO } from
|
|
392
|
+
import { ARIO } from '@ar.io/sdk';
|
|
393
|
+
import { createSolanaRpc, address } from '@solana/kit';
|
|
339
394
|
|
|
340
|
-
const ario = ARIO.
|
|
395
|
+
const ario = ARIO.init({
|
|
396
|
+
rpc: createSolanaRpc('https://api.devnet.solana.com'),
|
|
397
|
+
coreProgramId: address('<ARIO_CORE_PROGRAM_ID>'),
|
|
398
|
+
garProgramId: address('<ARIO_GAR_PROGRAM_ID>'),
|
|
399
|
+
arnsProgramId: address('<ARIO_ARNS_PROGRAM_ID>'),
|
|
400
|
+
antProgramId: address('<ARIO_ANT_PROGRAM_ID>'),
|
|
401
|
+
});
|
|
341
402
|
```
|
|
342
403
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
```typescript
|
|
346
|
-
import { ARIO } from "@ar.io/sdk";
|
|
347
|
-
|
|
348
|
-
const testnet = ARIO.testnet(); // or ARIO.init({ processId: ARIO_TESTNET_PROCESS_ID })
|
|
349
|
-
```
|
|
404
|
+
On localnet (Surfpool) source program IDs from
|
|
405
|
+
`migration/localnet/out/localnet.env` in the `solana-ar-io` monorepo.
|
|
350
406
|
|
|
351
407
|
##### Faucet
|
|
352
408
|
|
|
353
|
-
The SDK
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
1. Visit [faucet.ar.io](https://faucet.ar.io) - the easiest way to quickly get tokens for testing for a single address.
|
|
409
|
+
The SDK exposes a `createFaucet` HTTP wrapper around the ar.io faucet
|
|
410
|
+
service ([faucet.ar.io](https://faucet.ar.io)). The faucet backend has
|
|
411
|
+
not yet been ported to issue Solana-mint transfers — the SDK surface is
|
|
412
|
+
documented here for forward-compatibility once it lands:
|
|
358
413
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
414
|
+
- `createFaucet({ arioInstance, processId }).captchaUrl()` — returns
|
|
415
|
+
the captcha URL.
|
|
416
|
+
- `createFaucet({ arioInstance, processId }).claimWithAuthToken({ authToken, recipient, quantity })` —
|
|
417
|
+
claim tokens for `recipient` using an auth token returned by the
|
|
418
|
+
captcha flow.
|
|
419
|
+
- `createFaucet({ arioInstance, processId }).verifyAuthToken({ authToken })` —
|
|
420
|
+
check whether an auth token is still valid.
|
|
363
421
|
|
|
364
422
|
<details>
|
|
365
423
|
<summary><i>Example client-side code for claiming tokens</i></summary>
|
|
@@ -367,7 +425,7 @@ To claim testnet tokens from the testnet token faucet, you can use one of the fo
|
|
|
367
425
|
```typescript
|
|
368
426
|
import { ARIO } from "@ar.io/sdk";
|
|
369
427
|
|
|
370
|
-
const
|
|
428
|
+
const ario = ARIO.init({ rpc });
|
|
371
429
|
const captchaUrl = await ario.faucet.captchaUrl();
|
|
372
430
|
|
|
373
431
|
// open the captcha URL in the browser, and listen for the auth token event
|
|
@@ -428,7 +486,7 @@ if (
|
|
|
428
486
|
Retrieves the locked-balance user vault of the ARIO process by the specified wallet address and vault ID.
|
|
429
487
|
|
|
430
488
|
```typescript
|
|
431
|
-
const ario = ARIO.
|
|
489
|
+
const ario = ARIO.init({ rpc });
|
|
432
490
|
const vault = await ario.getVault({
|
|
433
491
|
address: "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
434
492
|
vaultId: "vaultIdOne",
|
|
@@ -453,7 +511,7 @@ const vault = await ario.getVault({
|
|
|
453
511
|
Retrieves all locked-balance user vaults of the ARIO process, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last wallet address from the previous request.
|
|
454
512
|
|
|
455
513
|
```typescript
|
|
456
|
-
const ario = ARIO.
|
|
514
|
+
const ario = ARIO.init({ rpc });
|
|
457
515
|
const vaults = await ario.getVaults({
|
|
458
516
|
cursor: "0",
|
|
459
517
|
limit: 100,
|
|
@@ -501,7 +559,7 @@ Transfers `mARIO` to the designated `recipient` address and locks the balance fo
|
|
|
501
559
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
502
560
|
|
|
503
561
|
```typescript
|
|
504
|
-
const ario = ARIO.
|
|
562
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
505
563
|
const { id: txId } = await ario.vaultedTransfer(
|
|
506
564
|
{
|
|
507
565
|
recipient: "-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5",
|
|
@@ -521,7 +579,7 @@ Revokes a vaulted transfer by the recipient address and vault ID. Only the sende
|
|
|
521
579
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
522
580
|
|
|
523
581
|
```typescript
|
|
524
|
-
const ario = ARIO.
|
|
582
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
525
583
|
const { id: txId } = await ario.revokeVault({
|
|
526
584
|
recipient: "-5dV7nk7waR8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5",
|
|
527
585
|
vaultId: "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs",
|
|
@@ -533,7 +591,7 @@ const { id: txId } = await ario.revokeVault({
|
|
|
533
591
|
Creates a vault for the specified `quantity` of mARIO from the signer's balance and locks it for the specified `lockLengthMs` milliseconds.
|
|
534
592
|
|
|
535
593
|
```typescript
|
|
536
|
-
const ario = ARIO.
|
|
594
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
537
595
|
|
|
538
596
|
const { id: txId } = await ario.createVault({
|
|
539
597
|
lockLengthMs: 1000 * 60 * 60 * 24 * 365, // 1 year
|
|
@@ -546,7 +604,7 @@ const { id: txId } = await ario.createVault({
|
|
|
546
604
|
Extends the lock length of a signer's vault by the specified `extendLengthMs` milliseconds.
|
|
547
605
|
|
|
548
606
|
```typescript
|
|
549
|
-
const ario = ARIO.
|
|
607
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
550
608
|
|
|
551
609
|
const { id: txId } = await ario.extendVault({
|
|
552
610
|
vaultId: "vaultIdOne",
|
|
@@ -559,7 +617,7 @@ const { id: txId } = await ario.extendVault({
|
|
|
559
617
|
Increases the balance of a signer's vault by the specified `quantity` of mARIO.
|
|
560
618
|
|
|
561
619
|
```typescript
|
|
562
|
-
const ario = ARIO.
|
|
620
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
563
621
|
const { id: txId } = await ario.increaseVault({
|
|
564
622
|
vaultId: "vaultIdOne",
|
|
565
623
|
quantity: new ARIOToken(1000).toMARIO(),
|
|
@@ -573,7 +631,7 @@ const { id: txId } = await ario.increaseVault({
|
|
|
573
631
|
Retrieves a gateway's info by its staking wallet address.
|
|
574
632
|
|
|
575
633
|
```typescript
|
|
576
|
-
const ario = ARIO.
|
|
634
|
+
const ario = ARIO.init({ rpc });
|
|
577
635
|
const gateway = await ario.getGateway({
|
|
578
636
|
address: "-7vXsQZQDk8TMDlpiSLy3CnLi5PDPlAaN2DaynORpck",
|
|
579
637
|
});
|
|
@@ -586,7 +644,13 @@ const gateway = await ario.getGateway({
|
|
|
586
644
|
{
|
|
587
645
|
"observerAddress": "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs",
|
|
588
646
|
"operatorStake": 250000000000,
|
|
647
|
+
"totalDelegatedStake": 0,
|
|
589
648
|
"settings": {
|
|
649
|
+
"allowDelegatedStaking": true,
|
|
650
|
+
"allowedDelegates": [],
|
|
651
|
+
"autoStake": false,
|
|
652
|
+
"delegateRewardShareRatio": 10,
|
|
653
|
+
"minDelegatedStake": 100000000,
|
|
590
654
|
"fqdn": "ar-io.dev",
|
|
591
655
|
"label": "ar.io Test",
|
|
592
656
|
"note": "Test Gateway operated by PDS for the ar.io ecosystem.",
|
|
@@ -595,22 +659,26 @@ const gateway = await ario.getGateway({
|
|
|
595
659
|
"protocol": "https"
|
|
596
660
|
},
|
|
597
661
|
"startTimestamp": 1720720620813,
|
|
662
|
+
"endTimestamp": 0,
|
|
598
663
|
"stats": {
|
|
664
|
+
"passedConsecutiveEpochs": 30,
|
|
599
665
|
"failedConsecutiveEpochs": 0,
|
|
600
|
-
"passedEpochCount": 30,
|
|
601
|
-
"submittedEpochCount": 30,
|
|
602
666
|
"totalEpochCount": 31,
|
|
603
|
-
"
|
|
667
|
+
"passedEpochCount": 30,
|
|
668
|
+
"failedEpochCount": 1,
|
|
669
|
+
"observedEpochCount": 30,
|
|
670
|
+
"prescribedEpochCount": 31
|
|
604
671
|
},
|
|
605
672
|
"status": "joined",
|
|
606
|
-
"vaults": {},
|
|
607
673
|
"weights": {
|
|
608
|
-
"
|
|
609
|
-
"gatewayPerformanceRatio": 1,
|
|
674
|
+
"stakeWeight": 5.02400000024,
|
|
610
675
|
"tenureWeight": 0.19444444444444,
|
|
676
|
+
"gatewayPerformanceRatio": 1,
|
|
677
|
+
"observerPerformanceRatio": 1,
|
|
678
|
+
"gatewayRewardRatioWeight": 1,
|
|
611
679
|
"observerRewardRatioWeight": 1,
|
|
612
|
-
"
|
|
613
|
-
"
|
|
680
|
+
"compositeWeight": 0.97688888893556,
|
|
681
|
+
"normalizedCompositeWeight": 0.19247316211083
|
|
614
682
|
}
|
|
615
683
|
}
|
|
616
684
|
```
|
|
@@ -622,7 +690,7 @@ const gateway = await ario.getGateway({
|
|
|
622
690
|
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.
|
|
623
691
|
|
|
624
692
|
```typescript
|
|
625
|
-
const ario = ARIO.
|
|
693
|
+
const ario = ARIO.init({ rpc });
|
|
626
694
|
const gateways = await ario.getGateways({
|
|
627
695
|
limit: 100,
|
|
628
696
|
sortOrder: "desc",
|
|
@@ -642,7 +710,13 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
642
710
|
"gatewayAddress": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
643
711
|
"observerAddress": "IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs",
|
|
644
712
|
"operatorStake": 250000000000,
|
|
713
|
+
"totalDelegatedStake": 0,
|
|
645
714
|
"settings": {
|
|
715
|
+
"allowDelegatedStaking": true,
|
|
716
|
+
"allowedDelegates": [],
|
|
717
|
+
"autoStake": false,
|
|
718
|
+
"delegateRewardShareRatio": 10,
|
|
719
|
+
"minDelegatedStake": 100000000,
|
|
646
720
|
"fqdn": "ar-io.dev",
|
|
647
721
|
"label": "ar.io Test",
|
|
648
722
|
"note": "Test Gateway operated by PDS for the ar.io ecosystem.",
|
|
@@ -651,28 +725,33 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
651
725
|
"protocol": "https"
|
|
652
726
|
},
|
|
653
727
|
"startTimestamp": 1720720620813,
|
|
728
|
+
"endTimestamp": 0,
|
|
654
729
|
"stats": {
|
|
730
|
+
"passedConsecutiveEpochs": 30,
|
|
655
731
|
"failedConsecutiveEpochs": 0,
|
|
656
|
-
"passedEpochCount": 30,
|
|
657
|
-
"submittedEpochCount": 30,
|
|
658
732
|
"totalEpochCount": 31,
|
|
659
|
-
"
|
|
733
|
+
"passedEpochCount": 30,
|
|
734
|
+
"failedEpochCount": 1,
|
|
735
|
+
"observedEpochCount": 30,
|
|
736
|
+
"prescribedEpochCount": 31
|
|
660
737
|
},
|
|
661
738
|
"status": "joined",
|
|
662
|
-
"vaults": {},
|
|
663
739
|
"weights": {
|
|
664
|
-
"
|
|
665
|
-
"gatewayPerformanceRatio": 1,
|
|
740
|
+
"stakeWeight": 5.02400000024,
|
|
666
741
|
"tenureWeight": 0.19444444444444,
|
|
742
|
+
"gatewayPerformanceRatio": 1,
|
|
743
|
+
"observerPerformanceRatio": 1,
|
|
744
|
+
"gatewayRewardRatioWeight": 1,
|
|
667
745
|
"observerRewardRatioWeight": 1,
|
|
668
|
-
"
|
|
669
|
-
"
|
|
746
|
+
"compositeWeight": 0.97688888893556,
|
|
747
|
+
"normalizedCompositeWeight": 0.19247316211083
|
|
670
748
|
}
|
|
671
749
|
}
|
|
672
750
|
],
|
|
673
751
|
"hasMore": true,
|
|
674
752
|
"nextCursor": "-4xgjroXENKYhTWqrBo57HQwvDL51mMdfsdsxJy6Y2Z_sA",
|
|
675
753
|
"totalItems": 316,
|
|
754
|
+
"limit": 100,
|
|
676
755
|
"sortBy": "operatorStake",
|
|
677
756
|
"sortOrder": "desc"
|
|
678
757
|
}
|
|
@@ -685,7 +764,7 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
|
|
|
685
764
|
Retrieves all delegates for a specific gateway, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last delegate address from the previous request.
|
|
686
765
|
|
|
687
766
|
```typescript
|
|
688
|
-
const ario = ARIO.
|
|
767
|
+
const ario = ARIO.init({ rpc });
|
|
689
768
|
const delegates = await ario.getGatewayDelegates({
|
|
690
769
|
address: "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
691
770
|
limit: 3,
|
|
@@ -734,7 +813,7 @@ Joins a gateway to the ar.io network via its associated wallet.
|
|
|
734
813
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
735
814
|
|
|
736
815
|
```typescript
|
|
737
|
-
const ario = ARIO.
|
|
816
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
738
817
|
const { id: txId } = await ario.joinNetwork(
|
|
739
818
|
{
|
|
740
819
|
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
|
|
@@ -762,7 +841,7 @@ Sets the gateway as `leaving` on the ar.io network. Requires `signer` to be prov
|
|
|
762
841
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
763
842
|
|
|
764
843
|
```typescript
|
|
765
|
-
const ario = ARIO.
|
|
844
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
766
845
|
|
|
767
846
|
const { id: txId } = await ario.leaveNetwork(
|
|
768
847
|
// optional additional tags
|
|
@@ -777,7 +856,7 @@ Writes new gateway settings to the callers gateway configuration.
|
|
|
777
856
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
778
857
|
|
|
779
858
|
```typescript
|
|
780
|
-
const ario = ARIO.
|
|
859
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
781
860
|
const { id: txId } = await ario.updateGatewaySettings(
|
|
782
861
|
{
|
|
783
862
|
// any other settings you want to update
|
|
@@ -795,7 +874,7 @@ Increases the callers stake on the target gateway.
|
|
|
795
874
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
796
875
|
|
|
797
876
|
```typescript
|
|
798
|
-
const ario = ARIO.
|
|
877
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
799
878
|
const { id: txId } = await ario.increaseDelegateStake(
|
|
800
879
|
{
|
|
801
880
|
target: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
@@ -813,7 +892,7 @@ Decreases the callers stake on the target gateway. Can instantly decrease stake
|
|
|
813
892
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
814
893
|
|
|
815
894
|
```typescript
|
|
816
|
-
const ario = ARIO.
|
|
895
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
817
896
|
const { id: txId } = await ario.decreaseDelegateStake(
|
|
818
897
|
{
|
|
819
898
|
target: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
@@ -828,7 +907,7 @@ const { id: txId } = await ario.decreaseDelegateStake(
|
|
|
828
907
|
Pay the early withdrawal fee and withdraw instantly.
|
|
829
908
|
|
|
830
909
|
```typescript
|
|
831
|
-
const ario = ARIO.
|
|
910
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
832
911
|
const { id: txId } = await ario.decreaseDelegateStake({
|
|
833
912
|
target: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
834
913
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -841,7 +920,7 @@ const { id: txId } = await ario.decreaseDelegateStake({
|
|
|
841
920
|
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 delgation) from the previous request.
|
|
842
921
|
|
|
843
922
|
```typescript
|
|
844
|
-
const ario = ARIO.
|
|
923
|
+
const ario = ARIO.init({ rpc });
|
|
845
924
|
const vaults = await ario.getDelegations({
|
|
846
925
|
address: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
847
926
|
cursor: "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ_123456789",
|
|
@@ -892,7 +971,7 @@ Instantly withdraws an existing vault on a gateway. If no `gatewayAddress` is pr
|
|
|
892
971
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
893
972
|
|
|
894
973
|
```typescript
|
|
895
|
-
const ario = ARIO.
|
|
974
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
896
975
|
// removes a delegated vault from a gateway
|
|
897
976
|
const { id: txId } = await ario.instantWithdrawal(
|
|
898
977
|
{
|
|
@@ -919,7 +998,7 @@ Cancels an existing vault on a gateway. The vaulted stake will be returned to th
|
|
|
919
998
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
920
999
|
|
|
921
1000
|
```typescript
|
|
922
|
-
const ario = ARIO.
|
|
1001
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
923
1002
|
// cancels a delegated vault from a gateway
|
|
924
1003
|
const { id: txId } = await ario.cancelWithdrawal(
|
|
925
1004
|
{
|
|
@@ -943,7 +1022,7 @@ const { id: txId } = await ario.cancelWithdrawal({
|
|
|
943
1022
|
Retrieves all allowed delegates for a specific address. The `cursor` used for pagination is the last address from the previous request.
|
|
944
1023
|
|
|
945
1024
|
```typescript
|
|
946
|
-
const ario = ARIO.
|
|
1025
|
+
const ario = ARIO.init({ rpc });
|
|
947
1026
|
const allowedDelegates = await ario.getAllowedDelegates({
|
|
948
1027
|
address: "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
949
1028
|
});
|
|
@@ -974,7 +1053,7 @@ const allowedDelegates = await ario.getAllowedDelegates({
|
|
|
974
1053
|
Retrieves all vaults across 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.
|
|
975
1054
|
|
|
976
1055
|
```typescript
|
|
977
|
-
const ario = ARIO.
|
|
1056
|
+
const ario = ARIO.init({ rpc });
|
|
978
1057
|
const vaults = await ario.getGatewayVaults({
|
|
979
1058
|
address: '"PZ5vIhHf8VY969TxBPQN-rYY9CNFP9ggNsMBqlWUzWM',
|
|
980
1059
|
});
|
|
@@ -1009,7 +1088,7 @@ const vaults = await ario.getGatewayVaults({
|
|
|
1009
1088
|
Retrieves all vaults across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last vaultId from the previous request.
|
|
1010
1089
|
|
|
1011
1090
|
```typescript
|
|
1012
|
-
const ario = ARIO.
|
|
1091
|
+
const ario = ARIO.init({ rpc });
|
|
1013
1092
|
const vaults = await ario.getAllGatewayVaults({
|
|
1014
1093
|
limit: 1,
|
|
1015
1094
|
sortBy: "endTimestamp",
|
|
@@ -1045,12 +1124,12 @@ const vaults = await ario.getAllGatewayVaults({
|
|
|
1045
1124
|
|
|
1046
1125
|
#### `getWithdrawals({ address, cursor, limit, sortBy, sortOrder })`
|
|
1047
1126
|
|
|
1048
|
-
|
|
1127
|
+
Returns every pending stake withdrawal owned by `address` — covering both operator-stake decreases (`isDelegate: false`) and delegate-stake decreases (`isDelegate: true`). A withdrawal is claimable when `Date.now() >= endTimestamp`; call `claimWithdrawal({ withdrawalId: item.vaultId })` to release the tokens.
|
|
1049
1128
|
|
|
1050
|
-
This is the per-owner read needed to drive "you have X claimable withdrawals" UIs without fanning out across every gateway the wallet has interacted with.
|
|
1129
|
+
This is the per-owner read needed to drive "you have X claimable withdrawals" UIs without fanning out across every gateway the wallet has interacted with.
|
|
1051
1130
|
|
|
1052
1131
|
```typescript
|
|
1053
|
-
const ario = ARIO.init({
|
|
1132
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1054
1133
|
|
|
1055
1134
|
const withdrawals = await ario.getWithdrawals({
|
|
1056
1135
|
address: "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
|
|
@@ -1101,7 +1180,7 @@ Increases the callers operator stake. Must be executed with a wallet registered
|
|
|
1101
1180
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1102
1181
|
|
|
1103
1182
|
```typescript
|
|
1104
|
-
const ario = ARIO.
|
|
1183
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1105
1184
|
const { id: txId } = await ario.increaseOperatorStake(
|
|
1106
1185
|
{
|
|
1107
1186
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1119,7 +1198,7 @@ Decreases the callers operator stake. Must be executed with a wallet registered
|
|
|
1119
1198
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1120
1199
|
|
|
1121
1200
|
```typescript
|
|
1122
|
-
const ario = ARIO.
|
|
1201
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1123
1202
|
const { id: txId } = await ario.decreaseOperatorStake(
|
|
1124
1203
|
{
|
|
1125
1204
|
qty: new ARIOToken(100).toMARIO(),
|
|
@@ -1137,7 +1216,7 @@ Redelegates the stake of a specific address to a new gateway. Vault ID may be op
|
|
|
1137
1216
|
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.
|
|
1138
1217
|
|
|
1139
1218
|
```typescript
|
|
1140
|
-
const ario = ARIO.
|
|
1219
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1141
1220
|
|
|
1142
1221
|
const { id: txId } = await ario.redelegateStake({
|
|
1143
1222
|
target: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
@@ -1152,7 +1231,7 @@ const { id: txId } = await ario.redelegateStake({
|
|
|
1152
1231
|
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.
|
|
1153
1232
|
|
|
1154
1233
|
```typescript
|
|
1155
|
-
const ario = ARIO.
|
|
1234
|
+
const ario = ARIO.init({ rpc });
|
|
1156
1235
|
|
|
1157
1236
|
const fee = await ario.getRedelegationFee({
|
|
1158
1237
|
address: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
@@ -1176,7 +1255,7 @@ const fee = await ario.getRedelegationFee({
|
|
|
1176
1255
|
Retrieves all delegates across all gateways, paginated and sorted by the specified criteria. The `cursor` used for pagination is a `cursorId` derived from delegate address and the gatewayAddress from the previous request. e.g `address_gatewayAddress`.
|
|
1177
1256
|
|
|
1178
1257
|
```typescript
|
|
1179
|
-
const ario = ARIO.
|
|
1258
|
+
const ario = ARIO.init({ rpc });
|
|
1180
1259
|
const delegates = await ario.getAllDelegates({
|
|
1181
1260
|
limit: 2,
|
|
1182
1261
|
sortBy: "startTimestamp",
|
|
@@ -1227,7 +1306,7 @@ Resolves an ArNS name to the underlying data id stored on the names correspondin
|
|
|
1227
1306
|
##### Resolving a base name
|
|
1228
1307
|
|
|
1229
1308
|
```typescript
|
|
1230
|
-
const ario = ARIO.
|
|
1309
|
+
const ario = ARIO.init({ rpc });
|
|
1231
1310
|
const record = await ario.resolveArNSName({ name: "ardrive" });
|
|
1232
1311
|
```
|
|
1233
1312
|
|
|
@@ -1236,13 +1315,12 @@ const record = await ario.resolveArNSName({ name: "ardrive" });
|
|
|
1236
1315
|
|
|
1237
1316
|
```json
|
|
1238
1317
|
{
|
|
1318
|
+
"name": "ardrive",
|
|
1239
1319
|
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
1240
1320
|
"txId": "kvhEUsIY5bXe0Wu2-YUFz20O078uYFzmQIO-7brv8qw",
|
|
1241
1321
|
"type": "lease",
|
|
1242
|
-
"
|
|
1243
|
-
"undernameLimit": 100
|
|
1244
|
-
"owner": "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
1245
|
-
"name": "ardrive"
|
|
1322
|
+
"ttlSeconds": 3600,
|
|
1323
|
+
"undernameLimit": 100
|
|
1246
1324
|
}
|
|
1247
1325
|
```
|
|
1248
1326
|
|
|
@@ -1251,7 +1329,7 @@ const record = await ario.resolveArNSName({ name: "ardrive" });
|
|
|
1251
1329
|
##### Resolving an undername
|
|
1252
1330
|
|
|
1253
1331
|
```typescript
|
|
1254
|
-
const ario = ARIO.
|
|
1332
|
+
const ario = ARIO.init({ rpc });
|
|
1255
1333
|
const record = await ario.resolveArNSName({ name: "logo_ardrive" });
|
|
1256
1334
|
```
|
|
1257
1335
|
|
|
@@ -1260,13 +1338,12 @@ const record = await ario.resolveArNSName({ name: "logo_ardrive" });
|
|
|
1260
1338
|
|
|
1261
1339
|
```json
|
|
1262
1340
|
{
|
|
1341
|
+
"name": "ardrive",
|
|
1263
1342
|
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
1264
1343
|
"txId": "kvhEUsIY5bXe0Wu2-YUFz20O078uYFzmQIO-7brv8qw",
|
|
1265
1344
|
"type": "lease",
|
|
1266
|
-
"
|
|
1267
|
-
"undernameLimit": 100
|
|
1268
|
-
"owner": "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
1269
|
-
"name": "ardrive"
|
|
1345
|
+
"ttlSeconds": 3600,
|
|
1346
|
+
"undernameLimit": 100
|
|
1270
1347
|
}
|
|
1271
1348
|
```
|
|
1272
1349
|
|
|
@@ -1287,7 +1364,7 @@ _Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
|
1287
1364
|
- `referrer` - _optional_: track purchase referrals for analytics (e.g. `my-app.com`)
|
|
1288
1365
|
|
|
1289
1366
|
```typescript
|
|
1290
|
-
const ario = ARIO.
|
|
1367
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1291
1368
|
const record = await ario.buyRecord(
|
|
1292
1369
|
{
|
|
1293
1370
|
name: "ardrive",
|
|
@@ -1325,7 +1402,7 @@ Upgrades an existing leased ArNS record to a permanent ownership. The record mus
|
|
|
1325
1402
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1326
1403
|
|
|
1327
1404
|
```typescript
|
|
1328
|
-
const ario = ARIO.
|
|
1405
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1329
1406
|
const record = await ario.upgradeRecord(
|
|
1330
1407
|
{
|
|
1331
1408
|
name: "ardrive",
|
|
@@ -1343,7 +1420,7 @@ const record = await ario.upgradeRecord(
|
|
|
1343
1420
|
Retrieves the record info of the specified ArNS name.
|
|
1344
1421
|
|
|
1345
1422
|
```typescript
|
|
1346
|
-
const ario = ARIO.
|
|
1423
|
+
const ario = ARIO.init({ rpc });
|
|
1347
1424
|
const record = await ario.getArNSRecord({ name: "ardrive" });
|
|
1348
1425
|
```
|
|
1349
1426
|
|
|
@@ -1353,10 +1430,11 @@ const record = await ario.getArNSRecord({ name: "ardrive" });
|
|
|
1353
1430
|
```json
|
|
1354
1431
|
{
|
|
1355
1432
|
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
1356
|
-
"endTimestamp": 1752256702026,
|
|
1357
1433
|
"startTimestamp": 1720720819969,
|
|
1434
|
+
"endTimestamp": 1752256702026,
|
|
1358
1435
|
"type": "lease",
|
|
1359
|
-
"undernameLimit": 100
|
|
1436
|
+
"undernameLimit": 100,
|
|
1437
|
+
"purchasePrice": 75541282285
|
|
1360
1438
|
}
|
|
1361
1439
|
```
|
|
1362
1440
|
|
|
@@ -1367,7 +1445,7 @@ const record = await ario.getArNSRecord({ name: "ardrive" });
|
|
|
1367
1445
|
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.
|
|
1368
1446
|
|
|
1369
1447
|
```typescript
|
|
1370
|
-
const ario = ARIO.
|
|
1448
|
+
const ario = ARIO.init({ rpc });
|
|
1371
1449
|
// get the newest 100 names
|
|
1372
1450
|
const records = await ario.getArNSRecords({
|
|
1373
1451
|
limit: 100,
|
|
@@ -1441,12 +1519,12 @@ Available `sortBy` options are any of the keys on the record object, e.g. `name`
|
|
|
1441
1519
|
|
|
1442
1520
|
</details>
|
|
1443
1521
|
|
|
1444
|
-
#### `getArNSRecordsForAddress({ address,
|
|
1522
|
+
#### `getArNSRecordsForAddress({ address, cursor, limit, sortBy, sortOrder })`
|
|
1445
1523
|
|
|
1446
1524
|
Retrieves all registered ArNS records of the specified address according to the `ANTRegistry` access control list, paginated and sorted by the specified criteria. The `cursor` used for pagination is the last ArNS name from the previous request.
|
|
1447
1525
|
|
|
1448
1526
|
```typescript
|
|
1449
|
-
const ario = ARIO.
|
|
1527
|
+
const ario = ARIO.init({ rpc });
|
|
1450
1528
|
const records = await ario.getArNSRecordsForAddress({
|
|
1451
1529
|
address: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
1452
1530
|
limit: 100,
|
|
@@ -1491,7 +1569,7 @@ Increases the undername support of a domain up to a maximum of 10k. Domains, by
|
|
|
1491
1569
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1492
1570
|
|
|
1493
1571
|
```typescript
|
|
1494
|
-
const ario = ARIO.
|
|
1572
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1495
1573
|
const { id: txId } = await ario.increaseUndernameLimit(
|
|
1496
1574
|
{
|
|
1497
1575
|
name: "ar-io",
|
|
@@ -1508,7 +1586,7 @@ const { id: txId } = await ario.increaseUndernameLimit(
|
|
|
1508
1586
|
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.
|
|
1509
1587
|
|
|
1510
1588
|
```typescript
|
|
1511
|
-
const ario = ARIO.
|
|
1589
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1512
1590
|
const { id: txId } = await ario.extendLease(
|
|
1513
1591
|
{
|
|
1514
1592
|
name: "ar-io",
|
|
@@ -1562,19 +1640,14 @@ const costDetails = await ario.getCostDetails({
|
|
|
1562
1640
|
|
|
1563
1641
|
```json
|
|
1564
1642
|
{
|
|
1565
|
-
"tokenCost":
|
|
1566
|
-
"
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
"
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
}
|
|
1574
|
-
},
|
|
1575
|
-
"shortfall": 0
|
|
1576
|
-
},
|
|
1577
|
-
"discounts": []
|
|
1643
|
+
"tokenCost": 1907401818,
|
|
1644
|
+
"discounts": [
|
|
1645
|
+
{
|
|
1646
|
+
"name": "Gateway Operator",
|
|
1647
|
+
"discountTotal": 476850455,
|
|
1648
|
+
"multiplier": 0.8
|
|
1649
|
+
}
|
|
1650
|
+
]
|
|
1578
1651
|
}
|
|
1579
1652
|
```
|
|
1580
1653
|
|
|
@@ -1585,7 +1658,7 @@ const costDetails = await ario.getCostDetails({
|
|
|
1585
1658
|
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.
|
|
1586
1659
|
|
|
1587
1660
|
```typescript
|
|
1588
|
-
const ario = ARIO.
|
|
1661
|
+
const ario = ARIO.init({ rpc });
|
|
1589
1662
|
const demandFactor = await ario.getDemandFactor();
|
|
1590
1663
|
```
|
|
1591
1664
|
|
|
@@ -1603,7 +1676,7 @@ const demandFactor = await ario.getDemandFactor();
|
|
|
1603
1676
|
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.
|
|
1604
1677
|
|
|
1605
1678
|
```typescript
|
|
1606
|
-
const ario = ARIO.
|
|
1679
|
+
const ario = ARIO.init({ rpc });
|
|
1607
1680
|
const returnedNames = await ario.getArNSReturnedNames({
|
|
1608
1681
|
limit: 100,
|
|
1609
1682
|
sortBy: "endTimestamp",
|
|
@@ -1619,21 +1692,15 @@ const returnedNames = await ario.getArNSReturnedNames({
|
|
|
1619
1692
|
"items": [
|
|
1620
1693
|
{
|
|
1621
1694
|
"name": "permalink",
|
|
1622
|
-
"endTimestamp": 1730985241349,
|
|
1623
1695
|
"startTimestamp": 1729775641349,
|
|
1624
|
-
"
|
|
1625
|
-
"demandFactor": 1.05256,
|
|
1696
|
+
"endTimestamp": 1730985241349,
|
|
1626
1697
|
"initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
|
|
1627
|
-
"
|
|
1628
|
-
"durationMs": 1209600000,
|
|
1629
|
-
"decayRate": 0.000000000016847809193121693,
|
|
1630
|
-
"scalingExponent": 190,
|
|
1631
|
-
"startPriceMultiplier": 50
|
|
1632
|
-
}
|
|
1698
|
+
"premiumMultiplier": 50
|
|
1633
1699
|
}
|
|
1634
1700
|
],
|
|
1635
1701
|
"hasMore": false,
|
|
1636
1702
|
"totalItems": 1,
|
|
1703
|
+
"limit": 100,
|
|
1637
1704
|
"sortBy": "endTimestamp",
|
|
1638
1705
|
"sortOrder": "asc"
|
|
1639
1706
|
}
|
|
@@ -1646,7 +1713,7 @@ const returnedNames = await ario.getArNSReturnedNames({
|
|
|
1646
1713
|
Retrieves the returned name data for the specified returned name.
|
|
1647
1714
|
|
|
1648
1715
|
```typescript
|
|
1649
|
-
const ario = ARIO.
|
|
1716
|
+
const ario = ARIO.init({ rpc });
|
|
1650
1717
|
const returnedName = await ario.getArNSReturnedName({ name: "permalink" });
|
|
1651
1718
|
```
|
|
1652
1719
|
|
|
@@ -1656,17 +1723,10 @@ const returnedName = await ario.getArNSReturnedName({ name: "permalink" });
|
|
|
1656
1723
|
```json
|
|
1657
1724
|
{
|
|
1658
1725
|
"name": "permalink",
|
|
1659
|
-
"endTimestamp": 1730985241349,
|
|
1660
1726
|
"startTimestamp": 1729775641349,
|
|
1661
|
-
"
|
|
1662
|
-
"demandFactor": 1.05256,
|
|
1727
|
+
"endTimestamp": 1730985241349,
|
|
1663
1728
|
"initiator": "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc",
|
|
1664
|
-
"
|
|
1665
|
-
"durationMs": 1209600000,
|
|
1666
|
-
"decayRate": 0.000000000016847809193121693,
|
|
1667
|
-
"scalingExponent": 190,
|
|
1668
|
-
"startPriceMultiplier": 50
|
|
1669
|
-
}
|
|
1729
|
+
"premiumMultiplier": 50
|
|
1670
1730
|
}
|
|
1671
1731
|
```
|
|
1672
1732
|
|
|
@@ -1679,7 +1739,7 @@ const returnedName = await ario.getArNSReturnedName({ name: "permalink" });
|
|
|
1679
1739
|
Returns the current epoch data.
|
|
1680
1740
|
|
|
1681
1741
|
```typescript
|
|
1682
|
-
const ario = ARIO.
|
|
1742
|
+
const ario = ARIO.init({ rpc });
|
|
1683
1743
|
const epoch = await ario.getCurrentEpoch();
|
|
1684
1744
|
```
|
|
1685
1745
|
|
|
@@ -1689,10 +1749,10 @@ const epoch = await ario.getCurrentEpoch();
|
|
|
1689
1749
|
```json
|
|
1690
1750
|
{
|
|
1691
1751
|
"epochIndex": 0,
|
|
1752
|
+
"startHeight": 0,
|
|
1692
1753
|
"startTimestamp": 1720720621424,
|
|
1693
1754
|
"endTimestamp": 1752256702026,
|
|
1694
|
-
"
|
|
1695
|
-
"distributionTimestamp": 1711122739,
|
|
1755
|
+
"distributionTimestamp": 1752256702026,
|
|
1696
1756
|
"observations": {
|
|
1697
1757
|
"failureSummaries": {
|
|
1698
1758
|
"-Tk2DDk8k4zkwtppp_XFKKI5oUgh6IEHygAoN7mD-w8": [
|
|
@@ -1709,21 +1769,28 @@ const epoch = await ario.getCurrentEpoch();
|
|
|
1709
1769
|
"gatewayAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1710
1770
|
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1711
1771
|
"stake": 10000000000,
|
|
1712
|
-
"
|
|
1772
|
+
"startTimestamp": 1720720621424,
|
|
1713
1773
|
"stakeWeight": 1,
|
|
1714
1774
|
"tenureWeight": 0.4494598765432099,
|
|
1715
1775
|
"gatewayPerformanceRatio": 1,
|
|
1776
|
+
"observerPerformanceRatio": 1,
|
|
1777
|
+
"gatewayRewardRatioWeight": 1,
|
|
1716
1778
|
"observerRewardRatioWeight": 1,
|
|
1717
1779
|
"compositeWeight": 0.4494598765432099,
|
|
1718
1780
|
"normalizedCompositeWeight": 0.002057032496835938
|
|
1719
1781
|
}
|
|
1720
1782
|
],
|
|
1721
1783
|
"distributions": {
|
|
1722
|
-
"
|
|
1784
|
+
"totalEligibleGateways": 1,
|
|
1723
1785
|
"totalEligibleRewards": 100000000,
|
|
1724
|
-
"
|
|
1725
|
-
|
|
1726
|
-
|
|
1786
|
+
"totalEligibleObserverReward": 100000000,
|
|
1787
|
+
"totalEligibleGatewayReward": 100000000
|
|
1788
|
+
},
|
|
1789
|
+
"arnsStats": {
|
|
1790
|
+
"totalReturnedNames": 0,
|
|
1791
|
+
"totalActiveNames": 0,
|
|
1792
|
+
"totalGracePeriodNames": 0,
|
|
1793
|
+
"totalReservedNames": 0
|
|
1727
1794
|
}
|
|
1728
1795
|
}
|
|
1729
1796
|
```
|
|
@@ -1735,7 +1802,7 @@ const epoch = await ario.getCurrentEpoch();
|
|
|
1735
1802
|
Returns the epoch data for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1736
1803
|
|
|
1737
1804
|
```typescript
|
|
1738
|
-
const ario = ARIO.
|
|
1805
|
+
const ario = ARIO.init({ rpc });
|
|
1739
1806
|
const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
1740
1807
|
```
|
|
1741
1808
|
|
|
@@ -1745,9 +1812,9 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1745
1812
|
```json
|
|
1746
1813
|
{
|
|
1747
1814
|
"epochIndex": 0,
|
|
1815
|
+
"startHeight": 0,
|
|
1748
1816
|
"startTimestamp": 1720720620813,
|
|
1749
1817
|
"endTimestamp": 1752256702026,
|
|
1750
|
-
"startHeight": 1350700,
|
|
1751
1818
|
"distributionTimestamp": 1752256702026,
|
|
1752
1819
|
"observations": {
|
|
1753
1820
|
"failureSummaries": {
|
|
@@ -1764,11 +1831,13 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1764
1831
|
{
|
|
1765
1832
|
"gatewayAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1766
1833
|
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1767
|
-
"stake": 10000000000,
|
|
1834
|
+
"stake": 10000000000,
|
|
1768
1835
|
"startTimestamp": 1720720620813,
|
|
1769
1836
|
"stakeWeight": 1,
|
|
1770
1837
|
"tenureWeight": 0.4494598765432099,
|
|
1771
1838
|
"gatewayPerformanceRatio": 1,
|
|
1839
|
+
"observerPerformanceRatio": 1,
|
|
1840
|
+
"gatewayRewardRatioWeight": 1,
|
|
1772
1841
|
"observerRewardRatioWeight": 1,
|
|
1773
1842
|
"compositeWeight": 0.4494598765432099,
|
|
1774
1843
|
"normalizedCompositeWeight": 0.002057032496835938
|
|
@@ -1778,14 +1847,13 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1778
1847
|
"totalEligibleGateways": 1,
|
|
1779
1848
|
"totalEligibleRewards": 100000000,
|
|
1780
1849
|
"totalEligibleObserverReward": 100000000,
|
|
1781
|
-
"totalEligibleGatewayReward": 100000000
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
"
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
}
|
|
1850
|
+
"totalEligibleGatewayReward": 100000000
|
|
1851
|
+
},
|
|
1852
|
+
"arnsStats": {
|
|
1853
|
+
"totalReturnedNames": 0,
|
|
1854
|
+
"totalActiveNames": 0,
|
|
1855
|
+
"totalGracePeriodNames": 0,
|
|
1856
|
+
"totalReservedNames": 0
|
|
1789
1857
|
}
|
|
1790
1858
|
}
|
|
1791
1859
|
```
|
|
@@ -1797,7 +1865,7 @@ const epoch = await ario.getEpoch({ epochIndex: 0 });
|
|
|
1797
1865
|
Returns the eligible epoch rewards for the specified block height. If no epoch index is provided, the current epoch is used.
|
|
1798
1866
|
|
|
1799
1867
|
```typescript
|
|
1800
|
-
const ario = ARIO.
|
|
1868
|
+
const ario = ARIO.init({ rpc });
|
|
1801
1869
|
const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
1802
1870
|
```
|
|
1803
1871
|
|
|
@@ -1830,7 +1898,7 @@ const rewards = await ario.getEligibleEpochRewards({ epochIndex: 0 });
|
|
|
1830
1898
|
Returns the epoch-indexed observation list. If no epoch index is provided, the current epoch is used.
|
|
1831
1899
|
|
|
1832
1900
|
```typescript
|
|
1833
|
-
const ario = ARIO.
|
|
1901
|
+
const ario = ARIO.init({ rpc });
|
|
1834
1902
|
const observations = await ario.getObservations();
|
|
1835
1903
|
```
|
|
1836
1904
|
|
|
@@ -1839,19 +1907,16 @@ const observations = await ario.getObservations();
|
|
|
1839
1907
|
|
|
1840
1908
|
```json
|
|
1841
1909
|
{
|
|
1842
|
-
"
|
|
1843
|
-
"
|
|
1844
|
-
"
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
"
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
"osZP4D9cqeDvbVFBaEfjIxwc1QLIvRxUBRAxDIX9je8": "aatgznEvC_UPcxp1v0uw_RqydhIfKm4wtt1KCpONBB0",
|
|
1853
|
-
"qZ90I67XG68BYIAFVNfm9PUdM7v1XtFTn7u-EOZFAtk": "Bd8SmFK9-ktJRmwIungS8ur6JM-JtpxrvMtjt5JkB1M"
|
|
1854
|
-
}
|
|
1910
|
+
"failureSummaries": {
|
|
1911
|
+
"-Tk2DDk8k4zkwtppp_XFKKI5oUgh6IEHygAoN7mD-w8": [
|
|
1912
|
+
"Ie2wEEUDKoU26c7IuckHNn3vMFdNQnMvfPBrFzAb3NA"
|
|
1913
|
+
]
|
|
1914
|
+
},
|
|
1915
|
+
"reports": {
|
|
1916
|
+
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": "B6UUjKWjjEWDBvDSMXWNmymfwvgR9EN27z5FTkEVlX4",
|
|
1917
|
+
"Ie2wEEUDKoU26c7IuckHNn3vMFdNQnMvfPBrFzAb3NA": "7tKsiQ2fxv0D8ZVN_QEv29fZ8hwFIgHoEDrpeEG0DIs",
|
|
1918
|
+
"osZP4D9cqeDvbVFBaEfjIxwc1QLIvRxUBRAxDIX9je8": "aatgznEvC_UPcxp1v0uw_RqydhIfKm4wtt1KCpONBB0",
|
|
1919
|
+
"qZ90I67XG68BYIAFVNfm9PUdM7v1XtFTn7u-EOZFAtk": "Bd8SmFK9-ktJRmwIungS8ur6JM-JtpxrvMtjt5JkB1M"
|
|
1855
1920
|
}
|
|
1856
1921
|
}
|
|
1857
1922
|
```
|
|
@@ -1863,7 +1928,7 @@ const observations = await ario.getObservations();
|
|
|
1863
1928
|
Returns the current rewards distribution information. If no epoch index is provided, the current epoch is used.
|
|
1864
1929
|
|
|
1865
1930
|
```typescript
|
|
1866
|
-
const ario = ARIO.
|
|
1931
|
+
const ario = ARIO.init({ rpc });
|
|
1867
1932
|
const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
1868
1933
|
```
|
|
1869
1934
|
|
|
@@ -1875,20 +1940,7 @@ const distributions = await ario.getDistributions({ epochIndex: 0 });
|
|
|
1875
1940
|
"totalEligibleGateways": 1,
|
|
1876
1941
|
"totalEligibleRewards": 100000000,
|
|
1877
1942
|
"totalEligibleObserverReward": 100000000,
|
|
1878
|
-
"totalEligibleGatewayReward": 100000000
|
|
1879
|
-
"totalDistributedRewards": 100000000,
|
|
1880
|
-
"distributedTimestamp": 1720720621424,
|
|
1881
|
-
"rewards": {
|
|
1882
|
-
"eligible": {
|
|
1883
|
-
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": {
|
|
1884
|
-
"operatorReward": 100000000,
|
|
1885
|
-
"delegateRewards": {}
|
|
1886
|
-
}
|
|
1887
|
-
},
|
|
1888
|
-
"distributed": {
|
|
1889
|
-
"IPdwa3Mb_9pDD8c2IaJx6aad51Ss-_TfStVwBuhtXMs": 100000000
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1943
|
+
"totalEligibleGatewayReward": 100000000
|
|
1892
1944
|
}
|
|
1893
1945
|
```
|
|
1894
1946
|
|
|
@@ -1899,7 +1951,7 @@ Saves the observations of the current epoch. Requires `signer` to be provided on
|
|
|
1899
1951
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
1900
1952
|
|
|
1901
1953
|
```typescript
|
|
1902
|
-
const ario = ARIO.
|
|
1954
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
1903
1955
|
const { id: txId } = await ario.saveObservations(
|
|
1904
1956
|
{
|
|
1905
1957
|
reportTxId: "fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3",
|
|
@@ -1918,7 +1970,7 @@ const { id: txId } = await ario.saveObservations(
|
|
|
1918
1970
|
Retrieves the prescribed observers of the ARIO process. To fetch prescribed observers for a previous epoch set the `epochIndex` to the desired epoch index.
|
|
1919
1971
|
|
|
1920
1972
|
```typescript
|
|
1921
|
-
const ario = ARIO.
|
|
1973
|
+
const ario = ARIO.init({ rpc });
|
|
1922
1974
|
const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
1923
1975
|
```
|
|
1924
1976
|
|
|
@@ -1930,11 +1982,13 @@ const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1930
1982
|
{
|
|
1931
1983
|
"gatewayAddress": "BpQlyhREz4lNGS-y3rSS1WxADfxPpAuing9Lgfdrj2U",
|
|
1932
1984
|
"observerAddress": "2Fk8lCmDegPg6jjprl57-UCpKmNgYiKwyhkU4vMNDnE",
|
|
1933
|
-
"stake": 10000000000,
|
|
1934
|
-
"
|
|
1985
|
+
"stake": 10000000000,
|
|
1986
|
+
"startTimestamp": 1720720620813,
|
|
1935
1987
|
"stakeWeight": 1,
|
|
1936
1988
|
"tenureWeight": 0.41453703703703704,
|
|
1937
1989
|
"gatewayPerformanceRatio": 1,
|
|
1990
|
+
"observerPerformanceRatio": 1,
|
|
1991
|
+
"gatewayRewardRatioWeight": 1,
|
|
1938
1992
|
"observerRewardRatioWeight": 1,
|
|
1939
1993
|
"compositeWeight": 0.41453703703703704,
|
|
1940
1994
|
"normalizedCompositeWeight": 0.0018972019546783507
|
|
@@ -1951,7 +2005,7 @@ const observers = await ario.getPrescribedObservers({ epochIndex: 0 });
|
|
|
1951
2005
|
Retrieves all primary names paginated and sorted by the specified criteria. The `cursor` used for pagination is the last name from the previous request.
|
|
1952
2006
|
|
|
1953
2007
|
```typescript
|
|
1954
|
-
const ario = ARIO.
|
|
2008
|
+
const ario = ARIO.init({ rpc });
|
|
1955
2009
|
const names = await ario.getPrimaryNames({
|
|
1956
2010
|
cursor: "ao", // this is the last name from the previous request
|
|
1957
2011
|
limit: 1,
|
|
@@ -1970,12 +2024,13 @@ const names = await ario.getPrimaryNames({
|
|
|
1970
2024
|
"totalItems": 100,
|
|
1971
2025
|
"limit": 1,
|
|
1972
2026
|
"sortBy": "startTimestamp",
|
|
1973
|
-
"
|
|
2027
|
+
"nextCursor": "arns",
|
|
1974
2028
|
"items": [
|
|
1975
2029
|
{
|
|
2030
|
+
"name": "arns",
|
|
1976
2031
|
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
1977
|
-
"
|
|
1978
|
-
"
|
|
2032
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
2033
|
+
"startTimestamp": 1719356032297
|
|
1979
2034
|
}
|
|
1980
2035
|
]
|
|
1981
2036
|
}
|
|
@@ -1988,7 +2043,7 @@ const names = await ario.getPrimaryNames({
|
|
|
1988
2043
|
Retrieves the primary name for a given name or address.
|
|
1989
2044
|
|
|
1990
2045
|
```typescript
|
|
1991
|
-
const ario = ARIO.
|
|
2046
|
+
const ario = ARIO.init({ rpc });
|
|
1992
2047
|
const name = await ario.getPrimaryName({
|
|
1993
2048
|
name: "arns",
|
|
1994
2049
|
});
|
|
@@ -2003,9 +2058,10 @@ const name = await ario.getPrimaryName({
|
|
|
2003
2058
|
|
|
2004
2059
|
```json
|
|
2005
2060
|
{
|
|
2061
|
+
"name": "arns",
|
|
2006
2062
|
"owner": "HwFceQaMQnOBgKDpnFqCqgwKwEU5LBme1oXRuQOWSRA",
|
|
2007
|
-
"
|
|
2008
|
-
"
|
|
2063
|
+
"processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
2064
|
+
"startTimestamp": 1719356032297
|
|
2009
2065
|
}
|
|
2010
2066
|
```
|
|
2011
2067
|
|
|
@@ -2018,9 +2074,8 @@ Sets an ArNS name already owned by the `signer` as their primary name. Note: `si
|
|
|
2018
2074
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
2019
2075
|
|
|
2020
2076
|
```typescript
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
await ario.setPrimaryName({ name: "my-arns-name" }); // the caller must already have purchased the name my-arns-name and be assigned as the owner of the processId that is assigned to the name
|
|
2077
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
2078
|
+
await ario.setPrimaryName({ name: 'my-arns-name' });
|
|
2024
2079
|
```
|
|
2025
2080
|
|
|
2026
2081
|
#### `requestPrimaryName({ name })`
|
|
@@ -2030,7 +2085,7 @@ Requests a primary name for the `signer`'s address. The request must be approved
|
|
|
2030
2085
|
_Note: Requires `signer` to be provided on `ARIO.init` to sign the transaction._
|
|
2031
2086
|
|
|
2032
2087
|
```typescript
|
|
2033
|
-
const ario = ARIO.
|
|
2088
|
+
const ario = ARIO.init({ rpc, rpcSubscriptions, signer });
|
|
2034
2089
|
const { id: txId } = await ario.requestPrimaryName({
|
|
2035
2090
|
name: "arns",
|
|
2036
2091
|
});
|
|
@@ -2041,7 +2096,7 @@ const { id: txId } = await ario.requestPrimaryName({
|
|
|
2041
2096
|
Retrieves the primary name request for a a wallet address.
|
|
2042
2097
|
|
|
2043
2098
|
```typescript
|
|
2044
|
-
const ario = ARIO.
|
|
2099
|
+
const ario = ARIO.init({ rpc });
|
|
2045
2100
|
const request = await ario.getPrimaryNameRequest({
|
|
2046
2101
|
initiator: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
2047
2102
|
});
|
|
@@ -2063,80 +2118,71 @@ const request = await ario.getPrimaryNameRequest({
|
|
|
2063
2118
|
|
|
2064
2119
|
### Configuration
|
|
2065
2120
|
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
import { ARIO , AOProcess } from '@ar.io/sdk';
|
|
2070
|
-
import { connect } from '@permaweb/aoconnect';
|
|
2071
|
-
|
|
2072
|
-
// provide a custom ao infrastructure and process id
|
|
2073
|
-
const ario = ARIO.mainnet({
|
|
2074
|
-
process: new AOProcess({
|
|
2075
|
-
processId: 'ARIO_PROCESS_ID'
|
|
2076
|
-
ao: connect({
|
|
2077
|
-
MODE: 'legacy',
|
|
2078
|
-
MU_URL: 'https://mu-testnet.xyz',
|
|
2079
|
-
CU_URL: 'https://cu-testnet.xyz',
|
|
2080
|
-
GRAPHQL_URL: 'https://arweave.net/graphql',
|
|
2081
|
-
GATEWAY_URL: 'https://arweave.net',
|
|
2082
|
-
})
|
|
2083
|
-
})
|
|
2084
|
-
});
|
|
2085
|
-
```
|
|
2121
|
+
`ARIO.init` accepts a `@solana/kit` RPC client plus optional program ID
|
|
2122
|
+
overrides for non-mainnet clusters. See [Networks](#networks) above for
|
|
2123
|
+
the full shape.
|
|
2086
2124
|
|
|
2087
2125
|
## ANT Contracts
|
|
2088
2126
|
|
|
2089
|
-
The ANT client class exposes APIs
|
|
2127
|
+
The ANT client class exposes APIs for Arweave Name Tokens. On Solana an
|
|
2128
|
+
ANT is a Metaplex Core asset; its `processId` is the asset's mint
|
|
2129
|
+
pubkey. The `ario-ant` program owns the on-chain records / controllers
|
|
2130
|
+
state attached to the asset.
|
|
2090
2131
|
|
|
2091
2132
|
### Initialize
|
|
2092
2133
|
|
|
2093
|
-
#### `init({ processId, signer })`
|
|
2134
|
+
#### `init({ processId, rpc, rpcSubscriptions?, signer? })`
|
|
2094
2135
|
|
|
2095
|
-
Factory
|
|
2136
|
+
Factory that creates a read-only or writeable ANT client. Providing
|
|
2137
|
+
`signer` and `rpcSubscriptions` enables write methods (`setRecord`,
|
|
2138
|
+
`transfer`, `addController`, etc.).
|
|
2096
2139
|
|
|
2097
2140
|
```typescript
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2141
|
+
import { ANT } from '@ar.io/sdk';
|
|
2142
|
+
import {
|
|
2143
|
+
createSolanaRpc,
|
|
2144
|
+
createSolanaRpcSubscriptions,
|
|
2145
|
+
} from '@solana/kit';
|
|
2146
|
+
|
|
2147
|
+
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
|
|
2148
|
+
|
|
2149
|
+
// Read-only
|
|
2150
|
+
const ant = await ANT.init({
|
|
2151
|
+
processId: '<MPL Core asset pubkey>',
|
|
2152
|
+
rpc,
|
|
2102
2153
|
});
|
|
2103
2154
|
|
|
2104
|
-
//
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
|
|
2155
|
+
// Read + write
|
|
2156
|
+
const antWrite = await ANT.init({
|
|
2157
|
+
processId: '<MPL Core asset pubkey>',
|
|
2158
|
+
rpc,
|
|
2159
|
+
rpcSubscriptions: createSolanaRpcSubscriptions(
|
|
2160
|
+
'wss://api.mainnet-beta.solana.com',
|
|
2161
|
+
),
|
|
2162
|
+
signer,
|
|
2108
2163
|
});
|
|
2109
2164
|
```
|
|
2110
2165
|
|
|
2111
2166
|
### Spawn
|
|
2112
2167
|
|
|
2113
|
-
#### `spawn({
|
|
2114
|
-
|
|
2115
|
-
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.
|
|
2168
|
+
#### `ANT.spawn({ rpc, rpcSubscriptions, signer, state })`
|
|
2116
2169
|
|
|
2117
|
-
|
|
2170
|
+
Static factory that mints a new MPL Core asset and initializes the
|
|
2171
|
+
`ario-ant` PDAs in a single transaction. Returns
|
|
2172
|
+
`{ processId, mint, signature }`.
|
|
2118
2173
|
|
|
2119
2174
|
```typescript
|
|
2120
|
-
import { ANT } from
|
|
2121
|
-
import { ArweaveSigner } from "@ar.io/sdk/node";
|
|
2122
|
-
|
|
2123
|
-
const processId = await ANT.spawn({
|
|
2124
|
-
signer: new ArweaveSigner(jwk),
|
|
2125
|
-
state: {
|
|
2126
|
-
name: "My ANT",
|
|
2127
|
-
ticker: "MYANT",
|
|
2128
|
-
description: "My custom ANT token",
|
|
2129
|
-
},
|
|
2130
|
-
});
|
|
2175
|
+
import { ANT } from '@ar.io/sdk';
|
|
2131
2176
|
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2177
|
+
const { processId, signature } = await ANT.spawn({
|
|
2178
|
+
rpc,
|
|
2179
|
+
rpcSubscriptions,
|
|
2180
|
+
signer,
|
|
2136
2181
|
state: {
|
|
2137
|
-
name:
|
|
2138
|
-
ticker:
|
|
2139
|
-
description:
|
|
2182
|
+
name: 'My ANT',
|
|
2183
|
+
ticker: 'MYANT',
|
|
2184
|
+
description: 'My ANT token',
|
|
2185
|
+
uri: 'ar://<metadata-tx-id>',
|
|
2140
2186
|
},
|
|
2141
2187
|
});
|
|
2142
2188
|
```
|
|
@@ -2144,25 +2190,34 @@ const processId = await ANT.spawn({
|
|
|
2144
2190
|
**CLI Usage:**
|
|
2145
2191
|
|
|
2146
2192
|
```bash
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2193
|
+
ar.io spawn-ant \
|
|
2194
|
+
--wallet-file wallet.json \
|
|
2195
|
+
--name "My ANT" \
|
|
2196
|
+
--ticker "MYANT" \
|
|
2197
|
+
--metadata-uri "ar://<metadata-tx-id>"
|
|
2152
2198
|
```
|
|
2153
2199
|
|
|
2154
2200
|
**Parameters:**
|
|
2155
2201
|
|
|
2156
|
-
- `
|
|
2157
|
-
- `
|
|
2158
|
-
- `
|
|
2159
|
-
- `
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
- `
|
|
2163
|
-
- `
|
|
2202
|
+
- `state.name: string` — display name of the ANT
|
|
2203
|
+
- `state.ticker?: string` — ticker symbol
|
|
2204
|
+
- `state.description?: string` — short description
|
|
2205
|
+
- `state.uri: string` — `ar://` URI of the Metaplex Core asset's JSON
|
|
2206
|
+
metadata. Build via `buildAntMetadata` from `@ar.io/sdk` and upload
|
|
2207
|
+
to Arweave (e.g. via `@ardrive/turbo-sdk`).
|
|
2208
|
+
- `state.keywords?: string[]`
|
|
2209
|
+
- `state.logo?: string` — Arweave TX ID of the logo
|
|
2210
|
+
- `state.transactionId?: string` — initial `@` record target
|
|
2164
2211
|
|
|
2165
|
-
**Returns:**
|
|
2212
|
+
**Returns:**
|
|
2213
|
+
|
|
2214
|
+
```ts
|
|
2215
|
+
{
|
|
2216
|
+
processId: string; // the MPL Core asset mint pubkey
|
|
2217
|
+
mint: Address;
|
|
2218
|
+
signature: string; // the Solana tx signature
|
|
2219
|
+
}
|
|
2220
|
+
```
|
|
2166
2221
|
|
|
2167
2222
|
### Versions
|
|
2168
2223
|
|
|
@@ -2233,61 +2288,6 @@ true
|
|
|
2233
2288
|
|
|
2234
2289
|
</details>
|
|
2235
2290
|
|
|
2236
|
-
#### `getANTVersions`
|
|
2237
|
-
|
|
2238
|
-
Static method that returns the full array of available ANT versions and the latest version from the ANT registry.
|
|
2239
|
-
|
|
2240
|
-
```typescript
|
|
2241
|
-
import { ANT } from "@ar.io/sdk";
|
|
2242
|
-
|
|
2243
|
-
// Get all available ANT versions
|
|
2244
|
-
const antVersions = ANT.versions;
|
|
2245
|
-
const versions = await antVersions.getANTVersions();
|
|
2246
|
-
```
|
|
2247
|
-
|
|
2248
|
-
Result:
|
|
2249
|
-
|
|
2250
|
-
```json
|
|
2251
|
-
{
|
|
2252
|
-
[
|
|
2253
|
-
{
|
|
2254
|
-
"moduleId": "FKtQtOOtlcWCW2pXrwWFiCSlnuewMZOHCzhulVkyqBE",
|
|
2255
|
-
"version": "23",
|
|
2256
|
-
"releaseNotes": "Initial release of the ANT module.",
|
|
2257
|
-
"releaseDate": 1700000000000
|
|
2258
|
-
}
|
|
2259
|
-
// ...other versions
|
|
2260
|
-
],
|
|
2261
|
-
}
|
|
2262
|
-
```
|
|
2263
|
-
|
|
2264
|
-
#### `getLatestANTVersion()`
|
|
2265
|
-
|
|
2266
|
-
Static method that returns the latest ANT version from the ANT registry.
|
|
2267
|
-
|
|
2268
|
-
```typescript
|
|
2269
|
-
import { ANT } from "@ar.io/sdk";
|
|
2270
|
-
|
|
2271
|
-
// Get the latest ANT version
|
|
2272
|
-
import { ANT } from "@ar.io/sdk";
|
|
2273
|
-
|
|
2274
|
-
// Get all available ANT versions
|
|
2275
|
-
const antVersions = ANT.versions;
|
|
2276
|
-
const versions = await antVersions.getANTVersions();
|
|
2277
|
-
const latestVersion = await antVersions.getLatestANTVersion();
|
|
2278
|
-
```
|
|
2279
|
-
|
|
2280
|
-
Result:
|
|
2281
|
-
|
|
2282
|
-
```json
|
|
2283
|
-
{
|
|
2284
|
-
"moduleId": "FKtQtOOtlcWCW2pXrwWFiCSlnuewMZOHCzhulVkyqBE",
|
|
2285
|
-
"version": "23",
|
|
2286
|
-
"releaseNotes": "Initial release of the ANT module.",
|
|
2287
|
-
"releaseDate": 1700000000000
|
|
2288
|
-
}
|
|
2289
|
-
```
|
|
2290
|
-
|
|
2291
2291
|
### State
|
|
2292
2292
|
|
|
2293
2293
|
#### `getInfo()`
|
|
@@ -2303,11 +2303,42 @@ const info = await ant.getInfo();
|
|
|
2303
2303
|
|
|
2304
2304
|
```json
|
|
2305
2305
|
{
|
|
2306
|
-
"
|
|
2307
|
-
"
|
|
2308
|
-
"
|
|
2309
|
-
"
|
|
2310
|
-
"
|
|
2306
|
+
"Name": "ArDrive",
|
|
2307
|
+
"Owner": "QGWqtJdLLgm2ehFWiiPzMaoFLD50CnGuzZIPEdoDRGQ",
|
|
2308
|
+
"Ticker": "ANT-ARDRIVE",
|
|
2309
|
+
"Total-Supply": "1",
|
|
2310
|
+
"Description": "This is the ANT for the ArDrive decentralized web app.",
|
|
2311
|
+
"Keywords": ["File-sharing", "Publishing", "dApp"],
|
|
2312
|
+
"Logo": "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A",
|
|
2313
|
+
"Denomination": "0",
|
|
2314
|
+
"Handlers": [
|
|
2315
|
+
"balance",
|
|
2316
|
+
"balances",
|
|
2317
|
+
"totalSupply",
|
|
2318
|
+
"info",
|
|
2319
|
+
"controllers",
|
|
2320
|
+
"record",
|
|
2321
|
+
"records",
|
|
2322
|
+
"state",
|
|
2323
|
+
"transfer",
|
|
2324
|
+
"addController",
|
|
2325
|
+
"removeController",
|
|
2326
|
+
"setRecord",
|
|
2327
|
+
"removeRecord",
|
|
2328
|
+
"setName",
|
|
2329
|
+
"setTicker",
|
|
2330
|
+
"setDescription",
|
|
2331
|
+
"setKeywords",
|
|
2332
|
+
"setLogo",
|
|
2333
|
+
"initializeState",
|
|
2334
|
+
"releaseName",
|
|
2335
|
+
"reassignName",
|
|
2336
|
+
"approvePrimaryName",
|
|
2337
|
+
"removePrimaryNames",
|
|
2338
|
+
"transferRecordOwnership",
|
|
2339
|
+
"_eval",
|
|
2340
|
+
"_default"
|
|
2341
|
+
]
|
|
2311
2342
|
}
|
|
2312
2343
|
```
|
|
2313
2344
|
|
|
@@ -2326,24 +2357,32 @@ const handlers = await ant.getHandlers();
|
|
|
2326
2357
|
|
|
2327
2358
|
```json
|
|
2328
2359
|
[
|
|
2329
|
-
"_eval",
|
|
2330
|
-
"_default",
|
|
2331
|
-
"transfer",
|
|
2332
2360
|
"balance",
|
|
2333
2361
|
"balances",
|
|
2334
2362
|
"totalSupply",
|
|
2335
2363
|
"info",
|
|
2364
|
+
"controllers",
|
|
2365
|
+
"record",
|
|
2366
|
+
"records",
|
|
2367
|
+
"state",
|
|
2368
|
+
"transfer",
|
|
2336
2369
|
"addController",
|
|
2337
2370
|
"removeController",
|
|
2338
|
-
"controllers",
|
|
2339
2371
|
"setRecord",
|
|
2340
2372
|
"removeRecord",
|
|
2341
|
-
"record",
|
|
2342
|
-
"records",
|
|
2343
2373
|
"setName",
|
|
2344
2374
|
"setTicker",
|
|
2375
|
+
"setDescription",
|
|
2376
|
+
"setKeywords",
|
|
2377
|
+
"setLogo",
|
|
2345
2378
|
"initializeState",
|
|
2346
|
-
"
|
|
2379
|
+
"releaseName",
|
|
2380
|
+
"reassignName",
|
|
2381
|
+
"approvePrimaryName",
|
|
2382
|
+
"removePrimaryNames",
|
|
2383
|
+
"transferRecordOwnership",
|
|
2384
|
+
"_eval",
|
|
2385
|
+
"_default"
|
|
2347
2386
|
]
|
|
2348
2387
|
```
|
|
2349
2388
|
|
|
@@ -2362,23 +2401,28 @@ const state = await ant.getState();
|
|
|
2362
2401
|
|
|
2363
2402
|
```json
|
|
2364
2403
|
{
|
|
2365
|
-
"
|
|
2366
|
-
"
|
|
2367
|
-
|
|
2368
|
-
|
|
2404
|
+
"Name": "ar.io Foundation",
|
|
2405
|
+
"Ticker": "ANT-AR-IO",
|
|
2406
|
+
"Description": "A friendly description for this ANT.",
|
|
2407
|
+
"Keywords": ["keyword1", "keyword2", "keyword3"],
|
|
2408
|
+
"Denomination": 0,
|
|
2409
|
+
"Owner": "98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY",
|
|
2369
2410
|
"Controllers": [],
|
|
2370
2411
|
"Records": {
|
|
2371
2412
|
"v1-0-0_whitepaper": {
|
|
2372
2413
|
"transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
|
|
2373
|
-
"ttlSeconds": 900
|
|
2414
|
+
"ttlSeconds": 900,
|
|
2415
|
+
"targetProtocol": 0
|
|
2374
2416
|
},
|
|
2375
2417
|
"@": {
|
|
2376
2418
|
"transactionId": "2rMLb2uHAyEt7jSu6bXtKx8e-jOfIf7E-DOgQnm8EtU",
|
|
2377
|
-
"ttlSeconds": 3600
|
|
2419
|
+
"ttlSeconds": 3600,
|
|
2420
|
+
"targetProtocol": 0
|
|
2378
2421
|
},
|
|
2379
2422
|
"alice": {
|
|
2380
2423
|
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
|
|
2381
2424
|
"ttlSeconds": 900,
|
|
2425
|
+
"targetProtocol": 0,
|
|
2382
2426
|
"owner": "alice-wallet-address-123...",
|
|
2383
2427
|
"displayName": "Alice's Portfolio",
|
|
2384
2428
|
"logo": "avatar-tx-id-456...",
|
|
@@ -2387,17 +2431,16 @@ const state = await ant.getState();
|
|
|
2387
2431
|
},
|
|
2388
2432
|
"whitepaper": {
|
|
2389
2433
|
"transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
|
|
2390
|
-
"ttlSeconds": 900
|
|
2434
|
+
"ttlSeconds": 900,
|
|
2435
|
+
"targetProtocol": 0
|
|
2391
2436
|
}
|
|
2392
2437
|
},
|
|
2393
|
-
"
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
"Keywords": ["keyword1", "keyword2", "keyword3"],
|
|
2438
|
+
"Balances": {
|
|
2439
|
+
"98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY": 1
|
|
2440
|
+
},
|
|
2397
2441
|
"Logo": "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A",
|
|
2398
|
-
"
|
|
2399
|
-
"
|
|
2400
|
-
"Owner": "98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY"
|
|
2442
|
+
"TotalSupply": 1,
|
|
2443
|
+
"Initialized": true
|
|
2401
2444
|
}
|
|
2402
2445
|
```
|
|
2403
2446
|
|
|
@@ -2486,24 +2529,32 @@ const records = await ant.getRecords();
|
|
|
2486
2529
|
{
|
|
2487
2530
|
"@": {
|
|
2488
2531
|
"transactionId": "UyC5P5qKPZaltMmmZAWdakhlDXsBF6qmyrbWYFchRTk",
|
|
2489
|
-
"ttlSeconds": 3600
|
|
2532
|
+
"ttlSeconds": 3600,
|
|
2533
|
+
"targetProtocol": 0,
|
|
2534
|
+
"index": 0
|
|
2490
2535
|
},
|
|
2491
2536
|
"alice": {
|
|
2492
2537
|
"transactionId": "kMk95k_3R8x_7d3wB9tEOiL5v6n8QhR_VnFCh3aeE3f",
|
|
2493
2538
|
"ttlSeconds": 900,
|
|
2539
|
+
"targetProtocol": 0,
|
|
2494
2540
|
"owner": "alice-wallet-address-123...",
|
|
2495
2541
|
"displayName": "Alice's Portfolio",
|
|
2496
2542
|
"logo": "avatar-tx-id-456...",
|
|
2497
2543
|
"description": "Personal portfolio and blog",
|
|
2498
|
-
"keywords": ["portfolio", "personal", "blog"]
|
|
2544
|
+
"keywords": ["portfolio", "personal", "blog"],
|
|
2545
|
+
"index": 1
|
|
2499
2546
|
},
|
|
2500
2547
|
"zed": {
|
|
2501
2548
|
"transactionId": "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI",
|
|
2502
|
-
"ttlSeconds": 900
|
|
2549
|
+
"ttlSeconds": 900,
|
|
2550
|
+
"targetProtocol": 0,
|
|
2551
|
+
"index": 2
|
|
2503
2552
|
},
|
|
2504
2553
|
"ardrive": {
|
|
2505
2554
|
"transactionId": "-cucucachoodwedwedoiwepodiwpodiwpoidpwoiedp",
|
|
2506
|
-
"ttlSeconds": 900
|
|
2555
|
+
"ttlSeconds": 900,
|
|
2556
|
+
"targetProtocol": 0,
|
|
2557
|
+
"index": 3
|
|
2507
2558
|
}
|
|
2508
2559
|
}
|
|
2509
2560
|
```
|
|
@@ -2525,6 +2576,7 @@ const record = await ant.getRecord({ undername: "dapp" });
|
|
|
2525
2576
|
{
|
|
2526
2577
|
"transactionId": "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM",
|
|
2527
2578
|
"ttlSeconds": 900,
|
|
2579
|
+
"targetProtocol": 0,
|
|
2528
2580
|
"owner": "alice-wallet-address-123...",
|
|
2529
2581
|
"displayName": "Alice's Site",
|
|
2530
2582
|
"logo": "avatar-tx-id-456...",
|
|
@@ -2839,115 +2891,28 @@ const { id: txId } = await ant.setLogo(
|
|
|
2839
2891
|
|
|
2840
2892
|
### ARIO Integrations
|
|
2841
2893
|
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
```typescript
|
|
2849
|
-
const { id: txId } = await ant.releaseName({
|
|
2850
|
-
name: "permalink",
|
|
2851
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID, // releases the name owned by the ANT and sends it to recently returned names on the ARIO contract
|
|
2852
|
-
});
|
|
2853
|
-
```
|
|
2854
|
-
|
|
2855
|
-
#### `reassignName({ name, arioProcessId, antProcessId })`
|
|
2856
|
-
|
|
2857
|
-
Reassigns a name to a new ANT. This can only be done by the current owner of the ANT.
|
|
2858
|
-
|
|
2859
|
-
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2860
|
-
|
|
2861
|
-
```typescript
|
|
2862
|
-
const { id: txId } = await ant.reassignName({
|
|
2863
|
-
name: "ardrive",
|
|
2864
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
2865
|
-
antProcessId: NEW_ANT_PROCESS_ID, // the new ANT process id that will take over ownership of the name
|
|
2866
|
-
});
|
|
2867
|
-
```
|
|
2868
|
-
|
|
2869
|
-
#### `approvePrimaryNameRequest({ name, address, arioProcessId })`
|
|
2870
|
-
|
|
2871
|
-
Approves a primary name request for a given name or address.
|
|
2872
|
-
|
|
2873
|
-
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2874
|
-
|
|
2875
|
-
```typescript
|
|
2876
|
-
const { id: txId } = await ant.approvePrimaryNameRequest({
|
|
2877
|
-
name: "arns",
|
|
2878
|
-
address: "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3", // must match the request initiator address
|
|
2879
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID, // the ARIO process id to use for the request
|
|
2880
|
-
});
|
|
2881
|
-
```
|
|
2882
|
-
|
|
2883
|
-
#### `removePrimaryNames({ names, arioProcessId, notifyOwners })`
|
|
2884
|
-
|
|
2885
|
-
Removes primary names from the ANT process.
|
|
2886
|
-
|
|
2887
|
-
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2888
|
-
|
|
2889
|
-
```typescript
|
|
2890
|
-
const { id: txId } = await ant.removePrimaryNames({
|
|
2891
|
-
names: ["arns", "test_arns"], // any primary names associated with a base name controlled by this ANT will be removed
|
|
2892
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
2893
|
-
notifyOwners: true, // if true, the owners of the removed names will be send AO messages to notify them of the removal
|
|
2894
|
-
});
|
|
2895
|
-
```
|
|
2894
|
+
`releaseName`, `reassignName`, `approvePrimaryNameRequest`, and
|
|
2895
|
+
`removePrimaryNames` were AO-only orchestration helpers and have been
|
|
2896
|
+
removed. Their on-chain equivalents on Solana live on the `ario-arns`
|
|
2897
|
+
program and are exposed through the `ARIO` write client
|
|
2898
|
+
(`upgradeRecord`, `setPrimaryName`, etc.) or — for permissionless
|
|
2899
|
+
maintenance — through `SolanaARIOWriteable`'s prune helpers.
|
|
2896
2900
|
|
|
2897
2901
|
### Upgrade
|
|
2898
2902
|
|
|
2899
|
-
#### `upgrade(
|
|
2900
|
-
|
|
2901
|
-
Upgrades an ANT by forking it to the latest version from the ANT registry and optionally reassigning ArNS names to the new process. This function first checks the version of the existing ANT, creates a new ANT using `.fork()` to the latest version, and then reassigns the ArNS names affiliated with this process to the new process.
|
|
2903
|
+
#### `upgrade()`
|
|
2902
2904
|
|
|
2903
|
-
|
|
2905
|
+
Migrates this ANT's on-chain state to the latest schema version (per-
|
|
2906
|
+
ANT data migration on Solana — no process forking, no name
|
|
2907
|
+
reassignment). Returns `{ id, needsMigration }`.
|
|
2904
2908
|
|
|
2905
2909
|
```typescript
|
|
2906
|
-
// Upgrade ANT and reassign all affiliated ArNS names to the new process
|
|
2907
2910
|
const result = await ant.upgrade();
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
names: ["ardrive", "example"],
|
|
2912
|
-
});
|
|
2913
|
-
|
|
2914
|
-
// with callbacks
|
|
2915
|
-
const result = await ant.upgrade({
|
|
2916
|
-
names: ["ardrive", "example"],
|
|
2917
|
-
onSigningProgress: (event, payload) => {
|
|
2918
|
-
console.log(`${event}:`, payload);
|
|
2919
|
-
if (event === "checking-version") {
|
|
2920
|
-
console.log(`Checking version: ${payload.antProcessId}`);
|
|
2921
|
-
}
|
|
2922
|
-
if (event === "fetching-affiliated-names") {
|
|
2923
|
-
console.log(`Fetching affiliated names: ${payload.arioProcessId}`);
|
|
2924
|
-
}
|
|
2925
|
-
if (event === "reassigning-name") {
|
|
2926
|
-
console.log(`Reassigning name: ${payload.name}`);
|
|
2927
|
-
}
|
|
2928
|
-
if (event === "validating-names") {
|
|
2929
|
-
console.log(`Validating names: ${payload.names}`);
|
|
2930
|
-
}
|
|
2931
|
-
// other callback events...
|
|
2932
|
-
},
|
|
2933
|
-
});
|
|
2934
|
-
|
|
2935
|
-
console.log(`Upgraded to process: ${result.forkedProcessId}`);
|
|
2936
|
-
console.log(`Successfully reassigned names: ${result.reassignedNames}`);
|
|
2937
|
-
console.log(`Failed to reassign names: ${result.failedReassignedNames}`);
|
|
2911
|
+
if (result.needsMigration) {
|
|
2912
|
+
console.log(`Migrated: ${result.id}`);
|
|
2913
|
+
}
|
|
2938
2914
|
```
|
|
2939
2915
|
|
|
2940
|
-
**Parameters:**
|
|
2941
|
-
|
|
2942
|
-
- `reassignAffiliatedNames?: boolean` - If true, reassigns all names associated with this process to the new forked process (defaults to true when names is empty)
|
|
2943
|
-
- `names?: string[]` - Optional array of specific names to reassign (cannot be used with `reassignAffiliatedNames: true`). These names must be affiliated with this ANT on the provided ARIO process.
|
|
2944
|
-
- `arioProcessId?: string` - Optional ARIO process ID (defaults to mainnet)
|
|
2945
|
-
- `antRegistryId?: string` - Optional ANT registry process ID used to resolve the latest version (defaults to mainnet registry)
|
|
2946
|
-
- `skipVersionCheck?: boolean` - Skip checking if ANT is already latest version (defaults to false)
|
|
2947
|
-
- `onSigningProgress?: Function` - Optional progress callback for tracking upgrade steps
|
|
2948
|
-
|
|
2949
|
-
**Returns:** `Promise<{ forkedProcessId: string, reassignedNames: Record<string, AoMessageResult>, failedReassignedNames: Record<string, { id?: string; error: Error }> }>`
|
|
2950
|
-
|
|
2951
2916
|
### Undername Ownership
|
|
2952
2917
|
|
|
2953
2918
|
NTs support ownership of undernames:
|
|
@@ -3000,9 +2965,11 @@ console.log(`Transaction ID: ${record.transactionId}`);
|
|
|
3000
2965
|
|
|
3001
2966
|
```typescript
|
|
3002
2967
|
// Alice (record owner) updating her own record
|
|
3003
|
-
const aliceAnt = ANT.init({
|
|
3004
|
-
processId:
|
|
3005
|
-
|
|
2968
|
+
const aliceAnt = await ANT.init({
|
|
2969
|
+
processId: 'ANT_MINT_PUBKEY',
|
|
2970
|
+
rpc,
|
|
2971
|
+
rpcSubscriptions,
|
|
2972
|
+
signer: aliceSigner, // Alice's @solana/kit signer
|
|
3006
2973
|
});
|
|
3007
2974
|
|
|
3008
2975
|
// ✅ CORRECT: Alice includes her own address as owner
|
|
@@ -3056,54 +3023,10 @@ console.log(recordAfter.owner); // undefined (controlled by ANT owner again)
|
|
|
3056
3023
|
|
|
3057
3024
|
### Static Methods
|
|
3058
3025
|
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
```typescript
|
|
3064
|
-
const newProcessId = await ANT.fork({
|
|
3065
|
-
signer: new ArweaveSigner(jwk),
|
|
3066
|
-
antProcessId: "existing-ant-process-id",
|
|
3067
|
-
// Optional: specify a specific module ID, defaults to latest from registry
|
|
3068
|
-
module: "new-module-id",
|
|
3069
|
-
onSigningProgress: (event, payload) => {
|
|
3070
|
-
console.log(`Fork progress: ${event}`);
|
|
3071
|
-
},
|
|
3072
|
-
});
|
|
3073
|
-
|
|
3074
|
-
console.log(`Forked ANT to new process: ${newProcessId}`);
|
|
3075
|
-
```
|
|
3076
|
-
|
|
3077
|
-
#### `ANT.upgrade({ signer, antProcessId, reassignAffiliatedNames?, names?, arioProcessId?, antRegistryId?, ao?, logger?, skipVersionCheck?, onSigningProgress?, hyperbeamUrl? })`
|
|
3078
|
-
|
|
3079
|
-
Static method to upgrade an ANT by forking it to the latest version and reassigning names.
|
|
3080
|
-
|
|
3081
|
-
```typescript
|
|
3082
|
-
// Upgrade and reassign all affiliated names
|
|
3083
|
-
const result = await ANT.upgrade({
|
|
3084
|
-
signer: new ArweaveSigner(jwk),
|
|
3085
|
-
antProcessId: "existing-ant-process-id",
|
|
3086
|
-
reassignAffiliatedNames: true,
|
|
3087
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
3088
|
-
});
|
|
3089
|
-
|
|
3090
|
-
// Upgrade and reassign specific names
|
|
3091
|
-
const result = await ANT.upgrade({
|
|
3092
|
-
signer: new ArweaveSigner(jwk),
|
|
3093
|
-
antProcessId: "existing-ant-process-id",
|
|
3094
|
-
names: ["ardrive", "example"],
|
|
3095
|
-
reassignAffiliatedNames: false,
|
|
3096
|
-
arioProcessId: ARIO_MAINNET_PROCESS_ID,
|
|
3097
|
-
});
|
|
3098
|
-
|
|
3099
|
-
console.log(`Upgraded to process: ${result.forkedProcessId}`);
|
|
3100
|
-
console.log(
|
|
3101
|
-
`Successfully reassigned names: ${Object.keys(result.reassignedNames)}`,
|
|
3102
|
-
);
|
|
3103
|
-
console.log(
|
|
3104
|
-
`Failed reassignments: ${Object.keys(result.failedReassignedNames)}`,
|
|
3105
|
-
);
|
|
3106
|
-
```
|
|
3026
|
+
`ANT.fork()` and the static `ANT.upgrade()` were AO-only (process
|
|
3027
|
+
forking + name reassignment). On Solana, schema migration is a
|
|
3028
|
+
per-asset CPI exposed as the instance method `ant.upgrade()` documented
|
|
3029
|
+
above; new ANTs are created with `ANT.spawn()`.
|
|
3107
3030
|
|
|
3108
3031
|
## Token Conversion
|
|
3109
3032
|
|
|
@@ -3157,10 +3080,9 @@ const customLogger: ILogger = {
|
|
|
3157
3080
|
},
|
|
3158
3081
|
};
|
|
3159
3082
|
|
|
3160
|
-
//
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
// or set it as the default logger in the entire SDK
|
|
3083
|
+
// Set it as the default logger across the entire SDK — every class
|
|
3084
|
+
// (ARIO, ANT, ANTRegistry, etc.) will route logs through it. `ARIO.init`
|
|
3085
|
+
// does not accept a per-instance logger.
|
|
3164
3086
|
Logger.default = customLogger;
|
|
3165
3087
|
```
|
|
3166
3088
|
|
|
@@ -3216,112 +3138,12 @@ In the example above, the query will return ArNS records where:
|
|
|
3216
3138
|
- The type is "lease" AND
|
|
3217
3139
|
- The processId is EITHER "ZkgLfyHALs5koxzojpcsEFAKA8fbpzP7l-tbM7wmQNM" OR "r61rbOjyXx3u644nGl9bkwLWlWmArMEzQgxBo2R-Vu0"
|
|
3218
3140
|
|
|
3219
|
-
##
|
|
3220
|
-
|
|
3221
|
-
The Solana backend ports the ARIO/ANT API surface to Solana. Same
|
|
3222
|
-
`ARIO.init`/`ANT.init` factory calls — pass `backend: 'solana'` plus a
|
|
3223
|
-
`@solana/kit` RPC client and you get the kit-native implementation.
|
|
3224
|
-
|
|
3225
|
-
### Quick start
|
|
3226
|
-
|
|
3227
|
-
```ts
|
|
3228
|
-
import { ARIO, ANT } from '@ar.io/sdk/solana';
|
|
3229
|
-
import {
|
|
3230
|
-
createSolanaRpc,
|
|
3231
|
-
createSolanaRpcSubscriptions,
|
|
3232
|
-
createKeyPairSignerFromBytes,
|
|
3233
|
-
} from '@solana/kit';
|
|
3234
|
-
import { readFileSync } from 'node:fs';
|
|
3235
|
-
|
|
3236
|
-
// Read-only client (RPC only)
|
|
3237
|
-
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
|
|
3238
|
-
const ario = ARIO.init({ backend: 'solana', rpc });
|
|
3239
|
-
|
|
3240
|
-
const record = await ario.getArNSRecord({ name: 'ardrive' });
|
|
3241
|
-
// record.processId === '<the ANT mint pubkey>'
|
|
3242
|
-
|
|
3243
|
-
// Write client — pair an RPC + a signer
|
|
3244
|
-
const signerBytes = new Uint8Array(
|
|
3245
|
-
JSON.parse(readFileSync('/path/to/keypair.json', 'utf8')),
|
|
3246
|
-
);
|
|
3247
|
-
const signer = await createKeyPairSignerFromBytes(signerBytes);
|
|
3248
|
-
const rpcSubs = createSolanaRpcSubscriptions(
|
|
3249
|
-
'wss://api.mainnet-beta.solana.com',
|
|
3250
|
-
);
|
|
3251
|
-
|
|
3252
|
-
const arioWrite = ARIO.init({
|
|
3253
|
-
backend: 'solana',
|
|
3254
|
-
rpc,
|
|
3255
|
-
rpcSubscriptions: rpcSubs,
|
|
3256
|
-
signer,
|
|
3257
|
-
});
|
|
3258
|
-
|
|
3259
|
-
await arioWrite.buyRecord({
|
|
3260
|
-
name: 'foo',
|
|
3261
|
-
type: 'lease',
|
|
3262
|
-
years: 1,
|
|
3263
|
-
processId: '<ANT mint pubkey>',
|
|
3264
|
-
});
|
|
3265
|
-
```
|
|
3266
|
-
|
|
3267
|
-
### What's available
|
|
3268
|
-
|
|
3269
|
-
The Solana backend implements the full `AoARIOWrite` and `AoANTWrite`
|
|
3270
|
-
interfaces — every method on the AO-backed clients has a Solana
|
|
3271
|
-
equivalent. Read paths (`getArNSRecord`, `getGateway`,
|
|
3272
|
-
`getEpochSettings`, etc.) and write paths (`buyRecord`, `extendLease`,
|
|
3273
|
-
`upgradeRecord`, `joinNetwork`, `delegateStake`, `decreaseDelegateStake`,
|
|
3274
|
-
`createVault`, `transferAnt`, `setRecord`, etc.) all work against the
|
|
3275
|
-
on-chain AR.IO programs deployed on Solana.
|
|
3276
|
-
|
|
3277
|
-
Multi-source funding works the same way as Lua's `getFundingPlan`:
|
|
3278
|
-
pass `fundFrom: 'any'` and the SDK composes a plan across balance,
|
|
3279
|
-
matured withdrawal vaults, excess delegated stake, and minimum stake
|
|
3280
|
-
across multiple gateways. See the planner at
|
|
3281
|
-
`src/solana/funding-plan.ts` for the Lua-faithful drawdown order.
|
|
3282
|
-
|
|
3283
|
-
### ANT lifecycle
|
|
3284
|
-
|
|
3285
|
-
ANTs on Solana are Metaplex Core NFTs with an Attributes plugin
|
|
3286
|
-
carrying ArNS traits (`ArNS Name`, `Type`, `Undername Limit`,
|
|
3287
|
-
`ANT Program`). Spawn a fresh one:
|
|
3288
|
-
|
|
3289
|
-
```ts
|
|
3290
|
-
import { ANT, spawnSolanaANT } from '@ar.io/sdk/solana';
|
|
3291
|
-
|
|
3292
|
-
const { processId } = await spawnSolanaANT({
|
|
3293
|
-
rpc, rpcSubscriptions: rpcSubs, signer,
|
|
3294
|
-
state: {
|
|
3295
|
-
name: 'My ANT',
|
|
3296
|
-
ticker: 'MYANT',
|
|
3297
|
-
description: 'whatever',
|
|
3298
|
-
uri: 'ar://placeholder-metadata',
|
|
3299
|
-
},
|
|
3300
|
-
});
|
|
3301
|
-
|
|
3302
|
-
const ant = await ANT.init({
|
|
3303
|
-
backend: 'solana',
|
|
3304
|
-
processId, // the Metaplex Core asset pubkey
|
|
3305
|
-
rpc, rpcSubscriptions: rpcSubs, signer,
|
|
3306
|
-
});
|
|
3307
|
-
await ant.setBaseNameRecord({ transactionId: '...', ttlSeconds: 3600 });
|
|
3308
|
-
await ant.addController({ controller: '<some-pubkey>' });
|
|
3309
|
-
```
|
|
3141
|
+
## Advanced
|
|
3310
3142
|
|
|
3311
|
-
|
|
3312
|
-
`ARIO_ANT_PROGRAM_ID` or a third-party-conformant program — see
|
|
3313
|
-
ADR-016) holds the records. The SDK reads the plugin to derive the
|
|
3314
|
-
correct `AntRecord` PDA on every record lookup.
|
|
3143
|
+
### Generated instruction builders
|
|
3315
3144
|
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
The `@ar.io/sdk/solana` subpath bundles Solana-only deps (`@solana/kit`,
|
|
3319
|
-
`@solana-program/compute-budget`, etc.). The default `@ar.io/sdk` /
|
|
3320
|
-
`@ar.io/sdk/node` / `@ar.io/sdk/web` entries stay AO-only — bundle size
|
|
3321
|
-
is unchanged for AO-only consumers.
|
|
3322
|
-
|
|
3323
|
-
You can also import the codama-emitted typed clients directly for
|
|
3324
|
-
custom transaction building:
|
|
3145
|
+
For custom transaction building, import Codama-emitted typed clients
|
|
3146
|
+
directly:
|
|
3325
3147
|
|
|
3326
3148
|
```ts
|
|
3327
3149
|
import {
|
|
@@ -3359,12 +3181,6 @@ To run your own ar.io gateway, you can refer to the following resources:
|
|
|
3359
3181
|
|
|
3360
3182
|
Running your own gateway allows you to participate in the ar.io network, serve Arweave data, and potentially earn rewards. Make sure to follow the official documentation for the most up-to-date and accurate information on gateway operation.
|
|
3361
3183
|
|
|
3362
|
-
### AO
|
|
3363
|
-
|
|
3364
|
-
This library integrates with [AO], a decentralized compute platform built on Arweave. We utilize [AO Connect] to interact with AO processes and messages. This integration allows for seamless communication with the AO network, enabling developers to leverage decentralized computation and storage capabilities in their applications.
|
|
3365
|
-
|
|
3366
|
-
For more information on how to use AO and AO Connect within this library, please refer to our documentation and examples.
|
|
3367
|
-
|
|
3368
3184
|
## Developers
|
|
3369
3185
|
|
|
3370
3186
|
### Requirements
|
|
@@ -3407,21 +3223,13 @@ For more information on how to contribute, please see [CONTRIBUTING.md].
|
|
|
3407
3223
|
<!-- ADD ALL LINK REFERENCES BELOW -->
|
|
3408
3224
|
|
|
3409
3225
|
[ar.io]: https://ar.io
|
|
3410
|
-
[permaweb/aoconnect]: https://github.com/permaweb/aoconnect
|
|
3411
|
-
[package.json]: ./package.json
|
|
3412
3226
|
[examples]: ./examples
|
|
3413
3227
|
[examples/webpack]: ./examples/webpack
|
|
3414
3228
|
[examples/vite]: ./examples/vite
|
|
3415
3229
|
[CONTRIBUTING.md]: ./CONTRIBUTING.md
|
|
3416
|
-
[AO Connect]: https://github.com/permaweb/ao/tree/main/connect
|
|
3417
|
-
[ARIO Testnet Process]: https://www.ao.link/#/entity/agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA
|
|
3418
|
-
[ARIO Network Spec]: https://github.com/ar-io/ar-io-network-process?tab=readme-ov-file#contract-spec
|
|
3419
|
-
[Winston]: https://www.npmjs.com/package/winston
|
|
3420
|
-
[AO]: https://github.com/permaweb/ao
|
|
3421
3230
|
[ar-io-node repository]: https://github.com/ar-io/ar-io-node
|
|
3422
3231
|
[ar.io Gateway Documentation]: https://docs.ar.io/gateways/ar-io-node/overview/
|
|
3423
3232
|
[ANS-104]: https://github.com/ArweaveTeam/arweave-standards/blob/master/ans/ANS-104.md
|
|
3424
|
-
[ar-io-testnet-faucet]: https://github.com/ar-io/ar-io-testnet-faucet?tab=readme-ov-file#asynchronous-workflow
|
|
3425
3233
|
|
|
3426
3234
|
```
|
|
3427
3235
|
|