@atomiqlabs/base 10.0.0-dev.15 → 10.0.0-dev.17

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.
@@ -4,10 +4,12 @@ export type TransactionConfirmationOptions = {
4
4
  feeRate?: string;
5
5
  };
6
6
  export type AbstractSigner = {
7
+ type: "AtomiqAbstractSigner";
7
8
  getAddress: () => string;
8
9
  init?: () => Promise<void>;
9
10
  stop?: () => Promise<void>;
10
11
  };
12
+ export declare function isAbstractSigner(val: any): val is AbstractSigner;
11
13
  export interface ChainInterface<TX = any, Signer extends AbstractSigner = AbstractSigner, ChainId extends string = string, NativeSigner = any> {
12
14
  readonly chainId: ChainId;
13
15
  /**
@@ -25,8 +27,9 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
25
27
  * Checks if a given string is a valid wallet address
26
28
  *
27
29
  * @param address
30
+ * @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
28
31
  */
29
- isValidAddress(address: string): boolean;
32
+ isValidAddress(address: string, lenient?: boolean): boolean;
30
33
  /**
31
34
  * Checks if a given string is a valid token identifier
32
35
  *
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAbstractSigner = void 0;
4
+ function isAbstractSigner(val) {
5
+ return typeof (val) === "object" && val.type === "AtomiqAbstractSigner" && typeof (val.getAddress) === "function";
6
+ }
7
+ exports.isAbstractSigner = isAbstractSigner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/base",
3
- "version": "10.0.0-dev.15",
3
+ "version": "10.0.0-dev.17",
4
4
  "description": "Base classes and interfaces for atomiq protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -5,11 +5,16 @@ export type TransactionConfirmationOptions = {
5
5
  };
6
6
 
7
7
  export type AbstractSigner = {
8
+ type: "AtomiqAbstractSigner",
8
9
  getAddress: () => string,
9
10
  init?: () => Promise<void>,
10
11
  stop?: () => Promise<void>
11
12
  };
12
13
 
14
+ export function isAbstractSigner(val: any): val is AbstractSigner {
15
+ return typeof(val)==="object" && val.type==="AtomiqAbstractSigner" && typeof(val.getAddress)==="function";
16
+ }
17
+
13
18
  export interface ChainInterface<
14
19
  TX = any,
15
20
  Signer extends AbstractSigner = AbstractSigner,
@@ -36,8 +41,9 @@ export interface ChainInterface<
36
41
  * Checks if a given string is a valid wallet address
37
42
  *
38
43
  * @param address
44
+ * @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
39
45
  */
40
- isValidAddress(address: string): boolean;
46
+ isValidAddress(address: string, lenient?: boolean): boolean;
41
47
 
42
48
  /**
43
49
  * Checks if a given string is a valid token identifier