@ar.io/sdk 3.18.0 → 3.18.2-alpha.1
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/bundles/web.bundle.min.js +44 -44
- package/lib/cjs/common/io.js +12 -0
- package/lib/cjs/common/turbo.js +3 -0
- package/lib/cjs/utils/ao.js +2 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +12 -0
- package/lib/esm/common/turbo.js +3 -0
- package/lib/esm/utils/ao.js +2 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/utils/ao.d.ts +5 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/io.js
CHANGED
|
@@ -1017,10 +1017,22 @@ class ARIOWriteable extends ARIOReadable {
|
|
|
1017
1017
|
// spawn a new ANT if not provided
|
|
1018
1018
|
if (params.processId === undefined) {
|
|
1019
1019
|
try {
|
|
1020
|
+
// if a Name tag is provided, use it. Else, default to the arns name being purchased.
|
|
1021
|
+
const { nameTag, otherTags } = (options?.tags || []).reduce((acc, tag) => {
|
|
1022
|
+
if (tag.name === 'Name') {
|
|
1023
|
+
acc.nameTag = tag;
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
acc.otherTags.push(tag);
|
|
1027
|
+
}
|
|
1028
|
+
return acc;
|
|
1029
|
+
}, { nameTag: { name: 'Name', value: params.name }, otherTags: [] });
|
|
1020
1030
|
params.processId = await ant_js_1.ANT.spawn({
|
|
1021
1031
|
signer: this.signer,
|
|
1022
1032
|
ao: this.process.ao,
|
|
1023
1033
|
logger: this.logger,
|
|
1034
|
+
// This lets AOS set the ArNS name as the Name in lua state
|
|
1035
|
+
tags: [nameTag, ...otherTags],
|
|
1024
1036
|
onSigningProgress: options?.onSigningProgress,
|
|
1025
1037
|
});
|
|
1026
1038
|
}
|
package/lib/cjs/common/turbo.js
CHANGED
|
@@ -55,6 +55,9 @@ async function signedRequestHeadersFromSigner({ signer, nonce = (0, uuid_1.v4)()
|
|
|
55
55
|
await signer.setPublicKey();
|
|
56
56
|
publicKey = (0, base64_js_1.toB64Url)(signer.publicKey);
|
|
57
57
|
}
|
|
58
|
+
else if ('publicKey' in signer) {
|
|
59
|
+
publicKey = (0, base64_js_1.toB64Url)(signer.publicKey);
|
|
60
|
+
}
|
|
58
61
|
break;
|
|
59
62
|
case arbundles_1.SignatureConfig.ETHEREUM:
|
|
60
63
|
if ('publicKey' in signer) {
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -36,7 +36,7 @@ const ant_js_1 = require("../types/ant.js");
|
|
|
36
36
|
const schema_js_1 = require("./schema.js");
|
|
37
37
|
async function spawnANT({ signer, module, ao = (0, aoconnect_1.connect)({
|
|
38
38
|
MODE: 'legacy',
|
|
39
|
-
}), 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, onSigningProgress = (name, payload) => {
|
|
39
|
+
}), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, tags = [], antRegistryId = constants_js_1.ANT_REGISTRY_ID, logger = index_js_1.Logger.default, authority = constants_js_1.AO_AUTHORITY, onSigningProgress = (name, payload) => {
|
|
40
40
|
logger.debug('Signing progress', { name, payload });
|
|
41
41
|
}, }) {
|
|
42
42
|
if (state) {
|
|
@@ -81,6 +81,7 @@ async function spawnANT({ signer, module, ao = (0, aoconnect_1.connect)({
|
|
|
81
81
|
name: 'ANT-Registry-Id',
|
|
82
82
|
value: antRegistryId,
|
|
83
83
|
},
|
|
84
|
+
...tags,
|
|
84
85
|
],
|
|
85
86
|
});
|
|
86
87
|
/**
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/io.js
CHANGED
|
@@ -1012,10 +1012,22 @@ export class ARIOWriteable extends ARIOReadable {
|
|
|
1012
1012
|
// spawn a new ANT if not provided
|
|
1013
1013
|
if (params.processId === undefined) {
|
|
1014
1014
|
try {
|
|
1015
|
+
// if a Name tag is provided, use it. Else, default to the arns name being purchased.
|
|
1016
|
+
const { nameTag, otherTags } = (options?.tags || []).reduce((acc, tag) => {
|
|
1017
|
+
if (tag.name === 'Name') {
|
|
1018
|
+
acc.nameTag = tag;
|
|
1019
|
+
}
|
|
1020
|
+
else {
|
|
1021
|
+
acc.otherTags.push(tag);
|
|
1022
|
+
}
|
|
1023
|
+
return acc;
|
|
1024
|
+
}, { nameTag: { name: 'Name', value: params.name }, otherTags: [] });
|
|
1015
1025
|
params.processId = await ANT.spawn({
|
|
1016
1026
|
signer: this.signer,
|
|
1017
1027
|
ao: this.process.ao,
|
|
1018
1028
|
logger: this.logger,
|
|
1029
|
+
// This lets AOS set the ArNS name as the Name in lua state
|
|
1030
|
+
tags: [nameTag, ...otherTags],
|
|
1019
1031
|
onSigningProgress: options?.onSigningProgress,
|
|
1020
1032
|
});
|
|
1021
1033
|
}
|
package/lib/esm/common/turbo.js
CHANGED
|
@@ -50,6 +50,9 @@ export async function signedRequestHeadersFromSigner({ signer, nonce = uuidv4(),
|
|
|
50
50
|
await signer.setPublicKey();
|
|
51
51
|
publicKey = toB64Url(signer.publicKey);
|
|
52
52
|
}
|
|
53
|
+
else if ('publicKey' in signer) {
|
|
54
|
+
publicKey = toB64Url(signer.publicKey);
|
|
55
|
+
}
|
|
53
56
|
break;
|
|
54
57
|
case SignatureConfig.ETHEREUM:
|
|
55
58
|
if ('publicKey' in signer) {
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -25,7 +25,7 @@ import { SpawnANTStateSchema } from '../types/ant.js';
|
|
|
25
25
|
import { parseSchemaResult } from './schema.js';
|
|
26
26
|
export async function spawnANT({ signer, module, ao = connect({
|
|
27
27
|
MODE: 'legacy',
|
|
28
|
-
}), scheduler = DEFAULT_SCHEDULER_ID, state, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, onSigningProgress = (name, payload) => {
|
|
28
|
+
}), scheduler = DEFAULT_SCHEDULER_ID, state, tags = [], antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, onSigningProgress = (name, payload) => {
|
|
29
29
|
logger.debug('Signing progress', { name, payload });
|
|
30
30
|
}, }) {
|
|
31
31
|
if (state) {
|
|
@@ -70,6 +70,7 @@ export async function spawnANT({ signer, module, ao = connect({
|
|
|
70
70
|
name: 'ANT-Registry-Id',
|
|
71
71
|
value: antRegistryId,
|
|
72
72
|
},
|
|
73
|
+
...tags,
|
|
73
74
|
],
|
|
74
75
|
});
|
|
75
76
|
/**
|
package/lib/esm/version.js
CHANGED
package/lib/types/utils/ao.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type SpawnANTParams = {
|
|
|
12
12
|
antRegistryId?: string;
|
|
13
13
|
logger?: Logger;
|
|
14
14
|
authority?: string;
|
|
15
|
+
tags?: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
15
19
|
/**
|
|
16
20
|
* @deprecated Compiled modules are now being used instead of luaCodeTxId
|
|
17
21
|
*/
|
|
@@ -25,7 +29,7 @@ export type SpawnANTParams = {
|
|
|
25
29
|
*/
|
|
26
30
|
onSigningProgress?: (name: keyof SpawnAntProgressEvent, payload: SpawnAntProgressEvent[keyof SpawnAntProgressEvent]) => void;
|
|
27
31
|
};
|
|
28
|
-
export declare function spawnANT({ signer, module, ao, scheduler, state, antRegistryId, logger, authority, onSigningProgress, }: SpawnANTParams): Promise<ProcessId>;
|
|
32
|
+
export declare function spawnANT({ signer, module, ao, scheduler, state, tags, antRegistryId, logger, authority, onSigningProgress, }: SpawnANTParams): Promise<ProcessId>;
|
|
29
33
|
/**
|
|
30
34
|
* @deprecated
|
|
31
35
|
* Direct Evals are not encouraged when dealing with ANTs.
|
package/lib/types/version.d.ts
CHANGED