@ar.io/sdk 3.10.0 → 3.11.0-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.
Files changed (96) hide show
  1. package/README.md +66 -125
  2. package/bundles/web.bundle.min.js +130 -125
  3. package/lib/cjs/cli/options.js +12 -0
  4. package/lib/cjs/cli/utils.js +32 -10
  5. package/lib/cjs/common/ant-versions.js +5 -5
  6. package/lib/cjs/common/index.js +2 -0
  7. package/lib/cjs/common/io.js +64 -1
  8. package/lib/cjs/common/turbo.js +208 -0
  9. package/lib/cjs/common/wayfinder/gateways.js +75 -0
  10. package/lib/cjs/common/wayfinder/index.js +36 -0
  11. package/lib/cjs/common/wayfinder/routers/fixed.js +14 -0
  12. package/lib/cjs/common/wayfinder/routers/fixed.test.js +14 -0
  13. package/lib/cjs/common/wayfinder/routers/priority.js +38 -0
  14. package/lib/cjs/common/wayfinder/routers/priority.test.js +155 -0
  15. package/lib/cjs/common/wayfinder/routers/random.js +23 -0
  16. package/lib/cjs/common/wayfinder/routers/random.test.js +104 -0
  17. package/lib/cjs/common/wayfinder/routers/simple-cache.js +25 -0
  18. package/lib/cjs/common/wayfinder/routers/simple-cache.test.js +41 -0
  19. package/lib/cjs/common/wayfinder/wayfinder.js +167 -0
  20. package/lib/cjs/common/wayfinder/wayfinder.test.js +253 -0
  21. package/lib/cjs/types/ant.js +12 -1
  22. package/lib/cjs/types/index.js +1 -0
  23. package/lib/cjs/types/io.js +1 -1
  24. package/lib/cjs/types/wayfinder.js +2 -0
  25. package/lib/cjs/utils/ao.js +5 -0
  26. package/lib/cjs/utils/random.js +30 -0
  27. package/lib/cjs/utils/url.js +28 -0
  28. package/lib/cjs/utils/url.test.js +24 -0
  29. package/lib/cjs/utils/utils.test.js +8 -8
  30. package/lib/cjs/version.js +1 -1
  31. package/lib/cjs/web/index.js +3 -1
  32. package/lib/esm/cli/options.js +12 -0
  33. package/lib/esm/cli/utils.js +31 -10
  34. package/lib/esm/common/ant-versions.js +5 -5
  35. package/lib/esm/common/index.js +2 -0
  36. package/lib/esm/common/io.js +64 -1
  37. package/lib/esm/common/turbo.js +200 -0
  38. package/lib/esm/common/wayfinder/gateways.js +69 -0
  39. package/lib/esm/common/wayfinder/index.js +20 -0
  40. package/lib/esm/common/wayfinder/routers/fixed.js +10 -0
  41. package/lib/esm/common/wayfinder/routers/fixed.test.js +12 -0
  42. package/lib/esm/common/wayfinder/routers/priority.js +34 -0
  43. package/lib/esm/common/wayfinder/routers/priority.test.js +153 -0
  44. package/lib/esm/common/wayfinder/routers/random.js +19 -0
  45. package/lib/esm/common/wayfinder/routers/random.test.js +102 -0
  46. package/lib/esm/common/wayfinder/routers/simple-cache.js +21 -0
  47. package/lib/esm/common/wayfinder/routers/simple-cache.test.js +39 -0
  48. package/lib/esm/common/wayfinder/wayfinder.js +161 -0
  49. package/lib/esm/common/wayfinder/wayfinder.test.js +248 -0
  50. package/lib/esm/types/ant.js +11 -0
  51. package/lib/esm/types/index.js +1 -0
  52. package/lib/esm/types/io.js +1 -1
  53. package/lib/esm/types/wayfinder.js +1 -0
  54. package/lib/esm/utils/ao.js +5 -0
  55. package/lib/esm/utils/random.js +26 -0
  56. package/lib/esm/utils/url.js +24 -0
  57. package/lib/esm/utils/url.test.js +19 -0
  58. package/lib/esm/utils/utils.test.js +1 -1
  59. package/lib/esm/version.js +1 -1
  60. package/lib/esm/web/index.js +1 -1
  61. package/lib/types/cli/commands/antCommands.d.ts +3 -3
  62. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +1 -1
  63. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +9 -9
  64. package/lib/types/cli/commands/readCommands.d.ts +1 -0
  65. package/lib/types/cli/commands/transfer.d.ts +3 -3
  66. package/lib/types/cli/options.d.ts +9 -0
  67. package/lib/types/cli/types.d.ts +3 -0
  68. package/lib/types/cli/utils.d.ts +4 -0
  69. package/lib/types/common/ant-versions.d.ts +3 -6
  70. package/lib/types/common/index.d.ts +1 -0
  71. package/lib/types/common/io.d.ts +9 -7
  72. package/lib/types/common/turbo.d.ts +62 -0
  73. package/lib/types/common/wayfinder/gateways.d.ts +44 -0
  74. package/lib/types/common/wayfinder/index.d.ts +19 -0
  75. package/lib/types/common/wayfinder/routers/fixed.d.ts +24 -0
  76. package/lib/types/common/wayfinder/routers/fixed.test.d.ts +1 -0
  77. package/lib/types/common/wayfinder/routers/priority.d.ts +33 -0
  78. package/lib/types/common/wayfinder/routers/priority.test.d.ts +1 -0
  79. package/lib/types/common/wayfinder/routers/random.d.ts +27 -0
  80. package/lib/types/common/wayfinder/routers/random.test.d.ts +1 -0
  81. package/lib/types/common/wayfinder/routers/simple-cache.d.ts +28 -0
  82. package/lib/types/common/wayfinder/routers/simple-cache.test.d.ts +1 -0
  83. package/lib/types/common/wayfinder/wayfinder.d.ts +113 -0
  84. package/lib/types/common/wayfinder/wayfinder.test.d.ts +1 -0
  85. package/lib/types/types/ant.d.ts +53 -1
  86. package/lib/types/types/common.d.ts +7 -2
  87. package/lib/types/types/index.d.ts +1 -0
  88. package/lib/types/types/io.d.ts +7 -5
  89. package/lib/types/types/wayfinder.d.ts +19 -0
  90. package/lib/types/utils/ao.d.ts +1 -12
  91. package/lib/types/utils/random.d.ts +7 -0
  92. package/lib/types/utils/url.d.ts +19 -0
  93. package/lib/types/utils/url.test.d.ts +1 -0
  94. package/lib/types/version.d.ts +1 -1
  95. package/lib/types/web/index.d.ts +1 -1
  96. package/package.json +5 -3
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const urlWithSearchParams = ({ baseUrl, params, }) => {
17
+ const urlObj = new URL(baseUrl);
18
+ Object.entries(params).forEach(([key, value]) => {
19
+ if (value === undefined || value === null)
20
+ return;
21
+ urlObj.searchParams.set(key, value.toString());
22
+ });
23
+ return urlObj.toString();
24
+ };
@@ -0,0 +1,19 @@
1
+ import assert from 'node:assert';
2
+ import { test } from 'node:test';
3
+ import { urlWithSearchParams } from './url.js';
4
+ test('urlWithSearchParams prunes undefined values but keeps other falsey values', () => {
5
+ const result = urlWithSearchParams({
6
+ baseUrl: 'https://example.com',
7
+ params: {
8
+ number: 1,
9
+ string: 'string',
10
+ boolean: true,
11
+ empty: '',
12
+ zero: 0,
13
+ false: false,
14
+ null: null,
15
+ undef: undefined,
16
+ },
17
+ });
18
+ assert.strictEqual(result, 'https://example.com/?number=1&string=string&boolean=true&empty=&zero=0&false=false');
19
+ });
@@ -1,7 +1,7 @@
1
1
  import { strict as assert } from 'node:assert';
