@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 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
- Updates or creates a record in the ANT process.
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: 'remove-domemain' },
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 })`