@avaprotocol/sdk-js 0.6.8 → 0.6.10

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/dist/index.d.ts CHANGED
@@ -3,38 +3,6 @@ import * as jspb from 'google-protobuf';
3
3
  import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
4
4
  import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb';
5
5
 
6
- type Environment = "production" | "development" | "staging";
7
- interface KeyExchangeResp {
8
- key: string;
9
- }
10
- interface ClientOption {
11
- privateKey?: string;
12
- jwtApiKey?: string;
13
- presignSignature?: string;
14
- signatureExpiredAt?: number;
15
- env?: Environment;
16
- owner?: string;
17
- }
18
- interface TaskResp {
19
- id: string;
20
- status: string;
21
- result?: any;
22
- error?: string;
23
- }
24
- interface TaskListResp {
25
- tasks: TaskResp[];
26
- }
27
- interface SmartWalletResp {
28
- address: string;
29
- smart_account_address: string;
30
- }
31
- interface TransactionResp {
32
- hash: string;
33
- }
34
- interface BalanceResp {
35
- balance: string;
36
- }
37
-
38
6
  declare const getKeyRequestMessage: (address: string, expiredAt: number) => string;
39
7
 
40
8
  // package: aggregator
@@ -1487,11 +1455,38 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
1487
1455
  ): grpc.ClientUnaryCall;
1488
1456
  }
1489
1457
 
