@ar.io/sdk 3.10.0-alpha.6 → 3.10.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 (104) hide show
  1. package/README.md +66 -125
  2. package/bundles/web.bundle.min.js +147 -126
  3. package/lib/cjs/cli/commands/antCommands.js +3 -4
  4. package/lib/cjs/cli/commands/arnsPurchaseCommands.js +5 -6
  5. package/lib/cjs/cli/commands/gatewayWriteCommands.js +11 -12
  6. package/lib/cjs/cli/commands/readCommands.js +21 -22
  7. package/lib/cjs/cli/commands/transfer.js +6 -7
  8. package/lib/cjs/cli/options.js +0 -12
  9. package/lib/cjs/cli/utils.js +52 -74
  10. package/lib/cjs/common/ant-versions.js +5 -5
  11. package/lib/cjs/common/faucet.js +2 -2
  12. package/lib/cjs/common/index.js +0 -2
  13. package/lib/cjs/common/io.js +5 -64
  14. package/lib/cjs/types/ant.js +2 -13
  15. package/lib/cjs/types/index.js +0 -1
  16. package/lib/cjs/types/io.js +5 -5
  17. package/lib/cjs/utils/ao.js +9 -14
  18. package/lib/cjs/utils/arweave.js +4 -4
  19. package/lib/cjs/utils/base64.js +4 -5
  20. package/lib/cjs/utils/json.js +1 -2
  21. package/lib/cjs/utils/schema.js +1 -2
  22. package/lib/cjs/version.js +1 -1
  23. package/lib/cjs/web/index.js +1 -3
  24. package/lib/esm/cli/options.js +0 -12
  25. package/lib/esm/cli/utils.js +10 -31
  26. package/lib/esm/common/ant-versions.js +5 -5
  27. package/lib/esm/common/index.js +0 -2
  28. package/lib/esm/common/io.js +5 -64
  29. package/lib/esm/types/ant.js +0 -11
  30. package/lib/esm/types/index.js +0 -1
  31. package/lib/esm/types/io.js +1 -1
  32. package/lib/esm/utils/ao.js +0 -5
  33. package/lib/esm/version.js +1 -1
  34. package/lib/esm/web/index.js +1 -1
  35. package/lib/types/cli/commands/antCommands.d.ts +3 -3
  36. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +1 -1
  37. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +9 -9
  38. package/lib/types/cli/commands/readCommands.d.ts +3 -4
  39. package/lib/types/cli/commands/transfer.d.ts +3 -3
  40. package/lib/types/cli/options.d.ts +0 -9
  41. package/lib/types/cli/types.d.ts +0 -3
  42. package/lib/types/cli/utils.d.ts +0 -4
  43. package/lib/types/common/ant-versions.d.ts +6 -3
  44. package/lib/types/common/http.d.ts +0 -1
  45. package/lib/types/common/index.d.ts +0 -1
  46. package/lib/types/common/io.d.ts +9 -15
  47. package/lib/types/types/ant.d.ts +1 -53
  48. package/lib/types/types/common.d.ts +2 -8
  49. package/lib/types/types/index.d.ts +0 -1
  50. package/lib/types/types/io.d.ts +7 -9
  51. package/lib/types/types/token.d.ts +0 -2
  52. package/lib/types/utils/ao.d.ts +12 -1
  53. package/lib/types/utils/base64.d.ts +0 -2
  54. package/lib/types/version.d.ts +1 -1
  55. package/lib/types/web/index.d.ts +1 -1
  56. package/package.json +3 -5
  57. package/lib/cjs/common/turbo.js +0 -208
  58. package/lib/cjs/common/wayfinder/gateways.js +0 -75
  59. package/lib/cjs/common/wayfinder/index.js +0 -36
  60. package/lib/cjs/common/wayfinder/routers/fixed.js +0 -14
  61. package/lib/cjs/common/wayfinder/routers/fixed.test.js +0 -14
  62. package/lib/cjs/common/wayfinder/routers/priority.js +0 -38
  63. package/lib/cjs/common/wayfinder/routers/priority.test.js +0 -155
  64. package/lib/cjs/common/wayfinder/routers/random.js +0 -23
  65. package/lib/cjs/common/wayfinder/routers/random.test.js +0 -104
  66. package/lib/cjs/common/wayfinder/routers/simple-cache.js +0 -25
  67. package/lib/cjs/common/wayfinder/routers/simple-cache.test.js +0 -41
  68. package/lib/cjs/common/wayfinder/wayfinder.js +0 -194
  69. package/lib/cjs/common/wayfinder/wayfinder.test.js +0 -254
  70. package/lib/cjs/types/wayfinder.js +0 -2
  71. package/lib/cjs/utils/url.js +0 -28
  72. package/lib/cjs/utils/url.test.js +0 -24
  73. package/lib/esm/common/turbo.js +0 -200
  74. package/lib/esm/common/wayfinder/gateways.js +0 -69
  75. package/lib/esm/common/wayfinder/index.js +0 -20
  76. package/lib/esm/common/wayfinder/routers/fixed.js +0 -10
  77. package/lib/esm/common/wayfinder/routers/fixed.test.js +0 -12
  78. package/lib/esm/common/wayfinder/routers/priority.js +0 -34
  79. package/lib/esm/common/wayfinder/routers/priority.test.js +0 -153
  80. package/lib/esm/common/wayfinder/routers/random.js +0 -19
  81. package/lib/esm/common/wayfinder/routers/random.test.js +0 -102
  82. package/lib/esm/common/wayfinder/routers/simple-cache.js +0 -21
  83. package/lib/esm/common/wayfinder/routers/simple-cache.test.js +0 -39
  84. package/lib/esm/common/wayfinder/wayfinder.js +0 -187
  85. package/lib/esm/common/wayfinder/wayfinder.test.js +0 -249
  86. package/lib/esm/types/wayfinder.js +0 -1
  87. package/lib/esm/utils/url.js +0 -24
  88. package/lib/esm/utils/url.test.js +0 -19
  89. package/lib/types/common/turbo.d.ts +0 -62
  90. package/lib/types/common/wayfinder/gateways.d.ts +0 -44
  91. package/lib/types/common/wayfinder/index.d.ts +0 -19
  92. package/lib/types/common/wayfinder/routers/fixed.d.ts +0 -25
  93. package/lib/types/common/wayfinder/routers/fixed.test.d.ts +0 -1
  94. package/lib/types/common/wayfinder/routers/priority.d.ts +0 -34
  95. package/lib/types/common/wayfinder/routers/priority.test.d.ts +0 -1
  96. package/lib/types/common/wayfinder/routers/random.d.ts +0 -28
  97. package/lib/types/common/wayfinder/routers/random.test.d.ts +0 -1
  98. package/lib/types/common/wayfinder/routers/simple-cache.d.ts +0 -29
  99. package/lib/types/common/wayfinder/routers/simple-cache.test.d.ts +0 -1
  100. package/lib/types/common/wayfinder/wayfinder.d.ts +0 -106
  101. package/lib/types/common/wayfinder/wayfinder.test.d.ts +0 -1
  102. package/lib/types/types/wayfinder.d.ts +0 -20
  103. package/lib/types/utils/url.d.ts +0 -19
  104. package/lib/types/utils/url.test.d.ts +0 -1
