denotify-client 1.1.24 → 1.1.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -10908,6 +10908,7 @@ class Ft {
10908
10908
  if (e.length === 0)
10909
10909
  return [];
10910
10910
  const r = (s, i) => {
10911
+ console.log(t);
10911
10912
  const o = t[i].find((a) => a.name === s.function);
10912
10913
  if (!o)
10913
10914
  throw new Error("function not in ABI");
@@ -10924,8 +10925,9 @@ class Ft {
10924
10925
  );
10925
10926
  }
10926
10927
  async addFunction(e, t, r, s, i) {
10928
+ console.log(i);
10927
10929
  const o = new nh(e, s);
10928
- return o.interface.encodeFunctionData(t, r), i = i || await this.getAbiHash(s), this.data.push({
10930
+ return o.interface.encodeFunctionData(t, r), i = i || await this.getAbiHash(s), console.log(i), this.data.push({
10929
10931
  address: e,
10930
10932
  bytecode: o.interface.encodeFunctionData(t, r),
10931
10933
  abiHash: i,
@@ -11219,8 +11221,9 @@ class sn {
11219
11221
  ];
11220
11222
  if (!e.functions)
11221
11223
  return r;
11224
+ console.log(e.functions);
11222
11225
  const s = e.functions.map((i) => t[i.abiHash]);
11223
- return [
11226
+ return console.log(s), [
11224
11227
  ...Ft.readFields(e.functions, s),
11225
11228
  ...r
11226
11229
  ];
@@ -11286,6 +11289,10 @@ class on {
11286
11289
  { source: "defaults", label: "Event", type: "string", key: "event" }
11287
11290
  /* eslint-enable */
11288
11291
  ];
11292
+ if (!e.abiHash)
11293
+ throw new Error("abiHash is required for onchain event v2");
11294
+ if (!t[e.abiHash])
11295
+ throw new Error("ABI for hash not found in abis");
11289
11296
  const s = t[e.abiHash].find(
11290
11297
  (o) => o.name === e.event
11291
11298
  );
@@ -11386,9 +11393,15 @@ class Ht {
11386
11393
  static readFields(e, t, r) {
11387
11394
  switch (e) {
11388
11395
  case "PollFunctionV2":
11389
- return sn.readFields(t, r);
11396
+ return sn.readFields(
11397
+ t,
11398
+ r
11399
+ );
11390
11400
  case "OnchainEventV2":
11391
- return on.readFields(t, r);
11401
+ return on.readFields(
11402
+ t,
11403
+ r
11404
+ );
11392
11405
  default:
11393
11406
  throw new Error("Invalid Trigger ID");
11394
11407
  }
@@ -11447,7 +11460,7 @@ class Xi {
11447
11460
  }
11448
11461
  async updateAlert(e, t) {
11449
11462
  const r = [], { trigger: s, notification: i, ...o } = t;
11450
- return (o.name || o.enabled) && r.push(this.updateRawTrigger(e, o)), s && r.push(this.updateRawHandler(e, s)), i && r.push(this.updateRawNotify(e, i)), await Promise.all(r), await this.getAlert(e);
11463
+ return (o.name != null || o.enabled != null) && r.push(this.updateRawTrigger(e, o)), s && r.push(this.updateRawHandler(e, s)), i && r.push(this.updateRawNotify(e, i)), await Promise.all(r), await this.getAlert(e);
11451
11464
  }
11452
11465
  async deleteAlert(e) {
11453
11466
  return await this.request("delete", `alerts/${e}`);
@@ -11458,6 +11471,7 @@ class Xi {
11458
11471
  enabled: e.trigger.enabled,
11459
11472
  name: e.trigger.nickname,
11460
11473
  network: e.trigger.network,
11474
+ triggered: e.trigger.triggered,
11461
11475
  triggerId: Ht.RawTypeToSimpleType(e.trigger.type),
11462
11476
  trigger: await Ht.RawToSimple(e.trigger),
11463
11477
  notificationId: en.RawTypeToSimpleType(
@@ -11486,10 +11500,14 @@ class Xi {
11486
11500
  for (const a of Object.keys(r.params))
11487
11501
  s.searchParams.append(a, r.params[a]);
11488
11502
  const i = {
11489
- method: e,
11503
+ method: e.toUpperCase(),
11490
11504
  headers: this.headers
11491
11505
  };
11492
- return r.body && (i.body = JSON.stringify(r.body)), (await fetch(s.toString(), i)).json();
11506
+ r.body && (i.body = JSON.stringify(r.body));
11507
+ const o = await fetch(s.toString(), i);
11508
+ if (o.status !== 200)
11509
+ throw new Error(o.statusText);
11510
+ return o.json();
11493
11511
  }
11494
11512
  readFields(e, t, r) {
11495
11513
  return Ht.readFields(e, t, r);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denotify-client",
3
3
  "private": false,
4
- "version": "1.1.24",
4
+ "version": "1.1.26",
5
5
  "main": "./dist/denotify-client.cjs",
6
6
  "module": "./dist/denotify-client.mjs",
7
7
  "types": "./dist/denotify-client.d.ts",