@ar.io/sdk 3.3.0 → 3.3.1-alpha.2
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 +3 -0
- package/bundles/web.bundle.min.js +45 -45
- package/lib/cjs/constants.js +2 -2
- package/lib/cjs/utils/ao.js +2 -43
- package/lib/cjs/version.js +1 -1
- package/lib/esm/constants.js +2 -2
- package/lib/esm/utils/ao.js +3 -44
- package/lib/esm/version.js +1 -1
- package/lib/types/constants.d.ts +2 -2
- package/lib/types/utils/ao.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/constants.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID;
|
|
|
29
29
|
exports.ARIO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
|
|
30
30
|
exports.ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
|
|
31
31
|
exports.MARIO_PER_ARIO = 1_000_000;
|
|
32
|
-
exports.AOS_MODULE_ID = '
|
|
33
|
-
exports.ANT_LUA_ID = '
|
|
32
|
+
exports.AOS_MODULE_ID = 'ra9B3DBMKv_Zm9ZoRpEea9Qknd_hwpTrVDWIvlAlpbo';
|
|
33
|
+
exports.ANT_LUA_ID = '1YqVEdJDvcpQ6qEWXYBEaVqB_NzAz4qPAsnUqLf5m3I';
|
|
34
34
|
exports.AO_AUTHORITY = 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY';
|
|
35
35
|
exports.DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -22,12 +22,13 @@ const zod_1 = require("zod");
|
|
|
22
22
|
const arweave_js_1 = require("../common/arweave.js");
|
|
23
23
|
const index_js_1 = require("../common/index.js");
|
|
24
24
|
const constants_js_1 = require("../constants.js");
|
|
25
|
-
async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)(), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state,
|
|
25
|
+
async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0, aoconnect_1.connect)(), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, antRegistryId = constants_js_1.ANT_REGISTRY_ID, logger = index_js_1.Logger.default, authority = constants_js_1.AO_AUTHORITY, }) {
|
|
26
26
|
// TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
|
|
27
27
|
const processId = await ao.spawn({
|
|
28
28
|
module,
|
|
29
29
|
scheduler,
|
|
30
30
|
signer,
|
|
31
|
+
data: state ? JSON.stringify(state) : undefined,
|
|
31
32
|
tags: [
|
|
32
33
|
// Required for AOS to initialize the authorities table
|
|
33
34
|
{
|
|
@@ -40,53 +41,11 @@ async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, ao = (0
|
|
|
40
41
|
},
|
|
41
42
|
],
|
|
42
43
|
});
|
|
43
|
-
const aosClient = new index_js_1.AOProcess({
|
|
44
|
-
processId,
|
|
45
|
-
ao,
|
|
46
|
-
logger,
|
|
47
|
-
});
|
|
48
44
|
logger.debug(`Spawned ANT`, {
|
|
49
45
|
processId,
|
|
50
46
|
module,
|
|
51
47
|
scheduler,
|
|
52
48
|
});
|
|
53
|
-
if (state) {
|
|
54
|
-
const { id: initializeMsgId } = await aosClient.send({
|
|
55
|
-
tags: [
|
|
56
|
-
{ name: 'Action', value: 'Initialize-State' },
|
|
57
|
-
...(stateContractTxId !== undefined
|
|
58
|
-
? [{ name: 'State-Contract-TX-ID', value: stateContractTxId }]
|
|
59
|
-
: []),
|
|
60
|
-
],
|
|
61
|
-
data: JSON.stringify(state),
|
|
62
|
-
signer,
|
|
63
|
-
});
|
|
64
|
-
logger.debug(`Initialized ANT`, {
|
|
65
|
-
processId,
|
|
66
|
-
module,
|
|
67
|
-
scheduler,
|
|
68
|
-
initializeMsgId,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
// This could be done by the ANT in On-Boot to self-register with its tagged ANT registry
|
|
72
|
-
const registryClient = index_js_1.ANTRegistry.init({
|
|
73
|
-
process: new index_js_1.AOProcess({
|
|
74
|
-
processId: antRegistryId,
|
|
75
|
-
ao,
|
|
76
|
-
logger,
|
|
77
|
-
}),
|
|
78
|
-
signer: signer,
|
|
79
|
-
});
|
|
80
|
-
const { id: antRegistrationMsgId } = await registryClient.register({
|
|
81
|
-
processId,
|
|
82
|
-
});
|
|
83
|
-
logger.debug(`Registered ANT to ANT Registry`, {
|
|
84
|
-
processId,
|
|
85
|
-
module,
|
|
86
|
-
scheduler,
|
|
87
|
-
antRegistrationMsgId,
|
|
88
|
-
antRegistryId,
|
|
89
|
-
});
|
|
90
49
|
return processId;
|
|
91
50
|
}
|
|
92
51
|
exports.spawnANT = spawnANT;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/constants.js
CHANGED
|
@@ -26,7 +26,7 @@ export const arioDevnetProcessId = ARIO_DEVNET_PROCESS_ID;
|
|
|
26
26
|
export const ARIO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
|
|
27
27
|
export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
|
|
28
28
|
export const MARIO_PER_ARIO = 1_000_000;
|
|
29
|
-
export const AOS_MODULE_ID = '
|
|
30
|
-
export const ANT_LUA_ID = '
|
|
29
|
+
export const AOS_MODULE_ID = 'ra9B3DBMKv_Zm9ZoRpEea9Qknd_hwpTrVDWIvlAlpbo';
|
|
30
|
+
export const ANT_LUA_ID = '1YqVEdJDvcpQ6qEWXYBEaVqB_NzAz4qPAsnUqLf5m3I';
|
|
31
31
|
export const AO_AUTHORITY = 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY';
|
|
32
32
|
export const DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -17,14 +17,15 @@ import { ArconnectSigner, DataItem, createData } from '@dha-team/arbundles';
|
|
|
17
17
|
import { connect, createDataItemSigner } from '@permaweb/aoconnect';
|
|
18
18
|
import { z } from 'zod';
|
|
19
19
|
import { defaultArweave } from '../common/arweave.js';
|
|
20
|
-
import {
|
|
20
|
+
import { AOProcess, Logger } from '../common/index.js';
|
|
21
21
|
import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, AO_AUTHORITY, DEFAULT_SCHEDULER_ID, } from '../constants.js';
|
|
22
|
-
export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state,
|
|
22
|
+
export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, }) {
|
|
23
23
|
// TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
|
|
24
24
|
const processId = await ao.spawn({
|
|
25
25
|
module,
|
|
26
26
|
scheduler,
|
|
27
27
|
signer,
|
|
28
|
+
data: state ? JSON.stringify(state) : undefined,
|
|
28
29
|
tags: [
|
|
29
30
|
// Required for AOS to initialize the authorities table
|
|
30
31
|
{
|
|
@@ -37,53 +38,11 @@ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(),
|
|
|
37
38
|
},
|
|
38
39
|
],
|
|
39
40
|
});
|
|
40
|
-
const aosClient = new AOProcess({
|
|
41
|
-
processId,
|
|
42
|
-
ao,
|
|
43
|
-
logger,
|
|
44
|
-
});
|
|
45
41
|
logger.debug(`Spawned ANT`, {
|
|
46
42
|
processId,
|
|
47
43
|
module,
|
|
48
44
|
scheduler,
|
|
49
45
|
});
|
|
50
|
-
if (state) {
|
|
51
|
-
const { id: initializeMsgId } = await aosClient.send({
|
|
52
|
-
tags: [
|
|
53
|
-
{ name: 'Action', value: 'Initialize-State' },
|
|
54
|
-
...(stateContractTxId !== undefined
|
|
55
|
-
? [{ name: 'State-Contract-TX-ID', value: stateContractTxId }]
|
|
56
|
-
: []),
|
|
57
|
-
],
|
|
58
|
-
data: JSON.stringify(state),
|
|
59
|
-
signer,
|
|
60
|
-
});
|
|
61
|
-
logger.debug(`Initialized ANT`, {
|
|
62
|
-
processId,
|
|
63
|
-
module,
|
|
64
|
-
scheduler,
|
|
65
|
-
initializeMsgId,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
// This could be done by the ANT in On-Boot to self-register with its tagged ANT registry
|
|
69
|
-
const registryClient = ANTRegistry.init({
|
|
70
|
-
process: new AOProcess({
|
|
71
|
-
processId: antRegistryId,
|
|
72
|
-
ao,
|
|
73
|
-
logger,
|
|
74
|
-
}),
|
|
75
|
-
signer: signer,
|
|
76
|
-
});
|
|
77
|
-
const { id: antRegistrationMsgId } = await registryClient.register({
|
|
78
|
-
processId,
|
|
79
|
-
});
|
|
80
|
-
logger.debug(`Registered ANT to ANT Registry`, {
|
|
81
|
-
processId,
|
|
82
|
-
module,
|
|
83
|
-
scheduler,
|
|
84
|
-
antRegistrationMsgId,
|
|
85
|
-
antRegistryId,
|
|
86
|
-
});
|
|
87
46
|
return processId;
|
|
88
47
|
}
|
|
89
48
|
export async function evolveANT({ signer, processId, luaCodeTxId = ANT_LUA_ID, ao = connect(), logger = Logger.default, arweave = defaultArweave, }) {
|
package/lib/esm/version.js
CHANGED
package/lib/types/constants.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare const arioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6
|
|
|
24
24
|
export declare const ARIO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
|
|
25
25
|
export declare const ANT_REGISTRY_ID = "i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc";
|
|
26
26
|
export declare const MARIO_PER_ARIO = 1000000;
|
|
27
|
-
export declare const AOS_MODULE_ID = "
|
|
28
|
-
export declare const ANT_LUA_ID = "
|
|
27
|
+
export declare const AOS_MODULE_ID = "ra9B3DBMKv_Zm9ZoRpEea9Qknd_hwpTrVDWIvlAlpbo";
|
|
28
|
+
export declare const ANT_LUA_ID = "1YqVEdJDvcpQ6qEWXYBEaVqB_NzAz4qPAsnUqLf5m3I";
|
|
29
29
|
export declare const AO_AUTHORITY = "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY";
|
|
30
30
|
export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
|
package/lib/types/utils/ao.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type SpawnANTParams = {
|
|
|
31
31
|
*/
|
|
32
32
|
arweave?: Arweave;
|
|
33
33
|
};
|
|
34
|
-
export declare function spawnANT({ signer, module, ao, scheduler, state,
|
|
34
|
+
export declare function spawnANT({ signer, module, ao, scheduler, state, antRegistryId, logger, authority, }: SpawnANTParams): Promise<string>;
|
|
35
35
|
export declare function evolveANT({ signer, processId, luaCodeTxId, ao, logger, arweave, }: {
|
|
36
36
|
signer: AoSigner;
|
|
37
37
|
processId: string;
|
package/lib/types/version.d.ts
CHANGED