2
2
  import { describe, it } from 'node:test';
3
+ import { errorMessageFromOutput } from './ao.js';
3
4
  import { pruneTags, sortAndPaginateEpochDataIntoEligibleDistributions, } from './arweave.js';
4
- import { errorMessageFromOutput } from './index.js';
5
5
  describe('pruneTags', () => {
6
6
  it('should remove tags with undefined values', () => {
7
7
  const tags = [
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.10.0';
17
+ export const version = '3.11.0-alpha.1';
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { ArweaveSigner, ArconnectSigner } from '@dha-team/arbundles';
16
+ export { ArweaveSigner, ArconnectSigner, InjectedEthereumSigner, EthereumSigner, } from '@dha-team/arbundles';
17
17
  export * from '../types/index.js';
18
18
  export * from '../common/index.js';
19
19
  export * from '../constants.js';
@@ -16,6 +16,6 @@
16
16
  import { AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams } from '../../types/ant.js';
17
17
  import { CLIWriteOptionsFromAoAntParams } from '../types.js';
18
18
  /** @deprecated -- use set-ant-base-name and set-ant-undername */
19
- export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
20
- export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
21
- export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult>;
19
+ export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
20
+ export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
21
+ export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
@@ -19,4 +19,4 @@ export declare function buyRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoBuy
19
19
  export declare function upgradeRecordCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
20
20
  export declare function extendLeaseCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendLeaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
21
21
  export declare function increaseUndernameLimitCLICommand(o: CLIWriteOptionsFromAoParams<AoIncreaseUndernameLimitParams>): Promise<import("../../types/common.js").AoMessageResult>;
22
- export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult>;
22
+ export declare function requestPrimaryNameCLICommand(o: CLIWriteOptionsFromAoParams<AoArNSPurchaseParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
@@ -1,11 +1,11 @@
1
1
  import { AddressAndVaultIdCLIWriteOptions, DecreaseDelegateStakeCLIOptions, JoinNetworkCLIOptions, OperatorStakeCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WriteActionCLIOptions } from '../types.js';
2
2
  export declare function joinNetwork(options: JoinNetworkCLIOptions): Promise<{
3
- joinNetworkResult: import("../../types/common.js").AoMessageResult;
3
+ joinNetworkResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
4
4
  joinedAddress: string;
5
5
  message: string;
6
6
  }>;
7
7
  export declare function updateGatewaySettings(options: UpdateGatewaySettingsCLIOptions): Promise<{
8
- updateGatewaySettingsResult: import("../../types/common.js").AoMessageResult;
8
+ updateGatewaySettingsResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
9
9
  updatedGatewayAddress: string;
10
10
  message: string;
11
11
  }>;
@@ -13,26 +13,26 @@ export declare function leaveNetwork(options: WriteActionCLIOptions): Promise<im
13
13
  export declare function saveObservations(o: WriteActionCLIOptions & {
14
14
  failedGateways?: string[];
15
15
  transactionId?: string;
16
- }): Promise<import("../../types/common.js").AoMessageResult>;
16
+ }): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
17
17
  export declare function increaseOperatorStake(o: OperatorStakeCLIOptions): Promise<import("../../types/common.js").WriteOptions>;
18
- export declare function decreaseOperatorStake(o: OperatorStakeCLIOptions): Promise<import("../../types/common.js").AoMessageResult>;
19
- export declare function instantWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult>;
20
- export declare function cancelWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult>;
18
+ export declare function decreaseOperatorStake(o: OperatorStakeCLIOptions): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
19
+ export declare function instantWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
20
+ export declare function cancelWithdrawal(o: AddressAndVaultIdCLIWriteOptions): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
21
21
  export declare function delegateStake(options: TransferCLIOptions): Promise<{
22
22
  senderAddress: string;
23
- transferResult: import("../../types/common.js").AoMessageResult;
23
+ transferResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
24
24
  message: string;
25
25
  } | {
26
26
  message: string;
27
27
  }>;
28
28
  export declare function decreaseDelegateStake(options: DecreaseDelegateStakeCLIOptions): Promise<{
29
29
  targetGateway: string;
30
- decreaseDelegateStakeResult: import("../../types/common.js").AoMessageResult;
30
+ decreaseDelegateStakeResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
31
31
  message: string;
32
32
  }>;
33
33
  export declare function redelegateStake(options: RedelegateStakeCLIOptions): Promise<{
34
34
  sourceGateway: string;
35
35
  targetGateway: string;
36
- redelegateStakeResult: import("../../types/common.js").AoMessageResult;
36
+ redelegateStakeResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
37
37
  message: string;
38
38
  }>;
@@ -58,6 +58,7 @@ export declare function getCostDetails(o: GlobalCLIOptions & CLIOptionsFromAoPar
58
58
  basePrice: number;
59
59
  };
60
60
  fundingPlan?: import("../../types/io.js").AoFundingPlan;
61
+ wincQty?: string;
61
62
  }>;
62
63
  export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName>;
63
64
  export declare function getGatewayVaults(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<AoGatewayVault> | {
@@ -17,7 +17,7 @@ import { AoCreateVaultParams, AoExtendVaultParams, AoIncreaseVaultParams, AoRevo
17
17
  import { CLIWriteOptionsFromAoParams, JsonSerializable, TransferCLIOptions } from '../types.js';
18
18
  export declare function transferCLICommand(options: TransferCLIOptions): Promise<{
19
19
  senderAddress: string;
20
- transferResult: import("../../types/common.js").AoMessageResult;
20
+ transferResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
21
21
  message: string;
22
22
  } | {
23
23
  message: string;
@@ -27,14 +27,14 @@ export declare function revokeVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoR
27
27
  export declare function createVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoCreateVaultParams>): Promise<JsonSerializable>;
28
28
  export declare function extendVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoExtendVaultParams>): Promise<{
29
29
  senderAddress: string;
30
- transferResult: import("../../types/common.js").AoMessageResult;
30
+ transferResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
31
31
  message: string;
32
32
  } | {
33
33
  message: string;
34
34
  }>;
35
35
  export declare function increaseVaultCLICommand(o: CLIWriteOptionsFromAoParams<AoIncreaseVaultParams>): Promise<{
36
36
  senderAddress: string;
37
- transferResult: import("../../types/common.js").AoMessageResult;
37
+ transferResult: import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>;
38
38
  message: string;
39
39
  } | {
40
40
  message: string;
@@ -45,6 +45,10 @@ export declare const optionMap: {
45
45
  alias: string;
46
46
  description: string;
47
47
  };
48
+ paymentUrl: {
49
+ alias: string;
50
+ description: string;
51
+ };
48
52
  processId: {
49
53
  alias: string;
50
54
  description: string;
@@ -265,6 +269,11 @@ export declare const optionMap: {
265
269
  alias: string;
266
270
  description: string;
267
271
  };
272
+ token: {
273
+ alias: string;
274
+ description: string;
275
+ default: string;
276
+ };
268
277
  };
269
278
  export declare const walletOptions: {
270
279
  alias: string;
@@ -14,8 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { AoAddressParams, AoArNSNameParams, AoGetVaultParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
17
+ export type SupportedCLITokenType = 'ethereum' | 'arweave';
17
18
  export type WalletCLIOptions = {
18
19
  walletFile?: string;
20
+ token?: SupportedCLITokenType;
19
21
  privateKey?: string;
20
22
  };
21
23
  export type GlobalCLIOptions = WalletCLIOptions & {
@@ -25,6 +27,7 @@ export type GlobalCLIOptions = WalletCLIOptions & {
25
27
  debug: boolean;
26
28
  arioProcessId?: string;
27
29
  cuUrl?: string;
30
+ paymentUrl?: string;
28
31
  };
29
32
  export type WriteActionCLIOptions = GlobalCLIOptions & {
30
33
  tags?: string[];
@@ -22,6 +22,10 @@ export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKIn
22
22
  export declare function jwkToAddress(jwk: JWKInterface): string;
23
23
  export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
24
24
  export declare function readARIOFromOptions(options: GlobalCLIOptions): AoARIORead;
25
+ export declare function contractSignerFromOptions(options: WalletCLIOptions): {
26
+ signer: ContractSigner;
27
+ signerAddress: string;
28
+ } | undefined;
25
29
  export declare function requiredContractSignerFromOptions(options: WalletCLIOptions): {
26
30
  signer: ContractSigner;
27
31
  signerAddress: string;
@@ -1,5 +1,5 @@
1
1
  import { AoANTVersionsRead, AoANTVersionsWrite } from '../types/ant.js';
2
- import { WithSigner } from '../types/common.js';
2
+ import { AoMessageResult, WithSigner } from '../types/common.js';
3
3
  import { ProcessConfiguration } from '../types/io.js';
4
4
  import { AOProcess } from './contracts/ao-process.js';
5
5
  type ANTVersionsNoSigner = ProcessConfiguration;
@@ -27,16 +27,13 @@ export declare class ANTVersionsReadable implements AoANTVersionsRead {
27
27
  export declare class ANTVersionsWritable extends ANTVersionsReadable implements AoANTVersionsWrite {
28
28
  private signer;
29
29
  constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
30
- addVersion(params: {
30
+ addVersion({ version, moduleId, luaSourceId, notes, }: {
31
31
  version: string;
32
32
  moduleId: string;
33
33
  luaSourceId?: string;
34
34
  notes?: string;
35
35
  }, { tags }: {
36
36
  tags: any;
37
- }): Promise<{
38
- id: string;
39
- result?: unknown;
40
- }>;
37
+ }): Promise<AoMessageResult>;
41
38
  }
42
39
  export {};
@@ -21,3 +21,4 @@ export * from './ant-versions.js';
21
21
  export * from './faucet.js';
22
22
  export * from './io.js';
23
23
  export * from './contracts/ao-process.js';
24
+ export * from './wayfinder/index.js';
@@ -1,8 +1,9 @@
1
1
  import Arweave from 'arweave';
2
- import { ARIOWithFaucet, AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSNameDataWithName, AoArNSPurchaseParams, AoArNSReservedNameData, AoArNSReservedNameDataWithName, AoBalanceWithAddress, AoBuyRecordParams, AoCreateVaultParams, AoDelegation, AoEligibleDistribution, AoEpochData, AoEpochDistributed, AoEpochDistributionData, AoEpochDistributionTotalsData, AoEpochObservationData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGatewayWithAddress, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoJoinNetworkParams, AoMessageResult, AoPaginatedAddressParams, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoRegistrationFees, AoReturnedName, AoRevokeVaultParams, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, AoWeightedObserver, CostDetailsResult, DemandFactorSettings, EpochInput, OptionalArweave, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions, mARIOToken } from '../types/index.js';
2
+ import { ARIOWithFaucet, AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, AoArNSNameData, AoArNSNameDataWithName, AoArNSPurchaseParams, AoArNSReservedNameData, AoArNSReservedNameDataWithName, AoBalanceWithAddress, AoBuyRecordParams, AoCreateVaultParams, AoDelegation, AoEligibleDistribution, AoEpochData, AoEpochDistributed, AoEpochDistributionData, AoEpochDistributionTotalsData, AoEpochObservationData, AoEpochSettings, AoExtendLeaseParams, AoExtendVaultParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGatewayWithAddress, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoIncreaseVaultParams, AoJoinNetworkParams, AoMessageResult, AoPaginatedAddressParams, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoRegistrationFees, AoReturnedName, AoRevokeVaultParams, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoVaultData, AoVaultedTransferParams, AoWalletVault, AoWeightedObserver, CostDetailsResult, DemandFactorSettings, EpochInput, OptionalArweave, OptionalPaymentUrl, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions, mARIOToken } from '../types/index.js';
3
3
  import { AOProcess } from './contracts/ao-process.js';
4
- type ARIOConfigNoSigner = OptionalArweave<ProcessConfiguration>;
5
- type ARIOConfigWithSigner = WithSigner<OptionalArweave<ProcessConfiguration>>;
4
+ import { TurboArNSPaymentProviderAuthenticated, TurboArNSPaymentProviderUnauthenticated } from './turbo.js';
5
+ type ARIOConfigNoSigner = OptionalPaymentUrl<OptionalArweave<ProcessConfiguration>>;
6
+ type ARIOConfigWithSigner = WithSigner<OptionalPaymentUrl<OptionalArweave<ProcessConfiguration>>>;
6
7
  export declare class ARIO {
7
8
  static init(): AoARIORead;
8
9
  static init(config: ARIOConfigWithSigner): AoARIOWrite;
@@ -26,7 +27,8 @@ export declare class ARIOReadable implements AoARIORead {
26
27
  readonly process: AOProcess;
27
28
  protected epochSettings: AoEpochSettings | undefined;
28
29
  protected arweave: Arweave;
29
- constructor(config?: OptionalArweave<ProcessConfiguration>);
30
+ protected paymentProvider: TurboArNSPaymentProviderUnauthenticated;
31
+ constructor(config?: ARIOConfigNoSigner);
30
32
  getInfo(): Promise<{
31
33
  Name: string;
32
34
  Ticker: string;
@@ -41,8 +43,8 @@ export declare class ARIOReadable implements AoARIORead {
41
43
  private computeCurrentEpochIndex;
42
44
  private computeEpochIndex;
43
45
  getEpochSettings(): Promise<AoEpochSettings>;
44
- getEpoch(epoch: EpochInput): Promise<AoEpochData<AoEpochDistributed>>;
45
46
  getEpoch(): Promise<AoEpochData<AoEpochDistributionTotalsData>>;
47
+ getEpoch(epoch: EpochInput): Promise<AoEpochData<AoEpochDistributed>>;
46
48
  getArNSRecord({ name }: {
47
49
  name: string;
48
50
  }): Promise<AoArNSNameData>;
@@ -139,9 +141,9 @@ export declare class ARIOReadable implements AoARIORead {
139
141
  getAllGatewayVaults(params?: PaginationParams<AoAllGatewayVaults>): Promise<PaginationResult<AoAllGatewayVaults>>;
140
142
  }
141
143
  export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
142
- readonly process: AOProcess;
143
144
  private signer;
144
- constructor({ signer, ...config }: ARIOConfigWithSigner);
145
+ protected paymentProvider: TurboArNSPaymentProviderAuthenticated | TurboArNSPaymentProviderUnauthenticated;
146
+ constructor({ signer, paymentUrl, ...config }: ARIOConfigWithSigner);
145
147
  transfer({ target, qty, }: {
146
148
  target: string;
147
149
  qty: number | mARIOToken;
@@ -0,0 +1,62 @@
1
+ import { AxiosInstance, RawAxiosRequestHeaders } from 'axios';
2
+ import { AoMessageResult, TransactionId, TurboArNSSigner } from '../types/common.js';
3
+ import { AoTokenCostParams } from '../types/io.js';
4
+ import { mARIOToken } from '../types/token.js';
5
+ import { ILogger } from './logger.js';
6
+ export interface TurboUnauthenticatedConfig {
7
+ paymentUrl?: string;
8
+ logger?: ILogger;
9
+ axios?: AxiosInstance;
10
+ }
11
+ export interface TurboAuthenticatedConfig extends TurboUnauthenticatedConfig {
12
+ signer: TurboArNSSigner;
13
+ }
14
+ export declare function signedRequestHeadersFromSigner({ signer, nonce, }: {
15
+ signer: TurboArNSSigner;
16
+ nonce?: string;
17
+ }): Promise<RawAxiosRequestHeaders>;
18
+ export type ArNSPurchaseReceipt = AoTokenCostParams & {
19
+ wincQty: string;
20
+ mARIOQty: string;
21
+ usdArRate: number;
22
+ createdDate: string;
23
+ };
24
+ export interface ArNSPaymentProvider {
25
+ /** Returns the cost of the action in the Payment Provider's native currency (winc for Turbo) */
26
+ getPrice(params: AoTokenCostParams): Promise<number>;
27
+ getArNSPriceDetails(params: AoTokenCostParams): Promise<{
28
+ winc: string;
29
+ mARIO: mARIOToken;
30
+ }>;
31
+ }
32
+ export interface ArNSAuthenticatedPaymentProvider extends ArNSPaymentProvider {
33
+ initiateArNSPurchase(params: AoTokenCostParams & {
34
+ processId?: TransactionId;
35
+ }): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
36
+ }
37
+ export declare class TurboArNSPaymentFactory {
38
+ static init(): TurboArNSPaymentProviderUnauthenticated;
39
+ static init({ paymentUrl, axios, logger, }: TurboUnauthenticatedConfig & {
40
+ signer?: TurboArNSSigner;
41
+ }): TurboArNSPaymentProviderUnauthenticated;
42
+ static init({ signer, paymentUrl, axios, logger, }: TurboAuthenticatedConfig): TurboArNSPaymentProviderAuthenticated;
43
+ }
44
+ export declare class TurboArNSPaymentProviderUnauthenticated implements ArNSPaymentProvider {
45
+ protected readonly paymentUrl: string;
46
+ protected readonly axios: AxiosInstance;
47
+ protected readonly logger: ILogger;
48
+ constructor({ paymentUrl, axios, logger, }: TurboUnauthenticatedConfig);
49
+ getArNSPriceDetails({ intent, name, quantity, type, years, }: AoTokenCostParams): Promise<{
50
+ winc: string;
51
+ mARIO: mARIOToken;
52
+ }>;
53
+ getPrice(params: AoTokenCostParams): Promise<number>;
54
+ }
55
+ export declare class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProviderUnauthenticated implements ArNSAuthenticatedPaymentProvider {
56
+ private readonly signer;
57
+ constructor({ signer, ...restConfig }: TurboAuthenticatedConfig);
58
+ initiateArNSPurchase({ intent, name, quantity, type, processId, years, }: AoTokenCostParams & {
59
+ processId?: TransactionId;
60
+ }): Promise<AoMessageResult<ArNSPurchaseReceipt>>;
61
+ }
62
+ export declare function isTurboArNSSigner(signer: unknown): signer is TurboArNSSigner;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AoARIORead, AoGatewayWithAddress } from '../../types/io.js';
17
+ export interface GatewaysProvider {
18
+ getGateways(): Promise<AoGatewayWithAddress[]>;
19
+ }
20
+ export declare class ARIOGatewaysProvider implements GatewaysProvider {
21
+ private ario;
22
+ constructor({ ario }: {
23
+ ario: AoARIORead;
24
+ });
25
+ getGateways(): Promise<AoGatewayWithAddress[]>;
26
+ }
27
+ export declare class StaticGatewaysProvider implements GatewaysProvider {
28
+ private gateways;
29
+ constructor({ gateways }: {
30
+ gateways: AoGatewayWithAddress[];
31
+ });
32
+ getGateways(): Promise<AoGatewayWithAddress[]>;
33
+ }
34
+ export declare class SimpleCacheGatewaysProvider implements GatewaysProvider {
35
+ private gatewaysProvider;
36
+ private ttlSeconds;
37
+ private lastUpdated;
38
+ private gatewaysCache;
39
+ constructor({ gatewaysProvider, ttlSeconds, }: {
40
+ gatewaysProvider: GatewaysProvider;
41
+ ttlSeconds?: number;
42
+ });
43
+ getGateways(): Promise<AoGatewayWithAddress[]>;
44
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export * from './wayfinder.js';
17
+ export * from './routers/random.js';
18
+ export * from './routers/priority.js';
19
+ export * from './routers/fixed.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { WayfinderRouter } from '../../../types/wayfinder.js';
17
+ export declare class FixedGatewayRouter implements WayfinderRouter {
18
+ readonly name = "fixed";
19
+ private gateway;
20
+ constructor({ gateway }: {
21
+ gateway: URL;
22
+ });
23
+ getTargetGateway(): Promise<URL>;
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { WayfinderRouter } from '../../../types/wayfinder.js';
17
+ import { GatewaysProvider } from '../gateways.js';
18
+ export declare class PriorityGatewayRouter implements WayfinderRouter {
19
+ readonly name = "priority";
20
+ private gatewaysProvider;
21
+ private limit;
22
+ private sortBy;
23
+ private sortOrder;
24
+ private blocklist;
25
+ constructor({ gatewaysProvider, limit, sortBy, sortOrder, blocklist, }: {
26
+ gatewaysProvider: GatewaysProvider;
27
+ limit?: number;
28
+ sortBy?: 'totalDelegatedStake' | 'operatorStake' | 'startTimestamp';
29
+ sortOrder?: 'asc' | 'desc';
30
+ blocklist?: string[];
31
+ });
32
+ getTargetGateway(): Promise<URL>;
33
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { WayfinderRouter } from '../../../types/wayfinder.js';
17
+ import { GatewaysProvider } from '../gateways.js';
18
+ export declare class RandomGatewayRouter implements WayfinderRouter {
19
+ readonly name = "random";
20
+ private gatewaysProvider;
21
+ private blocklist;
22
+ constructor({ gatewaysProvider, blocklist, }: {
23
+ gatewaysProvider: GatewaysProvider;
24
+ blocklist?: string[];
25
+ });
26
+ getTargetGateway(): Promise<URL>;
27
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { WayfinderRouter } from '../../../types/wayfinder.js';
17
+ export declare class SimpleCacheRouter implements WayfinderRouter {
18
+ readonly name: 'simple-cache';
19
+ private lastUpdatedTimestamp;
20
+ private ttlSeconds;
21
+ private targetGateway;
22
+ private router;
23
+ constructor({ router, ttlSeconds, }: {
24
+ router: WayfinderRouter;
25
+ ttlSeconds?: number;
26
+ });
27
+ getTargetGateway(): Promise<URL>;
28
+ }