@xyo-network/chain-wrappers 1.5.4 → 1.5.6

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.
@@ -1,14 +1,15 @@
1
1
  import type { PromisableArray } from '@xylabs/promise';
2
2
  import type { XyoProvider } from '@xyo-network/xl1-protocol';
3
- export interface BaseWrapperConfig {
3
+ export interface BaseWrapperConfig<T> {
4
4
  provider: XyoProvider;
5
+ value: T;
5
6
  }
6
- export declare class BaseWrapper<T, C extends BaseWrapperConfig = BaseWrapperConfig> {
7
+ export declare class BaseWrapper<T, C extends BaseWrapperConfig<T> = BaseWrapperConfig<T>> {
7
8
  protected readonly config: Partial<C>;
8
9
  protected readonly value: T;
9
10
  protected constructor(value: T, config?: Partial<C>);
10
11
  get provider(): XyoProvider | undefined;
11
- static create<T, C extends BaseWrapperConfig = BaseWrapperConfig>(value: T, config?: Partial<C>): Promise<BaseWrapper<T, BaseWrapperConfig>>;
12
+ static create<T, C extends BaseWrapperConfig<T> = BaseWrapperConfig<T>>(value: T, config?: Partial<C>): Promise<BaseWrapper<T, BaseWrapperConfig<T>>>;
12
13
  static validateConfig(_config: unknown): PromisableArray<Error>;
13
14
  static validateValue(_value: unknown): PromisableArray<Error>;
14
15
  validate(): PromisableArray<Error>;
@@ -1 +1 @@
1
- {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,WAAW,CAAA;CACtB;AAED,qBAAa,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACzE,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACrC,SAAS,CAAC,QAAQ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AAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAE,OAAO,CAAC,CAAC,CAAM;IAU/G,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC;IAI/D,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC;IAI7D,QAAQ,IAAI,eAAe,CAAC,KAAK,CAAC;CAGnC"}
@@ -0,0 +1,7 @@
1
+ import type { Address } from '@xylabs/hex';
2
+ import type { BaseWrapperConfig } from '../Base.ts';
3
+ import { BaseWrapper } from '../Base.ts';
4
+ export declare class ChainWrapper extends BaseWrapper<Address, BaseWrapperConfig<Address>> {
5
+ get id(): Address;
6
+ }
7
+ //# sourceMappingURL=chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/chain/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,qBAAa,YAAa,SAAQ,WAAW,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAChF,IAAI,EAAE,IAAI,OAAO,CAEhB;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from './chain.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chain/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/chain-wrappers",
4
- "version": "1.5.4",
4
+ "version": "1.5.6",
5
5
  "description": "XYO Layer One SDK Wrappers",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -34,25 +34,25 @@
34
34
  "deploy3": "echo Deploy3 not allowed!"
35
35
  },
36
36
  "dependencies": {
37
- "@xylabs/arraybuffer": "^4.11.4",
38
- "@xylabs/assert": "^4.11.4",
39
- "@xylabs/base": "^4.11.4",
40
- "@xylabs/events": "^4.11.4",
41
- "@xylabs/exists": "^4.11.4",
42
- "@xylabs/hex": "^4.11.4",
43
- "@xylabs/object": "^4.11.4",
44
- "@xylabs/promise": "^4.11.4",
45
- "@xylabs/typeof": "^4.11.4",
37
+ "@xylabs/arraybuffer": "^4.11.8",
38
+ "@xylabs/assert": "^4.11.8",
39
+ "@xylabs/base": "^4.11.8",
40
+ "@xylabs/events": "^4.11.8",
41
+ "@xylabs/exists": "^4.11.8",
42
+ "@xylabs/hex": "^4.11.8",
43
+ "@xylabs/object": "^4.11.8",
44
+ "@xylabs/promise": "^4.11.8",
45
+ "@xylabs/typeof": "^4.11.8",
46
46
  "@xyo-network/archivist-model": "^3.18.0",
47
47
  "@xyo-network/boundwitness-model": "^3.18.0",
48
48
  "@xyo-network/boundwitness-validator": "^3.18.0",
49
- "@xyo-network/chain-protocol": "^1.5.4",
50
- "@xyo-network/chain-utils": "^1.5.4",
51
- "@xyo-network/chain-validation": "^1.5.4",
49
+ "@xyo-network/chain-protocol": "^1.5.6",
50
+ "@xyo-network/chain-utils": "^1.5.6",
51
+ "@xyo-network/chain-validation": "^1.5.6",
52
52
  "@xyo-network/payload-builder": "^3.18.0",
53
53
  "@xyo-network/payload-model": "^3.18.0",
54
- "@xyo-network/xl1-protocol": "^1.4.12",
55
- "@xyo-network/xl1-protocol-sdk": "^1.5.4",
54
+ "@xyo-network/xl1-protocol": "^1.4.14",
55
+ "@xyo-network/xl1-protocol-sdk": "^1.5.6",
56
56
  "async-mutex": "^0.5.0"
57
57
  },
58
58
  "devDependencies": {
package/src/Base.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { PromisableArray } from '@xylabs/promise'
2
2
  import type { XyoProvider } from '@xyo-network/xl1-protocol'
3
3
 
4
- export interface BaseWrapperConfig {
4
+ export interface BaseWrapperConfig<T> {
5
5
  provider: XyoProvider
6
+ value: T
6
7
  }
7
8
 
8
- export class BaseWrapper<T, C extends BaseWrapperConfig = BaseWrapperConfig> {
9
+ export class BaseWrapper<T, C extends BaseWrapperConfig<T> = BaseWrapperConfig<T>> {
9
10
  protected readonly config: Partial<C>
10
11
  protected readonly value: T
11
12
  protected constructor(value: T, config: Partial<C> = {}) {
@@ -17,7 +18,7 @@ export class BaseWrapper<T, C extends BaseWrapperConfig = BaseWrapperConfig> {
17
18
  return this.config.provider
18
19
  }
19
20
 
20
- static async create<T, C extends BaseWrapperConfig = BaseWrapperConfig>(value: T, config: Partial<C> = {}) {
21
+ static async create<T, C extends BaseWrapperConfig<T> = BaseWrapperConfig<T>>(value: T, config: Partial<C> = {}) {
21
22
  if ((await this.validateValue(value)).length > 0) {
22
23
  throw new Error(`Invalid value for ${this.constructor.name}: ${value}`)
23
24
  }
@@ -0,0 +1,10 @@
1
+ import type { Address } from '@xylabs/hex'
2
+
3
+ import type { BaseWrapperConfig } from '../Base.ts'
4
+ import { BaseWrapper } from '../Base.ts'
5
+
6
+ export class ChainWrapper extends BaseWrapper<Address, BaseWrapperConfig<Address>> {
7
+ get id(): Address {
8
+ return this.value
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ export * from './chain.ts'