@ar.io/sdk 2.5.0-alpha.3 → 2.5.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 +38 -0
- package/bundles/web.bundle.min.js +63 -63
- package/lib/cjs/common/ant.js +12 -0
- package/lib/cjs/types/ant.js +13 -12
- package/lib/cjs/utils/ao.js +4 -0
- package/lib/cjs/utils/schema.js +0 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +12 -0
- package/lib/esm/types/ant.js +12 -11
- package/lib/esm/utils/ao.js +4 -0
- package/lib/esm/utils/schema.js +0 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +10 -1
- package/lib/types/types/ant.d.ts +7 -7
- package/lib/types/utils/schema.d.ts +0 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/ant.js
CHANGED
|
@@ -204,6 +204,18 @@ class AoANTReadable {
|
|
|
204
204
|
(0, schema_js_1.parseSchemaResult)(zod_1.z.number(), balance);
|
|
205
205
|
return balance;
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
|
|
209
|
+
* @example
|
|
210
|
+
* Get the handlers of the ANT.
|
|
211
|
+
* ```ts
|
|
212
|
+
* const handlers = await ant.getHandlers();
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
async getHandlers() {
|
|
216
|
+
const info = await this.getInfo();
|
|
217
|
+
return (info.Handlers ?? info.HandlerNames);
|
|
218
|
+
}
|
|
207
219
|
}
|
|
208
220
|
exports.AoANTReadable = AoANTReadable;
|
|
209
221
|
class AoANTWriteable extends AoANTReadable {
|
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.AntEntriesSchema = exports.AntRecordsSchema = exports.AntEntrySchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.ArweaveTxIdSchema = void 0;
|
|
3
|
+
exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntEntriesSchema = exports.AntRecordsSchema = exports.AntEntrySchema = 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
|
*
|
|
@@ -77,33 +77,35 @@ exports.AntStateSchema = zod_1.z.object({
|
|
|
77
77
|
Initialized: zod_1.z
|
|
78
78
|
.boolean()
|
|
79
79
|
.describe('Flag indicating whether the ANT has been initialized.'),
|
|
80
|
-
['Source-Code-TX-ID']: exports.ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
|
|
81
80
|
});
|
|
82
|
-
exports.
|
|
83
|
-
'evolve',
|
|
84
|
-
'_eval',
|
|
85
|
-
'_default',
|
|
86
|
-
'transfer',
|
|
81
|
+
exports.AntReadHandlers = [
|
|
87
82
|
'balance',
|
|
88
83
|
'balances',
|
|
89
84
|
'totalSupply',
|
|
90
85
|
'info',
|
|
86
|
+
'controllers',
|
|
87
|
+
'record',
|
|
88
|
+
'records',
|
|
89
|
+
'state',
|
|
90
|
+
];
|
|
91
|
+
exports.AntWriteHandlers = [
|
|
92
|
+
'evolve',
|
|
93
|
+
'_eval',
|
|
94
|
+
'_default',
|
|
95
|
+
'transfer',
|
|
91
96
|
'addController',
|
|
92
97
|
'removeController',
|
|
93
|
-
'controllers',
|
|
94
98
|
'setRecord',
|
|
95
99
|
'removeRecord',
|
|
96
|
-
'record',
|
|
97
|
-
'records',
|
|
98
100
|
'setName',
|
|
99
101
|
'setTicker',
|
|
100
102
|
'setDescription',
|
|
101
103
|
'setKeywords',
|
|
102
104
|
'initializeState',
|
|
103
|
-
'state',
|
|
104
105
|
'releaseName',
|
|
105
106
|
'reassignName',
|
|
106
107
|
];
|
|
108
|
+
exports.AntHandlerNames = [...exports.AntReadHandlers, ...exports.AntWriteHandlers];
|
|
107
109
|
exports.AntHandlersSchema = zod_1.z
|
|
108
110
|
.array(zod_1.z.string({ description: 'Handler Name' }))
|
|
109
111
|
.refine((antHandlers) => {
|
|
@@ -114,7 +116,6 @@ exports.AntHandlersSchema = zod_1.z
|
|
|
114
116
|
exports.AntInfoSchema = zod_1.z.object({
|
|
115
117
|
Name: zod_1.z.string().describe('The name of the ANT.'),
|
|
116
118
|
Owner: exports.ArweaveTxIdSchema.describe('The Owners address.'),
|
|
117
|
-
['Source-Code-TX-ID']: exports.ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
|
|
118
119
|
Ticker: zod_1.z.string().describe('The ticker symbol for the ANT.'),
|
|
119
120
|
['Total-Supply']: exports.IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
|
|
120
121
|
Description: exports.AntDescriptionSchema.describe('The description for the ANT.'),
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -45,6 +45,10 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, luaCode
|
|
|
45
45
|
name: 'ANT-Registry-Id',
|
|
46
46
|
value: antRegistryId,
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Source-Code-TX-ID', // utility for understanding what the original source id of the lua code was
|
|
50
|
+
value: luaCodeTxId,
|
|
51
|
+
},
|
|
48
52
|
],
|
|
49
53
|
});
|
|
50
54
|
const aosClient = new index_js_1.AOProcess({
|
package/lib/cjs/utils/schema.js
CHANGED
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -200,6 +200,18 @@ export class AoANTReadable {
|
|
|
200
200
|
parseSchemaResult(z.number(), balance);
|
|
201
201
|
return balance;
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
|
|
205
|
+
* @example
|
|
206
|
+
* Get the handlers of the ANT.
|
|
207
|
+
* ```ts
|
|
208
|
+
* const handlers = await ant.getHandlers();
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
async getHandlers() {
|
|
212
|
+
const info = await this.getInfo();
|
|
213
|
+
return (info.Handlers ?? info.HandlerNames);
|
|
214
|
+
}
|
|
203
215
|
}
|
|
204
216
|
export class AoANTWriteable extends AoANTReadable {
|
|
205
217
|
signer;
|
package/lib/esm/types/ant.js
CHANGED
|
@@ -74,33 +74,35 @@ export const AntStateSchema = z.object({
|
|
|
74
74
|
Initialized: z
|
|
75
75
|
.boolean()
|
|
76
76
|
.describe('Flag indicating whether the ANT has been initialized.'),
|
|
77
|
-
['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
|
|
78
77
|
});
|
|
79
|
-
export const
|
|
80
|
-
'evolve',
|
|
81
|
-
'_eval',
|
|
82
|
-
'_default',
|
|
83
|
-
'transfer',
|
|
78
|
+
export const AntReadHandlers = [
|
|
84
79
|
'balance',
|
|
85
80
|
'balances',
|
|
86
81
|
'totalSupply',
|
|
87
82
|
'info',
|
|
83
|
+
'controllers',
|
|
84
|
+
'record',
|
|
85
|
+
'records',
|
|
86
|
+
'state',
|
|
87
|
+
];
|
|
88
|
+
export const AntWriteHandlers = [
|
|
89
|
+
'evolve',
|
|
90
|
+
'_eval',
|
|
91
|
+
'_default',
|
|
92
|
+
'transfer',
|
|
88
93
|
'addController',
|
|
89
94
|
'removeController',
|
|
90
|
-
'controllers',
|
|
91
95
|
'setRecord',
|
|
92
96
|
'removeRecord',
|
|
93
|
-
'record',
|
|
94
|
-
'records',
|
|
95
97
|
'setName',
|
|
96
98
|
'setTicker',
|
|
97
99
|
'setDescription',
|
|
98
100
|
'setKeywords',
|
|
99
101
|
'initializeState',
|
|
100
|
-
'state',
|
|
101
102
|
'releaseName',
|
|
102
103
|
'reassignName',
|
|
103
104
|
];
|
|
105
|
+
export const AntHandlerNames = [...AntReadHandlers, ...AntWriteHandlers];
|
|
104
106
|
export const AntHandlersSchema = z
|
|
105
107
|
.array(z.string({ description: 'Handler Name' }))
|
|
106
108
|
.refine((antHandlers) => {
|
|
@@ -111,7 +113,6 @@ export const AntHandlersSchema = z
|
|
|
111
113
|
export const AntInfoSchema = z.object({
|
|
112
114
|
Name: z.string().describe('The name of the ANT.'),
|
|
113
115
|
Owner: ArweaveTxIdSchema.describe('The Owners address.'),
|
|
114
|
-
['Source-Code-TX-ID']: ArweaveTxIdSchema.describe('Transaction ID of the Source Code for the ANT.'),
|
|
115
116
|
Ticker: z.string().describe('The ticker symbol for the ANT.'),
|
|
116
117
|
['Total-Supply']: IntegerStringSchema.describe('Total supply of the ANT in circulation.'),
|
|
117
118
|
Description: AntDescriptionSchema.describe('The description for the ANT.'),
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -42,6 +42,10 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, luaCodeTxId = A
|
|
|
42
42
|
name: 'ANT-Registry-Id',
|
|
43
43
|
value: antRegistryId,
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Source-Code-TX-ID', // utility for understanding what the original source id of the lua code was
|
|
47
|
+
value: luaCodeTxId,
|
|
48
|
+
},
|
|
45
49
|
],
|
|
46
50
|
});
|
|
47
51
|
const aosClient = new AOProcess({
|
package/lib/esm/utils/schema.js
CHANGED
package/lib/esm/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AntReadOptions, AoANTInfo, AoANTRead, AoANTRecord, AoANTRecordEntry, AoANTState, AoANTWrite } from '../types/ant.js';
|
|
1
|
+
import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTRecordEntry, AoANTState, AoANTWrite } from '../types/ant.js';
|
|
2
2
|
import { AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
3
3
|
import { AOProcess } from './index.js';
|
|
4
4
|
export declare class ANT {
|
|
@@ -96,6 +96,15 @@ export declare class AoANTReadable implements AoANTRead {
|
|
|
96
96
|
getBalance({ address }: {
|
|
97
97
|
address: string;
|
|
98
98
|
}, { strict }?: AntReadOptions): Promise<number>;
|
|
99
|
+
/**
|
|
100
|
+
* @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
|
|
101
|
+
* @example
|
|
102
|
+
* Get the handlers of the ANT.
|
|
103
|
+
* ```ts
|
|
104
|
+
* const handlers = await ant.getHandlers();
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
getHandlers(): Promise<AoANTHandler[]>;
|
|
99
108
|
}
|
|
100
109
|
export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite {
|
|
101
110
|
private signer;
|
package/lib/types/types/ant.d.ts
CHANGED
|
@@ -109,9 +109,7 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
109
109
|
Logo: z.ZodEffects<z.ZodString, string, string>;
|
|
110
110
|
TotalSupply: z.ZodNumber;
|
|
111
111
|
Initialized: z.ZodBoolean;
|
|
112
|
-
"Source-Code-TX-ID": z.ZodEffects<z.ZodString, string, string>;
|
|
113
112
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
"Source-Code-TX-ID": string;
|
|
115
113
|
Name: string;
|
|
116
114
|
Ticker: string;
|
|
117
115
|
Description: string;
|
|
@@ -128,7 +126,6 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
128
126
|
TotalSupply: number;
|
|
129
127
|
Initialized: boolean;
|
|
130
128
|
}, {
|
|
131
|
-
"Source-Code-TX-ID": string;
|
|
132
129
|
Name: string;
|
|
133
130
|
Ticker: string;
|
|
134
131
|
Description: string;
|
|
@@ -146,12 +143,16 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
146
143
|
Initialized: boolean;
|
|
147
144
|
}>;
|
|
148
145
|
export type AoANTState = z.infer<typeof AntStateSchema>;
|
|
149
|
-
export declare const
|
|
146
|
+
export declare const AntReadHandlers: readonly ["balance", "balances", "totalSupply", "info", "controllers", "record", "records", "state"];
|
|
147
|
+
export type AoANTReadHandler = (typeof AntReadHandlers)[number];
|
|
148
|
+
export declare const AntWriteHandlers: readonly ["evolve", "_eval", "_default", "transfer", "addController", "removeController", "setRecord", "removeRecord", "setName", "setTicker", "setDescription", "setKeywords", "initializeState", "releaseName", "reassignName"];
|
|
149
|
+
export type AoANTWriteHandler = (typeof AntWriteHandlers)[number];
|
|
150
|
+
export declare const AntHandlerNames: ("balance" | "balances" | "totalSupply" | "info" | "controllers" | "record" | "records" | "state" | "evolve" | "_eval" | "_default" | "transfer" | "addController" | "removeController" | "setRecord" | "removeRecord" | "setName" | "setTicker" | "setDescription" | "setKeywords" | "initializeState" | "releaseName" | "reassignName")[];
|
|
151
|
+
export type AoANTHandler = AoANTWriteHandler | AoANTReadHandler;
|
|
150
152
|
export declare const AntHandlersSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
151
153
|
export declare const AntInfoSchema: z.ZodObject<{
|
|
152
154
|
Name: z.ZodString;
|
|
153
155
|
Owner: z.ZodEffects<z.ZodString, string, string>;
|
|
154
|
-
"Source-Code-TX-ID": z.ZodEffects<z.ZodString, string, string>;
|
|
155
156
|
Ticker: z.ZodString;
|
|
156
157
|
"Total-Supply": z.ZodEffects<z.ZodString, string, string>;
|
|
157
158
|
Description: z.ZodString;
|
|
@@ -161,7 +162,6 @@ export declare const AntInfoSchema: z.ZodObject<{
|
|
|
161
162
|
Handlers: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
162
163
|
HandlerNames: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
163
164
|
}, "strip", z.ZodTypeAny, {
|
|
164
|
-
"Source-Code-TX-ID": string;
|
|
165
165
|
Name: string;
|
|
166
166
|
Ticker: string;
|
|
167
167
|
Description: string;
|
|
@@ -173,7 +173,6 @@ export declare const AntInfoSchema: z.ZodObject<{
|
|
|
173
173
|
Handlers?: string[] | undefined;
|
|
174
174
|
HandlerNames?: string[] | undefined;
|
|
175
175
|
}, {
|
|
176
|
-
"Source-Code-TX-ID": string;
|
|
177
176
|
Name: string;
|
|
178
177
|
Ticker: string;
|
|
179
178
|
Description: string;
|
|
@@ -209,6 +208,7 @@ export interface AoANTRead {
|
|
|
209
208
|
address: WalletAddress;
|
|
210
209
|
}, opts?: AntReadOptions): Promise<number>;
|
|
211
210
|
getBalances(opts?: AntReadOptions): Promise<Record<WalletAddress, number>>;
|
|
211
|
+
getHandlers(): Promise<AoANTHandler[]>;
|
|
212
212
|
}
|
|
213
213
|
export interface AoANTWrite extends AoANTRead {
|
|
214
214
|
transfer({ target }: {
|
package/lib/types/version.d.ts
CHANGED