@0xsequence/guard 0.42.10 → 0.43.0

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.
@@ -3,46 +3,93 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _extends() {
6
- _extends = Object.assign || function (target) {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
7
7
  for (var i = 1; i < arguments.length; i++) {
8
8
  var source = arguments[i];
9
-
10
9
  for (var key in source) {
11
10
  if (Object.prototype.hasOwnProperty.call(source, key)) {
12
11
  target[key] = source[key];
13
12
  }
14
13
  }
15
14
  }
16
-
17
15
  return target;
18
16
  };
19
-
20
17
  return _extends.apply(this, arguments);
21
18
  }
22
19
 
23
20
  /* eslint-disable */
24
- // guardd v0.1.0 8d4d548d0af400f36ef39a21c29927fe65f9396c
21
+ // sequence-guard v0.4.0 8d39664df13fabe72919e65140f9563b21aa3531
25
22
  // --
26
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
27
- // Do not edit by hand. Update your webrpc schema and re-generate.
23
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
24
+ //
25
+ // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
26
+
28
27
  // WebRPC description and code-gen version
29
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
28
+ const WebRPCVersion = "v1";
29
+
30
+ // Schema version of your RIDL schema
31
+ const WebRPCSchemaVersion = "v0.4.0";
30
32
 
31
- const WebRPCSchemaVersion = "v0.1.0"; // Schema hash generated from your RIDL schema
33
+ // Schema hash generated from your RIDL schema
34
+ const WebRPCSchemaHash = "8d39664df13fabe72919e65140f9563b21aa3531";
32
35
 
33
- const WebRPCSchemaHash = "8d4d548d0af400f36ef39a21c29927fe65f9396c"; //
36
+ //
34
37
  // Types
35
38
  //
36
39
 
37
40
  //
38
41
  // Client
39
42
  //
40
- class GuarddService {
43
+ class Guard {
41
44
  constructor(hostname, fetch) {
42
45
  this.hostname = void 0;
43
46
  this.fetch = void 0;
44
- this.path = '/rpc/GuarddService/';
45
-
47
+ this.path = '/rpc/Guard/';
48
+ this.ping = headers => {
49
+ return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
50
+ return buildResponse(res).then(_data => {
51
+ return {
52
+ status: _data.status
53
+ };
54
+ });
55
+ });
56
+ };
57
+ this.version = headers => {
58
+ return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
59
+ return buildResponse(res).then(_data => {
60
+ return {
61
+ version: _data.version
62
+ };
63
+ });
64
+ });
65
+ };
66
+ this.runtimeStatus = headers => {
67
+ return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
68
+ return buildResponse(res).then(_data => {
69
+ return {
70
+ status: _data.status
71
+ };
72
+ });
73
+ });
74
+ };
75
+ this.getSequenceContext = headers => {
76
+ return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
77
+ return buildResponse(res).then(_data => {
78
+ return {
79
+ data: _data.data
80
+ };
81
+ });
82
+ });
83
+ };
84
+ this.getSignerConfig = headers => {
85
+ return this.fetch(this.url('GetSignerConfig'), createHTTPRequest({}, headers)).then(res => {
86
+ return buildResponse(res).then(_data => {
87
+ return {
88
+ signerConfig: _data.signerConfig
89
+ };
90
+ });
91
+ });
92
+ };
46
93
  this.sign = (args, headers) => {
47
94
  return this.fetch(this.url('Sign'), createHTTPRequest(args, headers)).then(res => {
48
95
  return buildResponse(res).then(_data => {
@@ -52,17 +99,13 @@ class GuarddService {
52
99
  });
53
100
  });
54
101
  };
55
-
56
102
  this.hostname = hostname;
57
- this.fetch = fetch;
103
+ this.fetch = (input, init) => fetch(input, init);
58
104
  }
59
-
60
105
  url(name) {
61
106
  return this.hostname + this.path + name;
62
107
  }
63
-
64
108
  }
65
-
66
109
  const createHTTPRequest = (body = {}, headers = {}) => {
67
110
  return {
68
111
  method: 'POST',
@@ -72,11 +115,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
72
115
  body: JSON.stringify(body || {})
73
116
  };
74
117
  };
