@taqueria/protocol 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@taqueria/protocol",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A TypeScript package which contains types that are to be shared between @taqueria/node-sdk and @taqueria/taqueria.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "echo 'Nothing to build.' ",
8
9
  "build-ci": "echo \"just passing through for CI, no need to build\" && exit 0",
9
10
  "prod-config-ci": "echo \"just passing through for CI, no need to update SDK dependency\" && exit 0"
10
11
  },
@@ -20,13 +21,11 @@
20
21
  ],
21
22
  "author": "ECAD Labs",
22
23
  "license": "Apache-2.0",
23
-
24
24
  "repository": {
25
25
  "type": "git",
26
26
  "url": "https://github.com/ecadlabs/taqueria.git",
27
27
  "directory": "taqueria-protocol"
28
28
  },
29
-
30
29
  "bugs": {
31
30
  "url": "https://github.com/ecadlabs/taqueria/issues"
32
31
  },
@@ -187,9 +187,14 @@ export interface UnvalidatedNetwork {
187
187
  readonly attributes?: Attributes
188
188
  }
189
189
 
190
+ // NOTE: This is a workaround as TypeScript doesn't support
191
+ // recursive / cyclical types yet. :(
192
+ type Accounts_Base = Record<string, AccountDetails>
193
+ export type Accounts = Record<string, (keyof Accounts_Base)|AccountDetails>
194
+
190
195
  export interface UnvalidatedSandbox extends UnvalidatedNetwork {
191
196
  readonly plugin?: string
192
- readonly accounts?: Record<string, AccountDetails>
197
+ readonly accounts?: Accounts
193
198
  }
194
199
 
195
200
  const hookType: unique symbol = Symbol()
@@ -464,7 +469,7 @@ export interface SandboxConfig {
464
469
  readonly rpcUrl?: string
465
470
  readonly protocol?: string
466
471
  readonly attributes?: Attributes
467
- readonly accounts: Record<string|'default', AccountDetails|string>
472
+ readonly accounts: Accounts
468
473
  }
469
474
 
470
475
  export interface NetworkConfig {
@@ -510,6 +515,7 @@ export class EconomicalProtocolHash extends StringLike {
510
515
 
511
516
  const economicProtocalType: unique symbol = Symbol()
512
517
  export class EconomicalProtocol {
518
+ [economicProtocalType]: void
513
519
  readonly hash: EconomicalProtocolHash
514
520
  readonly label: HumanReadableIdentifier | undefined
515
521
  constructor(hash: EconomicalProtocolHash, label: (HumanReadableIdentifier|undefined)=undefined) {
@@ -555,11 +561,11 @@ export class Network {
555
561
 
556
562
  const sandboxType: unique symbol = Symbol()
557
563
  export class Sandbox extends Network {
558
- readonly accounts: Record<string, AccountDetails>
564
+ readonly accounts: Accounts
559
565
  [sandboxType]: void
560
566
  readonly plugin?: string
561
567
 
562
- protected constructor(name: HumanReadableIdentifier, label: StringMax30, rpcUrl: Url, protocol: EconomicalProtocol, attributes: Attributes, plugin?: string, accounts?: Record<string, AccountDetails>) {
568
+ protected constructor(name: HumanReadableIdentifier, label: StringMax30, rpcUrl: Url, protocol: EconomicalProtocol, attributes: Attributes, plugin?: string, accounts?: Accounts) {
563
569
  super(name, label, rpcUrl, protocol, attributes)
564
570
  this.plugin = plugin
565
571
  this.accounts = accounts ? accounts: {}