@ar.io/sdk 2.4.0-alpha.4 → 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.
- package/README.md +35 -1
- package/bundles/web.bundle.min.js +53 -53
- package/lib/cjs/common/ant.js +36 -0
- package/lib/cjs/types/ant.js +9 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +36 -0
- package/lib/esm/types/ant.js +8 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +22 -0
- package/lib/types/types/ant.d.ts +20 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/ant.js
CHANGED
|
@@ -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.
|
package/lib/cjs/types/ant.js
CHANGED
|
@@ -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.'),
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -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.
|
package/lib/esm/types/ant.js
CHANGED
|
@@ -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.'),
|
package/lib/esm/version.js
CHANGED
|
@@ -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.
|
package/lib/types/types/ant.d.ts
CHANGED
|
@@ -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>;
|
package/lib/types/version.d.ts
CHANGED