@dynamic-labs/utils 1.0.0-alpha.3 → 1.0.0-alpha.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,24 @@
1
1
 
2
+ ## [1.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2023-11-29)
3
+
4
+
5
+ ### Features
6
+
7
+ * gracefully handle uknown wallet ([#3997](https://github.com/dynamic-labs/DynamicAuth/issues/3997)) ([ce7ff6a](https://github.com/dynamic-labs/DynamicAuth/commit/ce7ff6a50a8e8947050734b61587c8cadd041dbe))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * remove total on sponsored transactions ([#4019](https://github.com/dynamic-labs/DynamicAuth/issues/4019)) ([d976678](https://github.com/dynamic-labs/DynamicAuth/commit/d9766787b29665fbcd7983c5d61c31a4d97c8257))
13
+ * send balance align information ([#4020](https://github.com/dynamic-labs/DynamicAuth/issues/4020)) ([508dccf](https://github.com/dynamic-labs/DynamicAuth/commit/508dccfa2c6aeaed30616b6a41b30002cccb3b40))
14
+
15
+ ## [1.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-11-28)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * update zerodev provider initialization ([#4015](https://github.com/dynamic-labs/DynamicAuth/issues/4015)) ([8faca00](https://github.com/dynamic-labs/DynamicAuth/commit/8faca00d414677adc5fecde451ca01da53fe9641))
21
+
2
22
  ## [1.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-11-28)
3
23
 
4
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -29,7 +29,7 @@
29
29
  "viem": "^1.5.3"
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs/logger": "1.0.0-alpha.3",
33
- "@dynamic-labs/types": "1.0.0-alpha.3"
32
+ "@dynamic-labs/logger": "1.0.0-alpha.5",
33
+ "@dynamic-labs/types": "1.0.0-alpha.5"
34
34
  }
35
35
  }
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * A DeferredPromise provides methods to manually resolve or reject a Promise.
7
+ * This is useful in scenarios where you need to resolve or reject a Promise
8
+ * outside of the executor function.
9
+ *
10
+ * @template T The type of the value with which the promise will be resolved.
11
+ */
12
+ class DeferredPromise {
13
+ constructor() {
14
+ this.promise = new Promise((resolve, reject) => {
15
+ this.resolve = resolve;
16
+ this.reject = reject;
17
+ });
18
+ }
19
+ }
20
+
21
+ exports.DeferredPromise = DeferredPromise;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A DeferredPromise provides methods to manually resolve or reject a Promise.
3
+ * This is useful in scenarios where you need to resolve or reject a Promise
4
+ * outside of the executor function.
5
+ *
6
+ * @template T The type of the value with which the promise will be resolved.
7
+ */
8
+ export declare class DeferredPromise<T> {
9
+ promise: Promise<T>;
10
+ resolve: (value: T | PromiseLike<T>) => void;
11
+ reject: (reason?: any) => void;
12
+ constructor();
13
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A DeferredPromise provides methods to manually resolve or reject a Promise.
3
+ * This is useful in scenarios where you need to resolve or reject a Promise
4
+ * outside of the executor function.
5
+ *
6
+ * @template T The type of the value with which the promise will be resolved.
7
+ */
8
+ class DeferredPromise {
9
+ constructor() {
10
+ this.promise = new Promise((resolve, reject) => {
11
+ this.resolve = resolve;
12
+ this.reject = reject;
13
+ });
14
+ }
15
+ }
16
+
17
+ export { DeferredPromise };
@@ -0,0 +1 @@
1
+ export { DeferredPromise } from './DeferredPromise';
@@ -8,6 +8,11 @@ class TransactionGasCannotBeSponsoredError extends DynamicError.DynamicError {
8
8
  constructor() {
9
9
  super('Transaction gas cannot be sponsored.');
10
10
  }
11
+ static isInstance(err) {
12
+ var _a;
13
+ const error = ((_a = err === null || err === void 0 ? void 0 : err.walk) === null || _a === void 0 ? void 0 : _a.call(err)) || err;
14
+ return error instanceof TransactionGasCannotBeSponsoredError;
15
+ }
11
16
  }
12
17
 
13
18
  exports.TransactionGasCannotBeSponsoredError = TransactionGasCannotBeSponsoredError;
@@ -1,4 +1,7 @@
1
1
  import { DynamicError } from './DynamicError';
2
2
  export declare class TransactionGasCannotBeSponsoredError extends DynamicError {
3
3
  constructor();
4
+ static isInstance(err: {
5
+ walk?: () => unknown;
6
+ } | unknown): err is TransactionGasCannotBeSponsoredError;
4
7
  }
@@ -4,6 +4,11 @@ class TransactionGasCannotBeSponsoredError extends DynamicError {
4
4
  constructor() {
5
5
  super('Transaction gas cannot be sponsored.');
6
6
  }
7
+ static isInstance(err) {
8
+ var _a;
9
+ const error = ((_a = err === null || err === void 0 ? void 0 : err.walk) === null || _a === void 0 ? void 0 : _a.call(err)) || err;
10
+ return error instanceof TransactionGasCannotBeSponsoredError;
11
+ }
7
12
  }
8
13
 
9
14
  export { TransactionGasCannotBeSponsoredError };
package/src/index.cjs CHANGED
@@ -32,6 +32,7 @@ var sleep = require('./sleep/sleep.cjs');
32
32
  var getOrMapViemChain = require('./getOrMapViemChain.cjs');
33
33
  var retryableFn = require('./retryableFn.cjs');
34
34
  var wrapMethodWithCallback = require('./wrapMethodWithCallback/wrapMethodWithCallback.cjs');
35
+ var DeferredPromise = require('./DeferredPromise/DeferredPromise.cjs');
35
36
 
36
37
 
37
38
 
@@ -79,3 +80,4 @@ exports.mapChain = getOrMapViemChain.mapChain;
79
80
  exports.FALLBACK_UNDEFINED = retryableFn.FALLBACK_UNDEFINED;
80
81
  exports.retryableFn = retryableFn.retryableFn;
81
82
  exports.wrapMethodWithCallback = wrapMethodWithCallback.wrapMethodWithCallback;
83
+ exports.DeferredPromise = DeferredPromise.DeferredPromise;
package/src/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from './sleep';
12
12
  export * from './getOrMapViemChain';
13
13
  export * from './retryableFn';
14
14
  export * from './wrapMethodWithCallback';
15
+ export * from './DeferredPromise';
package/src/index.js CHANGED
@@ -28,3 +28,4 @@ export { sleep } from './sleep/sleep.js';
28
28
  export { getChain, getOrMapViemChain, mapChain } from './getOrMapViemChain.js';
29
29
  export { FALLBACK_UNDEFINED, retryableFn } from './retryableFn.js';
30
30
  export { wrapMethodWithCallback } from './wrapMethodWithCallback/wrapMethodWithCallback.js';
31
+ export { DeferredPromise } from './DeferredPromise/DeferredPromise.js';