@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.
@@ -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 = new arweave_1.default({})) {
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 = [
@@ -18,4 +18,4 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.version = void 0;
20
20
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
21
- exports.version = '2.0.0-alpha.6';
21
+ exports.version = '2.0.0-alpha.8';
@@ -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 = new 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 = [
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '2.0.0-alpha.6';
18
+ export const version = '2.0.0-alpha.8';
@@ -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>;
@@ -14,4 +14,4 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export declare const version = "2.0.0-alpha.5";
17
+ export declare const version = "2.0.0-alpha.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"