75
-
76
118
  const buildResponse = res => {
77
119
  return res.text().then(text => {
78
120
  let data;
79
-
80
121
  try {
81
122
  data = JSON.parse(text);
82
123
  } catch (err) {
@@ -86,7 +127,6 @@ const buildResponse = res => {
86
127
  status: res.status
87
128
  };
88
129
  }
89
-
90
130
  if (!res.ok) {
91
131
  throw data; // webrpc error response
92
132
  }
@@ -95,7 +135,7 @@ const buildResponse = res => {
95
135
  });
96
136
  };
97
137
 
98
- exports.GuarddService = GuarddService;
138
+ exports.Guard = Guard;
99
139
  exports.WebRPCSchemaHash = WebRPCSchemaHash;
100
140
  exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
101
141
  exports.WebRPCVersion = WebRPCVersion;
@@ -3,46 +3,93 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _extends() {
6
- _extends = Object.assign || function (target) {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
7
7
  for (var i = 1; i < arguments.length; i++) {
8
8
  var source = arguments[i];
9
-
10
9
  for (var key in source) {
11
10
  if (Object.prototype.hasOwnProperty.call(source, key)) {
12
11
  target[key] = source[key];
13
12
  }
14
13
  }
15
14
  }
16
-
17
15
  return target;
18
16
  };
19
-
20
17
  return _extends.apply(this, arguments);
21
18
  }
22
19
 
23
20
  /* eslint-disable */
24
- // guardd v0.1.0 8d4d548d0af400f36ef39a21c29927fe65f9396c
21
+ // sequence-guard v0.4.0 8d39664df13fabe72919e65140f9563b21aa3531
25
22
  // --
26
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
27
- // Do not edit by hand. Update your webrpc schema and re-generate.
23
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
24
+ //
25
+ // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
26
+
28
27
  // WebRPC description and code-gen version
29
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
28
+ const WebRPCVersion = "v1";
29
+
30
+ // Schema version of your RIDL schema
31
+ const WebRPCSchemaVersion = "v0.4.0";
30
32
 
31
- const WebRPCSchemaVersion = "v0.1.0"; // Schema hash generated from your RIDL schema
33
+ // Schema hash generated from your RIDL schema
34
+ const WebRPCSchemaHash = "8d39664df13fabe72919e65140f9563b21aa3531";
32
35
 
33
- const WebRPCSchemaHash = "8d4d548d0af400f36ef39a21c29927fe65f9396c"; //
36
+ //
34
37
  // Types
35
38
  //
36
39
 
37
40
  //
38
41
  // Client
39
42
  //
40
- class GuarddService {
43
+ class Guard {
41
44
  constructor(hostname, fetch) {
42
45
  this.hostname = void 0;
43
46
  this.fetch = void 0;
44
- this.path = '/rpc/GuarddService/';
45
-
47
+ this.path = '/rpc/Guard/';
48
+ this.ping = headers => {
49
+ return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
50
+ return buildResponse(res).then(_data => {
51
+ return {
52
+ status: _data.status
53
+ };
54
+ });
55
+ });
56
+ };
57
+ this.version = headers => {
58
+ return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
59
+ return buildResponse(res).then(_data => {
60
+ return {
61
+ version: _data.version
62
+ };
63
+ });
64
+ });
65
+ };
66
+ this.runtimeStatus = headers => {
67
+ return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
68
+ return buildResponse(res).then(_data => {
69
+ return {
70
+ status: _data.status
71
+ };
72
+ });
73
+ });
74
+ };
75
+ this.getSequenceContext = headers => {
76
+ return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
77
+ return buildResponse(res).then(_data => {
78
+ return {
79
+ data: _data.data
80
+ };
81
+ });
82
+ });
83
+ };
84
+ this.getSignerConfig = headers => {
85
+ return this.fetch(this.url('GetSignerConfig'), createHTTPRequest({}, headers)).then(res => {
86
+ return buildResponse(res).then(_data => {
87
+ return {
88
+ signerConfig: _data.signerConfig
89
+ };
90
+ });
91
+ });
92
+ };
46
93
  this.sign = (args, headers) => {
47
94
  return this.fetch(this.url('Sign'), createHTTPRequest(args, headers)).then(res => {
48
95
  return buildResponse(res).then(_data => {
@@ -52,17 +99,13 @@ class GuarddService {
52
99
  });
53
100
  });
54
101
  };
55
-
56
102
  this.hostname = hostname;
57
- this.fetch = fetch;
103
+ this.fetch = (input, init) => fetch(input, init);
58
104
  }
