@ar.io/sdk 2.5.0-alpha.12 → 2.5.0-alpha.13

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.
@@ -438,6 +438,21 @@ class IOReadable {
438
438
  ],
439
439
  });
440
440
  }
441
+ /**
442
+ * Get current redelegation fee percentage for address
443
+ *
444
+ * @param {Object} params - The parameters for fetching redelegation fee
445
+ * @param {string} params.address - The address to fetch the fee for
446
+ * @returns {Promise<AoMessageResult>} The redelegation fee result
447
+ */
448
+ async getRedelegationFee(params) {
449
+ return this.process.read({
450
+ tags: [
451
+ { name: 'Action', value: 'Redelegation-Fee' },
452
+ { name: 'Address', value: params.address },
453
+ ],
454
+ });
455
+ }
441
456
  }
442
457
  exports.IOReadable = IOReadable;
443
458
  class IOWriteable extends IOReadable {
@@ -790,5 +805,31 @@ class IOWriteable extends IOReadable {
790
805
  ],
791
806
  });
792
807
  }
808
+ /**
809
+ * Redelegate stake from one gateway to another gateway.
810
+ *
811
+ * @param {Object} params - The parameters for redelegating stake
812
+ * @param {string} params.target - The target gateway address
813
+ * @param {string} params.source - The source gateway address
814
+ * @param {number} params.stakeQty - The quantity of stake to redelegate
815
+ * @param {string} params.vaultId - An optional vault ID to redelegate from
816
+ * @param {Object} [options] - The options for the redelegation
817
+ * @returns {Promise<AoMessageResult>} The result of the redelegation
818
+ */
819
+ async redelegateStake(params, options) {
820
+ const { tags = [] } = options || {};
821
+ const allTags = [
822
+ ...tags,
823
+ { name: 'Action', value: 'Redelegate-Stake' },
824
+ { name: 'Target', value: params.target },
825
+ { name: 'Source', value: params.source },
826
+ { name: 'Quantity', value: params.stakeQty.valueOf().toString() },
827
+ { name: 'Vault-Id', value: params.vaultId },
828
+ ];
829
+ return this.process.send({
830
+ signer: this.signer,
831
+ tags: (0, arweave_js_1.pruneTags)(allTags),
832
+ });
833
+ }
793
834
  }
794
835
  exports.IOWriteable = IOWriteable;
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '2.5.0-alpha.12';
20
+ exports.version = '2.5.0-alpha.13';
@@ -434,6 +434,21 @@ export class IOReadable {
434
434
  ],
435
435
  });
436
436
  }
437
+ /**
438
+ * Get current redelegation fee percentage for address
439
+ *
440
+ * @param {Object} params - The parameters for fetching redelegation fee
441
+ * @param {string} params.address - The address to fetch the fee for
442
+ * @returns {Promise<AoMessageResult>} The redelegation fee result
443
+ */
444
+ async getRedelegationFee(params) {
445
+ return this.process.read({
446
+ tags: [
447
+ { name: 'Action', value: 'Redelegation-Fee' },
448
+ { name: 'Address', value: params.address },
449
+ ],
450
+ });
451
+ }
437
452
  }
438
453
  export class IOWriteable extends IOReadable {
439
454
  signer;
@@ -785,4 +800,30 @@ export class IOWriteable extends IOReadable {
785
800
  ],
786
801
  });
787
802
  }
803
+ /**
804
+ * Redelegate stake from one gateway to another gateway.
805
+ *
806
+ * @param {Object} params - The parameters for redelegating stake
807
+ * @param {string} params.target - The target gateway address
808
+ * @param {string} params.source - The source gateway address
809
+ * @param {number} params.stakeQty - The quantity of stake to redelegate
810
+ * @param {string} params.vaultId - An optional vault ID to redelegate from
811
+ * @param {Object} [options] - The options for the redelegation
812
+ * @returns {Promise<AoMessageResult>} The result of the redelegation
813
+ */
814
+ async redelegateStake(params, options) {
815
+ const { tags = [] } = options || {};
816
+ const allTags = [
817
+ ...tags,
818
+ { name: 'Action', value: 'Redelegate-Stake' },
819
+ { name: 'Target', value: params.target },
820
+ { name: 'Source', value: params.source },
821
+ { name: 'Quantity', value: params.stakeQty.valueOf().toString() },
822
+ { name: 'Vault-Id', value: params.vaultId },
823
+ ];
824
+ return this.process.send({
825
+ signer: this.signer,
826
+ tags: pruneTags(allTags),
827
+ });
828
+ }
788
829
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '2.5.0-alpha.12';
17
+ export const version = '2.5.0-alpha.13';
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import Arweave from 'arweave';
17
- import { AoArNSNameDataWithName, AoArNSReservedNameData, AoAuction, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
17
+ import { AoArNSNameDataWithName, AoArNSReservedNameData, AoAuction, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
18
18
  import { AoArNSNameData, AoArNSReservedNameDataWithName, AoAuctionPriceData, AoDelegation, AoEpochData, AoEpochSettings, AoGateway, AoGatewayDelegateWithAddress, AoGatewayVault, AoIORead, AoIOWrite, AoRegistrationFees, AoVaultData, AoWalletVault, EpochInput } from '../types/io.js';
19
19
  import { mIOToken } from '../types/token.js';
20
20
  import { AOProcess } from './contracts/ao-process.js';
@@ -146,6 +146,16 @@ export declare class IOReadable implements AoIORead {
146
146
  name: string;
147
147
  }): Promise<AoPrimaryName>;
148
148
  getPrimaryNames(params: PaginationParams<AoPrimaryName>): Promise<PaginationResult<AoPrimaryName>>;
149
+ /**
150
+ * Get current redelegation fee percentage for address
151
+ *
152
+ * @param {Object} params - The parameters for fetching redelegation fee
153
+ * @param {string} params.address - The address to fetch the fee for
154
+ * @returns {Promise<AoMessageResult>} The redelegation fee result
155
+ */
156
+ getRedelegationFee(params: {
157
+ address: WalletAddress;
158
+ }): Promise<AoRedelegationFeeInfo>;
149
159
  }
