@ar.io/sdk 3.4.0-alpha.1 → 3.4.0-alpha.3
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 +73 -2
- package/bundles/web.bundle.min.js +3 -3
- package/lib/cjs/cli/cli.js +16 -19
- package/lib/cjs/cli/commands/antCommands.js +48 -0
- package/lib/cjs/cli/options.js +11 -1
- package/lib/cjs/cli/utils.js +5 -2
- package/lib/cjs/common/ant.js +96 -7
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +17 -20
- package/lib/esm/cli/commands/antCommands.js +42 -0
- package/lib/esm/cli/options.js +10 -0
- package/lib/esm/cli/utils.js +4 -1
- package/lib/esm/common/ant.js +96 -7
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +21 -0
- package/lib/types/cli/options.d.ts +8 -0
- package/lib/types/cli/types.d.ts +3 -0
- package/lib/types/cli/utils.d.ts +1 -0
- package/lib/types/common/ant.d.ts +80 -8
- package/lib/types/types/ant.d.ts +44 -31
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,9 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
91
91
|
- [`transfer({ target })`](#transfer-target-)
|
|
92
92
|
- [`setController({ controller })`](#setcontroller-controller-)
|
|
93
93
|
- [`removeController({ controller })`](#removecontroller-controller-)
|
|
94
|
+
- [`setBaseNameRecord({ transactionId, ttlSeconds })`](#setbasenamerecord-transactionid-ttlseconds-)
|
|
95
|
+
- [`setUndernameRecord({ undername, transactionId, ttlSeconds })`](#setundernamerecord-undername-transactionid-ttlseconds-)
|
|
96
|
+
- [`removeUndernameRecord({ undername })`](#removeundernamerecord-undername-)
|
|
94
97
|
- [`setRecord({ undername, transactionId, ttlSeconds })`](#setrecord-undername-transactionid-ttlseconds-)
|
|
95
98
|
- [`removeRecord({ undername })`](#removerecord-undername-)
|
|
96
99
|
- [`setName({ name })`](#setname-name-)
|
|
@@ -2060,9 +2063,70 @@ const { id: txId } = await ant.removeController(
|
|
|
2060
2063
|
);
|
|
2061
2064
|
```
|
|
2062
2065
|
|
|
2066
|
+
#### `setBaseNameRecord({ transactionId, ttlSeconds })`
|
|
2067
|
+
|
|
2068
|
+
Adds or updates the base name record for the ANT. This is the top level name of the ANT (e.g. ardrive.ar.io)
|
|
2069
|
+
|
|
2070
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2071
|
+
|
|
2072
|
+
```typescript
|
|
2073
|
+
// get the ant for the base name
|
|
2074
|
+
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
|
|
2075
|
+
const ant = await ANT.init({ processId: arnsName.processId });
|
|
2076
|
+
const { id: txId } = await ant.setBaseNameRecord({
|
|
2077
|
+
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
2078
|
+
ttlSeconds: 3600,
|
|
2079
|
+
});
|
|
2080
|
+
|
|
2081
|
+
// ardrive.ar.io will now resolve to the provided 432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM transaction id
|
|
2082
|
+
```
|
|
2083
|
+
|
|
2084
|
+
#### `setUndernameRecord({ undername, transactionId, ttlSeconds })`
|
|
2085
|
+
|
|
2086
|
+
Adds or updates an undername record for the ANT. An undername is appended to the base name of the ANT (e.g. dapp_ardrive.ar.io)
|
|
2087
|
+
|
|
2088
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2089
|
+
|
|
2090
|
+
> Records, or `undernames` are configured with the `transactionId` - the arweave transaction id the record resolves - and `ttlSeconds`, the Time To Live in the cache of client applications.
|
|
2091
|
+
|
|
2092
|
+
```typescript
|
|
2093
|
+
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
|
|
2094
|
+
const ant = await ANT.init({ processId: arnsName.processId });
|
|
2095
|
+
const { id: txId } = await ant.setUndernameRecord(
|
|
2096
|
+
{
|
|
2097
|
+
undername: 'dapp',
|
|
2098
|
+
transactionId: '432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM',
|
|
2099
|
+
ttlSeconds: 900,
|
|
2100
|
+
},
|
|
2101
|
+
// optional additional tags
|
|
2102
|
+
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
2103
|
+
);
|
|
2104
|
+
|
|
2105
|
+
// dapp_ardrive.ar.io will now resolve to the provided 432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM transaction id
|
|
2106
|
+
```
|
|
2107
|
+
|
|
2108
|
+
#### `removeUndernameRecord({ undername })`
|
|
2109
|
+
|
|
2110
|
+
Removes an undername record from the ANT process.
|
|
2111
|
+
|
|
2112
|
+
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2113
|
+
|
|
2114
|
+
```typescript
|
|
2115
|
+
const { id: txId } = await ant.removeUndernameRecord(
|
|
2116
|
+
{ undername: 'dapp' },
|
|
2117
|
+
// optional additional tags
|
|
2118
|
+
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
2119
|
+
);
|
|
2120
|
+
|
|
2121
|
+
// dapp_ardrive.ar.io will no longer resolve to the provided transaction id
|
|
2122
|
+
```
|
|
2123
|
+
|
|
2063
2124
|
#### `setRecord({ undername, transactionId, ttlSeconds })`
|
|
2064
2125
|
|
|
2065
|
-
|
|
2126
|
+
> [!WARNING]
|
|
2127
|
+
> Deprecated: Use `setBaseNameRecord` or `setUndernameRecord` instead.
|
|
2128
|
+
|
|
2129
|
+
Adds or updates a record for the ANT process. The `undername` parameter is used to specify the record name. Use `@` for the base name record.
|
|
2066
2130
|
|
|
2067
2131
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2068
2132
|
|
|
@@ -2082,16 +2146,23 @@ const { id: txId } = await ant.setRecord(
|
|
|
2082
2146
|
|
|
2083
2147
|
#### `removeRecord({ undername })`
|
|
2084
2148
|
|
|
2149
|
+
> [!WARNING]
|
|
2150
|
+
> Deprecated: Use `removeUndernameRecord` instead.
|
|
2151
|
+
|
|
2085
2152
|
Removes a record from the ANT process.
|
|
2086
2153
|
|
|
2087
2154
|
_Note: Requires `signer` to be provided on `ANT.init` to sign the transaction._
|
|
2088
2155
|
|
|
2089
2156
|
```typescript
|
|
2157
|
+
const arnsRecord = await ario.getArNSRecord({ name: 'ardrive' });
|
|
2158
|
+
const ant = await ANT.init({ processId: arnsName.processId });
|
|
2090
2159
|
const { id: txId } = await ant.removeRecord(
|
|
2091
|
-
{ undername: '
|
|
2160
|
+
{ undername: 'dapp' },
|
|
2092
2161
|
// optional additional tags
|
|
2093
2162
|
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
|
|
2094
2163
|
);
|
|
2164
|
+
|
|
2165
|
+
// dapp_ardrive.ar.io will no longer resolve to the provided transaction id
|
|
2095
2166
|
```
|
|
2096
2167
|
|
|
2097
2168
|
#### `setName({ name })`
|