use-agently 0.3.1 → 0.4.0

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 (2) hide show
  1. package/build/bin.js +698 -474
  2. package/package.json +1 -1
package/build/bin.js CHANGED
@@ -6697,7 +6697,7 @@ function parseAccount2(account) {
6697
6697
  }
6698
6698
 
6699
6699
  // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/constants/abis.js
6700
- var multicall3Abi, batchGatewayAbi, universalResolverErrors, universalResolverResolveAbi, universalResolverReverseAbi, textResolverAbi, addressResolverAbi, erc1271Abi, erc6492SignatureValidatorAbi;
6700
+ var multicall3Abi, batchGatewayAbi, universalResolverErrors, universalResolverResolveAbi, universalResolverReverseAbi, textResolverAbi, addressResolverAbi, erc1271Abi, erc6492SignatureValidatorAbi, erc20Abi;
6701
6701
  var init_abis = __esm(() => {
6702
6702
  multicall3Abi = [
6703
6703
  {
@@ -7050,6 +7050,194 @@ var init_abis = __esm(() => {
7050
7050
  name: "isValidSig"
7051
7051
  }
7052
7052
  ];
7053
+ erc20Abi = [
7054
+ {
7055
+ type: "event",
7056
+ name: "Approval",
7057
+ inputs: [
7058
+ {
7059
+ indexed: true,
7060
+ name: "owner",
7061
+ type: "address"
7062
+ },
7063
+ {
7064
+ indexed: true,
7065
+ name: "spender",
7066
+ type: "address"
7067
+ },
7068
+ {
7069
+ indexed: false,
7070
+ name: "value",
7071
+ type: "uint256"
7072
+ }
7073
+ ]
7074
+ },
7075
+ {
7076
+ type: "event",
7077
+ name: "Transfer",
7078
+ inputs: [
7079
+ {
7080
+ indexed: true,
7081
+ name: "from",
7082
+ type: "address"
7083
+ },
7084
+ {
7085
+ indexed: true,
7086
+ name: "to",
7087
+ type: "address"
7088
+ },
7089
+ {
7090
+ indexed: false,
7091
+ name: "value",
7092
+ type: "uint256"
7093
+ }
7094
+ ]
7095
+ },
7096
+ {
7097
+ type: "function",
7098
+ name: "allowance",
7099
+ stateMutability: "view",
7100
+ inputs: [
7101
+ {
7102
+ name: "owner",
7103
+ type: "address"
7104
+ },
7105
+ {
7106
+ name: "spender",
7107
+ type: "address"
7108
+ }
7109
+ ],
7110
+ outputs: [
7111
+ {
7112
+ type: "uint256"
7113
+ }
7114
+ ]
7115
+ },
7116
+ {
7117
+ type: "function",
7118
+ name: "approve",
7119
+ stateMutability: "nonpayable",
7120
+ inputs: [
7121
+ {
7122
+ name: "spender",
7123
+ type: "address"
7124
+ },
7125
+ {
7126
+ name: "amount",
7127
+ type: "uint256"
7128
+ }
7129
+ ],
7130
+ outputs: [
7131
+ {
7132
+ type: "bool"
7133
+ }
7134
+ ]
7135
+ },
7136
+ {
7137
+ type: "function",
7138
+ name: "balanceOf",
7139
+ stateMutability: "view",
7140
+ inputs: [
7141
+ {
7142
+ name: "account",
7143
+ type: "address"
7144
+ }
7145
+ ],
7146
+ outputs: [
7147
+ {
7148
+ type: "uint256"
7149
+ }
7150
+ ]
7151
+ },
7152
+ {
7153
+ type: "function",
7154
+ name: "decimals",
7155
+ stateMutability: "view",
7156
+ inputs: [],
7157
+ outputs: [
7158
+ {
7159
+ type: "uint8"
7160
+ }
7161
+ ]
7162
+ },
7163
+ {
7164
+ type: "function",
7165
+ name: "name",
7166
+ stateMutability: "view",
7167
+ inputs: [],
7168
+ outputs: [
7169
+ {
7170
+ type: "string"
7171
+ }
7172
+ ]
7173
+ },
7174
+ {
7175
+ type: "function",
7176
+ name: "symbol",
7177
+ stateMutability: "view",
7178
+ inputs: [],
7179
+ outputs: [
7180
+ {
7181
+ type: "string"
7182
+ }
7183
+ ]
7184
+ },
7185
+ {
7186
+ type: "function",
7187
+ name: "totalSupply",
7188
+ stateMutability: "view",
7189
+ inputs: [],
7190
+ outputs: [
7191
+ {
7192
+ type: "uint256"
7193
+ }
7194
+ ]
7195
+ },
7196
+ {
7197
+ type: "function",
7198
+ name: "transfer",
7199
+ stateMutability: "nonpayable",
7200
+ inputs: [
7201
+ {
7202
+ name: "recipient",
7203
+ type: "address"
7204
+ },
7205
+ {
7206
+ name: "amount",
7207
+ type: "uint256"
7208
+ }
7209
+ ],
7210
+ outputs: [
7211
+ {
7212
+ type: "bool"
7213
+ }
7214
+ ]
7215
+ },
7216
+ {
7217
+ type: "function",
7218
+ name: "transferFrom",
7219
+ stateMutability: "nonpayable",
7220
+ inputs: [
7221
+ {
7222
+ name: "sender",
7223
+ type: "address"
7224
+ },
7225
+ {
7226
+ name: "recipient",
7227
+ type: "address"
7228
+ },
7229
+ {
7230
+ name: "amount",
7231
+ type: "uint256"
7232
+ }
7233
+ ],
7234
+ outputs: [
7235
+ {
7236
+ type: "bool"
7237
+ }
7238
+ ]
7239
+ }
7240
+ ];
7053
7241
  });
7054
7242
 
7055
7243
  // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/utils/encoding/fromBytes.js
@@ -11830,12 +12018,12 @@ var require_nacl_fast = __commonJS((exports, module) => {
11830
12018
  o[i] = a[i] - b[i];
11831
12019
  }
11832
12020
  function M(o, a, b) {
11833
- var v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];
12021
+ var v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b32 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];
11834
12022
  v = a[0];
11835
12023
  t0 += v * b0;
11836
12024
  t1 += v * b1;
11837
12025
  t2 += v * b2;
11838
- t3 += v * b3;
12026
+ t3 += v * b32;
11839
12027
  t4 += v * b4;
11840
12028
  t5 += v * b5;
11841
12029
  t6 += v * b6;
@@ -11852,7 +12040,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11852
12040
  t1 += v * b0;
11853
12041
  t2 += v * b1;
11854
12042
  t3 += v * b2;
11855
- t4 += v * b3;
12043
+ t4 += v * b32;
11856
12044
  t5 += v * b4;
11857
12045
  t6 += v * b5;
11858
12046
  t7 += v * b6;
@@ -11869,7 +12057,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11869
12057
  t2 += v * b0;
11870
12058
  t3 += v * b1;
11871
12059
  t4 += v * b2;
11872
- t5 += v * b3;
12060
+ t5 += v * b32;
11873
12061
  t6 += v * b4;
11874
12062
  t7 += v * b5;
11875
12063
  t8 += v * b6;
@@ -11886,7 +12074,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11886
12074
  t3 += v * b0;
11887
12075
  t4 += v * b1;
11888
12076
  t5 += v * b2;
11889
- t6 += v * b3;
12077
+ t6 += v * b32;
11890
12078
  t7 += v * b4;
11891
12079
  t8 += v * b5;
11892
12080
  t9 += v * b6;
@@ -11903,7 +12091,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11903
12091
  t4 += v * b0;
11904
12092
  t5 += v * b1;
11905
12093
  t6 += v * b2;
11906
- t7 += v * b3;
12094
+ t7 += v * b32;
11907
12095
  t8 += v * b4;
11908
12096
  t9 += v * b5;
11909
12097
  t10 += v * b6;
@@ -11920,7 +12108,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11920
12108
  t5 += v * b0;
11921
12109
  t6 += v * b1;
11922
12110
  t7 += v * b2;
11923
- t8 += v * b3;
12111
+ t8 += v * b32;
11924
12112
  t9 += v * b4;
11925
12113
  t10 += v * b5;
11926
12114
  t11 += v * b6;
@@ -11937,7 +12125,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11937
12125
  t6 += v * b0;
11938
12126
  t7 += v * b1;
11939
12127
  t8 += v * b2;
11940
- t9 += v * b3;
12128
+ t9 += v * b32;
11941
12129
  t10 += v * b4;
11942
12130
  t11 += v * b5;
11943
12131
  t12 += v * b6;
@@ -11954,7 +12142,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11954
12142
  t7 += v * b0;
11955
12143
  t8 += v * b1;
11956
12144
  t9 += v * b2;
11957
- t10 += v * b3;
12145
+ t10 += v * b32;
11958
12146
  t11 += v * b4;
11959
12147
  t12 += v * b5;
11960
12148
  t13 += v * b6;
@@ -11971,7 +12159,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11971
12159
  t8 += v * b0;
11972
12160
  t9 += v * b1;
11973
12161
  t10 += v * b2;
11974
- t11 += v * b3;
12162
+ t11 += v * b32;
11975
12163
  t12 += v * b4;
11976
12164
  t13 += v * b5;
11977
12165
  t14 += v * b6;
@@ -11988,7 +12176,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
11988
12176
  t9 += v * b0;
11989
12177
  t10 += v * b1;
11990
12178
  t11 += v * b2;
11991
- t12 += v * b3;
12179
+ t12 += v * b32;
11992
12180
  t13 += v * b4;
11993
12181
  t14 += v * b5;
11994
12182
  t15 += v * b6;
@@ -12005,7 +12193,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12005
12193
  t10 += v * b0;
12006
12194
  t11 += v * b1;
12007
12195
  t12 += v * b2;
12008
- t13 += v * b3;
12196
+ t13 += v * b32;
12009
12197
  t14 += v * b4;
12010
12198
  t15 += v * b5;
12011
12199
  t16 += v * b6;
@@ -12022,7 +12210,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12022
12210
  t11 += v * b0;
12023
12211
  t12 += v * b1;
12024
12212
  t13 += v * b2;
12025
- t14 += v * b3;
12213
+ t14 += v * b32;
12026
12214
  t15 += v * b4;
12027
12215
  t16 += v * b5;
12028
12216
  t17 += v * b6;
@@ -12039,7 +12227,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12039
12227
  t12 += v * b0;
12040
12228
  t13 += v * b1;
12041
12229
  t14 += v * b2;
12042
- t15 += v * b3;
12230
+ t15 += v * b32;
12043
12231
  t16 += v * b4;
12044
12232
  t17 += v * b5;
12045
12233
  t18 += v * b6;
@@ -12056,7 +12244,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12056
12244
  t13 += v * b0;
12057
12245
  t14 += v * b1;
12058
12246
  t15 += v * b2;
12059
- t16 += v * b3;
12247
+ t16 += v * b32;
12060
12248
  t17 += v * b4;
12061
12249
  t18 += v * b5;
12062
12250
  t19 += v * b6;
@@ -12073,7 +12261,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12073
12261
  t14 += v * b0;
12074
12262
  t15 += v * b1;
12075
12263
  t16 += v * b2;
12076
- t17 += v * b3;
12264
+ t17 += v * b32;
12077
12265
  t18 += v * b4;
12078
12266
  t19 += v * b5;
12079
12267
  t20 += v * b6;
@@ -12090,7 +12278,7 @@ var require_nacl_fast = __commonJS((exports, module) => {
12090
12278
  t15 += v * b0;
12091
12279
  t16 += v * b1;
12092
12280
  t17 += v * b2;
12093
- t18 += v * b3;
12281
+ t18 += v * b32;
12094
12282
  t19 += v * b4;
12095
12283
  t20 += v * b5;
12096
12284
  t21 += v * b6;
@@ -13687,11 +13875,11 @@ var require_transformers = __commonJS((exports) => {
13687
13875
  }
13688
13876
  return x;
13689
13877
  }
13690
- function bytes3(b12, b2, b3) {
13691
- if ((b3 & 192) !== 128 || (b2 & 192) !== 128) {
13878
+ function bytes3(b12, b2, b32) {
13879
+ if ((b32 & 192) !== 128 || (b2 & 192) !== 128) {
13692
13880
  return TRAILING;
13693
13881
  }
13694
- const x = ((b12 & mask[4]) << 12) + ((b2 & mask[6]) << 6) + (b3 & mask[6]);
13882
+ const x = ((b12 & mask[4]) << 12) + ((b2 & mask[6]) << 6) + (b32 & mask[6]);
13695
13883
  if (x < 2048) {
13696
13884
  return NON_SHORTEST;
13697
13885
  }
@@ -13700,11 +13888,11 @@ var require_transformers = __commonJS((exports) => {
13700
13888
  }
13701
13889
  return x;
13702
13890
  }
13703
- function bytes4(b12, b2, b3, b4) {
13704
- if ((b4 & 192) !== 128 || (b3 & 192) !== 128 || (b2 & 192) !== 128) {
13891
+ function bytes4(b12, b2, b32, b4) {
13892
+ if ((b4 & 192) !== 128 || (b32 & 192) !== 128 || (b2 & 192) !== 128) {
13705
13893
  return TRAILING;
13706
13894
  }
13707
- const x = (((b12 & mask[3]) << 2) + (b2 >> 4 & mask[2]) << 16) + ((b2 & mask[4]) << 12) + ((b3 & mask[6]) << 6) + (b4 & mask[6]);
13895
+ const x = (((b12 & mask[3]) << 2) + (b2 >> 4 & mask[2]) << 16) + ((b2 & mask[4]) << 12) + ((b32 & mask[6]) << 6) + (b4 & mask[6]);
13708
13896
  if (x < 65536) {
13709
13897
  return NON_SHORTEST;
13710
13898
  }
@@ -15663,7 +15851,7 @@ var require_ast = __commonJS((exports, module) => {
15663
15851
  const id = require_identifiers();
15664
15852
  const utils = require_utilities();
15665
15853
  const thisFileName = "ast.js: ";
15666
- const that = this;
15854
+ const that2 = this;
15667
15855
  let rules = null;
15668
15856
  let udts = null;
15669
15857
  let chars = null;
@@ -15695,17 +15883,17 @@ var require_ast = __commonJS((exports, module) => {
15695
15883
  nodesDefined[i] = false;
15696
15884
  nodeCallbacks[i] = null;
15697
15885
  }
15698
- for (const index2 in that.callbacks) {
15886
+ for (const index2 in that2.callbacks) {
15699
15887
  const lower = index2.toLowerCase();
15700
15888
  i = list.indexOf(lower);
15701
15889
  if (i < 0) {
15702
15890
  throw new Error(`${thisFileName}init: node '${index2}' not a rule or udt name`);
15703
15891
  }
15704
- if (typeof that.callbacks[index2] === "function") {
15892
+ if (typeof that2.callbacks[index2] === "function") {
15705
15893
  nodesDefined[i] = true;
15706
- nodeCallbacks[i] = that.callbacks[index2];
15894
+ nodeCallbacks[i] = that2.callbacks[index2];
15707
15895
  }
15708
- if (that.callbacks[index2] === true) {
15896
+ if (that2.callbacks[index2] === true) {
15709
15897
  nodesDefined[i] = true;
15710
15898
  }
15711
15899
  }
@@ -15790,14 +15978,14 @@ var require_ast = __commonJS((exports, module) => {
15790
15978
  let display = utils.charsToDec;
15791
15979
  let caption = "decimal integer character codes";
15792
15980
  if (typeof modeArg === "string" && modeArg.length >= 3) {
15793
- const mode = modeArg.slice(0, 3).toLowerCase();
15794
- if (mode === "asc") {
15981
+ const mode2 = modeArg.slice(0, 3).toLowerCase();
15982
+ if (mode2 === "asc") {
15795
15983
  display = utils.charsToAscii;
15796
15984
  caption = "ASCII for printing characters, hex for non-printing";
15797
- } else if (mode === "hex") {
15985
+ } else if (mode2 === "hex") {
15798
15986
  display = utils.charsToHex;
15799
15987
  caption = "hexadecimal integer character codes";
15800
- } else if (mode === "uni") {
15988
+ } else if (mode2 === "uni") {
15801
15989
  display = utils.charsToUnicode;
15802
15990
  caption = "Unicode UTF-32 integer character codes";
15803
15991
  }
@@ -17425,7 +17613,7 @@ var require_trace = __commonJS((exports, module) => {
17425
17613
  const circular = new (require_circular_buffer());
17426
17614
  const id = require_identifiers();
17427
17615
  const thisFileName = "trace.js: ";
17428
- const that = this;
17616
+ const that2 = this;
17429
17617
  const MODE_HEX = 16;
17430
17618
  const MODE_DEC = 10;
17431
17619
  const MODE_ASCII = 8;
@@ -17463,14 +17651,14 @@ var require_trace = __commonJS((exports, module) => {
17463
17651
  operatorFilter[id.AEN] = set;
17464
17652
  };
17465
17653
  let items = 0;
17466
- for (const name in that.filter.operators) {
17654
+ for (const name in that2.filter.operators) {
17467
17655
  items += 1;
17468
17656
  }
17469
17657
  if (items === 0) {
17470
17658
  setOperators(false);
17471
17659
  return;
17472
17660
  }
17473
- for (const name in that.filter.operators) {
17661
+ for (const name in that2.filter.operators) {
17474
17662
  const upper = name.toUpperCase();
17475
17663
  if (upper === "<ALL>") {
17476
17664
  setOperators(true);
@@ -17482,34 +17670,34 @@ var require_trace = __commonJS((exports, module) => {
17482
17670
  }
17483
17671
  }
17484
17672
  setOperators(false);
17485
- for (const name in that.filter.operators) {
17673
+ for (const name in that2.filter.operators) {
17486
17674
  const upper = name.toUpperCase();
17487
17675
  if (upper === "ALT") {
17488
- operatorFilter[id.ALT] = that.filter.operators[name] === true;
17676
+ operatorFilter[id.ALT] = that2.filter.operators[name] === true;
17489
17677
  } else if (upper === "CAT") {
17490
- operatorFilter[id.CAT] = that.filter.operators[name] === true;
17678
+ operatorFilter[id.CAT] = that2.filter.operators[name] === true;
17491
17679
  } else if (upper === "REP") {
17492
- operatorFilter[id.REP] = that.filter.operators[name] === true;
17680
+ operatorFilter[id.REP] = that2.filter.operators[name] === true;
17493
17681
  } else if (upper === "AND") {
17494
- operatorFilter[id.AND] = that.filter.operators[name] === true;
17682
+ operatorFilter[id.AND] = that2.filter.operators[name] === true;
17495
17683
  } else if (upper === "NOT") {
17496
- operatorFilter[id.NOT] = that.filter.operators[name] === true;
17684
+ operatorFilter[id.NOT] = that2.filter.operators[name] === true;
17497
17685
  } else if (upper === "TLS") {
17498
- operatorFilter[id.TLS] = that.filter.operators[name] === true;
17686
+ operatorFilter[id.TLS] = that2.filter.operators[name] === true;
17499
17687
  } else if (upper === "TBS") {
17500
- operatorFilter[id.TBS] = that.filter.operators[name] === true;
17688
+ operatorFilter[id.TBS] = that2.filter.operators[name] === true;
17501
17689
  } else if (upper === "TRG") {
17502
- operatorFilter[id.TRG] = that.filter.operators[name] === true;
17690
+ operatorFilter[id.TRG] = that2.filter.operators[name] === true;
17503
17691
  } else if (upper === "BKR") {
17504
- operatorFilter[id.BKR] = that.filter.operators[name] === true;
17692
+ operatorFilter[id.BKR] = that2.filter.operators[name] === true;
17505
17693
  } else if (upper === "BKA") {
17506
- operatorFilter[id.BKA] = that.filter.operators[name] === true;
17694
+ operatorFilter[id.BKA] = that2.filter.operators[name] === true;
17507
17695
  } else if (upper === "BKN") {
17508
- operatorFilter[id.BKN] = that.filter.operators[name] === true;
17696
+ operatorFilter[id.BKN] = that2.filter.operators[name] === true;
17509
17697
  } else if (upper === "ABG") {
17510
- operatorFilter[id.ABG] = that.filter.operators[name] === true;
17698
+ operatorFilter[id.ABG] = that2.filter.operators[name] === true;
17511
17699
  } else if (upper === "AEN") {
17512
- operatorFilter[id.AEN] = that.filter.operators[name] === true;
17700
+ operatorFilter[id.AEN] = that2.filter.operators[name] === true;
17513
17701
  } else {
17514
17702
  throw new Error(`${thisFileName}initOpratorFilter: '${name}' not a valid operator name.` + ` Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`);
17515
17703
  }
@@ -17536,14 +17724,14 @@ var require_trace = __commonJS((exports, module) => {
17536
17724
  }
17537
17725
  ruleFilter.length = 0;
17538
17726
  items = 0;
17539
- for (const name in that.filter.rules) {
17727
+ for (const name in that2.filter.rules) {
17540
17728
  items += 1;
17541
17729
  }
17542
17730
  if (items === 0) {
17543
17731
  setRules(true);
17544
17732
  return;
17545
17733
  }
17546
- for (const name in that.filter.rules) {
17734
+ for (const name in that2.filter.rules) {
17547
17735
  const lower = name.toLowerCase();
17548
17736
  if (lower === "<all>") {
17549
17737
  setRules(true);
@@ -17557,13 +17745,13 @@ var require_trace = __commonJS((exports, module) => {
17557
17745
  setRules(false);
17558
17746
  operatorFilter[id.RNM] = true;
17559
17747
  operatorFilter[id.UDT] = true;
17560
- for (const name in that.filter.rules) {
17748
+ for (const name in that2.filter.rules) {
17561
17749
  const lower = name.toLowerCase();
17562
17750
  i = list.indexOf(lower);
17563
17751
  if (i < 0) {
17564
17752
  throw new Error(`${thisFileName}initRuleFilter: '${name}' not a valid rule or udt name`);
17565
17753
  }
17566
- ruleFilter[i] = that.filter.rules[name] === true;
17754
+ ruleFilter[i] = that2.filter.rules[name] === true;
17567
17755
  }
17568
17756
  };
17569
17757
  this.traceObject = "traceObject";
@@ -17844,7 +18032,7 @@ var require_trace = __commonJS((exports, module) => {
17844
18032
  return obj2;
17845
18033
  }
17846
18034
  const branch = [];
17847
- let root;
18035
+ let root2;
17848
18036
  let node;
17849
18037
  let parent;
17850
18038
  let record;
@@ -17887,17 +18075,17 @@ var require_trace = __commonJS((exports, module) => {
17887
18075
  if (branch.length === 0) {
17888
18076
  throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");
17889
18077
  }
17890
- root = dummy.children[0];
17891
- let prev = root;
17892
- while (root && !root.down && !root.up) {
17893
- prev = root;
17894
- root = root.children[0];
17895
- }
17896
- root = prev;
17897
- root.leftMost = true;
17898
- root.rightMost = true;
17899
- walk3(root);
17900
- root.branch = 0;
18078
+ root2 = dummy.children[0];
18079
+ let prev = root2;
18080
+ while (root2 && !root2.down && !root2.up) {
18081
+ prev = root2;
18082
+ root2 = root2.children[0];
18083
+ }
18084
+ root2 = prev;
18085
+ root2.leftMost = true;
18086
+ root2.rightMost = true;
18087
+ walk3(root2);
18088
+ root2.branch = 0;
17901
18089
  const obj = {};
17902
18090
  obj.string = [];
17903
18091
  for (let i = 0;i < chars.length; i += 1) {
@@ -17934,19 +18122,19 @@ var require_trace = __commonJS((exports, module) => {
17934
18122
  obj.treeDepth = treeDepth;
17935
18123
  obj.leafNodes = leafNodes;
17936
18124
  let branchesIncomplete;
17937
- if (root.down) {
17938
- if (root.up) {
18125
+ if (root2.down) {
18126
+ if (root2.up) {
17939
18127
  branchesIncomplete = "none";
17940
18128
  } else {
17941
18129
  branchesIncomplete = "right";
17942
18130
  }
17943
- } else if (root.up) {
18131
+ } else if (root2.up) {
17944
18132
  branchesIncomplete = "left";
17945
18133
  } else {
17946
18134
  branchesIncomplete = "both";
17947
18135
  }
17948
18136
  obj.branchesIncomplete = branchesIncomplete;
17949
- obj.tree = display(root, root.depth, false);
18137
+ obj.tree = display(root2, root2.depth, false);
17950
18138
  return obj;
17951
18139
  };
17952
18140
  this.toTree = function(stringify5) {
@@ -17956,12 +18144,12 @@ var require_trace = __commonJS((exports, module) => {
17956
18144
  }
17957
18145
  return obj;
17958
18146
  };
17959
- this.toHtmlPage = function(mode, caption, title) {
17960
- return utils.htmlToPage(this.toHtml(mode, caption), title);
18147
+ this.toHtmlPage = function(mode2, caption, title) {
18148
+ return utils.htmlToPage(this.toHtml(mode2, caption), title);
17961
18149
  };
17962
- const htmlHeader = function(mode, caption) {
18150
+ const htmlHeader = function(mode2, caption) {
17963
18151
  let modeName;
17964
- switch (mode) {
18152
+ switch (mode2) {
17965
18153
  case MODE_HEX:
17966
18154
  modeName = "hexadecimal";
17967
18155
  break;
@@ -17975,7 +18163,7 @@ var require_trace = __commonJS((exports, module) => {
17975
18163
  modeName = "UNICODE";
17976
18164
  break;
17977
18165
  default:
17978
- throw new Error(`${thisFileName}htmlHeader: unrecognized mode: ${mode}`);
18166
+ throw new Error(`${thisFileName}htmlHeader: unrecognized mode: ${mode2}`);
17979
18167
  }
17980
18168
  let header = "";
17981
18169
  header += `<p>display mode: ${modeName}</p>
@@ -18084,15 +18272,15 @@ var require_trace = __commonJS((exports, module) => {
18084
18272
  }
18085
18273
  return html;
18086
18274
  };
18087
- const displayTrg = function(mode, op) {
18275
+ const displayTrg = function(mode2, op) {
18088
18276
  let html = "";
18089
18277
  if (op.type === id.TRG) {
18090
- if (mode === MODE_HEX || mode === MODE_UNICODE) {
18278
+ if (mode2 === MODE_HEX || mode2 === MODE_UNICODE) {
18091
18279
  let hex = op.min.toString(16).toUpperCase();
18092
18280
  if (hex.length % 2 !== 0) {
18093
18281
  hex = `0${hex}`;
18094
18282
  }
18095
- html += mode === MODE_HEX ? "%x" : "U+";
18283
+ html += mode2 === MODE_HEX ? "%x" : "U+";
18096
18284
  html += hex;
18097
18285
  hex = op.max.toString(16).toUpperCase();
18098
18286
  if (hex.length % 2 !== 0) {
@@ -18105,10 +18293,10 @@ var require_trace = __commonJS((exports, module) => {
18105
18293
  }
18106
18294
  return html;
18107
18295
  };
18108
- const displayRep = function(mode, op) {
18296
+ const displayRep = function(mode2, op) {
18109
18297
  let html = "";
18110
18298
  if (op.type === id.REP) {
18111
- if (mode === MODE_HEX) {
18299
+ if (mode2 === MODE_HEX) {
18112
18300
  let hex = op.min.toString(16).toUpperCase();
18113
18301
  if (hex.length % 2 !== 0) {
18114
18302
  hex = `0${hex}`;
@@ -18131,12 +18319,12 @@ var require_trace = __commonJS((exports, module) => {
18131
18319
  }
18132
18320
  return html;
18133
18321
  };
18134
- const displayTbs = function(mode, op) {
18322
+ const displayTbs = function(mode2, op) {
18135
18323
  let html = "";
18136
18324
  if (op.type === id.TBS) {
18137
18325
  const len = Math.min(op.string.length, MAX_TLS * 2);
18138
- if (mode === MODE_HEX || mode === MODE_UNICODE) {
18139
- html += mode === MODE_HEX ? "%x" : "U+";
18326
+ if (mode2 === MODE_HEX || mode2 === MODE_UNICODE) {
18327
+ html += mode2 === MODE_HEX ? "%x" : "U+";
18140
18328
  for (let i = 0;i < len; i += 1) {
18141
18329
  let hex;
18142
18330
  if (i > 0) {
@@ -18163,20 +18351,20 @@ var require_trace = __commonJS((exports, module) => {
18163
18351
  }
18164
18352
  return html;
18165
18353
  };
18166
- const displayTls = function(mode, op) {
18354
+ const displayTls = function(mode2, op) {
18167
18355
  let html = "";
18168
18356
  if (op.type === id.TLS) {
18169
18357
  const len = Math.min(op.string.length, MAX_TLS);
18170
- if (mode === MODE_HEX || mode === MODE_DEC) {
18358
+ if (mode2 === MODE_HEX || mode2 === MODE_DEC) {
18171
18359
  let charu;
18172
18360
  let charl;
18173
- let base;
18174
- if (mode === MODE_HEX) {
18361
+ let base2;
18362
+ if (mode2 === MODE_HEX) {
18175
18363
  html = "%x";
18176
- base = 16;
18364
+ base2 = 16;
18177
18365
  } else {
18178
18366
  html = "%d";
18179
- base = 10;
18367
+ base2 = 10;
18180
18368
  }
18181
18369
  for (let i = 0;i < len; i += 1) {
18182
18370
  if (i > 0) {
@@ -18185,13 +18373,13 @@ var require_trace = __commonJS((exports, module) => {
18185
18373
  charl = op.string[i];
18186
18374
  if (charl >= 97 && charl <= 122) {
18187
18375
  charu = charl - 32;
18188
- html += `${charu.toString(base)}/${charl.toString(base)}`.toUpperCase();
18376
+ html += `${charu.toString(base2)}/${charl.toString(base2)}`.toUpperCase();
18189
18377
  } else if (charl >= 65 && charl <= 90) {
18190
18378
  charu = charl;
18191
18379
  charl += 32;
18192
- html += `${charu.toString(base)}/${charl.toString(base)}`.toUpperCase();
18380
+ html += `${charu.toString(base2)}/${charl.toString(base2)}`.toUpperCase();
18193
18381
  } else {
18194
- html += charl.toString(base).toUpperCase();
18382
+ html += charl.toString(base2).toUpperCase();
18195
18383
  }
18196
18384
  }
18197
18385
  if (len < op.string.length) {
@@ -18210,13 +18398,13 @@ var require_trace = __commonJS((exports, module) => {
18210
18398
  }
18211
18399
  return html;
18212
18400
  };
18213
- const subPhrase = function(mode, charsArg, index2, length, prev) {
18401
+ const subPhrase = function(mode2, charsArg, index2, length, prev) {
18214
18402
  if (length === 0) {
18215
18403
  return "";
18216
18404
  }
18217
18405
  let phrase = "";
18218
18406
  const comma = prev ? "," : "";
18219
- switch (mode) {
18407
+ switch (mode2) {
18220
18408
  case MODE_HEX:
18221
18409
  phrase = comma + utils.charsToHex(charsArg, index2, length);
18222
18410
  break;
@@ -18236,7 +18424,7 @@ var require_trace = __commonJS((exports, module) => {
18236
18424
  }
18237
18425
  return phrase;
18238
18426
  };
18239
- const displayBehind = function(mode, charsArg, state, index2, length, anchor) {
18427
+ const displayBehind = function(mode2, charsArg, state, index2, length, anchor) {
18240
18428
  let html = "";
18241
18429
  let beg1;
18242
18430
  let len1;
@@ -18272,18 +18460,18 @@ var require_trace = __commonJS((exports, module) => {
18272
18460
  }
18273
18461
  if (len1 > 0) {
18274
18462
  html += spanBehind;
18275
- html += subPhrase(mode, charsArg, beg1, len1, prev);
18463
+ html += subPhrase(mode2, charsArg, beg1, len1, prev);
18276
18464
  html += spanend;
18277
18465
  prev = true;
18278
18466
  }
18279
18467
  if (len2 > 0) {
18280
18468
  html += spanRemainder;
18281
- html += subPhrase(mode, charsArg, beg2, len2, prev);
18469
+ html += subPhrase(mode2, charsArg, beg2, len2, prev);
18282
18470
  html += spanend;
18283
18471
  }
18284
18472
  return html + lastchar;
18285
18473
  };
18286
- const displayForward = function(mode, charsArg, state, index2, length, spanAhead) {
18474
+ const displayForward = function(mode2, charsArg, state, index2, length, spanAhead) {
18287
18475
  let html = "";
18288
18476
  let beg1;
18289
18477
  let len1;
@@ -18323,26 +18511,26 @@ var require_trace = __commonJS((exports, module) => {
18323
18511
  }
18324
18512
  if (len1 > 0) {
18325
18513
  html += spanAhead;
18326
- html += subPhrase(mode, charsArg, beg1, len1, prev);
18514
+ html += subPhrase(mode2, charsArg, beg1, len1, prev);
18327
18515
  html += spanend;
18328
18516
  prev = true;
18329
18517
  }
18330
18518
  if (len2 > 0) {
18331
18519
  html += spanRemainder;
18332
- html += subPhrase(mode, charsArg, beg2, len2, prev);
18520
+ html += subPhrase(mode2, charsArg, beg2, len2, prev);
18333
18521
  html += spanend;
18334
18522
  }
18335
18523
  return html + lastchar;
18336
18524
  };
18337
- const displayAhead = function(mode, charsArg, state, index2, length) {
18525
+ const displayAhead = function(mode2, charsArg, state, index2, length) {
18338
18526
  const spanAhead = `<span class="${style.CLASS_LOOKAHEAD}">`;
18339
- return displayForward(mode, charsArg, state, index2, length, spanAhead);
18527
+ return displayForward(mode2, charsArg, state, index2, length, spanAhead);
18340
18528
  };
18341
- const displayNone = function(mode, charsArg, state, index2, length) {
18529
+ const displayNone = function(mode2, charsArg, state, index2, length) {
18342
18530
  const spanAhead = `<span class="${style.CLASS_MATCH}">`;
18343
- return displayForward(mode, charsArg, state, index2, length, spanAhead);
18531
+ return displayForward(mode2, charsArg, state, index2, length, spanAhead);
18344
18532
  };
18345
- const htmlTable = function(mode) {
18533
+ const htmlTable = function(mode2) {
18346
18534
  if (rules === null) {
18347
18535
  return "";
18348
18536
  }
@@ -18408,7 +18596,7 @@ var require_trace = __commonJS((exports, module) => {
18408
18596
  }
18409
18597
  html += "</td>";
18410
18598
  html += "<td>";
18411
- html += that.indent(line.depth);
18599
+ html += that2.indent(line.depth);
18412
18600
  if (lookAhead) {
18413
18601
  html += `<span class="${style.CLASS_LOOKAHEAD}">`;
18414
18602
  } else if (lookBehind) {
@@ -18427,16 +18615,16 @@ var require_trace = __commonJS((exports, module) => {
18427
18615
  html += `(${udts[line.opcode.index].name}) `;
18428
18616
  }
18429
18617
  if (line.opcode.type === id.TRG) {
18430
- html += `(${displayTrg(mode, line.opcode)}) `;
18618
+ html += `(${displayTrg(mode2, line.opcode)}) `;
18431
18619
  }
18432
18620
  if (line.opcode.type === id.TBS) {
18433
- html += `(${displayTbs(mode, line.opcode)}) `;
18621
+ html += `(${displayTbs(mode2, line.opcode)}) `;
18434
18622
  }
18435
18623
  if (line.opcode.type === id.TLS) {
18436
- html += `(${displayTls(mode, line.opcode)}) `;
18624
+ html += `(${displayTls(mode2, line.opcode)}) `;
18437
18625
  }
18438
18626
  if (line.opcode.type === id.REP) {
18439
- html += `(${displayRep(mode, line.opcode)}) `;
18627
+ html += `(${displayRep(mode2, line.opcode)}) `;
18440
18628
  }
18441
18629
  if (lookAround) {
18442
18630
  html += "</span>";
@@ -18444,11 +18632,11 @@ var require_trace = __commonJS((exports, module) => {
18444
18632
  html += "</td>";
18445
18633
  html += "<td>";
18446
18634
  if (lookBehind) {
18447
- html += displayBehind(mode, chars, line.state, line.phraseIndex, line.phraseLength, anchor);
18635
+ html += displayBehind(mode2, chars, line.state, line.phraseIndex, line.phraseLength, anchor);
18448
18636
  } else if (lookAhead) {
18449
- html += displayAhead(mode, chars, line.state, line.phraseIndex, line.phraseLength);
18637
+ html += displayAhead(mode2, chars, line.state, line.phraseIndex, line.phraseLength);
18450
18638
  } else {
18451
- html += displayNone(mode, chars, line.state, line.phraseIndex, line.phraseLength);
18639
+ html += displayNone(mode2, chars, line.state, line.phraseIndex, line.phraseLength);
18452
18640
  }
18453
18641
  html += `</td></tr>
18454
18642
  `;
@@ -18461,20 +18649,20 @@ var require_trace = __commonJS((exports, module) => {
18461
18649
  return html;
18462
18650
  };
18463
18651
  this.toHtml = function(modearg, caption) {
18464
- let mode = MODE_ASCII;
18652
+ let mode2 = MODE_ASCII;
18465
18653
  if (typeof modearg === "string" && modearg.length >= 3) {
18466
18654
  const modein = modearg.toLowerCase().slice(0, 3);
18467
18655
  if (modein === "hex") {
18468
- mode = MODE_HEX;
18656
+ mode2 = MODE_HEX;
18469
18657
  } else if (modein === "dec") {
18470
- mode = MODE_DEC;
18658
+ mode2 = MODE_DEC;
18471
18659
  } else if (modein === "uni") {
18472
- mode = MODE_UNICODE;
18660
+ mode2 = MODE_UNICODE;
18473
18661
  }
18474
18662
  }
18475
18663
  let html = "";
18476
- html += htmlHeader(mode, caption);
18477
- html += htmlTable(mode);
18664
+ html += htmlHeader(mode2, caption);
18665
+ html += htmlTable(mode2);
18478
18666
  html += htmlFooter();
18479
18667
  return html;
18480
18668
  };
@@ -23953,18 +24141,18 @@ var require_tslib = __commonJS((exports, module) => {
23953
24141
  var __addDisposableResource;
23954
24142
  var __disposeResources;
23955
24143
  (function(factory) {
23956
- var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
24144
+ var root2 = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
23957
24145
  if (typeof define === "function" && define.amd) {
23958
24146
  define("tslib", ["exports"], function(exports2) {
23959
- factory(createExporter(root, createExporter(exports2)));
24147
+ factory(createExporter(root2, createExporter(exports2)));
23960
24148
  });
23961
24149
  } else if (typeof module === "object" && typeof exports === "object") {
23962
- factory(createExporter(root, createExporter(exports)));
24150
+ factory(createExporter(root2, createExporter(exports)));
23963
24151
  } else {
23964
- factory(createExporter(root));
24152
+ factory(createExporter(root2));
23965
24153
  }
23966
24154
  function createExporter(exports2, previous) {
23967
- if (exports2 !== root) {
24155
+ if (exports2 !== root2) {
23968
24156
  if (typeof Object.create === "function") {
23969
24157
  Object.defineProperty(exports2, "__esModule", { value: true });
23970
24158
  } else {
@@ -24100,22 +24288,22 @@ var require_tslib = __commonJS((exports, module) => {
24100
24288
  return new (P || (P = Promise))(function(resolve, reject) {
24101
24289
  function fulfilled(value) {
24102
24290
  try {
24103
- step(generator.next(value));
24291
+ step2(generator.next(value));
24104
24292
  } catch (e) {
24105
24293
  reject(e);
24106
24294
  }
24107
24295
  }
24108
24296
  function rejected(value) {
24109
24297
  try {
24110
- step(generator["throw"](value));
24298
+ step2(generator["throw"](value));
24111
24299
  } catch (e) {
24112
24300
  reject(e);
24113
24301
  }
24114
24302
  }
24115
- function step(result) {
24303
+ function step2(result) {
24116
24304
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
24117
24305
  }
24118
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24306
+ step2((generator = generator.apply(thisArg, _arguments || [])).next());
24119
24307
  });
24120
24308
  };
24121
24309
  __generator = function(thisArg, body) {
@@ -24129,10 +24317,10 @@ var require_tslib = __commonJS((exports, module) => {
24129
24317
  }), g;
24130
24318
  function verb(n) {
24131
24319
  return function(v) {
24132
- return step([n, v]);
24320
+ return step2([n, v]);
24133
24321
  };
24134
24322
  }
24135
- function step(op) {
24323
+ function step2(op) {
24136
24324
  if (f)
24137
24325
  throw new TypeError("Generator is already executing.");
24138
24326
  while (g && (g = 0, op[0] && (_ = 0)), _)
@@ -24301,12 +24489,12 @@ var require_tslib = __commonJS((exports, module) => {
24301
24489
  }
24302
24490
  function resume(n, v) {
24303
24491
  try {
24304
- step(g[n](v));
24492
+ step2(g[n](v));
24305
24493
  } catch (e) {
24306
24494
  settle(q[0][3], e);
24307
24495
  }
24308
24496
  }
24309
- function step(r) {
24497
+ function step2(r) {
24310
24498
  r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
24311
24499
  }
24312
24500
  function fulfill(value) {
@@ -24688,26 +24876,26 @@ var require_errors = __commonJS((exports) => {
24688
24876
  });
24689
24877
  }
24690
24878
  exports.assertArgumentCount = assertArgumentCount;
24691
- var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
24879
+ var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form2) => {
24692
24880
  try {
24693
- if ("test".normalize(form) !== "test") {
24881
+ if ("test".normalize(form2) !== "test") {
24694
24882
  throw new Error("bad");
24695
24883
  }
24696
- if (form === "NFD") {
24884
+ if (form2 === "NFD") {
24697
24885
  const check = String.fromCharCode(233).normalize("NFD");
24698
24886
  const expected = String.fromCharCode(101, 769);
24699
24887
  if (check !== expected) {
24700
24888
  throw new Error("broken");
24701
24889
  }
24702
24890
  }
24703
- accum.push(form);
24891
+ accum.push(form2);
24704
24892
  } catch (error) {}
24705
24893
  return accum;
24706
24894
  }, []);
24707
- function assertNormalize(form) {
24708
- assert8(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
24895
+ function assertNormalize(form2) {
24896
+ assert8(_normalizeForms.indexOf(form2) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
24709
24897
  operation: "String.prototype.normalize",
24710
- info: { form }
24898
+ info: { form: form2 }
24711
24899
  });
24712
24900
  }
24713
24901
  exports.assertNormalize = assertNormalize;
@@ -25231,11 +25419,11 @@ var require_utf8 = __commonJS((exports) => {
25231
25419
  }
25232
25420
  return result;
25233
25421
  }
25234
- function toUtf8Bytes(str, form) {
25422
+ function toUtf8Bytes(str, form2) {
25235
25423
  (0, errors_js_1.assertArgument)(typeof str === "string", "invalid string value", "str", str);
25236
- if (form != null) {
25237
- (0, errors_js_1.assertNormalize)(form);
25238
- str = str.normalize(form);
25424
+ if (form2 != null) {
25425
+ (0, errors_js_1.assertNormalize)(form2);
25426
+ str = str.normalize(form2);
25239
25427
  }
25240
25428
  let result = [];
25241
25429
  for (let i = 0;i < str.length; i++) {
@@ -25276,8 +25464,8 @@ var require_utf8 = __commonJS((exports) => {
25276
25464
  return _toUtf8String(getUtf8CodePoints(bytes, onError));
25277
25465
  }
25278
25466
  exports.toUtf8String = toUtf8String;
25279
- function toUtf8CodePoints(str, form) {
25280
- return getUtf8CodePoints(toUtf8Bytes(str, form));
25467
+ function toUtf8CodePoints(str, form2) {
25468
+ return getUtf8CodePoints(toUtf8Bytes(str, form2));
25281
25469
  }
25282
25470
  exports.toUtf8CodePoints = toUtf8CodePoints;
25283
25471
  });
@@ -26459,7 +26647,7 @@ var require_units = __commonJS((exports) => {
26459
26647
  "finney",
26460
26648
  "ether"
26461
26649
  ];
26462
- function formatUnits4(value, unit) {
26650
+ function formatUnits3(value, unit) {
26463
26651
  let decimals = 18;
26464
26652
  if (typeof unit === "string") {
26465
26653
  const index2 = names.indexOf(unit);
@@ -26470,7 +26658,7 @@ var require_units = __commonJS((exports) => {
26470
26658
  }
26471
26659
  return fixednumber_js_1.FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString();
26472
26660
  }
26473
- exports.formatUnits = formatUnits4;
26661
+ exports.formatUnits = formatUnits3;
26474
26662
  function parseUnits3(value, unit) {
26475
26663
  (0, errors_js_1.assertArgument)(typeof value === "string", "value must be a string", "value", value);
26476
26664
  let decimals = 18;
@@ -26484,10 +26672,10 @@ var require_units = __commonJS((exports) => {
26484
26672
  return fixednumber_js_1.FixedNumber.fromString(value, { decimals, width: 512 }).value;
26485
26673
  }
26486
26674
  exports.parseUnits = parseUnits3;
26487
- function formatEther3(wei) {
26488
- return formatUnits4(wei, 18);
26675
+ function formatEther4(wei) {
26676
+ return formatUnits3(wei, 18);
26489
26677
  }
26490
- exports.formatEther = formatEther3;
26678
+ exports.formatEther = formatEther4;
26491
26679
  function parseEther3(ether) {
26492
26680
  return parseUnits3(ether, 18);
26493
26681
  }
@@ -28816,10 +29004,10 @@ var require_modular = __commonJS((exports) => {
28816
29004
  if (S === 1) {
28817
29005
  const p1div4 = (P + _1n7) / _4n3;
28818
29006
  return function tonelliFast(Fp, n) {
28819
- const root = Fp.pow(n, p1div4);
28820
- if (!Fp.eql(Fp.sqr(root), n))
29007
+ const root2 = Fp.pow(n, p1div4);
29008
+ if (!Fp.eql(Fp.sqr(root2), n))
28821
29009
  throw new Error("Cannot find square root");
28822
- return root;
29010
+ return root2;
28823
29011
  };
28824
29012
  }
28825
29013
  const Q1div2 = (Q + _1n7) / _2n5;
@@ -28853,10 +29041,10 @@ var require_modular = __commonJS((exports) => {
28853
29041
  if (P % _4n3 === _3n3) {
28854
29042
  const p1div4 = (P + _1n7) / _4n3;
28855
29043
  return function sqrt3mod42(Fp, n) {
28856
- const root = Fp.pow(n, p1div4);
28857
- if (!Fp.eql(Fp.sqr(root), n))
29044
+ const root2 = Fp.pow(n, p1div4);
29045
+ if (!Fp.eql(Fp.sqr(root2), n))
28858
29046
  throw new Error("Cannot find square root");
28859
- return root;
29047
+ return root2;
28860
29048
  };
28861
29049
  }
28862
29050
  if (P % _8n2 === _5n2) {
@@ -28866,10 +29054,10 @@ var require_modular = __commonJS((exports) => {
28866
29054
  const v = Fp.pow(n2, c1);
28867
29055
  const nv = Fp.mul(n, v);
28868
29056
  const i = Fp.mul(Fp.mul(nv, _2n5), v);
28869
- const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
28870
- if (!Fp.eql(Fp.sqr(root), n))
29057
+ const root2 = Fp.mul(nv, Fp.sub(i, Fp.ONE));
29058
+ if (!Fp.eql(Fp.sqr(root2), n))
28871
29059
  throw new Error("Cannot find square root");
28872
- return root;
29060
+ return root2;
28873
29061
  };
28874
29062
  }
28875
29063
  if (P % _16n === _9n) {}
@@ -29016,15 +29204,15 @@ var require_modular = __commonJS((exports) => {
29016
29204
  function FpSqrtOdd(Fp, elm) {
29017
29205
  if (!Fp.isOdd)
29018
29206
  throw new Error(`Field doesn't have isOdd`);
29019
- const root = Fp.sqrt(elm);
29020
- return Fp.isOdd(root) ? root : Fp.neg(root);
29207
+ const root2 = Fp.sqrt(elm);
29208
+ return Fp.isOdd(root2) ? root2 : Fp.neg(root2);
29021
29209
  }
29022
29210
  exports.FpSqrtOdd = FpSqrtOdd;
29023
29211
  function FpSqrtEven(Fp, elm) {
29024
29212
  if (!Fp.isOdd)
29025
29213
  throw new Error(`Field doesn't have isOdd`);
29026
- const root = Fp.sqrt(elm);
29027
- return Fp.isOdd(root) ? Fp.neg(root) : root;
29214
+ const root2 = Fp.sqrt(elm);
29215
+ return Fp.isOdd(root2) ? Fp.neg(root2) : root2;
29028
29216
  }
29029
29217
  exports.FpSqrtEven = FpSqrtEven;
29030
29218
  function hashToPrivateScalar(hash3, groupOrder, isLE2 = false) {
@@ -29098,15 +29286,15 @@ var require_curve = __commonJS((exports) => {
29098
29286
  const { windows, windowSize } = opts(W);
29099
29287
  const points = [];
29100
29288
  let p = elm;
29101
- let base = p;
29289
+ let base2 = p;
29102
29290
  for (let window2 = 0;window2 < windows; window2++) {
29103
- base = p;
29104
- points.push(base);
29291
+ base2 = p;
29292
+ points.push(base2);
29105
29293
  for (let i = 1;i < windowSize; i++) {
29106
- base = base.add(p);
29107
- points.push(base);
29294
+ base2 = base2.add(p);
29295
+ points.push(base2);
29108
29296
  }
29109
- p = base.double();
29297
+ p = base2.double();
29110
29298
  }
29111
29299
  return points;
29112
29300
  },
@@ -29396,7 +29584,7 @@ var require_weierstrass = __commonJS((exports) => {
29396
29584
  }
29397
29585
  double() {
29398
29586
  const { a, b } = CURVE;
29399
- const b3 = Fp.mul(b, _3n3);
29587
+ const b32 = Fp.mul(b, _3n3);
29400
29588
  const { px: X1, py: Y1, pz: Z1 } = this;
29401
29589
  let { ZERO: X3, ZERO: Y3, ZERO: Z3 } = Fp;
29402
29590
  let t0 = Fp.mul(X1, X1);
@@ -29407,13 +29595,13 @@ var require_weierstrass = __commonJS((exports) => {
29407
29595
  Z3 = Fp.mul(X1, Z1);
29408
29596
  Z3 = Fp.add(Z3, Z3);
29409
29597
  X3 = Fp.mul(a, Z3);
29410
- Y3 = Fp.mul(b3, t2);
29598
+ Y3 = Fp.mul(b32, t2);
29411
29599
  Y3 = Fp.add(X3, Y3);
29412
29600
  X3 = Fp.sub(t1, Y3);
29413
29601
  Y3 = Fp.add(t1, Y3);
29414
29602
  Y3 = Fp.mul(X3, Y3);
29415
29603
  X3 = Fp.mul(t3, X3);
29416
- Z3 = Fp.mul(b3, Z3);
29604
+ Z3 = Fp.mul(b32, Z3);
29417
29605
  t2 = Fp.mul(a, t2);
29418
29606
  t3 = Fp.sub(t0, t2);
29419
29607
  t3 = Fp.mul(a, t3);
@@ -29438,7 +29626,7 @@ var require_weierstrass = __commonJS((exports) => {
29438
29626
  const { px: X2, py: Y2, pz: Z2 } = other;
29439
29627
  let { ZERO: X3, ZERO: Y3, ZERO: Z3 } = Fp;
29440
29628
  const a = CURVE.a;
29441
- const b3 = Fp.mul(CURVE.b, _3n3);
29629
+ const b32 = Fp.mul(CURVE.b, _3n3);
29442
29630
  let t0 = Fp.mul(X1, X2);
29443
29631
  let t1 = Fp.mul(Y1, Y2);
29444
29632
  let t2 = Fp.mul(Z1, Z2);
@@ -29458,7 +29646,7 @@ var require_weierstrass = __commonJS((exports) => {
29458
29646
  X3 = Fp.add(t1, t2);
29459
29647
  t5 = Fp.sub(t5, X3);
29460
29648
  Z3 = Fp.mul(a, t4);
29461
- X3 = Fp.mul(b3, t2);
29649
+ X3 = Fp.mul(b32, t2);
29462
29650
  Z3 = Fp.add(X3, Z3);
29463
29651
  X3 = Fp.sub(t1, Z3);
29464
29652
  Z3 = Fp.add(t1, Z3);
@@ -29466,7 +29654,7 @@ var require_weierstrass = __commonJS((exports) => {
29466
29654
  t1 = Fp.add(t0, t0);
29467
29655
  t1 = Fp.add(t1, t0);
29468
29656
  t2 = Fp.mul(a, t2);
29469
- t4 = Fp.mul(b3, t4);
29657
+ t4 = Fp.mul(b32, t4);
29470
29658
  t1 = Fp.add(t1, t2);
29471
29659
  t2 = Fp.sub(t0, t2);
29472
29660
  t2 = Fp.mul(a, t2);
@@ -30199,22 +30387,22 @@ var require_secp256k1 = __commonJS((exports) => {
30199
30387
  const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
30200
30388
  const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
30201
30389
  const b2 = y * y * y % P;
30202
- const b3 = b2 * b2 * y % P;
30203
- const b6 = (0, modular_js_1.pow2)(b3, _3n3, P) * b3 % P;
30204
- const b9 = (0, modular_js_1.pow2)(b6, _3n3, P) * b3 % P;
30390
+ const b32 = b2 * b2 * y % P;
30391
+ const b6 = (0, modular_js_1.pow2)(b32, _3n3, P) * b32 % P;
30392
+ const b9 = (0, modular_js_1.pow2)(b6, _3n3, P) * b32 % P;
30205
30393
  const b11 = (0, modular_js_1.pow2)(b9, _2n5, P) * b2 % P;
30206
30394
  const b22 = (0, modular_js_1.pow2)(b11, _11n, P) * b11 % P;
30207
30395
  const b44 = (0, modular_js_1.pow2)(b22, _22n, P) * b22 % P;
30208
30396
  const b88 = (0, modular_js_1.pow2)(b44, _44n, P) * b44 % P;
30209
30397
  const b176 = (0, modular_js_1.pow2)(b88, _88n, P) * b88 % P;
30210
30398
  const b220 = (0, modular_js_1.pow2)(b176, _44n, P) * b44 % P;
30211
- const b223 = (0, modular_js_1.pow2)(b220, _3n3, P) * b3 % P;
30399
+ const b223 = (0, modular_js_1.pow2)(b220, _3n3, P) * b32 % P;
30212
30400
  const t1 = (0, modular_js_1.pow2)(b223, _23n, P) * b22 % P;
30213
30401
  const t2 = (0, modular_js_1.pow2)(t1, _6n, P) * b2 % P;
30214
- const root = (0, modular_js_1.pow2)(t2, _2n5, P);
30215
- if (!Fp.eql(Fp.sqr(root), y))
30402
+ const root2 = (0, modular_js_1.pow2)(t2, _2n5, P);
30403
+ if (!Fp.eql(Fp.sqr(root2), y))
30216
30404
  throw new Error("Cannot find square root");
30217
- return root;
30405
+ return root2;
30218
30406
  }
30219
30407
  var Fp = (0, modular_js_1.Field)(secp256k1P2, undefined, undefined, { sqrt: sqrtMod2 });
30220
30408
  exports.secp256k1 = (0, _shortw_utils_js_1.createCurve)({
@@ -31509,12 +31697,12 @@ var require_array = __commonJS((exports) => {
31509
31697
  if (Array.isArray(values)) {
31510
31698
  arrayValues = values;
31511
31699
  } else if (values && typeof values === "object") {
31512
- let unique = {};
31700
+ let unique2 = {};
31513
31701
  arrayValues = coders.map((coder) => {
31514
31702
  const name = coder.localName;
31515
31703
  (0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
31516
- (0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
31517
- unique[name] = true;
31704
+ (0, index_js_1.assert)(!unique2[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
31705
+ unique2[name] = true;
31518
31706
  return values[name];
31519
31707
  });
31520
31708
  } else {
@@ -33801,10 +33989,10 @@ var require_dist = __commonJS((exports) => {
33801
33989
  }
33802
33990
  }
33803
33991
  check_fenced(norm);
33804
- let unique = Array_from(new Set(chars));
33805
- let [g] = determine_group(unique);
33992
+ let unique2 = Array_from(new Set(chars));
33993
+ let [g] = determine_group(unique2);
33806
33994
  check_group(g, chars);
33807
- check_whole(g, unique);
33995
+ check_whole(g, unique2);
33808
33996
  type = g.N;
33809
33997
  }
33810
33998
  }
@@ -33815,10 +34003,10 @@ var require_dist = __commonJS((exports) => {
33815
34003
  return info;
33816
34004
  });
33817
34005
  }
33818
- function check_whole(group, unique) {
34006
+ function check_whole(group, unique2) {
33819
34007
  let maker;
33820
34008
  let shared = [];
33821
- for (let cp of unique) {
34009
+ for (let cp of unique2) {
33822
34010
  let whole = WHOLE_MAP.get(cp);
33823
34011
  if (whole === UNIQUE_PH)
33824
34012
  return;
@@ -33839,9 +34027,9 @@ var require_dist = __commonJS((exports) => {
33839
34027
  }
33840
34028
  }
33841
34029
  }
33842
- function determine_group(unique) {
34030
+ function determine_group(unique2) {
33843
34031
  let groups = GROUPS;
33844
- for (let cp of unique) {
34032
+ for (let cp of unique2) {
33845
34033
  let gs = groups.filter((g) => group_has_cp(g, cp));
33846
34034
  if (!gs.length) {
33847
34035
  if (!GROUPS.some((g) => group_has_cp(g, cp))) {
@@ -34408,14 +34596,14 @@ var require_typed_data = __commonJS((exports) => {
34408
34596
  const types2 = {};
34409
34597
  Object.keys(_types).forEach((type) => {
34410
34598
  types2[type] = _types[type].map(({ name, type: type2 }) => {
34411
- let { base, index: index2 } = splitArray(type2);
34412
- if (base === "int" && !_types["int"]) {
34413
- base = "int256";
34599
+ let { base: base2, index: index2 } = splitArray(type2);
34600
+ if (base2 === "int" && !_types["int"]) {
34601
+ base2 = "int256";
34414
34602
  }
34415
- if (base === "uint" && !_types["uint"]) {
34416
- base = "uint256";
34603
+ if (base2 === "uint" && !_types["uint"]) {
34604
+ base2 = "uint256";
34417
34605
  }
34418
- return { name, type: base + (index2 || "") };
34606
+ return { name, type: base2 + (index2 || "") };
34419
34607
  });
34420
34608
  links.set(type, new Set);
34421
34609
  parents.set(type, []);
@@ -37135,7 +37323,7 @@ var require_provider = __commonJS((exports) => {
37135
37323
  logsBloom,
37136
37324
  logs,
37137
37325
  status,
37138
- root
37326
+ root: root2
37139
37327
  } = this;
37140
37328
  return {
37141
37329
  _type: "TransactionReceipt",
@@ -37152,7 +37340,7 @@ var require_provider = __commonJS((exports) => {
37152
37340
  index: index2,
37153
37341
  logs,
37154
37342
  logsBloom,
37155
- root,
37343
+ root: root2,
37156
37344
  status,
37157
37345
  to
37158
37346
  };
@@ -46439,12 +46627,12 @@ var require_provider_fallback = __commonJS((exports) => {
46439
46627
  weight: c.weight
46440
46628
  })))));
46441
46629
  }
46442
- const mode = getFuzzyMode(this.quorum, results);
46443
- if (mode === undefined) {
46630
+ const mode2 = getFuzzyMode(this.quorum, results);
46631
+ if (mode2 === undefined) {
46444
46632
  return;
46445
46633
  }
46446
- if (mode > this.#height) {
46447
- this.#height = mode;
46634
+ if (mode2 > this.#height) {
46635
+ this.#height = mode2;
46448
46636
  }
46449
46637
  return this.#height;
46450
46638
  }
@@ -50874,22 +51062,22 @@ var require_utils7 = __commonJS((exports) => {
50874
51062
  return new (P || (P = Promise))(function(resolve, reject) {
50875
51063
  function fulfilled(value) {
50876
51064
  try {
50877
- step(generator.next(value));
51065
+ step2(generator.next(value));
50878
51066
  } catch (e) {
50879
51067
  reject(e);
50880
51068
  }
50881
51069
  }
50882
51070
  function rejected(value) {
50883
51071
  try {
50884
- step(generator["throw"](value));
51072
+ step2(generator["throw"](value));
50885
51073
  } catch (e) {
50886
51074
  reject(e);
50887
51075
  }
50888
51076
  }
50889
- function step(result) {
51077
+ function step2(result) {
50890
51078
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
50891
51079
  }
50892
- step((generator = generator.apply(thisArg, _arguments || [])).next());
51080
+ step2((generator = generator.apply(thisArg, _arguments || [])).next());
50893
51081
  });
50894
51082
  };
50895
51083
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -50985,22 +51173,22 @@ var require_client = __commonJS((exports) => {
50985
51173
  return new (P || (P = Promise))(function(resolve, reject) {
50986
51174
  function fulfilled(value) {
50987
51175
  try {
50988
- step(generator.next(value));
51176
+ step2(generator.next(value));
50989
51177
  } catch (e) {
50990
51178
  reject(e);
50991
51179
  }
50992
51180
  }
50993
51181
  function rejected(value) {
50994
51182
  try {
50995
- step(generator["throw"](value));
51183
+ step2(generator["throw"](value));
50996
51184
  } catch (e) {
50997
51185
  reject(e);
50998
51186
  }
50999
51187
  }
51000
- function step(result) {
51188
+ function step2(result) {
51001
51189
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
51002
51190
  }
51003
- step((generator = generator.apply(thisArg, _arguments || [])).next());
51191
+ step2((generator = generator.apply(thisArg, _arguments || [])).next());
51004
51192
  });
51005
51193
  };
51006
51194
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -51335,31 +51523,45 @@ var {
51335
51523
  import { homedir } from "node:os";
51336
51524
  import { join } from "node:path";
51337
51525
  import { mkdir, rename, readFile, writeFile } from "node:fs/promises";
51338
- var CONFIG_DIR = join(homedir(), ".use-agently");
51339
- var CONFIG_PATH = join(CONFIG_DIR, "config.json");
51340
- async function loadConfig() {
51526
+ function getConfigDir(scope) {
51527
+ return scope === "local" ? join(process.cwd(), ".use-agently") : join(homedir(), ".use-agently");
51528
+ }
51529
+ function getConfigPath(scope) {
51530
+ return join(getConfigDir(scope), "config.json");
51531
+ }
51532
+ async function loadConfigFromPath(configPath) {
51341
51533
  let contents;
51342
51534
  try {
51343
- contents = await readFile(CONFIG_PATH, "utf8");
51535
+ contents = await readFile(configPath, "utf8");
51344
51536
  } catch {
51345
51537
  return;
51346
51538
  }
51347
51539
  try {
51348
51540
  return JSON.parse(contents);
51349
51541
  } catch {
51350
- throw new Error(`Config file at ${CONFIG_PATH} contains invalid JSON. Please fix or delete it and run \`use-agently init\`.`);
51542
+ throw new Error(`Config file at ${configPath} contains invalid JSON. Please fix or delete it and run \`use-agently init\`.`);
51351
51543
  }
51352
51544
  }
51353
- async function saveConfig(config) {
51354
- await mkdir(CONFIG_DIR, { recursive: true });
51355
- await writeFile(CONFIG_PATH, JSON.stringify(config, null, 2) + `
51545
+ async function loadConfig(scope) {
51546
+ if (scope !== undefined) {
51547
+ return loadConfigFromPath(getConfigPath(scope));
51548
+ }
51549
+ return await loadConfigFromPath(getConfigPath("local")) ?? await loadConfigFromPath(getConfigPath("global"));
51550
+ }
51551
+ async function saveConfig(config, scope = "global") {
51552
+ const configDir = getConfigDir(scope);
51553
+ const configPath = getConfigPath(scope);
51554
+ await mkdir(configDir, { recursive: true });
51555
+ await writeFile(configPath, JSON.stringify(config, null, 2) + `
51356
51556
  `, "utf8");
51357
51557
  }
51358
- async function backupConfig() {
51558
+ async function backupConfig(scope = "global") {
51559
+ const configDir = getConfigDir(scope);
51560
+ const configPath = getConfigPath(scope);
51359
51561
  const now = new Date;
51360
51562
  const timestamp = now.toISOString().replace(/T/, "_").replace(/:/g, "").replace(/\..+/, "").slice(0, 17);
51361
- const backupPath = join(CONFIG_DIR, `config-${timestamp}.json`);
51362
- await rename(CONFIG_PATH, backupPath);
51563
+ const backupPath = join(configDir, `config-${timestamp}.json`);
51564
+ await rename(configPath, backupPath);
51363
51565
  return backupPath;
51364
51566
  }
51365
51567
  async function getConfigOrThrow() {
@@ -59050,11 +59252,204 @@ function http(url, config = {}) {
59050
59252
  });
59051
59253
  };
59052
59254
  }
59255
+
59053
59256
  // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/index.js
59257
+ init_abis();
59054
59258
  init_getAddress();
59055
59259
  init_toHex();
59056
- init_formatEther();
59260
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/contracts.js
59261
+ var contracts = {
59262
+ gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
59263
+ l1Block: { address: "0x4200000000000000000000000000000000000015" },
59264
+ l2CrossDomainMessenger: {
59265
+ address: "0x4200000000000000000000000000000000000007"
59266
+ },
59267
+ l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
59268
+ l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
59269
+ l2ToL1MessagePasser: {
59270
+ address: "0x4200000000000000000000000000000000000016"
59271
+ }
59272
+ };
59273
+
59274
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/formatters.js
59275
+ init_fromHex();
59276
+ var formatters = {
59277
+ block: /* @__PURE__ */ defineBlock({
59278
+ format(args) {
59279
+ const transactions = args.transactions?.map((transaction) => {
59280
+ if (typeof transaction === "string")
59281
+ return transaction;
59282
+ const formatted = formatTransaction(transaction);
59283
+ if (formatted.typeHex === "0x7e") {
59284
+ formatted.isSystemTx = transaction.isSystemTx;
59285
+ formatted.mint = transaction.mint ? hexToBigInt(transaction.mint) : undefined;
59286
+ formatted.sourceHash = transaction.sourceHash;
59287
+ formatted.type = "deposit";
59288
+ }
59289
+ return formatted;
59290
+ });
59291
+ return {
59292
+ transactions,
59293
+ stateRoot: args.stateRoot
59294
+ };
59295
+ }
59296
+ }),
59297
+ transaction: /* @__PURE__ */ defineTransaction({
59298
+ format(args) {
59299
+ const transaction = {};
59300
+ if (args.type === "0x7e") {
59301
+ transaction.isSystemTx = args.isSystemTx;
59302
+ transaction.mint = args.mint ? hexToBigInt(args.mint) : undefined;
59303
+ transaction.sourceHash = args.sourceHash;
59304
+ transaction.type = "deposit";
59305
+ }
59306
+ return transaction;
59307
+ }
59308
+ }),
59309
+ transactionReceipt: /* @__PURE__ */ defineTransactionReceipt2({
59310
+ format(args) {
59311
+ return {
59312
+ l1GasPrice: args.l1GasPrice ? hexToBigInt(args.l1GasPrice) : null,
59313
+ l1GasUsed: args.l1GasUsed ? hexToBigInt(args.l1GasUsed) : null,
59314
+ l1Fee: args.l1Fee ? hexToBigInt(args.l1Fee) : null,
59315
+ l1FeeScalar: args.l1FeeScalar ? Number(args.l1FeeScalar) : null
59316
+ };
59317
+ }
59318
+ })
59319
+ };
59320
+
59321
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/serializers.js
59322
+ init_address();
59323
+ init_isAddress();
59324
+ init_toHex();
59325
+ function serializeTransaction4(transaction, signature) {
59326
+ if (isDeposit(transaction))
59327
+ return serializeTransactionDeposit(transaction);
59328
+ return serializeTransaction(transaction, signature);
59329
+ }
59330
+ var serializers = {
59331
+ transaction: serializeTransaction4
59332
+ };
59333
+ function serializeTransactionDeposit(transaction) {
59334
+ assertTransactionDeposit(transaction);
59335
+ const { sourceHash, data, from: from14, gas, isSystemTx, mint, to, value } = transaction;
59336
+ const serializedTransaction = [
59337
+ sourceHash,
59338
+ from14,
59339
+ to ?? "0x",
59340
+ mint ? toHex(mint) : "0x",
59341
+ value ? toHex(value) : "0x",
59342
+ gas ? toHex(gas) : "0x",
59343
+ isSystemTx ? "0x1" : "0x",
59344
+ data ?? "0x"
59345
+ ];
59346
+ return concatHex([
59347
+ "0x7e",
59348
+ toRlp(serializedTransaction)
59349
+ ]);
59350
+ }
59351
+ function isDeposit(transaction) {
59352
+ if (transaction.type === "deposit")
59353
+ return true;
59354
+ if (typeof transaction.sourceHash !== "undefined")
59355
+ return true;
59356
+ return false;
59357
+ }
59358
+ function assertTransactionDeposit(transaction) {
59359
+ const { from: from14, to } = transaction;
59360
+ if (from14 && !isAddress(from14))
59361
+ throw new InvalidAddressError({ address: from14 });
59362
+ if (to && !isAddress(to))
59363
+ throw new InvalidAddressError({ address: to });
59364
+ }
59365
+
59366
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/chainConfig.js
59367
+ var chainConfig = {
59368
+ blockTime: 2000,
59369
+ contracts,
59370
+ formatters,
59371
+ serializers
59372
+ };
59373
+
59374
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/utils/chain/defineChain.js
59375
+ function defineChain3(chain) {
59376
+ const chainInstance = {
59377
+ formatters: undefined,
59378
+ fees: undefined,
59379
+ serializers: undefined,
59380
+ ...chain
59381
+ };
59382
+ function extend(base) {
59383
+ return (fnOrExtended) => {
59384
+ const properties = typeof fnOrExtended === "function" ? fnOrExtended(base) : fnOrExtended;
59385
+ const combined = { ...base, ...properties };
59386
+ return Object.assign(combined, { extend: extend(combined) });
59387
+ };
59388
+ }
59389
+ return Object.assign(chainInstance, {
59390
+ extend: extend(chainInstance)
59391
+ });
59392
+ }
59057
59393
 
59394
+ // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/chains/definitions/base.js
59395
+ var sourceId = 1;
59396
+ var base = /* @__PURE__ */ defineChain3({
59397
+ ...chainConfig,
59398
+ id: 8453,
59399
+ name: "Base",
59400
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
59401
+ rpcUrls: {
59402
+ default: {
59403
+ http: ["https://mainnet.base.org"]
59404
+ }
59405
+ },
59406
+ blockExplorers: {
59407
+ default: {
59408
+ name: "Basescan",
59409
+ url: "https://basescan.org",
59410
+ apiUrl: "https://api.basescan.org/api"
59411
+ }
59412
+ },
59413
+ contracts: {
59414
+ ...chainConfig.contracts,
59415
+ disputeGameFactory: {
59416
+ [sourceId]: {
59417
+ address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"
59418
+ }
59419
+ },
59420
+ l2OutputOracle: {
59421
+ [sourceId]: {
59422
+ address: "0x56315b90c40730925ec5485cf004d835058518A0"
59423
+ }
59424
+ },
59425
+ multicall3: {
59426
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
59427
+ blockCreated: 5022
59428
+ },
59429
+ portal: {
59430
+ [sourceId]: {
59431
+ address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
59432
+ blockCreated: 17482143
59433
+ }
59434
+ },
59435
+ l1StandardBridge: {
59436
+ [sourceId]: {
59437
+ address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
59438
+ blockCreated: 17482143
59439
+ }
59440
+ }
59441
+ },
59442
+ sourceId
59443
+ });
59444
+ var basePreconf = /* @__PURE__ */ defineChain3({
59445
+ ...base,
59446
+ experimental_preconfirmationTime: 200,
59447
+ rpcUrls: {
59448
+ default: {
59449
+ http: ["https://mainnet-preconf.base.org"]
59450
+ }
59451
+ }
59452
+ });
59058
59453
  // ../../node_modules/.bun/@x402+evm@2.4.0+a87db4669db97ac8/node_modules/@x402/evm/dist/esm/chunk-GSU4DHTC.mjs
59059
59454
  var authorizationTypes = {
59060
59455
  TransferWithAuthorization: [
@@ -60747,12 +61142,12 @@ ZodString.create = (params) => {
60747
61142
  ...processCreateParams(params)
60748
61143
  });
60749
61144
  };
60750
- function floatSafeRemainder(val, step) {
61145
+ function floatSafeRemainder(val, step2) {
60751
61146
  const valDecCount = (val.toString().split(".")[1] || "").length;
60752
- const stepDecCount = (step.toString().split(".")[1] || "").length;
61147
+ const stepDecCount = (step2.toString().split(".")[1] || "").length;
60753
61148
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
60754
61149
  const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
60755
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
61150
+ const stepInt = Number.parseInt(step2.toFixed(decCount).replace(".", ""));
60756
61151
  return valInt % stepInt / 10 ** decCount;
60757
61152
  }
60758
61153
 
@@ -61574,9 +61969,9 @@ class ZodObject extends ZodType {
61574
61969
  _getCached() {
61575
61970
  if (this._cached !== null)
61576
61971
  return this._cached;
61577
- const shape = this._def.shape();
61578
- const keys = util.objectKeys(shape);
61579
- this._cached = { shape, keys };
61972
+ const shape2 = this._def.shape();
61973
+ const keys = util.objectKeys(shape2);
61974
+ this._cached = { shape: shape2, keys };
61580
61975
  return this._cached;
61581
61976
  }
61582
61977
  _parse(input) {
@@ -61591,7 +61986,7 @@ class ZodObject extends ZodType {
61591
61986
  return INVALID;
61592
61987
  }
61593
61988
  const { status, ctx } = this._processInputParams(input);
61594
- const { shape, keys: shapeKeys } = this._getCached();
61989
+ const { shape: shape2, keys: shapeKeys } = this._getCached();
61595
61990
  const extraKeys = [];
61596
61991
  if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
61597
61992
  for (const key in ctx.data) {
@@ -61602,7 +61997,7 @@ class ZodObject extends ZodType {
61602
61997
  }
61603
61998
  const pairs = [];
61604
61999
  for (const key of shapeKeys) {
61605
- const keyValidator = shape[key];
62000
+ const keyValidator = shape2[key];
61606
62001
  const value = ctx.data[key];
61607
62002
  pairs.push({
61608
62003
  key: { status: "valid", value: key },
@@ -61726,27 +62121,27 @@ class ZodObject extends ZodType {
61726
62121
  });
61727
62122
  }
61728
62123
  pick(mask) {
61729
- const shape = {};
62124
+ const shape2 = {};
61730
62125
  for (const key of util.objectKeys(mask)) {
61731
62126
  if (mask[key] && this.shape[key]) {
61732
- shape[key] = this.shape[key];
62127
+ shape2[key] = this.shape[key];
61733
62128
  }
61734
62129
  }
61735
62130
  return new ZodObject({
61736
62131
  ...this._def,
61737
- shape: () => shape
62132
+ shape: () => shape2
61738
62133
  });
61739
62134
  }
61740
62135
  omit(mask) {
61741
- const shape = {};
62136
+ const shape2 = {};
61742
62137
  for (const key of util.objectKeys(this.shape)) {
61743
62138
  if (!mask[key]) {
61744
- shape[key] = this.shape[key];
62139
+ shape2[key] = this.shape[key];
61745
62140
  }
61746
62141
  }
61747
62142
  return new ZodObject({
61748
62143
  ...this._def,
61749
- shape: () => shape
62144
+ shape: () => shape2
61750
62145
  });
61751
62146
  }
61752
62147
  deepPartial() {
@@ -61790,27 +62185,27 @@ class ZodObject extends ZodType {
61790
62185
  return createZodEnum(util.objectKeys(this.shape));
61791
62186
  }
61792
62187
  }
61793
- ZodObject.create = (shape, params) => {
62188
+ ZodObject.create = (shape2, params) => {
61794
62189
  return new ZodObject({
61795
- shape: () => shape,
62190
+ shape: () => shape2,
61796
62191
  unknownKeys: "strip",
61797
62192
  catchall: ZodNever.create(),
61798
62193
  typeName: ZodFirstPartyTypeKind.ZodObject,
61799
62194
  ...processCreateParams(params)
61800
62195
  });
61801
62196
  };
61802
- ZodObject.strictCreate = (shape, params) => {
62197
+ ZodObject.strictCreate = (shape2, params) => {
61803
62198
  return new ZodObject({
61804
- shape: () => shape,
62199
+ shape: () => shape2,
61805
62200
  unknownKeys: "strict",
61806
62201
  catchall: ZodNever.create(),
61807
62202
  typeName: ZodFirstPartyTypeKind.ZodObject,
61808
62203
  ...processCreateParams(params)
61809
62204
  });
61810
62205
  };
61811
- ZodObject.lazycreate = (shape, params) => {
62206
+ ZodObject.lazycreate = (shape2, params) => {
61812
62207
  return new ZodObject({
61813
- shape,
62208
+ shape: shape2,
61814
62209
  unknownKeys: "strip",
61815
62210
  catchall: ZodNever.create(),
61816
62211
  typeName: ZodFirstPartyTypeKind.ZodObject,
@@ -62766,23 +63161,23 @@ class ZodEffects extends ZodType {
62766
63161
  }
62767
63162
  if (effect.type === "transform") {
62768
63163
  if (ctx.common.async === false) {
62769
- const base = this._def.schema._parseSync({
63164
+ const base2 = this._def.schema._parseSync({
62770
63165
  data: ctx.data,
62771
63166
  path: ctx.path,
62772
63167
  parent: ctx
62773
63168
  });
62774
- if (!isValid(base))
63169
+ if (!isValid(base2))
62775
63170
  return INVALID;
62776
- const result = effect.transform(base.value, checkCtx);
63171
+ const result = effect.transform(base2.value, checkCtx);
62777
63172
  if (result instanceof Promise) {
62778
63173
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
62779
63174
  }
62780
63175
  return { status: status.value, value: result };
62781
63176
  } else {
62782
- return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
62783
- if (!isValid(base))
63177
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base2) => {
63178
+ if (!isValid(base2))
62784
63179
  return INVALID;
62785
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
63180
+ return Promise.resolve(effect.transform(base2.value, checkCtx)).then((result) => ({
62786
63181
  status: status.value,
62787
63182
  value: result
62788
63183
  }));
@@ -63555,7 +63950,8 @@ class EvmPrivateKeyWallet {
63555
63950
  }
63556
63951
  getX402Schemes() {
63557
63952
  const account = privateKeyToAccount(this.privateKey);
63558
- const signer = toClientEvmSigner(account);
63953
+ const publicClient = createPublicClient({ chain: base, transport: http() });
63954
+ const signer = toClientEvmSigner(account, publicClient);
63559
63955
  return [
63560
63956
  {
63561
63957
  network: "eip155:*",
@@ -63566,18 +63962,19 @@ class EvmPrivateKeyWallet {
63566
63962
  }
63567
63963
 
63568
63964
  // src/commands/init.ts
63569
- var initCommand = new Command("init").description("Generate a new local wallet and save it to config").option("--regenerate", "Backup existing config and generate a new wallet").action(async (options) => {
63570
- const existing = await loadConfig();
63965
+ var initCommand = new Command("init").description("Generate a new local wallet and save it to config").option("--regenerate", "Backup existing config and generate a new wallet").option("--local", "Save config to the current directory (.use-agently/config.json) instead of the home directory").action(async (options) => {
63966
+ const scope = options.local ? "local" : "global";
63967
+ const existing = await loadConfig(scope);
63571
63968
  if (existing?.wallet) {
63572
63969
  if (!options.regenerate) {
63573
63970
  console.error("Wallet already configured. Use --regenerate to create a new wallet.");
63574
63971
  process.exit(1);
63575
63972
  }
63576
- const backupPath = await backupConfig();
63973
+ const backupPath = await backupConfig(scope);
63577
63974
  console.log(`Existing config backed up to ${backupPath}`);
63578
63975
  }
63579
63976
  const walletConfig = generateEvmPrivateKeyConfig();
63580
- await saveConfig({ wallet: walletConfig });
63977
+ await saveConfig({ wallet: walletConfig }, scope);
63581
63978
  console.log("Wallet created successfully!");
63582
63979
  console.log(`Address: ${walletConfig.address}`);
63583
63980
  console.log(`
@@ -63601,233 +63998,48 @@ var whoamiCommand = new Command("whoami").description("Show current wallet info"
63601
63998
  console.log(`Type: ${wallet.type}`);
63602
63999
  console.log(`Address: ${wallet.address}`);
63603
64000
  });
63604
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/contracts.js
63605
- var contracts = {
63606
- gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
63607
- l1Block: { address: "0x4200000000000000000000000000000000000015" },
63608
- l2CrossDomainMessenger: {
63609
- address: "0x4200000000000000000000000000000000000007"
63610
- },
63611
- l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
63612
- l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
63613
- l2ToL1MessagePasser: {
63614
- address: "0x4200000000000000000000000000000000000016"
63615
- }
63616
- };
63617
-
63618
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/formatters.js
63619
- init_fromHex();
63620
- var formatters = {
63621
- block: /* @__PURE__ */ defineBlock({
63622
- format(args) {
63623
- const transactions = args.transactions?.map((transaction) => {
63624
- if (typeof transaction === "string")
63625
- return transaction;
63626
- const formatted = formatTransaction(transaction);
63627
- if (formatted.typeHex === "0x7e") {
63628
- formatted.isSystemTx = transaction.isSystemTx;
63629
- formatted.mint = transaction.mint ? hexToBigInt(transaction.mint) : undefined;
63630
- formatted.sourceHash = transaction.sourceHash;
63631
- formatted.type = "deposit";
63632
- }
63633
- return formatted;
63634
- });
63635
- return {
63636
- transactions,
63637
- stateRoot: args.stateRoot
63638
- };
63639
- }
63640
- }),
63641
- transaction: /* @__PURE__ */ defineTransaction({
63642
- format(args) {
63643
- const transaction = {};
63644
- if (args.type === "0x7e") {
63645
- transaction.isSystemTx = args.isSystemTx;
63646
- transaction.mint = args.mint ? hexToBigInt(args.mint) : undefined;
63647
- transaction.sourceHash = args.sourceHash;
63648
- transaction.type = "deposit";
63649
- }
63650
- return transaction;
63651
- }
63652
- }),
63653
- transactionReceipt: /* @__PURE__ */ defineTransactionReceipt2({
63654
- format(args) {
63655
- return {
63656
- l1GasPrice: args.l1GasPrice ? hexToBigInt(args.l1GasPrice) : null,
63657
- l1GasUsed: args.l1GasUsed ? hexToBigInt(args.l1GasUsed) : null,
63658
- l1Fee: args.l1Fee ? hexToBigInt(args.l1Fee) : null,
63659
- l1FeeScalar: args.l1FeeScalar ? Number(args.l1FeeScalar) : null
63660
- };
63661
- }
63662
- })
63663
- };
63664
64001
 
63665
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/serializers.js
63666
- init_address();
63667
- init_isAddress();
63668
- init_toHex();
63669
- function serializeTransaction4(transaction, signature) {
63670
- if (isDeposit(transaction))
63671
- return serializeTransactionDeposit(transaction);
63672
- return serializeTransaction(transaction, signature);
63673
- }
63674
- var serializers = {
63675
- transaction: serializeTransaction4
63676
- };
63677
- function serializeTransactionDeposit(transaction) {
63678
- assertTransactionDeposit(transaction);
63679
- const { sourceHash, data, from: from14, gas, isSystemTx, mint, to, value } = transaction;
63680
- const serializedTransaction = [
63681
- sourceHash,
63682
- from14,
63683
- to ?? "0x",
63684
- mint ? toHex(mint) : "0x",
63685
- value ? toHex(value) : "0x",
63686
- gas ? toHex(gas) : "0x",
63687
- isSystemTx ? "0x1" : "0x",
63688
- data ?? "0x"
63689
- ];
63690
- return concatHex([
63691
- "0x7e",
63692
- toRlp(serializedTransaction)
63693
- ]);
63694
- }
63695
- function isDeposit(transaction) {
63696
- if (transaction.type === "deposit")
63697
- return true;
63698
- if (typeof transaction.sourceHash !== "undefined")
63699
- return true;
63700
- return false;
63701
- }
63702
- function assertTransactionDeposit(transaction) {
63703
- const { from: from14, to } = transaction;
63704
- if (from14 && !isAddress(from14))
63705
- throw new InvalidAddressError({ address: from14 });
63706
- if (to && !isAddress(to))
63707
- throw new InvalidAddressError({ address: to });
63708
- }
63709
-
63710
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/op-stack/chainConfig.js
63711
- var chainConfig = {
63712
- blockTime: 2000,
63713
- contracts,
63714
- formatters,
63715
- serializers
63716
- };
63717
-
63718
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/utils/chain/defineChain.js
63719
- function defineChain3(chain) {
63720
- const chainInstance = {
63721
- formatters: undefined,
63722
- fees: undefined,
63723
- serializers: undefined,
63724
- ...chain
63725
- };
63726
- function extend(base) {
63727
- return (fnOrExtended) => {
63728
- const properties = typeof fnOrExtended === "function" ? fnOrExtended(base) : fnOrExtended;
63729
- const combined = { ...base, ...properties };
63730
- return Object.assign(combined, { extend: extend(combined) });
63731
- };
63732
- }
63733
- return Object.assign(chainInstance, {
63734
- extend: extend(chainInstance)
63735
- });
63736
- }
63737
-
63738
- // ../../node_modules/.bun/viem@2.46.3+9e930878b0ba546c/node_modules/viem/_esm/chains/definitions/base.js
63739
- var sourceId = 1;
63740
- var base = /* @__PURE__ */ defineChain3({
63741
- ...chainConfig,
63742
- id: 8453,
63743
- name: "Base",
63744
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
63745
- rpcUrls: {
63746
- default: {
63747
- http: ["https://mainnet.base.org"]
63748
- }
63749
- },
63750
- blockExplorers: {
63751
- default: {
63752
- name: "Basescan",
63753
- url: "https://basescan.org",
63754
- apiUrl: "https://api.basescan.org/api"
63755
- }
63756
- },
63757
- contracts: {
63758
- ...chainConfig.contracts,
63759
- disputeGameFactory: {
63760
- [sourceId]: {
63761
- address: "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"
63762
- }
63763
- },
63764
- l2OutputOracle: {
63765
- [sourceId]: {
63766
- address: "0x56315b90c40730925ec5485cf004d835058518A0"
63767
- }
63768
- },
63769
- multicall3: {
63770
- address: "0xca11bde05977b3631167028862be2a173976ca11",
63771
- blockCreated: 5022
63772
- },
63773
- portal: {
63774
- [sourceId]: {
63775
- address: "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",
63776
- blockCreated: 17482143
63777
- }
63778
- },
63779
- l1StandardBridge: {
63780
- [sourceId]: {
63781
- address: "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
63782
- blockCreated: 17482143
63783
- }
63784
- }
63785
- },
63786
- sourceId
63787
- });
63788
- var basePreconf = /* @__PURE__ */ defineChain3({
63789
- ...base,
63790
- experimental_preconfirmationTime: 200,
63791
- rpcUrls: {
63792
- default: {
63793
- http: ["https://mainnet-preconf.base.org"]
63794
- }
63795
- }
63796
- });
63797
64002
  // src/commands/balance.ts
64003
+ var BASE_USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
63798
64004
  var balanceCommand = new Command("balance").description("Check wallet balance on-chain").option("--rpc <url>", "Custom RPC URL").action(async (options) => {
63799
64005
  const config = await getConfigOrThrow();
63800
64006
  const wallet = loadWallet(config.wallet);
64007
+ const address = wallet.address;
63801
64008
  const client = createPublicClient({
63802
64009
  chain: base,
63803
64010
  transport: http(options.rpc)
63804
64011
  });
63805
- const balance = await client.getBalance({ address: wallet.address });
64012
+ const balance = await client.readContract({
64013
+ address: BASE_USDC,
64014
+ abi: erc20Abi,
64015
+ functionName: "balanceOf",
64016
+ args: [address]
64017
+ });
63806
64018
  console.log(`Address: ${wallet.address}`);
63807
- console.log(`Balance: ${formatEther(balance)} ETH (Base)`);
64019
+ console.log(`Balance: ${formatUnits(balance, 6)} USDC (Base)`);
63808
64020
  });
63809
64021
 
63810
64022
  // src/commands/agents.ts
63811
- var STATIC_SESSION = "MHgzODNmYWYxOThjOTI0NjUwZWRiODQzYTRiYWU3NDJhOGZlZDU4YzBkMzE5YTg3YjE1MTA2NzI5OTE4MDI5MjBk";
63812
- var AGENTS_URL = `https://agently.to/sessions/${STATIC_SESSION}/agents`;
64023
+ var AGENTS_URL = `https://use-agently.com/marketplace.json`;
63813
64024
  var agentsCommand = new Command("agents").description("List available agents on Agently").action(async () => {
63814
64025
  const response = await fetch(AGENTS_URL);
63815
64026
  if (!response.ok) {
63816
64027
  throw new Error(`Failed to fetch agents: ${response.status} ${response.statusText}`);
63817
64028
  }
63818
- const agents = await response.json();
63819
- if (!Array.isArray(agents) || agents.length === 0) {
64029
+ const data = await response.json();
64030
+ if (!data.agents || data.agents.length === 0) {
63820
64031
  console.log("No agents available.");
63821
64032
  return;
63822
64033
  }
63823
- for (const agent of agents) {
63824
- console.log(`${agent.name ?? agent.id ?? "unknown"}`);
64034
+ for (const agent of data.agents) {
64035
+ console.log(`${agent.name ?? agent.uri}`);
63825
64036
  if (agent.description) {
63826
64037
  console.log(` ${agent.description}`);
63827
64038
  }
63828
- if (agent.url) {
63829
- console.log(` ${agent.url}`);
64039
+ if (agent.protocols.length > 0) {
64040
+ console.log(` Protocols: ${agent.protocols.join(", ")}`);
63830
64041
  }
64042
+ console.log(` ${agent.uri}`);
63831
64043
  console.log();
63832
64044
  }
63833
64045
  });
@@ -66936,10 +67148,37 @@ async function createA2AClient(agentUrl, fetchImpl) {
66936
67148
  }
66937
67149
 
66938
67150
  // src/commands/a2a.ts
66939
- var a2aCommand = new Command("a2a").description("Send a message to an agent via A2A protocol").argument("<agent>", "Agent URL").requiredOption("-m, --message <text>", "Message to send").action(async (agentUrl, options) => {
67151
+ function extractTextFromParts(parts) {
67152
+ return parts.filter((p) => p.kind === "text").map((p) => p.text).join("");
67153
+ }
67154
+ function extractAgentText(result) {
67155
+ if (!result) {
67156
+ return "The agent processed your request but returned no response.";
67157
+ }
67158
+ if (result.kind === "message" && result.parts) {
67159
+ return extractTextFromParts(result.parts);
67160
+ }
67161
+ const messages = result.kind === "task" ? result.messages : result.task?.messages || result.messages;
67162
+ if (messages) {
67163
+ const text = messages.filter((m) => m.role === "agent").flatMap((m) => extractTextFromParts(m.parts)).join(`
67164
+ `);
67165
+ if (text)
67166
+ return text;
67167
+ }
67168
+ const artifacts = result.artifacts || result.task?.artifacts;
67169
+ if (artifacts && artifacts.length > 0) {
67170
+ const text = artifacts.flatMap((a) => extractTextFromParts(a.parts)).join(`
67171
+ `);
67172
+ if (text)
67173
+ return text;
67174
+ }
67175
+ return result.text || "The agent processed your request but returned no text response.";
67176
+ }
67177
+ var a2aCommand = new Command("a2a").description("Send a message to an agent via A2A protocol").argument("<agent>", "Agent URI").requiredOption("-m, --message <text>", "Message to send").action(async (agentUri, options) => {
66940
67178
  const config = await getConfigOrThrow();
66941
67179
  const wallet = loadWallet(config.wallet);
66942
67180
  const paymentFetch = createPaymentFetch(wallet);
67181
+ const agentUrl = `https://use-agently.com/${agentUri}/`;
66943
67182
  const client = await createA2AClient(agentUrl, paymentFetch);
66944
67183
  const result = await client.sendMessage({
66945
67184
  message: {
@@ -66949,22 +67188,7 @@ var a2aCommand = new Command("a2a").description("Send a message to an agent via
66949
67188
  parts: [{ kind: "text", text: options.message }]
66950
67189
  }
66951
67190
  });
66952
- if ("parts" in result) {
66953
- for (const part of result.parts) {
66954
- if (part.kind === "text") {
66955
- console.log(part.text);
66956
- }
66957
- }
66958
- } else if ("status" in result) {
66959
- console.log(`Task ${result.id}: ${result.status.state}`);
66960
- if (result.status.message) {
66961
- for (const part of result.status.message.parts) {
66962
- if (part.kind === "text") {
66963
- console.log(part.text);
66964
- }
66965
- }
66966
- }
66967
- }
67191
+ console.log(extractAgentText(result));
66968
67192
  });
66969
67193
 
66970
67194
  // src/commands/doctor.ts