1458
+ type Environment = "production" | "development" | "staging";
1459
+ interface KeyExchangeResp {
1460
+ key: string;
1461
+ }
1462
+ interface ClientOption {
1463
+ endpoint: string;
1464
+ jwtApiKey?: string;
1465
+ }
1466
+ interface TaskResp {
1467
+ id: string;
1468
+ status: string;
1469
+ result?: any;
1470
+ error?: string;
1471
+ }
1472
+ interface TaskListResp {
1473
+ tasks: TaskResp[];
1474
+ }
1475
+ interface SmartWalletResp {
1476
+ address: string;
1477
+ smart_account_address: string;
1478
+ }
1479
+ interface TransactionResp {
1480
+ hash: string;
1481
+ }
1482
+ interface BalanceResp {
1483
+ balance: string;
1484
+ }
1485
+
1490
1486
  declare class BaseClient {
1491
- readonly env: Environment;
1487
+ readonly endpoint: string;
1492
1488
  readonly rpcClient: AggregatorClient;
1493
1489
  protected authkey?: string;
1494
- protected wallet?: any;
1495
1490
  constructor(opts: ClientOption);
1496
1491
  authWithSignature(address: string, signature: string, expiredAtEpoch: number): Promise<KeyExchangeResp>;
1497
1492
  isAuthenticated(): boolean;
package/dist/index.js CHANGED
@@ -1,13 +1,10 @@
1
+ "use strict";
2
+ var __create = Object.create;
1
3
  var __defProp = Object.defineProperty;
2
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
4
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
- }) : x)(function(x) {
8
- if (typeof require !== "undefined") return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
8
  var __esm = (fn, res) => function __init() {
12
9
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
10
  };
@@ -23,6 +20,14 @@ var __copyProps = (to, from, except, desc) => {
23
20
  }
24
21
  return to;
25
22
  };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
26
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
32
 
28
33
  // grpc_codegen/avs_pb.js
@@ -40,7 +45,7 @@ var jspb, goog, global, google_protobuf_timestamp_pb, google_protobuf_wrappers_p
40
45
  var init_avs_pb = __esm({
41
46
  "grpc_codegen/avs_pb.js"() {
42
47
  "use strict";
43
- jspb = __require("google-protobuf");
48
+ jspb = require("google-protobuf");
44
49
  goog = jspb;
45
50
  global = function() {
46
51
  if (this) {
@@ -57,9 +62,9 @@ var init_avs_pb = __esm({
57
62
  }
58
63
  return Function("return this")();
59
64
  }.call(null);
60
- google_protobuf_timestamp_pb = __require("google-protobuf/google/protobuf/timestamp_pb.js");
65
+ google_protobuf_timestamp_pb = require("google-protobuf/google/protobuf/timestamp_pb.js");
61
66
  goog.object.extend(proto, google_protobuf_timestamp_pb);
62
- google_protobuf_wrappers_pb = __require("google-protobuf/google/protobuf/wrappers_pb.js");
67
+ google_protobuf_wrappers_pb = require("google-protobuf/google/protobuf/wrappers_pb.js");
63
68
  goog.object.extend(proto, google_protobuf_wrappers_pb);
64
69
  goog.exportSymbol("proto.aggregator.AddressRequest", null, global);
65
70
  goog.exportSymbol("proto.aggregator.AddressResp", null, global);
@@ -4102,24 +4107,13 @@ var init_avs_pb = __esm({
4102
4107
  });
4103
4108
 
4104
4109
  // src/index.ts
4105
- import * as grpc2 from "@grpc/grpc-js";
4106
-
4107
- // src/config.ts
4108
- var DEFAULT_JWT_EXPIRATION = 24 * 60 * 60;
4109
- var configs = {
4110
- development: {
4111
- AVS_RPC_URL: process.env.AVS_RPC_URL || "localhost:2206"
4112
- },
4113
- staging: {
4114
- AVS_RPC_URL: "aggregator-holesky.avaprotocol.org:2206"
4115
- },
4116
- production: {
4117
- AVS_RPC_URL: "aggregator.avaprotocol.org:2206"
4118
- }
4119
- };
4120
- function getRpcEndpoint(env) {
4121
- return configs[env].AVS_RPC_URL;
4122
- }
4110
+ var src_exports = {};
4111
+ __export(src_exports, {
4112
+ default: () => Client,
4113
+ getKeyRequestMessage: () => getKeyRequestMessage
4114
+ });
4115
+ module.exports = __toCommonJS(src_exports);
4116
+ var grpc2 = __toESM(require("@grpc/grpc-js"));
4123
4117
 
4124
4118
  // src/auth.ts
4125
4119
  var getKeyRequestMessage = (address, expiredAt) => {
@@ -4127,10 +4121,10 @@ var getKeyRequestMessage = (address, expiredAt) => {
4127
4121
  };
4128
4122
 
4129
4123
  // grpc_codegen/avs_grpc_pb.js
4130
- var grpc = __require("@grpc/grpc-js");
4124
+ var grpc = require("@grpc/grpc-js");
4131
4125
  var avs_pb = (init_avs_pb(), __toCommonJS(avs_pb_exports));
4132
- var google_protobuf_timestamp_pb2 = __require("google-protobuf/google/protobuf/timestamp_pb.js");
4133
- var google_protobuf_wrappers_pb2 = __require("google-protobuf/google/protobuf/wrappers_pb.js");
4126
+ var google_protobuf_timestamp_pb2 = require("google-protobuf/google/protobuf/timestamp_pb.js");
4127
+ var google_protobuf_wrappers_pb2 = require("google-protobuf/google/protobuf/wrappers_pb.js");
4134
4128
  function serialize_aggregator_AddressRequest(arg) {
4135
4129
  if (!(arg instanceof avs_pb.AddressRequest)) {
4136
4130
  throw new Error("Expected argument of type aggregator.AddressRequest");
@@ -4435,10 +4429,11 @@ var AggregatorClient = grpc.makeGenericClientConstructor(AggregatorService);
4435
4429
  init_avs_pb();
4436
4430
  var metadata = new grpc2.Metadata();
4437
4431
  var BaseClient = class {
4432
+ // protected wallet?: any;
4438
4433
  constructor(opts) {
4439
- this.env = opts.env || "production";
4434
+ this.endpoint = opts.endpoint;
4440
4435
  this.rpcClient = new AggregatorClient(
4441
- getRpcEndpoint(this.env),
4436
+ this.endpoint,
4442
4437
  // TODO: switch to the TLS after we're able to update all the operator
4443
4438
  grpc2.credentials.createInsecure()
4444
4439
  );
@@ -4505,7 +4500,7 @@ var Client = class extends BaseClient {
4505
4500
  super(config);
4506
4501
  }
4507
4502
  };
4508
- export {
4509
- Client as default,
4503
+ // Annotate the CommonJS export names for ESM import in node:
4504
+ 0 && (module.exports = {
4510
4505
  getKeyRequestMessage
4511
- };
4506
+ });