@ar.io/sdk 2.4.0-alpha.4 → 2.4.0-alpha.6

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.
@@ -344,6 +344,42 @@ class AoANTWriteable extends AoANTReadable {
344
344
  signer: this.signer,
345
345
  });
346
346
  }
347
+ /**
348
+ * @param description @type {string} Sets the ANT Description.
349
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
350
+ * @example
351
+ * ```ts
352
+ * ant.setDescription({ description: "This name is used for the ArDrive" });
353
+ * ```
354
+ */
355
+ async setDescription({ description }, options) {
356
+ return this.process.send({
357
+ tags: [
358
+ ...(options?.tags ?? []),
359
+ { name: 'Action', value: 'Set-Description' },
360
+ { name: 'Description', value: description },
361
+ ],
362
+ signer: this.signer,
363
+ });
364
+ }
365
+ /**
366
+ * @param keywords @type {string[]} Sets the ANT Keywords.
367
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
368
+ * @example
369
+ * ```ts
370
+ * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
371
+ * ```
372
+ */
373
+ async setKeywords({ keywords }, options) {
374
+ return this.process.send({
375
+ tags: [
376
+ ...(options?.tags ?? []),
377
+ { name: 'Action', value: 'Set-Keywords' },
378
+ { name: 'Description', value: JSON.stringify(keywords) },
379
+ ],
380
+ signer: this.signer,
381
+ });
382
+ }
347
383
  /**
348
384
  * @param name @type {string} The name you want to release. The name will be put up for auction on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
349
385
  * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
@@ -643,6 +643,34 @@ class IOWriteable extends IOReadable {
643
643
  tags: prunedTags,
644
644
  });
645
645
  }
646
+ /**
647
+ * Upgrades an existing leased record to a permabuy.
648
+ *
649
+ * @param {Object} params - The parameters for upgrading a record
650
+ * @param {string} params.name - The name of the record to upgrade
651
+ * @param {Object} [options] - The options for the upgrade
652
+ * @returns {Promise<AoMessageResult>} The result of the upgrade
653
+ */
654
+ async upgradeRecord(params, options) {
655
+ const { tags = [] } = options || {};
656
+ return this.process.send({
657
+ signer: this.signer,
658
+ tags: [
659
+ ...tags,
660
+ { name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
661
+ { name: 'Name', value: params.name },
662
+ ],
663
+ });
664
+ }
665
+ /**
666
+ * Extends the lease of an existing leased record.
667
+ *
668
+ * @param {Object} params - The parameters for extending a lease
669
+ * @param {string} params.name - The name of the record to extend
670
+ * @param {number} params.years - The number of years to extend the lease
671
+ * @param {Object} [options] - The options for the extension
672
+ * @returns {Promise<AoMessageResult>} The result of the extension
673
+ */
646
674
  async extendLease(params, options) {
647
675
  const { tags = [] } = options || {};
648
676
  return this.process.send({
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.IntegerStringSchema = exports.ArweaveTxIdSchema = void 0;
3
+ exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.ArweaveTxIdSchema = void 0;
4
4
  /**
5
5
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
6
  *
@@ -45,6 +45,8 @@ exports.IntegerStringSchema = zod_1.z
45
45
  const num = parseInt(val);
46
46
  return Number.isInteger(num) && num >= 0;
47
47
  }, { message: 'Must be a non negative integer string' });
48
+ exports.AntDescriptionSchema = zod_1.z.string(); // TODO: add specific limits for description ie max length
49
+ exports.AntKeywordsSchema = zod_1.z.array(zod_1.z.string()); // TODO: add specific limits for keywords ie max amount and max length
48
50
  exports.AntRecordSchema = zod_1.z.object({
49
51
  transactionId: exports.ArweaveTxIdSchema.describe('The Target ID of the undername'),
50
52
  ttlSeconds: zod_1.z.number(),
@@ -55,6 +57,8 @@ exports.AntBalancesSchema = zod_1.z.record(exports.ArweaveTxIdSchema.describe('H
55
57
  exports.AntStateSchema = zod_1.z.object({
56
58
  Name: zod_1.z.string().describe('The name of the ANT.'),
57
59
  Ticker: zod_1.z.string().describe('The ticker symbol for the ANT.'),
60
+ Description: zod_1.z.string().describe('The description for the ANT.'),
61
+ Keywords: exports.AntKeywordsSchema.describe('The keywords for the ANT.'),
58
62
  Denomination: zod_1.z
59
63
  .number()
60
64
  .describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.')
@@ -91,6 +95,8 @@ exports.AntHandlerNames = [
91
95
  'records',
92
96
  'setName',
93
97
  'setTicker',
98
+ 'setDescription',
99
+ 'setKeywords',
94
100
  'initializeState',
95
101
  'state',
96
102
  'releaseName',
@@ -108,6 +114,8 @@ exports.AntInfoSchema = zod_1.z.object({
108
114
  ['Source-Code-TX-ID']: exports.ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
109
115
  Ticker: zod_1.z.string().describe('The ticker symbol for the ANT.'),
110
116
  ['Total-Supply']: exports.IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
117
+ Description: exports.AntDescriptionSchema.describe('The description for the ANT.'),
118
+ Keywords: exports.AntKeywordsSchema.describe('The keywords for the ANT.'),
111
119
  Logo: exports.ArweaveTxIdSchema.describe('Transaction ID of the ANT logo.'),
112
120
  Denomination: exports.IntegerStringSchema.describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.'),
113
121
  Handlers: exports.AntHandlersSchema.optional().describe('List of handlers for the ANT.'),
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '2.4.0-alpha.4';
20
+ exports.version = '2.4.0-alpha.6';
@@ -339,6 +339,42 @@ export class AoANTWriteable extends AoANTReadable {
339
339
  signer: this.signer,
340
340
  });
341
341
  }
342
+ /**
343
+ * @param description @type {string} Sets the ANT Description.
344
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
345
+ * @example
346
+ * ```ts
347
+ * ant.setDescription({ description: "This name is used for the ArDrive" });
348
+ * ```
349
+ */
350
+ async setDescription({ description }, options) {
351
+ return this.process.send({
352
+ tags: [
353
+ ...(options?.tags ?? []),
354
+ { name: 'Action', value: 'Set-Description' },
355
+ { name: 'Description', value: description },
356
+ ],
357
+ signer: this.signer,
358
+ });
359
+ }
360
+ /**
361
+ * @param keywords @type {string[]} Sets the ANT Keywords.
362
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
363
+ * @example
364
+ * ```ts
365
+ * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
366
+ * ```
367
+ */
368
+ async setKeywords({ keywords }, options) {
369
+ return this.process.send({
370
+ tags: [
371
+ ...(options?.tags ?? []),
372
+ { name: 'Action', value: 'Set-Keywords' },
373
+ { name: 'Description', value: JSON.stringify(keywords) },
374
+ ],
375
+ signer: this.signer,
376
+ });
377
+ }
342
378
  /**
343
379
  * @param name @type {string} The name you want to release. The name will be put up for auction on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
344
380
  * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
@@ -638,6 +638,34 @@ export class IOWriteable extends IOReadable {
638
638
  tags: prunedTags,
639
639
  });
640
640
  }
641
+ /**
642
+ * Upgrades an existing leased record to a permabuy.
643
+ *
644
+ * @param {Object} params - The parameters for upgrading a record
645
+ * @param {string} params.name - The name of the record to upgrade
646
+ * @param {Object} [options] - The options for the upgrade
647
+ * @returns {Promise<AoMessageResult>} The result of the upgrade
648
+ */
649
+ async upgradeRecord(params, options) {
650
+ const { tags = [] } = options || {};
651
+ return this.process.send({
652
+ signer: this.signer,
653
+ tags: [
654
+ ...tags,
655
+ { name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
656
+ { name: 'Name', value: params.name },
657
+ ],
658
+ });
659
+ }
660
+ /**
661
+ * Extends the lease of an existing leased record.
662
+ *
663
+ * @param {Object} params - The parameters for extending a lease
664
+ * @param {string} params.name - The name of the record to extend
665
+ * @param {number} params.years - The number of years to extend the lease
666
+ * @param {Object} [options] - The options for the extension
667
+ * @returns {Promise<AoMessageResult>} The result of the extension
668
+ */
641
669
  async extendLease(params, options) {
642
670
  const { tags = [] } = options || {};
643
671
  return this.process.send({
@@ -42,6 +42,8 @@ export const IntegerStringSchema = z
42
42
  const num = parseInt(val);
43
43
  return Number.isInteger(num) && num >= 0;
44
44
  }, { message: 'Must be a non negative integer string' });
45
+ export const AntDescriptionSchema = z.string(); // TODO: add specific limits for description ie max length
46
+ export const AntKeywordsSchema = z.array(z.string()); // TODO: add specific limits for keywords ie max amount and max length
45
47
  export const AntRecordSchema = z.object({
46
48
  transactionId: ArweaveTxIdSchema.describe('The Target ID of the undername'),
47
49
  ttlSeconds: z.number(),
@@ -52,6 +54,8 @@ export const AntBalancesSchema = z.record(ArweaveTxIdSchema.describe('Holder add
52
54
  export const AntStateSchema = z.object({
53
55
  Name: z.string().describe('The name of the ANT.'),
54
56
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
57
+ Description: z.string().describe('The description for the ANT.'),
58
+ Keywords: AntKeywordsSchema.describe('The keywords for the ANT.'),
55
59
  Denomination: z
56
60
  .number()
57
61
  .describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.')
@@ -88,6 +92,8 @@ export const AntHandlerNames = [
88
92
  'records',
89
93
  'setName',
90
94
  'setTicker',
95
+ 'setDescription',
96
+ 'setKeywords',
91
97
  'initializeState',
92
98
  'state',
93
99
  'releaseName',
@@ -105,6 +111,8 @@ export const AntInfoSchema = z.object({
105
111
  ['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
106
112
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
107
113
  ['Total-Supply']: IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
114
+ Description: AntDescriptionSchema.describe('The description for the ANT.'),
115
+ Keywords: AntKeywordsSchema.describe('The keywords for the ANT.'),
108
116
  Logo: ArweaveTxIdSchema.describe('Transaction ID of the ANT logo.'),
109
117
  Denomination: IntegerStringSchema.describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.'),
110
118
  Handlers: AntHandlersSchema.optional().describe('List of handlers for the ANT.'),
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '2.4.0-alpha.4';
17
+ export const version = '2.4.0-alpha.6';
@@ -183,6 +183,28 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
183
183
  setName({ name }: {
184
184
  name: string;
185
185
  }, options?: WriteOptions): Promise<AoMessageResult>;
186
+ /**
187
+ * @param description @type {string} Sets the ANT Description.
188
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
189
+ * @example
190
+ * ```ts
191
+ * ant.setDescription({ description: "This name is used for the ArDrive" });
192
+ * ```
193
+ */
194
+ setDescription({ description }: {
195
+ description: string;
196
+ }, options?: WriteOptions): Promise<AoMessageResult>;
197
+ /**
198
+ * @param keywords @type {string[]} Sets the ANT Keywords.
199
+ * @returns {Promise<AoMessageResult>} The result of the interaction.
200
+ * @example
201
+ * ```ts
202
+ * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
203
+ * ```
204
+ */
205
+ setKeywords({ keywords }: {
206
+ keywords: string[];
207
+ }, options?: WriteOptions): Promise<AoMessageResult>;
186
208
  /**
187
209
  * @param name @type {string} The name you want to release. The name will be put up for auction on the IO contract. 50% of the winning bid will be distributed to the ANT owner at the time of release. If no bids, the name will be released and can be reregistered by anyone.
188
210
  * @param ioProcessId @type {string} The processId of the IO contract. This is where the ANT will send the message to release the name.
@@ -158,6 +158,26 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
158
158
  type: 'lease' | 'permabuy';
159
159
  processId: string;
160
160
  }, options?: WriteOptions): Promise<AoMessageResult>;
161
+ /**
162
+ * Upgrades an existing leased record to a permabuy.
163
+ *
164
+ * @param {Object} params - The parameters for upgrading a record
165
+ * @param {string} params.name - The name of the record to upgrade
166
+ * @param {Object} [options] - The options for the upgrade
167
+ * @returns {Promise<AoMessageResult>} The result of the upgrade
168
+ */
169
+ upgradeRecord(params: {
170
+ name: string;
171
+ }, options?: WriteOptions): Promise<AoMessageResult>;
172
+ /**
173
+ * Extends the lease of an existing leased record.
174
+ *
175
+ * @param {Object} params - The parameters for extending a lease
176
+ * @param {string} params.name - The name of the record to extend
177
+ * @param {number} params.years - The number of years to extend the lease
178
+ * @param {Object} [options] - The options for the extension
179
+ * @returns {Promise<AoMessageResult>} The result of the extension
180
+ */
161
181
  extendLease(params: {
162
182
  name: string;
163
183
  years: number;
@@ -29,6 +29,8 @@ import { AoMessageResult, WalletAddress, WriteOptions } from './common.js';
29
29
  */
30
30
  export declare const ArweaveTxIdSchema: z.ZodEffects<z.ZodString, string, string>;
31
31
  export declare const IntegerStringSchema: z.ZodEffects<z.ZodString, string, string>;
32
+ export declare const AntDescriptionSchema: z.ZodString;
33
+ export declare const AntKeywordsSchema: z.ZodArray<z.ZodString, "many">;
32
34
  export declare const AntRecordSchema: z.ZodObject<{
33
35
  transactionId: z.ZodEffects<z.ZodString, string, string>;
34
36
  ttlSeconds: z.ZodNumber;
@@ -55,6 +57,8 @@ export declare const AntBalancesSchema: z.ZodRecord<z.ZodEffects<z.ZodString, st
55
57
  export declare const AntStateSchema: z.ZodObject<{
56
58
  Name: z.ZodString;
57
59
  Ticker: z.ZodString;
60
+ Description: z.ZodString;
61
+ Keywords: z.ZodArray<z.ZodString, "many">;
58
62
  Denomination: z.ZodNumber;
59
63
  Owner: z.ZodEffects<z.ZodString, string, string>;
60
64
  Controllers: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
@@ -77,6 +81,8 @@ export declare const AntStateSchema: z.ZodObject<{
77
81
  "Source-Code-TX-ID": string;
78
82
  Name: string;
79
83
  Ticker: string;
84
+ Description: string;
85
+ Keywords: string[];
80
86
  Denomination: number;
81
87
  Owner: string;
82
88
  Controllers: string[];
@@ -92,6 +98,8 @@ export declare const AntStateSchema: z.ZodObject<{
92
98
  "Source-Code-TX-ID": string;
93
99
  Name: string;
94
100
  Ticker: string;
101
+ Description: string;
102
+ Keywords: string[];
95
103
  Denomination: number;
96
104
  Owner: string;
97
105
  Controllers: string[];
@@ -113,6 +121,8 @@ export declare const AntInfoSchema: z.ZodObject<{
113
121
  "Source-Code-TX-ID": z.ZodEffects<z.ZodString, string, string>;
114
122
  Ticker: z.ZodString;
115
123
  "Total-Supply": z.ZodEffects<z.ZodString, string, string>;
124
+ Description: z.ZodString;
125
+ Keywords: z.ZodArray<z.ZodString, "many">;
116
126
  Logo: z.ZodEffects<z.ZodString, string, string>;
117
127
  Denomination: z.ZodEffects<z.ZodString, string, string>;
118
128
  Handlers: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
@@ -121,6 +131,8 @@ export declare const AntInfoSchema: z.ZodObject<{
121
131
  "Source-Code-TX-ID": string;
122
132
  Name: string;
123
133
  Ticker: string;
134
+ Description: string;
135
+ Keywords: string[];
124
136
  Denomination: string;
125
137
  Owner: string;
126
138
  Logo: string;
@@ -131,6 +143,8 @@ export declare const AntInfoSchema: z.ZodObject<{
131
143
  "Source-Code-TX-ID": string;
132
144
  Name: string;
133
145
  Ticker: string;
146
+ Description: string;
147
+ Keywords: string[];
134
148
  Denomination: string;
135
149
  Owner: string;
136
150
  Logo: string;
@@ -184,6 +198,12 @@ export interface AoANTWrite extends AoANTRead {
184
198
  setTicker({ ticker }: {
185
199
  ticker: string;
186
200
  }, options?: WriteOptions): Promise<AoMessageResult>;
201
+ setDescription({ description }: {
202
+ description: string;
203
+ }, options?: WriteOptions): Promise<AoMessageResult>;
204
+ setKeywords({ keywords }: {
205
+ keywords: string[];
206
+ }, options?: WriteOptions): Promise<AoMessageResult>;
187
207
  setName({ name }: {
188
208
  name: string;
189
209
  }, options?: WriteOptions): Promise<AoMessageResult>;
@@ -317,6 +317,9 @@ export interface AoIOWrite extends AoIORead {
317
317
  type: 'lease' | 'permabuy';
318
318
  processId: string;
319
319
  }, options?: WriteOptions): Promise<AoMessageResult>;
320
+ upgradeRecord(params: {
321
+ name: string;
322
+ }, options?: WriteOptions): Promise<AoMessageResult>;
320
323
  extendLease(params: {
321
324
  name: string;
322
325
  years: number;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "2.4.0-alpha.3";
16
+ export declare const version = "2.4.0-alpha.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.4.0-alpha.4",
3
+ "version": "2.4.0-alpha.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"