@ar.io/sdk 2.0.0-alpha.6 → 2.0.0-alpha.8
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 +18 -0
- package/bundles/web.bundle.min.js +92 -93
- package/lib/cjs/common/io.js +9 -21
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +9 -18
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +1 -0
- package/lib/types/io.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/io.js
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.IOWriteable = exports.IOReadable = exports.IO = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
9
|
-
*
|
|
10
|
-
* This program is free software: you can redistribute it and/or modify
|
|
11
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
12
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
13
|
-
* (at your option) any later version.
|
|
14
|
-
*
|
|
15
|
-
* This program is distributed in the hope that it will be useful,
|
|
16
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
-
* GNU Affero General Public License for more details.
|
|
19
|
-
*
|
|
20
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
21
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
22
|
-
*/
|
|
23
|
-
const arweave_1 = __importDefault(require("arweave"));
|
|
24
4
|
const constants_js_1 = require("../constants.js");
|
|
25
5
|
const io_js_1 = require("../io.js");
|
|
6
|
+
const arweave_js_1 = require("./arweave.js");
|
|
26
7
|
const ao_process_js_1 = require("./contracts/ao-process.js");
|
|
27
8
|
const error_js_1 = require("./error.js");
|
|
28
9
|
class IO {
|
|
@@ -41,7 +22,7 @@ exports.IO = IO;
|
|
|
41
22
|
class IOReadable {
|
|
42
23
|
process;
|
|
43
24
|
arweave;
|
|
44
|
-
constructor(config, arweave =
|
|
25
|
+
constructor(config, arweave = arweave_js_1.defaultArweave) {
|
|
45
26
|
if (!config) {
|
|
46
27
|
this.process = new ao_process_js_1.AOProcess({
|
|
47
28
|
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
@@ -392,6 +373,13 @@ class IOWriteable extends IOReadable {
|
|
|
392
373
|
tags: prunedTags,
|
|
393
374
|
});
|
|
394
375
|
}
|
|
376
|
+
async leaveNetwork(options) {
|
|
377
|
+
const { tags = [] } = options || {};
|
|
378
|
+
return this.process.send({
|
|
379
|
+
signer: this.signer,
|
|
380
|
+
tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
|
|
381
|
+
});
|
|
382
|
+
}
|
|
395
383
|
async updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
|
|
396
384
|
const { tags = [] } = options || {};
|
|
397
385
|
const allTags = [
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/io.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
import Arweave from 'arweave';
|
|
18
1
|
import { IO_TESTNET_PROCESS_ID } from '../constants.js';
|
|
19
2
|
import { isProcessConfiguration, isProcessIdConfiguration, } from '../io.js';
|
|
3
|
+
import { defaultArweave } from './arweave.js';
|
|
20
4
|
import { AOProcess } from './contracts/ao-process.js';
|
|
21
5
|
import { InvalidContractConfigurationError } from './error.js';
|
|
22
6
|
export class IO {
|
|
@@ -34,7 +18,7 @@ export class IO {
|
|
|
34
18
|
export class IOReadable {
|
|
35
19
|
process;
|
|
36
20
|
arweave;
|
|
37
|
-
constructor(config, arweave =
|
|
21
|
+
constructor(config, arweave = defaultArweave) {
|
|
38
22
|
if (!config) {
|
|
39
23
|
this.process = new AOProcess({
|
|
40
24
|
processId: IO_TESTNET_PROCESS_ID,
|
|
@@ -384,6 +368,13 @@ export class IOWriteable extends IOReadable {
|
|
|
384
368
|
tags: prunedTags,
|
|
385
369
|
});
|
|
386
370
|
}
|
|
371
|
+
async leaveNetwork(options) {
|
|
372
|
+
const { tags = [] } = options || {};
|
|
373
|
+
return this.process.send({
|
|
374
|
+
signer: this.signer,
|
|
375
|
+
tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
|
|
376
|
+
});
|
|
377
|
+
}
|
|
387
378
|
async updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
|
|
388
379
|
const { tags = [] } = options || {};
|
|
389
380
|
const allTags = [
|
package/lib/esm/version.js
CHANGED
package/lib/types/common/io.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
105
105
|
observerAddress: string;
|
|
106
106
|
operatorStake: number | mIOToken;
|
|
107
107
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
108
|
+
leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
|
|
108
109
|
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<UpdateGatewaySettingsParams, 'observerWallet'> & {
|
|
109
110
|
observerAddress: string;
|
|
110
111
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
package/lib/types/io.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export interface AoIOWrite extends AoIORead {
|
|
|
102
102
|
observerAddress: string;
|
|
103
103
|
operatorStake: number | mIOToken;
|
|
104
104
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
105
|
+
leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
|
|
105
106
|
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<UpdateGatewaySettingsParams, 'observerWallet'> & {
|
|
106
107
|
observerAddress?: WalletAddress;
|
|
107
108
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
package/lib/types/version.d.ts
CHANGED