59
-
60
105
  url(name) {
61
106
  return this.hostname + this.path + name;
62
107
  }
63
-
64
108
  }
65
-
66
109
  const createHTTPRequest = (body = {}, headers = {}) => {
67
110
  return {
68
111
  method: 'POST',
@@ -72,11 +115,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
72
115
  body: JSON.stringify(body || {})
73
116
  };
74
117
  };
75
-
76
118
  const buildResponse = res => {
77
119
  return res.text().then(text => {
78
120
  let data;
79
-
80
121
  try {
81
122
  data = JSON.parse(text);
82
123
  } catch (err) {
@@ -86,7 +127,6 @@ const buildResponse = res => {
86
127
  status: res.status
87
128
  };
88
129
  }
89
-
90
130
  if (!res.ok) {
91
131
  throw data; // webrpc error response
92
132
  }
@@ -95,7 +135,7 @@ const buildResponse = res => {
95
135
  });
96
136
  };
97
137
 
98
- exports.GuarddService = GuarddService;
138
+ exports.Guard = Guard;
99
139
  exports.WebRPCSchemaHash = WebRPCSchemaHash;
100
140
  exports.WebRPCSchemaVersion = WebRPCSchemaVersion;
101
141
  exports.WebRPCVersion = WebRPCVersion;
@@ -1,44 +1,91 @@
1
1
  function _extends() {
2
- _extends = Object.assign || function (target) {
2
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3
3
  for (var i = 1; i < arguments.length; i++) {
4
4
  var source = arguments[i];
5
-
6
5
  for (var key in source) {
7
6
  if (Object.prototype.hasOwnProperty.call(source, key)) {
8
7
  target[key] = source[key];
9
8
  }
10
9
  }
11
10
  }
12
-
13
11
  return target;
14
12
  };
15
-
16
13
  return _extends.apply(this, arguments);
17
14
  }
18
15
 
19
16
  /* eslint-disable */
20
- // guardd v0.1.0 8d4d548d0af400f36ef39a21c29927fe65f9396c
17
+ // sequence-guard v0.4.0 8d39664df13fabe72919e65140f9563b21aa3531
21
18
  // --
22
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
23
- // Do not edit by hand. Update your webrpc schema and re-generate.
19
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
20
+ //
21
+ // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
22
+
24
23
  // WebRPC description and code-gen version
25
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
24
+ const WebRPCVersion = "v1";
25
+
26
+ // Schema version of your RIDL schema
27
+ const WebRPCSchemaVersion = "v0.4.0";
26
28
 
27
- const WebRPCSchemaVersion = "v0.1.0"; // Schema hash generated from your RIDL schema
29
+ // Schema hash generated from your RIDL schema
30
+ const WebRPCSchemaHash = "8d39664df13fabe72919e65140f9563b21aa3531";
28
31
 
29
- const WebRPCSchemaHash = "8d4d548d0af400f36ef39a21c29927fe65f9396c"; //
32
+ //
30
33
  // Types
31
34
  //
32
35
 
33
36
  //
34
37
  // Client
35
38
  //
36
- class GuarddService {
39
+ class Guard {
37
40
  constructor(hostname, fetch) {
38
41
  this.hostname = void 0;
39
42
  this.fetch = void 0;
40
- this.path = '/rpc/GuarddService/';
41
-
43
+ this.path = '/rpc/Guard/';
44
+ this.ping = headers => {
45
+ return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
46
+ return buildResponse(res).then(_data => {
47
+ return {
48
+ status: _data.status
49
+ };
50
+ });
51
+ });
52
+ };
53
+ this.version = headers => {
54
+ return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
55
+ return buildResponse(res).then(_data => {
56
+ return {
57
+ version: _data.version
58
+ };
59
+ });
60
+ });
61
+ };
62
+ this.runtimeStatus = headers => {
63
+ return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
64
+ return buildResponse(res).then(_data => {
65
+ return {
66
+ status: _data.status
67
+ };
68
+ });
69
+ });
70
+ };
71
+ this.getSequenceContext = headers => {
72
+ return this.fetch(this.url('GetSequenceContext'), createHTTPRequest({}, headers)).then(res => {
73
+ return buildResponse(res).then(_data => {
74
+ return {
75
+ data: _data.data
76
+ };
77
+ });
78
+ });
79
+ };
80
+ this.getSignerConfig = headers => {
81
+ return this.fetch(this.url('GetSignerConfig'), createHTTPRequest({}, headers)).then(res => {
82
+ return buildResponse(res).then(_data => {
83
+ return {
84
+ signerConfig: _data.signerConfig
85
+ };
86
+ });
87
+ });
88
+ };
42
89
  this.sign = (args, headers) => {
43
90
  return this.fetch(this.url('Sign'), createHTTPRequest(args, headers)).then(res => {
44
91
  return buildResponse(res).then(_data => {
@@ -48,17 +95,13 @@ class GuarddService {
48
95
  });
49
96
  });
50
97
  };
51
-
52
98
  this.hostname = hostname;
53
- this.fetch = fetch;
99
+ this.fetch = (input, init) => fetch(input, init);
54
100
  }
