@xyo-network/xl1-protocol 1.5.18 → 1.5.19

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,25 +1,64 @@
1
- import type { Address, Hex } from '@xylabs/hex';
1
+ import type { Hex } from '@xylabs/hex';
2
+ import type { JsonValue } from '@xylabs/object';
2
3
  import type { Promisable } from '@xylabs/promise';
3
4
  export interface ChainConnection {
5
+ /** Chain Identifier - can be a hex (eth contract address) or a string */
4
6
  chainId?: string | Hex;
7
+ /** Name of the chain */
5
8
  name: string;
6
9
  /** Url for accessing the network */
7
10
  url: string;
8
11
  }
12
+ /**
13
+ * Modeled after EIP-2255
14
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
15
+ */
16
+ export interface PermissionRequest {
17
+ [capability: string]: {
18
+ [caveatName: string]: JsonValue;
19
+ };
20
+ }
21
+ /**
22
+ * Modeled after EIP-2255
23
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
24
+ */
25
+ export interface RequestedPermission {
26
+ /** Permission identifier (i.e. RPC method, action, etc.) */
27
+ capability: string;
28
+ /** Optional timestamp for when the permission was granted */
29
+ date?: number;
30
+ }
31
+ export type CaveatTypes = 'chain' | 'expiration' | 'filteredResponse' | 'rateLimit';
32
+ /**
33
+ * Modeled after EIP-2255
34
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
35
+ */
36
+ export interface Caveats {
37
+ /** Type of caveat */
38
+ type: CaveatTypes;
39
+ /** Value for the caveat (i.e. chain id, subset of accounts, expiration, max request per minute, etc.) */
40
+ value: JsonValue;
41
+ }
42
+ /**
43
+ * Modeled after EIP-2255
44
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
45
+ */
9
46
  export interface Permission {
47
+ /** Permission identifier (i.e. RPC method, action, etc.) */
10
48
  capability: string;
11
- chain: Address;
12
- expiration?: number;
13
- grantee?: string;
14
- id: string;
15
- issuedAt?: number;
16
- status?: 'granted' | 'revoked';
17
- value?: string[];
49
+ /** Caveats for the permission, if applicable (i.e. allowed accounts, signing, etc.) */
50
+ caveats?: Caveats[];
51
+ /** Invoker for the given permission (URI, domain, webpage, address, etc.) */
52
+ invoker: string;
53
+ }
54
+ export interface InvokerPermission extends Permission {
55
+ /** Time at which the permission was granted */
56
+ date?: number;
18
57
  }
19
58
  export interface XyoHost {
20
59
  addChain(chainConnectionInfo: ChainConnection): Promisable<boolean>;
21
60
  chains(): Promisable<ChainConnection[]>;
22
- getPermissions(): Promisable<Permission[]>;
61
+ getPermissions(): Promisable<InvokerPermission[]>;
23
62
  requestPermissions(permissions: Permission[]): Promisable<boolean>;
24
63
  revokePermissions(permissions: Permission[]): Promisable<boolean>;
25
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"XyoHost.d.ts","sourceRoot":"","sources":["../../../../src/provider/v1/XyoHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,WAAW,eAAe;IAE9B,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;IAEtB,IAAI,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IAEzB,UAAU,EAAE,MAAM,CAAA;IAElB,KAAK,EAAE,OAAO,CAAA;IAEd,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,EAAE,EAAE,MAAM,CAAA;IAEV,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAE9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,mBAAmB,EAAE,eAAe,GAAG,UAAU,CAAC,OAA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GAGG;AACH,MAAM,WAAW,UAAU;IACzB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAA;IAClB,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;IACnB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,mBAAmB,EAAE,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IACnE,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,CAAC,CAAA;IACvC,cAAc,IAAI,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACjD,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAClE,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;CAClE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-protocol",
4
- "version": "1.5.18",
4
+ "version": "1.5.19",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -1,38 +1,72 @@
1
- import type { Address, Hex } from '@xylabs/hex'
1
+ import type { Hex } from '@xylabs/hex'
2
+ import type { JsonValue } from '@xylabs/object'
2
3
  import type { Promisable } from '@xylabs/promise'
3
4
 
4
5
  export interface ChainConnection {
5
- // Chain Identifier - can be a hex (eth contract address) or a string
6
+ /** Chain Identifier - can be a hex (eth contract address) or a string */
6
7
  chainId?: string | Hex
7
- // Name of the chain
8
+ /** Name of the chain */
8
9
  name: string
9
10
  /** Url for accessing the network */
10
11
  url: string
11
12
  }
12
13
 
14
+ /**
15
+ * Modeled after EIP-2255
16
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
17
+ */
18
+ export interface PermissionRequest {
19
+ [capability: string]: {
20
+ [caveatName: string]: JsonValue
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Modeled after EIP-2255
26
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
27
+ */
28
+ export interface RequestedPermission {
29
+ /** Permission identifier (i.e. RPC method, action, etc.) */
30
+ capability: string
31
+ /** Optional timestamp for when the permission was granted */
32
+ date?: number
33
+ }
34
+
35
+ export type CaveatTypes = 'chain' | 'expiration' | 'filteredResponse' | 'rateLimit'
36
+
37
+ /**
38
+ * Modeled after EIP-2255
39
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
40
+ */
41
+ export interface Caveats {
42
+ /** Type of caveat */
43
+ type: CaveatTypes
44
+ /** Value for the caveat (i.e. chain id, subset of accounts, expiration, max request per minute, etc.) */
45
+ value: JsonValue
46
+ }
47
+
48
+ /**
49
+ * Modeled after EIP-2255
50
+ * See - https://eips.ethereum.org/EIPS/eip-2255#specification
51
+ */
13
52
  export interface Permission {
14
- // Permission identifier (i.e. RPC method, action, etc.)
53
+ /** Permission identifier (i.e. RPC method, action, etc.) */
15
54
  capability: string
16
- // NOTE: Against which chain this permission is granted
17
- chain: Address
18
- // Expiration to prevent ever-green-lighted permissions
19
- expiration?: number
20
- // Grantee for the request, if applicable (URI, domain, webpage, address, etc.)
21
- grantee?: string
22
- // UUID for the permission
23
- id: string
24
- // Time at which the permission was granted
25
- issuedAt?: number
26
- // status of the permission (granted, revoked, etc.)
27
- status?: 'granted' | 'revoked'
28
- // Specific value for the permission (i.e. allowed accounts, methods, etc.)
29
- value?: string[]
55
+ /** Caveats for the permission, if applicable (i.e. allowed accounts, signing, etc.) */
56
+ caveats?: Caveats[]
57
+ /** Invoker for the given permission (URI, domain, webpage, address, etc.) */
58
+ invoker: string
59
+ }
60
+
61
+ export interface InvokerPermission extends Permission {
62
+ /** Time at which the permission was granted */
63
+ date?: number
30
64
  }
31
65
 
32
66
  export interface XyoHost {
33
67
  addChain(chainConnectionInfo: ChainConnection): Promisable<boolean>
34
68
  chains(): Promisable<ChainConnection[]>
35
- getPermissions(): Promisable<Permission[]>
69
+ getPermissions(): Promisable<InvokerPermission[]>
36
70
  requestPermissions(permissions: Permission[]): Promisable<boolean>
37
71
  revokePermissions(permissions: Permission[]): Promisable<boolean>
38
72
  }