@@ -54,11 +54,10 @@ export declare function getCostDetails(o: GlobalCLIOptions & CLIOptionsFromAoPar
54
54
  message: string;
55
55
  tokenCost: number;
56
56
  discounts: import("../../types/io.js").CostDiscount[];
57
- returnedNameDetails?: (import("../../types/io.js").AoReturnedName & {
57
+ returnedNameDetails?: import("../../types/io.js").AoReturnedName & {
58
58
  basePrice: number;
59
- }) | undefined;
60
- fundingPlan?: import("../../types/io.js").AoFundingPlan | undefined;
61
- wincQty?: string | undefined;
59
+ };
60
+ fundingPlan?: import("../../types/io.js").AoFundingPlan;
62
61
  }>;
63
62
  export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<import("../../types/common.js").AoPrimaryName>;
64
63
  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<Record<string, string | number | boolean | null>>;
20
+ transferResult: import("../../types/common.js").AoMessageResult;
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<Record<string, string | number | boolean | null>>;
30
+ transferResult: import("../../types/common.js").AoMessageResult;
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<Record<string, string | number | boolean | null>>;
37
+ transferResult: import("../../types/common.js").AoMessageResult;
38
38
  message: string;
39
39
  } | {
40
40
  message: string;
@@ -45,10 +45,6 @@ export declare const optionMap: {
45
45
  alias: string;
46
46
  description: string;
47
47
  };
48
- paymentUrl: {
49
- alias: string;
50
- description: string;
51
- };
52
48
  processId: {
53
49
  alias: string;
54
50
  description: string;
@@ -269,11 +265,6 @@ export declare const optionMap: {
269
265
  alias: string;
270
266
  description: string;
271
267
  };
272
- token: {
273
- alias: string;
274
- description: string;
275
- default: string;
276
- };
277
268
  };
278
269
  export declare const walletOptions: {
279
270
  alias: string;
@@ -14,10 +14,8 @@
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';
18
17
  export type WalletCLIOptions = {
19
18
  walletFile?: string;
20
- token?: SupportedCLITokenType;
21
19
  privateKey?: string;
22
20
  };
23
21
  export type GlobalCLIOptions = WalletCLIOptions & {
@@ -27,7 +25,6 @@ export type GlobalCLIOptions = WalletCLIOptions & {
27
25
  debug: boolean;
28
26
  arioProcessId?: string;
29
27
  cuUrl?: string;
30
- paymentUrl?: string;
31
28
  };
32
29
  export type WriteActionCLIOptions = GlobalCLIOptions & {
33
30
  tags?: string[];
@@ -22,10 +22,6 @@ 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;
29
25
  export declare function requiredContractSignerFromOptions(options: WalletCLIOptions): {
30
26
  signer: ContractSigner;
31
27
  signerAddress: string;
@@ -1,5 +1,5 @@
1
1
  import { AoANTVersionsRead, AoANTVersionsWrite } from '../types/ant.js';
2
- import { AoMessageResult, WithSigner } from '../types/common.js';
2
+ import { 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,13 +27,16 @@ 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({ version, moduleId, luaSourceId, notes, }: {
30
+ addVersion(params: {
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<AoMessageResult>;
37
+ }): Promise<{
38
+ id: string;
39
+ result?: unknown;
40
+ }>;
38
41
  }
39
42
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { HTTPClient } from '../types/index.js';
3
2
  import { ILogger } from './logger.js';
4
3
  export declare class AxiosHTTPService implements HTTPClient {
@@ -21,4 +21,3 @@ 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,20 +1,15 @@
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, OptionalPaymentUrl, 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, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions, mARIOToken } from '../types/index.js';
3
3
  import { AOProcess } from './contracts/ao-process.js';
4
- import { TurboArNSPaymentProviderAuthenticated, TurboArNSPaymentProviderUnauthenticated } from './turbo.js';
5
- type ARIOConfigNoSigner = OptionalPaymentUrl<OptionalArweave<ProcessConfiguration>>;
6
- type ARIOConfigWithSigner = WithSigner<OptionalPaymentUrl<OptionalArweave<ProcessConfiguration>>>;
4
+ type ARIOConfigNoSigner = OptionalArweave<ProcessConfiguration>;
5
+ type ARIOConfigWithSigner = WithSigner<OptionalArweave<ProcessConfiguration>>;
7
6
  export declare class ARIO {
8
7
  static init(): AoARIORead;
9
8
  static init(config: ARIOConfigWithSigner): AoARIOWrite;
10
9
  static init(config: ARIOConfigNoSigner): AoARIORead;
11
10
  static mainnet(): AoARIORead;
12
- static mainnet(config: ARIOConfigNoSigner & {
13
- faucetUrl?: string;
14
- }): AoARIORead;
15
- static mainnet(config: ARIOConfigWithSigner & {
16
- faucetUrl?: string;
17
- }): AoARIOWrite;
11
+ static mainnet(config: ARIOConfigNoSigner): AoARIORead;
12
+ static mainnet(config: ARIOConfigWithSigner): AoARIOWrite;
18
13
  static testnet(): ARIOWithFaucet<AoARIORead>;
19
14
  static testnet(config: ARIOConfigNoSigner & {
20
15
  faucetUrl?: string;
@@ -27,8 +22,7 @@ export declare class ARIOReadable implements AoARIORead {
27
22
  readonly process: AOProcess;
28
23
  protected epochSettings: AoEpochSettings | undefined;
29
24
  protected arweave: Arweave;
30
- protected paymentProvider: TurboArNSPaymentProviderUnauthenticated;
31
- constructor(config?: ARIOConfigNoSigner);
25
+ constructor(config?: OptionalArweave<ProcessConfiguration>);
32
26
  getInfo(): Promise<{
33
27
  Name: string;
34
28
  Ticker: string;
@@ -43,8 +37,8 @@ export declare class ARIOReadable implements AoARIORead {
43
37
  private computeCurrentEpochIndex;
44
38
  private computeEpochIndex;
45
39
  getEpochSettings(): Promise<AoEpochSettings>;
46
- getEpoch(): Promise<AoEpochData<AoEpochDistributionTotalsData>>;
47
40
  getEpoch(epoch: EpochInput): Promise<AoEpochData<AoEpochDistributed>>;
41
+ getEpoch(): Promise<AoEpochData<AoEpochDistributionTotalsData>>;
48
42
  getArNSRecord({ name }: {
49
43
  name: string;
50
44
  }): Promise<AoArNSNameData>;
@@ -141,9 +135,9 @@ export declare class ARIOReadable implements AoARIORead {
141
135
  getAllGatewayVaults(params?: PaginationParams<AoAllGatewayVaults>): Promise<PaginationResult<AoAllGatewayVaults>>;
142
136
  }
143
137
  export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
138
+ readonly process: AOProcess;
144
139
  private signer;
145
- protected paymentProvider: TurboArNSPaymentProviderAuthenticated | TurboArNSPaymentProviderUnauthenticated;
146
- constructor({ signer, paymentUrl, ...config }: ARIOConfigWithSigner);
140
+ constructor({ signer, ...config }: ARIOConfigWithSigner);
147
141
  transfer({ target, qty, }: {
148
142
  target: string;
149
143
  qty: number | mARIOToken;
@@ -127,63 +127,11 @@ export declare const AntStateSchema: z.ZodObject<{
127
127
  Initialized: boolean;
128
128
  }>;
129
129
  export type AoANTState = z.infer<typeof AntStateSchema>;
130
- export declare const SpawnANTStateSchema: z.ZodObject<{
131
- name: z.ZodString;
132
- ticker: z.ZodString;
133
- description: z.ZodString;
134
- keywords: z.ZodArray<z.ZodString, "many">;
135
- owner: z.ZodString;
136
- controllers: z.ZodArray<z.ZodString, "many">;
137
- records: z.ZodRecord<z.ZodString, z.ZodObject<{
138
- transactionId: z.ZodEffects<z.ZodString, string, string>;
139
- ttlSeconds: z.ZodNumber;
140
- priority: z.ZodOptional<z.ZodNumber>;
141
- }, "strip", z.ZodTypeAny, {
142
- transactionId: string;
143
- ttlSeconds: number;
144
- priority?: number | undefined;
145
- }, {
146
- transactionId: string;
147
- ttlSeconds: number;
148
- priority?: number | undefined;
149
- }>>;
150
- balances: z.ZodRecord<z.ZodString, z.ZodNumber>;
151
- logo: z.ZodEffects<z.ZodString, string, string>;
152
- }, "strip", z.ZodTypeAny, {
153
- description: string;
154
- name: string;
155
- ticker: string;
156
- keywords: string[];
157
- owner: string;
158
- controllers: string[];
159
- records: Record<string, {
160
- transactionId: string;
161
- ttlSeconds: number;
162
- priority?: number | undefined;
163
- }>;
164
- balances: Record<string, number>;
165
- logo: string;
166
- }, {
167
- description: string;
168
- name: string;
169
- ticker: string;
170
- keywords: string[];
171
- owner: string;
172
- controllers: string[];
173
- records: Record<string, {
174
- transactionId: string;
175
- ttlSeconds: number;
176
- priority?: number | undefined;
177
- }>;
178
- balances: Record<string, number>;
179
- logo: string;
180
- }>;
181
- export type SpawnANTState = z.infer<typeof SpawnANTStateSchema>;
182
130
  export declare const AntReadHandlers: readonly ["balance", "balances", "totalSupply", "info", "controllers", "record", "records", "state"];
183
131
  export type AoANTReadHandler = (typeof AntReadHandlers)[number];
184
132
  export declare const AntWriteHandlers: readonly ["_eval", "_default", "transfer", "addController", "removeController", "setRecord", "removeRecord", "setName", "setTicker", "setDescription", "setKeywords", "setLogo", "initializeState", "releaseName", "reassignName", "approvePrimaryName", "removePrimaryNames"];
185
133
  export type AoANTWriteHandler = (typeof AntWriteHandlers)[number];
186
- export declare const AntHandlerNames: ("controllers" | "records" | "balances" | "balance" | "totalSupply" | "info" | "record" | "state" | "_eval" | "_default" | "transfer" | "addController" | "removeController" | "setRecord" | "removeRecord" | "setName" | "setTicker" | "setDescription" | "setKeywords" | "setLogo" | "initializeState" | "releaseName" | "reassignName" | "approvePrimaryName" | "removePrimaryNames")[];
134
+ export declare const AntHandlerNames: ("balance" | "balances" | "totalSupply" | "info" | "controllers" | "record" | "records" | "state" | "_eval" | "_default" | "transfer" | "addController" | "removeController" | "setRecord" | "removeRecord" | "setName" | "setTicker" | "setDescription" | "setKeywords" | "setLogo" | "initializeState" | "releaseName" | "reassignName" | "approvePrimaryName" | "removePrimaryNames")[];
187
135
  export type AoANTHandler = AoANTWriteHandler | AoANTReadHandler;
188
136
  export declare const AntHandlersSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
189
137
  export declare const AntInfoSchema: z.ZodObject<{
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
4
3
  *
@@ -14,7 +13,7 @@
14
13
  * See the License for the specific language governing permissions and
15
14
  * limitations under the License.
16
15
  */
17
- import { ArconnectSigner, ArweaveSigner, EthereumSigner, InjectedEthereumSigner, Signer } from '@dha-team/arbundles';
16
+ import { Signer } from '@dha-team/arbundles';
18
17
  import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
19
18
  import Arweave from 'arweave';
20
19
  import { AoSigner } from './token.js';
@@ -27,10 +26,6 @@ export type ProcessId = string;
27
26
  export type OptionalArweave<T = NonNullable<unknown>> = {
28
27
  arweave?: Arweave;
29
28
  } & T;
30
- export type OptionalPaymentUrl<T = NonNullable<unknown>> = {
31
- paymentUrl?: string;
32
- } & T;
33
- export type TurboArNSSigner = EthereumSigner | InjectedEthereumSigner | ArweaveSigner | ArconnectSigner | Window['arweaveWallet'];
34
29
  export type ContractSigner = Signer | Window['arweaveWallet'] | AoSigner;
35
30
  export type WithSigner<T = NonNullable<unknown>> = {
36
31
  signer: ContractSigner;
@@ -49,9 +44,8 @@ export type WriteOptions = {
49
44
  }[];
50
45
  };
51
46
  export type WriteParameters<Input> = WithSigner<Required<ReadParameters<Input>>>;
52
- export type AoMessageResult<T = Record<string, string | number | boolean | null>> = {
47
+ export type AoMessageResult = {
53
48
  id: string;
54
- result?: T;
55
49
  };
56
50
  export type AoPrimaryNameRequest = {
57
51
  name: string;
@@ -19,4 +19,3 @@ export * from './common.js';
19
19
  export * from './faucet.js';
20
20
  export * from './io.js';
21
21
  export * from './token.js';
22
- export * from './wayfinder.js';
@@ -301,7 +301,7 @@ export type AoRedelegateStakeParams = {
301
301
  export declare const validIntents: readonly ["Buy-Name", "Buy-Record", "Extend-Lease", "Increase-Undername-Limit", "Upgrade-Name", "Primary-Name-Request"];
302
302
  export declare const intentsUsingYears: readonly ["Buy-Record", "Buy-Name", "Extend-Lease"];
303
303
  export type Intent = (typeof validIntents)[number];
304
- export declare const isValidIntent: (intent: string) => intent is "Buy-Name" | "Buy-Record" | "Extend-Lease" | "Increase-Undername-Limit" | "Upgrade-Name" | "Primary-Name-Request";
304
+ export declare const isValidIntent: (intent: string) => intent is Intent;
305
305
  export type AoTokenCostParams = {
306
306
  intent: Intent;
307
307
  type?: 'permabuy' | 'lease';
@@ -310,9 +310,9 @@ export type AoTokenCostParams = {
310
310
  quantity?: number;
311
311
  fromAddress?: WalletAddress;
312
312
  };
313
- export declare const fundFromOptions: readonly ["balance", "stakes", "any", "turbo"];
313
+ export declare const fundFromOptions: readonly ["balance", "stakes", "any"];
314
314
  export type FundFrom = (typeof fundFromOptions)[number];
315
- export declare const isValidFundFrom: (fundFrom: string) => fundFrom is "balance" | "stakes" | "any" | "turbo";
315
+ export declare const isValidFundFrom: (fundFrom: string) => fundFrom is FundFrom;
316
316
  export type AoGetCostDetailsParams = AoTokenCostParams & {
317
317
  fundFrom?: FundFrom;
318
318
  };
@@ -338,7 +338,6 @@ export type CostDetailsResult = {
338
338
  basePrice: number;
339
339
  };
340
340
  fundingPlan?: AoFundingPlan;
341
- wincQty?: string;
342
341
  };
343
342
  export type AoGetVaultParams = {
344
343
  address: WalletAddress;
@@ -421,7 +420,6 @@ export type DemandFactorSettings = {
421
420
  criteria: string;
422
421
  };
423
422
  export interface AoARIORead {
424
- process: AOProcess;
425
423
  getInfo(): Promise<{
426
424
  Ticker: string;
427
425
  Name: string;
@@ -525,10 +523,10 @@ export interface AoARIOWrite extends AoARIORead {
525
523
  reportTxId: TransactionId;
526
524
  failedGateways: WalletAddress[];
527
525
  }>;
528
- buyRecord: AoWriteAction<AoBuyRecordParams, AoMessageResult>;
529
- upgradeRecord: AoWriteAction<AoArNSPurchaseParams, AoMessageResult>;
530
- extendLease: AoWriteAction<AoExtendLeaseParams, AoMessageResult>;
531
- increaseUndernameLimit: AoWriteAction<AoIncreaseUndernameLimitParams, AoMessageResult>;
526
+ buyRecord: AoWriteAction<AoBuyRecordParams>;
527
+ upgradeRecord: AoWriteAction<AoArNSPurchaseParams>;
528
+ extendLease: AoWriteAction<AoExtendLeaseParams>;
529
+ increaseUndernameLimit: AoWriteAction<AoIncreaseUndernameLimitParams>;
532
530
  cancelWithdrawal: AoWriteAction<{
533
531
  gatewayAddress?: WalletAddress;
534
532
  vaultId: string;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  interface Equatable<T> {
4
2
  equals(other: T): boolean;
5
3
  }
@@ -1,7 +1,18 @@
1
1
  import Arweave from 'arweave';
2
2
  import { Logger } from '../common/index.js';
3
- import { SpawnANTState } from '../types/ant.js';
3
+ import { AoANTRecord } from '../types/ant.js';
4
4
  import { AoClient, AoEpochData, AoEpochDistributed, AoSigner, ContractSigner, WalletAddress } from '../types/index.js';
5
+ export type SpawnANTState = {
6
+ owner: WalletAddress;
7
+ controllers: WalletAddress[];
8
+ name: string;
9
+ description: string;
10
+ keywords: string[];
11
+ ticker: string;
12
+ records: Record<string, AoANTRecord>;
13
+ balances: Record<WalletAddress, number>;
14
+ logo: string;
15
+ };
5
16
  export type SpawnANTParams = {
6
17
  signer: AoSigner;
7
18
  module?: string;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export declare function fromB64Url(str: string): Buffer;
4
2
  export declare function toB64Url(buffer: Buffer): string;
5
3
  export declare function sha256B64Url(input: Buffer): string;
@@ -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 = "3.10.0-alpha.5";
16
+ export declare const version = "3.10.0";
@@ -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, InjectedEthereumSigner, EthereumSigner, } from '@dha-team/arbundles';
16
+ export { ArweaveSigner, ArconnectSigner } from '@dha-team/arbundles';
17
17
  export * from '../types/index.js';
18
18
  export * from '../common/index.js';
19
19
  export * from '../constants.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.10.0-alpha.6",
3
+ "version": "3.10.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -72,7 +72,7 @@
72
72
  "test:cjs": "yarn build:cjs && yarn link && cd ./tests/e2e/cjs && yarn && yarn test",
73
73
  "test:esm": "yarn build:esm && yarn link && cd ./tests/e2e/esm && yarn && yarn test",
74
74
  "test:web": "yarn build:esm && yarn link && cd ./tests/e2e/web && yarn && yarn test",
75
- "test:unit": "node --import=./register.mjs --test --test-reporter=spec 'src/**/*.test.ts'",
75
+ "test:unit": "node --import=./register.mjs --test --test-reporter=spec src/**/**.test.ts",
76
76
  "test:link": "yarn build && yarn link",
77
77
  "test:e2e": "yarn test:cjs && yarn test:esm && yarn test:web",
78
78
  "test:integration": "yarn build:esm && yarn link && cd ./tests/integration && yarn && yarn test",
@@ -92,7 +92,7 @@
92
92
  "@semantic-release/git": "^10.0.1",
93
93
  "@semantic-release/npm": "^11.0.3",
94
94
  "@trivago/prettier-plugin-sort-imports": "^4.2.0",
95
- "@types/node": "^22.14.1",
95
+ "@types/node": "^20.12.12",
96
96
  "@types/prompts": "^2.4.9",
97
97
  "@types/sinon": "^10.0.15",
98
98
  "@typescript-eslint/eslint-plugin": "^5.62.0",
@@ -110,7 +110,6 @@
110
110
  "eslint-plugin-n": "^16.0.1",
111
111
  "eslint-plugin-prettier": "^5.0.0",
112
112
  "eslint-plugin-promise": "^6.1.1",
113
- "got": "^12.4.7",
114
113
  "http-server": "^14.1.1",
115
114
  "husky": "^8.0.3",
116
115
  "lint-staged": "^15.2.2",
@@ -134,7 +133,6 @@
134
133
  "eventemitter3": "^5.0.1",
135
134
  "plimit-lit": "^3.0.1",
136
135
  "prompts": "^2.4.2",
137
- "uuid": "^11.1.0",
138
136
  "winston": "^3.13.0",
139
137
  "zod": "^3.23.8"
140
138
  },
@@ -1,208 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTurboArNSSigner = exports.TurboArNSPaymentProviderAuthenticated = exports.TurboArNSPaymentProviderUnauthenticated = exports.TurboArNSPaymentFactory = exports.signedRequestHeadersFromSigner = void 0;
4
- /**
5
- * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
- *
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- const arbundles_1 = require("@dha-team/arbundles");
20
- const uuid_1 = require("uuid");
21
- const token_js_1 = require("../types/token.js");
22
- const base64_js_1 = require("../utils/base64.js");
23
- const http_client_js_1 = require("../utils/http-client.js");
24
- const url_js_1 = require("../utils/url.js");
25
- const logger_js_1 = require("./logger.js");
26
- async function signedRequestHeadersFromSigner({ signer, nonce = (0, uuid_1.v4)(), }) {
27
- let signature = undefined;
28
- let publicKey = undefined;
29
- const signatureType = isWanderArweaveBrowserSigner(signer)
30
- ? arbundles_1.SignatureConfig.ARWEAVE
31
- : signer.signatureType;
32
- // equivalent to window.arweaveWallet
33
- if (isWanderArweaveBrowserSigner(signer)) {
34
- signature = (0, base64_js_1.toB64Url)(Buffer.from(await signer.signMessage(Uint8Array.from(Buffer.from(nonce)))));
35
- }
36
- else if (signer instanceof arbundles_1.ArconnectSigner) {
37
- signature = (0, base64_js_1.toB64Url)(Buffer.from(await signer['signer'].signMessage(Uint8Array.from(Buffer.from(nonce)))));
38
- }
39
- else if (signer instanceof arbundles_1.ArweaveSigner ||
40
- signer instanceof arbundles_1.EthereumSigner ||
41
- signer instanceof arbundles_1.InjectedEthereumSigner) {
42
- if ('setPublicKey' in signer && signer['publicKey'] === undefined) {
43
- await signer.setPublicKey();
44
- }
45
- signature = (0, base64_js_1.toB64Url)(Buffer.from(await signer.sign(Uint8Array.from(Buffer.from(nonce)))));
46
- }
47
- switch (signatureType) {
48
- case arbundles_1.SignatureConfig.ARWEAVE:
49
- if (isWanderArweaveBrowserSigner(signer)) {
50
- publicKey = await signer.getActivePublicKey();
51
- }
52
- else if ('setPublicKey' in signer) {
53
- await signer.setPublicKey();
54
- publicKey = (0, base64_js_1.toB64Url)(signer.publicKey);
55
- }
56
- break;
57
- case arbundles_1.SignatureConfig.ETHEREUM:
58
- if ('publicKey' in signer) {
59
- publicKey = '0x' + signer.publicKey.toString('hex');
60
- }
61
- else {
62
- throw new Error('Public key not found');
63
- }
64
- break;
65
- // TODO: solana sig support
66
- // case SignatureConfig.SOLANA:
67
- // case SignatureConfig.ED25519:
68
- default:
69
- throw new Error(`Unsupported signer type for signing requests: ${signatureType}`);
70
- }
71
- if (publicKey === undefined || signature === undefined) {
72
- throw new Error('Public key or signature not found');
73
- }
74
- return {
75
- 'x-public-key': publicKey,
76
- 'x-nonce': nonce,
77
- 'x-signature': signature,
78
- 'x-signature-type': signatureType,
79
- };
80
- }
81
- exports.signedRequestHeadersFromSigner = signedRequestHeadersFromSigner;
82
- class TurboArNSPaymentFactory {
83
- static init(config) {
84
- const { signer, paymentUrl, axios, logger } = config ?? {};
85
- if (signer !== undefined) {
86
- return new TurboArNSPaymentProviderAuthenticated({
87
- signer,
88
- paymentUrl,
89
- axios,
90
- logger,
91
- });
92
- }
93
- return new TurboArNSPaymentProviderUnauthenticated({
94
- paymentUrl,
95
- axios,
96
- logger,
97
- });
98
- }
99
- }
100
- exports.TurboArNSPaymentFactory = TurboArNSPaymentFactory;
101
- // Base class for unauthenticated operations
102
- class TurboArNSPaymentProviderUnauthenticated {
103
- paymentUrl;
104
- axios;
105
- logger;
106
- constructor({ paymentUrl = 'https://payment.ardrive.io', axios = (0, http_client_js_1.createAxiosInstance)(), logger = logger_js_1.Logger.default, }) {
107
- this.paymentUrl = paymentUrl;
108
- this.axios = axios;
109
- this.logger = logger;
110
- }
111
- async getArNSPriceDetails({ intent, name, quantity, type, years, }) {
112
- const url = (0, url_js_1.urlWithSearchParams)({
113
- baseUrl: `${this.paymentUrl}/v1/arns/price/${intent}/${name}`,
114
- params: {
115
- increaseQty: quantity,
116
- type,
117
- years,
118
- },
119
- });
120
- const { data, status } = await this.axios.get(url);
121
- this.logger.debug('getArNSPriceDetails', {
122
- intent,
123
- name,
124
- quantity,
125
- type,
126
- years,
127
- data,
128
- status,
129
- });
130
- if (status !== 200) {
131
- throw new Error('Failed to get ArNS purchase price ' + JSON.stringify(data));
132
- }
133
- if (!data.winc || !data.mARIO) {
134
- throw new Error('Invalid response from Turbo ' + JSON.stringify(data));
135
- }
136
- return {
137
- winc: data.winc,
138
- mARIO: new token_js_1.mARIOToken(+data.mARIO),
139
- };
140
- }
141
- async getPrice(params) {
142
- const { winc } = await this.getArNSPriceDetails(params);
143
- return +winc;
144
- }
145
- }
146
- exports.TurboArNSPaymentProviderUnauthenticated = TurboArNSPaymentProviderUnauthenticated;
147
- // Class for authenticated operations, extending the base class
148
- class TurboArNSPaymentProviderAuthenticated extends TurboArNSPaymentProviderUnauthenticated {
149
- signer;
150
- constructor({ signer, ...restConfig }) {
151
- super(restConfig); // Pass unauthenticated config to base class+
152
- if (!isTurboArNSSigner(signer)) {
153
- throw new Error('Signer must be a TurboArNSSigner');
154
- }
155
- this.signer = signer;
156
- }
157
- async initiateArNSPurchase({ intent, name, quantity, type, processId, years, }) {
158
- // Signer check is implicitly handled by requiring it in the constructor
159
- const url = (0, url_js_1.urlWithSearchParams)({
160
- baseUrl: `${this.paymentUrl}/v1/arns/purchase/${intent}/${name}`,
161
- params: {
162
- increaseQty: quantity,
163
- processId,
164
- type,
165
- years,
166
- },
167
- });
168
- const headers = await signedRequestHeadersFromSigner({
169
- signer: this.signer,
170
- });
171
- const { data, status } = await this.axios.post(url, null, {
172
- headers,
173
- });
174
- this.logger.debug('Initiated ArNS purchase', {
175
- intent,
176
- name,
177
- quantity,
178
- processId,
179
- type,
180
- years,
181
- data,
182
- status,
183
- });
184
- if (status !== 200) {
185
- throw new Error('Failed to initiate ArNS purchase ' + JSON.stringify(data));
186
- }
187
- return {
188
- id: data.arioWriteResult.id,
189
- result: data.purchaseReceipt,
190
- };
191
- }
192
- }
193
- exports.TurboArNSPaymentProviderAuthenticated = TurboArNSPaymentProviderAuthenticated;
194
- function isWanderArweaveBrowserSigner(signer) {
195
- return (typeof signer === 'object' &&
196
- signer !== null &&
197
- 'signMessage' in signer &&
198
- 'getActivePublicKey' in signer);
199
- }
200
- function isTurboArNSSigner(signer) {
201
- const isWanderWallet = isWanderArweaveBrowserSigner(signer);
202
- const isSigner = signer instanceof arbundles_1.EthereumSigner ||
203
- signer instanceof arbundles_1.InjectedEthereumSigner ||
204
- signer instanceof arbundles_1.ArweaveSigner ||
205
- signer instanceof arbundles_1.ArconnectSigner;
206
- return isWanderWallet || isSigner;
207
- }
208
- exports.isTurboArNSSigner = isTurboArNSSigner;