@ar.io/sdk 2.4.0-alpha.3 → 2.4.0-alpha.5

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.
@@ -667,16 +667,27 @@ class IOWriteable extends IOReadable {
667
667
  ],
668
668
  });
669
669
  }
670
- async cancelDelegateWithdrawal(params, options) {
670
+ /**
671
+ * Cancel a withdrawal from a gateway.
672
+ *
673
+ * @param {Object} params - The parameters for cancelling a withdrawal
674
+ * @param {string} [params.address] - The address of the withdrawal (optional). If not provided, the signer's address will be used.
675
+ * @param {string} params.vaultId - The vault ID of the withdrawal.
676
+ * @param {Object} [options] - The options for the cancellation
677
+ * @returns {Promise<AoMessageResult>} The result of the cancellation
678
+ */
679
+ async cancelWithdrawal(params, options) {
671
680
  const { tags = [] } = options || {};
681
+ const allTags = [
682
+ ...tags,
683
+ { name: 'Action', value: 'Cancel-Withdrawal' },
684
+ { name: 'Address', value: params.address },
685
+ { name: 'Vault-Id', value: params.vaultId },
686
+ ];
687
+ const prunedTags = allTags.filter((tag) => tag.value !== undefined);
672
688
  return this.process.send({
673
689
  signer: this.signer,
674
- tags: [
675
- ...tags,
676
- { name: 'Action', value: 'Cancel-Delegate-Withdrawal' },
677
- { name: 'Address', value: params.address },
678
- { name: 'Vault-Id', value: params.vaultId },
679
- ],
690
+ tags: prunedTags,
680
691
  });
681
692
  }
682
693
  async submitAuctionBid(params, options) {
@@ -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.3';
20
+ exports.version = '2.4.0-alpha.5';
@@ -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.
@@ -662,16 +662,27 @@ export class IOWriteable extends IOReadable {
662
662
  ],
663
663
  });
664
664
  }
665
- async cancelDelegateWithdrawal(params, options) {
665
+ /**
666
+ * Cancel a withdrawal from a gateway.
667
+ *
668
+ * @param {Object} params - The parameters for cancelling a withdrawal
669
+ * @param {string} [params.address] - The address of the withdrawal (optional). If not provided, the signer's address will be used.
670
+ * @param {string} params.vaultId - The vault ID of the withdrawal.
671
+ * @param {Object} [options] - The options for the cancellation
672
+ * @returns {Promise<AoMessageResult>} The result of the cancellation
673
+ */
674
+ async cancelWithdrawal(params, options) {
666
675
  const { tags = [] } = options || {};
676
+ const allTags = [
677
+ ...tags,
678
+ { name: 'Action', value: 'Cancel-Withdrawal' },
679
+ { name: 'Address', value: params.address },
680
+ { name: 'Vault-Id', value: params.vaultId },
681
+ ];
682
+ const prunedTags = allTags.filter((tag) => tag.value !== undefined);
667
683
  return this.process.send({
668
684
  signer: this.signer,
669
- tags: [
670
- ...tags,
671
- { name: 'Action', value: 'Cancel-Delegate-Withdrawal' },
672
- { name: 'Address', value: params.address },
673
- { name: 'Vault-Id', value: params.vaultId },
674
- ],
685
+ tags: prunedTags,
675
686
  });
676
687
  }
677
688
  async submitAuctionBid(params, options) {
@@ -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.3';
17
+ export const version = '2.4.0-alpha.5';
@@ -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.
@@ -166,8 +166,17 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
166
166
  name: string;
167
167
  increaseCount: number;
168
168
  }, options?: WriteOptions): Promise<AoMessageResult>;
169
- cancelDelegateWithdrawal(params: {
170
- address: string;
169
+ /**
170
+ * Cancel a withdrawal from a gateway.
171
+ *
172
+ * @param {Object} params - The parameters for cancelling a withdrawal
173
+ * @param {string} [params.address] - The address of the withdrawal (optional). If not provided, the signer's address will be used.
174
+ * @param {string} params.vaultId - The vault ID of the withdrawal.
175
+ * @param {Object} [options] - The options for the cancellation
176
+ * @returns {Promise<AoMessageResult>} The result of the cancellation
177
+ */
178
+ cancelWithdrawal(params: {
179
+ address?: WalletAddress;
171
180
  vaultId: string;
172
181
  }, options?: WriteOptions | undefined): Promise<AoMessageResult>;
173
182
  submitAuctionBid(params: {
@@ -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>;
@@ -325,8 +325,8 @@ export interface AoIOWrite extends AoIORead {
325
325
  name: string;
326
326
  increaseCount: number;
327
327
  }, options?: WriteOptions): Promise<AoMessageResult>;
328
- cancelDelegateWithdrawal(params: {
329
- address: string;
328
+ cancelWithdrawal(params: {
329
+ address?: WalletAddress;
330
330
  vaultId: string;
331
331
  }, options?: WriteOptions): Promise<AoMessageResult>;
332
332
  submitAuctionBid(params: {
@@ -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.2";
16
+ export declare const version = "2.4.0-alpha.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.4.0-alpha.3",
3
+ "version": "2.4.0-alpha.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"