150
160
  export declare class IOWriteable extends IOReadable implements AoIOWrite {
151
161
  protected process: AOProcess;
@@ -250,4 +260,21 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
250
260
  requestPrimaryName(params: {
251
261
  name: string;
252
262
  }): Promise<AoMessageResult>;
263
+ /**
264
+ * Redelegate stake from one gateway to another gateway.
265
+ *
266
+ * @param {Object} params - The parameters for redelegating stake
267
+ * @param {string} params.target - The target gateway address
268
+ * @param {string} params.source - The source gateway address
269
+ * @param {number} params.stakeQty - The quantity of stake to redelegate
270
+ * @param {string} params.vaultId - An optional vault ID to redelegate from
271
+ * @param {Object} [options] - The options for the redelegation
272
+ * @returns {Promise<AoMessageResult>} The result of the redelegation
273
+ */
274
+ redelegateStake(params: {
275
+ target: string;
276
+ source: string;
277
+ stakeQty: number | mIOToken;
278
+ vaultId?: string;
279
+ }, options?: WriteOptions): Promise<AoMessageResult>;
253
280
  }
@@ -54,6 +54,16 @@ export type AoPrimaryName = {
54
54
  name: string;
55
55
  startTimestamp: Timestamp;
56
56
  };
57
+ /**
58
+ * Users are allowed one free redelegation every seven epochs. Each additional
59
+ * redelegation increases the fee by 10%, capping at a 60% redelegation fee
60
+ */
61
+ export type AoRedelegationFeeInfo = {
62
+ /** Percentage of redelegated stake that will be returned to the protocol on redelegation */
63
+ redelegationFeeRate: number;
64
+ /** Timestamp when the redelegation fee will reset to zero */
65
+ feeResetTimestamp: number;
66
+ };
57
67
  export type AtLeastOne<T, U = {
58
68
  [K in keyof T]-?: Record<K, T[K]>;
59
69
  }> = Partial<T> & U[keyof U];
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { AOProcess } from '../common/index.js';
17
- import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
17
+ import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
18
18
  import { mIOToken } from './token.js';
19
19
  export type PaginationParams<T = Record<string, never>> = {
20
20
  cursor?: string;
@@ -331,6 +331,9 @@ export interface AoIORead {
331
331
  name: string;
332
332
  }): Promise<AoPrimaryName>;
333
333
  getPrimaryNames(params?: PaginationParams<AoPrimaryName>): Promise<PaginationResult<AoPrimaryName>>;
334
+ getRedelegationFee(params: {
335
+ address: WalletAddress;
336
+ }): Promise<AoRedelegationFeeInfo>;
334
337
  }
335
338
  export interface AoIOWrite extends AoIORead {
336
339
  transfer({ target, qty, }: {
@@ -394,6 +397,12 @@ export interface AoIOWrite extends AoIORead {
394
397
  requestPrimaryName(params: {
395
398
  name: string;
396
399
  }): Promise<AoMessageResult>;
400
+ redelegateStake(params: {
401
+ target: string;
402
+ source: string;
403
+ stakeQty: number | mIOToken;
404
+ vaultId?: string;
405
+ }, options?: WriteOptions): Promise<AoMessageResult>;
397
406
  }
398
407
  export declare function isProcessConfiguration(config: object): config is {
399
408
  process: AOProcess;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "2.5.0-alpha.11";
16
+ export declare const version = "2.5.0-alpha.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.5.0-alpha.12",
3
+ "version": "2.5.0-alpha.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"