55
-
56
101
  url(name) {
57
102
  return this.hostname + this.path + name;
58
103
  }
59
-
60
104
  }
61
-
62
105
  const createHTTPRequest = (body = {}, headers = {}) => {
63
106
  return {
64
107
  method: 'POST',
@@ -68,11 +111,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
68
111
  body: JSON.stringify(body || {})
69
112
  };
70
113
  };
71
-
72
114
  const buildResponse = res => {
73
115
  return res.text().then(text => {
74
116
  let data;
75
-
76
117
  try {
77
118
  data = JSON.parse(text);
78
119
  } catch (err) {
@@ -82,7 +123,6 @@ const buildResponse = res => {
82
123
  status: res.status
83
124
  };
84
125
  }
85
-
86
126
  if (!res.ok) {
87
127
  throw data; // webrpc error response
88
128
  }
@@ -91,4 +131,4 @@ const buildResponse = res => {
91
131
  });
92
132
  };
93
133
 
94
- export { GuarddService, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
134
+ export { Guard, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
@@ -1,26 +1,91 @@
1
1
  export declare const WebRPCVersion = "v1";
2
- export declare const WebRPCSchemaVersion = "v0.1.0";
3
- export declare const WebRPCSchemaHash = "8d4d548d0af400f36ef39a21c29927fe65f9396c";
4
- export interface Request {
2
+ export declare const WebRPCSchemaVersion = "v0.4.0";
3
+ export declare const WebRPCSchemaHash = "8d39664df13fabe72919e65140f9563b21aa3531";
4
+ export interface Version {
5
+ webrpcVersion: string;
6
+ schemaVersion: string;
7
+ schemaHash: string;
8
+ appVersion: string;
9
+ }
10
+ export interface RuntimeStatus {
11
+ healthOK: boolean;
12
+ startTime: string;
13
+ uptime: number;
14
+ ver: string;
15
+ branch: string;
16
+ commitHash: string;
17
+ }
18
+ export interface SequenceContext {
19
+ factory: string;
20
+ mainModule: string;
21
+ mainModuleUpgradable: string;
22
+ guestModule: string;
23
+ utils: string;
24
+ }
25
+ export interface WalletConfig {
26
+ address: string;
27
+ signers: Array<WalletSigner>;
28
+ threshold: number;
29
+ }
30
+ export interface WalletSigner {
31
+ address: string;
32
+ weight: number;
33
+ }
34
+ export interface SignRequest {
5
35
  chainId: number;
6
36
  msg: string;
7
37
  auxData: string;
8
38
  }
9
- export interface GuarddService {
39
+ export interface Guard {
40
+ ping(headers?: object): Promise<PingReturn>;
41
+ version(headers?: object): Promise<VersionReturn>;
42
+ runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
43
+ getSequenceContext(headers?: object): Promise<GetSequenceContextReturn>;
44
+ getSignerConfig(headers?: object): Promise<GetSignerConfigReturn>;
10
45
  sign(args: SignArgs, headers?: object): Promise<SignReturn>;
11
46
  }
47
+ export interface PingArgs {
48
+ }
49
+ export interface PingReturn {
50
+ status: boolean;
51
+ }
52
+ export interface VersionArgs {
53
+ }
54
+ export interface VersionReturn {
55
+ version: Version;
56
+ }
57
+ export interface RuntimeStatusArgs {
58
+ }
59
+ export interface RuntimeStatusReturn {
60
+ status: RuntimeStatus;
61
+ }
62
+ export interface GetSequenceContextArgs {
63
+ }
64
+ export interface GetSequenceContextReturn {
65
+ data: SequenceContext;
66
+ }
67
+ export interface GetSignerConfigArgs {
68
+ }
69
+ export interface GetSignerConfigReturn {
70
+ signerConfig: WalletConfig;
71
+ }
12
72
  export interface SignArgs {
13
- request: Request;
73
+ request: SignRequest;
14
74
  }
15
75
  export interface SignReturn {
16
76
  sig: string;
17
77
  }
18
- export declare class GuarddService implements GuarddService {
78
+ export declare class Guard implements Guard {
19
79
  protected hostname: string;
20
80
  protected fetch: Fetch;
21
81
  protected path: string;
22
82
  constructor(hostname: string, fetch: Fetch);
23
83
  private url;
84
+ ping: (headers?: object | undefined) => Promise<PingReturn>;
85
+ version: (headers?: object | undefined) => Promise<VersionReturn>;
86
+ runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
87
+ getSequenceContext: (headers?: object | undefined) => Promise<GetSequenceContextReturn>;
88
+ getSignerConfig: (headers?: object | undefined) => Promise<GetSignerConfigReturn>;
24
89
  sign: (args: SignArgs, headers?: object | undefined) => Promise<SignReturn>;
25
90
  }
26
91
  export interface WebRPCError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/guard",
3
- "version": "0.42.10",
3
+ "version": "0.43.0",
4
4
  "description": "guard sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/guard",
6
6
  "source": "src/index.ts",
package/src/guard.gen.ts CHANGED
@@ -1,34 +1,104 @@
1
1
  /* eslint-disable */
2
- // guardd v0.1.0 8d4d548d0af400f36ef39a21c29927fe65f9396c
2
+ // sequence-guard v0.4.0 8d39664df13fabe72919e65140f9563b21aa3531
3
3
  // --
4
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
5
- // Do not edit by hand. Update your webrpc schema and re-generate.
4
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
5
+ //
6
+ // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
6
7
 
7
8
  // WebRPC description and code-gen version
8
9
  export const WebRPCVersion = "v1"
9
10
 
10
11
  // Schema version of your RIDL schema
11
- export const WebRPCSchemaVersion = "v0.1.0"
12
+ export const WebRPCSchemaVersion = "v0.4.0"
12
13
 
13
14
  // Schema hash generated from your RIDL schema
14
- export const WebRPCSchemaHash = "8d4d548d0af400f36ef39a21c29927fe65f9396c"
15
-
15
+ export const WebRPCSchemaHash = "8d39664df13fabe72919e65140f9563b21aa3531"
16
16
 
17
17
  //
18
18
  // Types
19
19
  //
20
- export interface Request {
20
+ export interface Version {
21
+ webrpcVersion: string
22
+ schemaVersion: string
23
+ schemaHash: string
24
+ appVersion: string
25
+ }
26
+
27
+ export interface RuntimeStatus {
28
+ healthOK: boolean
29
+ startTime: string
30
+ uptime: number
31
+ ver: string
32
+ branch: string
33
+ commitHash: string
34
+ }
35
+
36
+ export interface SequenceContext {
37
+ factory: string
38
+ mainModule: string
39
+ mainModuleUpgradable: string
40
+ guestModule: string
41
+ utils: string
42
+ }
43
+
44
+ export interface WalletConfig {
45
+ address: string
46
+ signers: Array<WalletSigner>
47
+ threshold: number
48
+ }
49
+
50
+ export interface WalletSigner {
51
+ address: string
52
+ weight: number
53
+ }
54
+
55
+ export interface SignRequest {
21
56
  chainId: number
22
57
  msg: string
23
58
  auxData: string
24
59
  }
25
60
 
26
- export interface GuarddService {
61
+ export interface Guard {
62
+ ping(headers?: object): Promise<PingReturn>
63
+ version(headers?: object): Promise<VersionReturn>
64
+ runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>
65
+ getSequenceContext(headers?: object): Promise<GetSequenceContextReturn>
66
+ getSignerConfig(headers?: object): Promise<GetSignerConfigReturn>
27
67
  sign(args: SignArgs, headers?: object): Promise<SignReturn>
28
68
  }
29
69
 
70
+ export interface PingArgs {
71
+ }
72
+
73
+ export interface PingReturn {
74
+ status: boolean
75
+ }
76
+ export interface VersionArgs {
77
+ }
78
+
79
+ export interface VersionReturn {
80
+ version: Version
81
+ }
82
+ export interface RuntimeStatusArgs {
83
+ }
84
+
85
+ export interface RuntimeStatusReturn {
86
+ status: RuntimeStatus
87
+ }
88
+ export interface GetSequenceContextArgs {
89
+ }
90
+
91
+ export interface GetSequenceContextReturn {
92
+ data: SequenceContext
93
+ }
94
+ export interface GetSignerConfigArgs {
95
+ }
96
+
97
+ export interface GetSignerConfigReturn {
98
+ signerConfig: WalletConfig
99
+ }
30
100
  export interface SignArgs {
31
- request: Request
101
+ request: SignRequest
32
102
  }
33
103
 
34
104
  export interface SignReturn {
@@ -40,20 +110,85 @@ export interface SignReturn {
40
110
  //
41
111
  // Client
42
112
  //
43
- export class GuarddService implements GuarddService {
113
+ export class Guard implements Guard {
44
114
  protected hostname: string
45
115
  protected fetch: Fetch
46
- protected path = '/rpc/GuarddService/'
116
+ protected path = '/rpc/Guard/'
47
117
 
48
118
  constructor(hostname: string, fetch: Fetch) {
49
119
  this.hostname = hostname
50
- this.fetch = fetch
120
+ this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init)
51
121
  }
52
122
 
53
123
  private url(name: string): string {
54
124
  return this.hostname + this.path + name
55
125
  }
56
126
 
127
+ ping = (headers?: object): Promise<PingReturn> => {
128
+ return this.fetch(
129
+ this.url('Ping'),
130
+ createHTTPRequest({}, headers)
131
+ ).then((res) => {
132
+ return buildResponse(res).then(_data => {
133
+ return {
134
+ status: <boolean>(_data.status)
135
+ }
136
+ })
137
+ })
138
+ }
139
+
140
+ version = (headers?: object): Promise<VersionReturn> => {
141
+ return this.fetch(
142
+ this.url('Version'),
143
+ createHTTPRequest({}, headers)
144
+ ).then((res) => {
145
+ return buildResponse(res).then(_data => {
146
+ return {
147
+ version: <Version>(_data.version)
148
+ }
149
+ })
150
+ })
151
+ }
152
+
153
+ runtimeStatus = (headers?: object): Promise<RuntimeStatusReturn> => {
154
+ return this.fetch(
155
+ this.url('RuntimeStatus'),
156
+ createHTTPRequest({}, headers)
157
+ ).then((res) => {
158
+ return buildResponse(res).then(_data => {
159
+ return {
160
+ status: <RuntimeStatus>(_data.status)
161
+ }
162
+ })
163
+ })
164
+ }
165
+
166
+ getSequenceContext = (headers?: object): Promise<GetSequenceContextReturn> => {
167
+ return this.fetch(
168
+ this.url('GetSequenceContext'),
169
+ createHTTPRequest({}, headers)
170
+ ).then((res) => {
171
+ return buildResponse(res).then(_data => {
172
+ return {
173
+ data: <SequenceContext>(_data.data)
174
+ }
175
+ })
176
+ })
177
+ }
178
+
179
+ getSignerConfig = (headers?: object): Promise<GetSignerConfigReturn> => {
180
+ return this.fetch(
181
+ this.url('GetSignerConfig'),
182
+ createHTTPRequest({}, headers)
183
+ ).then((res) => {
184
+ return buildResponse(res).then(_data => {
185
+ return {
186
+ signerConfig: <WalletConfig>(_data.signerConfig)
187
+ }
188
+ })
189
+ })
190
+ }
191
+
57
192
  sign = (args: SignArgs, headers?: object): Promise<SignReturn> => {
58
193
  return this.fetch(
59
194
  this.url('Sign'),