@canton-network/core-wallet-dapp-remote-rpc-client 0.5.0 → 0.7.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.
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +48 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -18
- package/dist/index.js.map +1 -1
- package/package.json +16 -5
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
8
|
+
|
|
9
|
+
// src/index.ts
|
|
10
|
+
var SpliceWalletJSONRPCRemoteDAppAPI = class {
|
|
11
|
+
constructor(transport) {
|
|
12
|
+
__publicField(this, "transport");
|
|
13
|
+
this.transport = transport;
|
|
14
|
+
}
|
|
15
|
+
async request(method, params) {
|
|
16
|
+
const response = await this.transport.submit({ method, params });
|
|
17
|
+
if ("error" in response) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
"RPC error: " + response.error.code + " - " + response.error.message
|
|
20
|
+
);
|
|
21
|
+
} else {
|
|
22
|
+
return response.result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var index_default = SpliceWalletJSONRPCRemoteDAppAPI;
|
|
27
|
+
|
|
28
|
+
exports.SpliceWalletJSONRPCRemoteDAppAPI = SpliceWalletJSONRPCRemoteDAppAPI;
|
|
29
|
+
exports.default = index_default;
|
|
30
|
+
//# sourceMappingURL=index.cjs.map
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAmXO,IAAM,mCAAN,MAAuC;AAAA,EAG1C,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EA8GA,MAAa,OAAA,CACT,MAAA,EACA,MAAA,EACgB;AAChB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAE/D,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestPayload, RpcTransport } from '@canton-network/core-types'\n\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Wallet Gateway.\n *\n */\nexport type Id = string\n/**\n *\n * The type of client that implements the Wallet Gateway.\n *\n */\nexport type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Gateway.\n *\n */\nexport type Url = string\n/**\n *\n * Represents a Wallet Gateway.\n *\n */\nexport interface KernelInfo {\n id: Id\n clientType: ClientType\n url?: Url\n [k: string]: any\n}\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\nexport interface StatusEvent {\n kernel: KernelInfo\n isConnected: IsConnected\n networkId?: NetworkId\n [k: string]: any\n}\n/**\n *\n * JWT authentication token (if applicable).\n *\n */\nexport type SessionToken = string\nexport type Dar = string\nexport type Dars = Dar[]\n/**\n *\n * The prepared transaction data.\n *\n */\nexport type PreparedTransaction = string\n/**\n *\n * The hash of the prepared transaction.\n *\n */\nexport type PreparedTransactionHash = string\n/**\n *\n * Structure representing the result of a prepareReturn call\n *\n */\nexport interface JsPrepareSubmissionResponse {\n preparedTransaction?: PreparedTransaction\n preparedTransactionHash?: PreparedTransactionHash\n [k: string]: any\n}\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\nexport interface PrepareReturnParams {\n commands: JsCommands\n [k: string]: any\n}\nexport interface PrepareExecuteParams {\n commands: JsCommands\n [k: string]: any\n}\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n [k: string]: any\n}\nexport interface ConnectResult {\n status: StatusEvent\n sessionToken: SessionToken\n [k: string]: any\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface DarsAvailableResult {\n dars: Dars\n [k: string]: any\n}\nexport type PrepareReturnResult = any\nexport interface PrepareExecuteResult {\n userUrl: UserUrl\n [k: string]: any\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n [k: string]: any\n}\nexport interface OnConnectedEvent {\n kernel: KernelInfo\n networkId: NetworkId\n sessionToken?: SessionToken\n [k: string]: any\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type RequestAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<ConnectResult>\nexport type Disconnect = () => Promise<Null>\nexport type DarsAvailable = () => Promise<DarsAvailableResult>\nexport type PrepareReturn = (\n params: PrepareReturnParams\n) => Promise<PrepareReturnResult>\nexport type PrepareExecute = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type OnConnected = () => Promise<OnConnectedEvent>\nexport type OnStatusChanged = () => Promise<StatusEvent>\nexport type OnAccountsChanged = () => Promise<AccountsChangedEvent>\nexport type RequestAccounts = () => Promise<RequestAccountsResult>\nexport type OnTxChanged = () => Promise<TxChangedEvent>\n\nexport class SpliceWalletJSONRPCRemoteDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'status',\n ...params: Parameters<Status>\n ): ReturnType<Status>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'connect',\n ...params: Parameters<Connect>\n ): ReturnType<Connect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'disconnect',\n ...params: Parameters<Disconnect>\n ): ReturnType<Disconnect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'darsAvailable',\n ...params: Parameters<DarsAvailable>\n ): ReturnType<DarsAvailable>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareReturn',\n ...params: Parameters<PrepareReturn>\n ): ReturnType<PrepareReturn>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecute',\n ...params: Parameters<PrepareExecute>\n ): ReturnType<PrepareExecute>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'ledgerApi',\n ...params: Parameters<LedgerApi>\n ): ReturnType<LedgerApi>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onConnected',\n ...params: Parameters<OnConnected>\n ): ReturnType<OnConnected>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onStatusChanged',\n ...params: Parameters<OnStatusChanged>\n ): ReturnType<OnStatusChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onAccountsChanged',\n ...params: Parameters<OnAccountsChanged>\n ): ReturnType<OnAccountsChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'requestAccounts',\n ...params: Parameters<RequestAccounts>\n ): ReturnType<RequestAccounts>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onTxChanged',\n ...params: Parameters<OnTxChanged>\n ): ReturnType<OnTxChanged>\n\n public async request(\n method: string,\n params?: RequestPayload['params']\n ): Promise<unknown> {\n const response = await this.transport.submit({ method, params })\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result\n }\n }\n}\nexport default SpliceWalletJSONRPCRemoteDAppAPI\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface KernelInfo {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
*
|
|
44
|
-
* Whether or not a connection to a network is
|
|
44
|
+
* Whether or not a connection to a network is established.
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
47
|
export type IsConnected = boolean;
|
|
@@ -50,13 +50,19 @@ export type IsConnected = boolean;
|
|
|
50
50
|
* The network ID the wallet corresponds to.
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
|
-
export type
|
|
53
|
+
export type NetworkId = string;
|
|
54
|
+
export interface StatusEvent {
|
|
55
|
+
kernel: KernelInfo;
|
|
56
|
+
isConnected: IsConnected;
|
|
57
|
+
networkId?: NetworkId;
|
|
58
|
+
[k: string]: any;
|
|
59
|
+
}
|
|
54
60
|
/**
|
|
55
61
|
*
|
|
56
|
-
*
|
|
62
|
+
* JWT authentication token (if applicable).
|
|
57
63
|
*
|
|
58
64
|
*/
|
|
59
|
-
export type
|
|
65
|
+
export type SessionToken = string;
|
|
60
66
|
export type Dar = string;
|
|
61
67
|
export type Dars = Dar[];
|
|
62
68
|
/**
|
|
@@ -81,13 +87,13 @@ export interface JsPrepareSubmissionResponse {
|
|
|
81
87
|
preparedTransactionHash?: PreparedTransactionHash;
|
|
82
88
|
[k: string]: any;
|
|
83
89
|
}
|
|
84
|
-
export type Response = string;
|
|
85
90
|
/**
|
|
86
91
|
*
|
|
87
|
-
*
|
|
92
|
+
* A URL that points to a user interface.
|
|
88
93
|
*
|
|
89
94
|
*/
|
|
90
|
-
export type
|
|
95
|
+
export type UserUrl = string;
|
|
96
|
+
export type Response = string;
|
|
91
97
|
/**
|
|
92
98
|
*
|
|
93
99
|
* Set as primary wallet for dApp usage.
|
|
@@ -124,6 +130,18 @@ export type Namespace = string;
|
|
|
124
130
|
*
|
|
125
131
|
*/
|
|
126
132
|
export type SigningProviderId = string;
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
export type ExternalTxId = string;
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* The topology transactions
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
export type TopologyTransactions = string;
|
|
127
145
|
/**
|
|
128
146
|
*
|
|
129
147
|
* Structure representing a wallet
|
|
@@ -135,8 +153,10 @@ export interface Wallet {
|
|
|
135
153
|
hint: Hint;
|
|
136
154
|
publicKey: PublicKey;
|
|
137
155
|
namespace: Namespace;
|
|
138
|
-
|
|
156
|
+
networkId: NetworkId;
|
|
139
157
|
signingProviderId: SigningProviderId;
|
|
158
|
+
externalTxId?: ExternalTxId;
|
|
159
|
+
topologyTransactions?: TopologyTransactions;
|
|
140
160
|
[k: string]: any;
|
|
141
161
|
}
|
|
142
162
|
/**
|
|
@@ -265,19 +285,17 @@ export interface LedgerApiParams {
|
|
|
265
285
|
body?: Body;
|
|
266
286
|
[k: string]: any;
|
|
267
287
|
}
|
|
268
|
-
export interface StatusResult {
|
|
269
|
-
kernel: KernelInfo;
|
|
270
|
-
isConnected: IsConnected;
|
|
271
|
-
chainId?: ChainId;
|
|
272
|
-
[k: string]: any;
|
|
273
|
-
}
|
|
274
288
|
export interface ConnectResult {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
chainId?: ChainId;
|
|
278
|
-
userUrl: UserUrl;
|
|
289
|
+
status: StatusEvent;
|
|
290
|
+
sessionToken: SessionToken;
|
|
279
291
|
[k: string]: any;
|
|
280
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
*
|
|
295
|
+
* Represents a null value, used in responses where no data is returned.
|
|
296
|
+
*
|
|
297
|
+
*/
|
|
298
|
+
export type Null = null;
|
|
281
299
|
export interface DarsAvailableResult {
|
|
282
300
|
dars: Dars;
|
|
283
301
|
[k: string]: any;
|
|
@@ -298,7 +316,7 @@ export interface LedgerApiResult {
|
|
|
298
316
|
}
|
|
299
317
|
export interface OnConnectedEvent {
|
|
300
318
|
kernel: KernelInfo;
|
|
301
|
-
|
|
319
|
+
networkId: NetworkId;
|
|
302
320
|
sessionToken?: SessionToken;
|
|
303
321
|
[k: string]: any;
|
|
304
322
|
}
|
|
@@ -325,13 +343,15 @@ export type TxChangedEvent = TxChangedPendingEvent | TxChangedSignedEvent | TxCh
|
|
|
325
343
|
* Generated! Represents an alias to any of the provided schemas
|
|
326
344
|
*
|
|
327
345
|
*/
|
|
328
|
-
export type Status = () => Promise<
|
|
346
|
+
export type Status = () => Promise<StatusEvent>;
|
|
329
347
|
export type Connect = () => Promise<ConnectResult>;
|
|
348
|
+
export type Disconnect = () => Promise<Null>;
|
|
330
349
|
export type DarsAvailable = () => Promise<DarsAvailableResult>;
|
|
331
350
|
export type PrepareReturn = (params: PrepareReturnParams) => Promise<PrepareReturnResult>;
|
|
332
351
|
export type PrepareExecute = (params: PrepareExecuteParams) => Promise<PrepareExecuteResult>;
|
|
333
352
|
export type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>;
|
|
334
353
|
export type OnConnected = () => Promise<OnConnectedEvent>;
|
|
354
|
+
export type OnStatusChanged = () => Promise<StatusEvent>;
|
|
335
355
|
export type OnAccountsChanged = () => Promise<AccountsChangedEvent>;
|
|
336
356
|
export type RequestAccounts = () => Promise<RequestAccountsResult>;
|
|
337
357
|
export type OnTxChanged = () => Promise<TxChangedEvent>;
|
|
@@ -346,6 +366,10 @@ export declare class SpliceWalletJSONRPCRemoteDAppAPI {
|
|
|
346
366
|
*
|
|
347
367
|
*/
|
|
348
368
|
request(method: 'connect', ...params: Parameters<Connect>): ReturnType<Connect>;
|
|
369
|
+
/**
|
|
370
|
+
*
|
|
371
|
+
*/
|
|
372
|
+
request(method: 'disconnect', ...params: Parameters<Disconnect>): ReturnType<Disconnect>;
|
|
349
373
|
/**
|
|
350
374
|
*
|
|
351
375
|
*/
|
|
@@ -366,6 +390,10 @@ export declare class SpliceWalletJSONRPCRemoteDAppAPI {
|
|
|
366
390
|
*
|
|
367
391
|
*/
|
|
368
392
|
request(method: 'onConnected', ...params: Parameters<OnConnected>): ReturnType<OnConnected>;
|
|
393
|
+
/**
|
|
394
|
+
*
|
|
395
|
+
*/
|
|
396
|
+
request(method: 'onStatusChanged', ...params: Parameters<OnStatusChanged>): ReturnType<OnStatusChanged>;
|
|
369
397
|
/**
|
|
370
398
|
*
|
|
371
399
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB;AACD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;AAC7D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAC7B,MAAM,MAAM,IAAI,GAAG,MAAM,CAAA;AACzB;;;;GAIG;AACH,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;AACvB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACpE;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAA;AACxB;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,UAAU,EAAE,UAAU,CAAA;IACtB,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AACD;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAA;AACjC;;;;GAIG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","s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,CAAC;IAEhC;;OAEG;IAEU,OAAO,CAChB,MAAM,EAAE,iBAAiB,EACzB,GAAG,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,GACvC,UAAU,CAAC,eAAe,CAAC;IAE9B;;OAEG;IAEU,OAAO,CAChB,MAAM,EAAE,aAAa,EACrB,GAAG,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,GACnC,UAAU,CAAC,WAAW,CAAC;CAmB7B;AACD,eAAe,gCAAgC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
var SpliceWalletJSONRPCRemoteDAppAPI = class {
|
|
7
|
+
constructor(transport) {
|
|
8
|
+
__publicField(this, "transport");
|
|
9
|
+
this.transport = transport;
|
|
10
|
+
}
|
|
11
|
+
async request(method, params) {
|
|
12
|
+
const response = await this.transport.submit({ method, params });
|
|
13
|
+
if ("error" in response) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"RPC error: " + response.error.code + " - " + response.error.message
|
|
16
|
+
);
|
|
17
|
+
} else {
|
|
18
|
+
return response.result;
|
|
5
19
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
response.error.message);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return response.result;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export default SpliceWalletJSONRPCRemoteDAppAPI;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var index_default = SpliceWalletJSONRPCRemoteDAppAPI;
|
|
23
|
+
|
|
24
|
+
export { SpliceWalletJSONRPCRemoteDAppAPI, index_default as default };
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
20
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+VA,MAAM,OAAO,gCAAgC;IAClC,SAAS,CAAc;IAE9B,YAAY,SAAuB;QAC/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC9B,CAAC;IA4FM,KAAK,CAAC,OAAO,CAChB,MAAc,EACd,MAAiC;QAEjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAEhE,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACX,aAAa;gBACT,QAAQ,CAAC,KAAK,CAAC,IAAI;gBACnB,KAAK;gBACL,QAAQ,CAAC,KAAK,CAAC,OAAO,CAC7B,CAAA;QACL,CAAC;aAAM,CAAC;YACJ,OAAO,QAAQ,CAAC,MAAM,CAAA;QAC1B,CAAC;IACL,CAAC;CACJ;AACD,eAAe,gCAAgC,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAmXO,IAAM,mCAAN,MAAuC;AAAA,EAG1C,YAAY,SAAA,EAAyB;AAFrC,IAAA,aAAA,CAAA,IAAA,EAAO,WAAA,CAAA;AAGH,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACrB;AAAA,EA8GA,MAAa,OAAA,CACT,MAAA,EACA,MAAA,EACgB;AAChB,IAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,SAAA,CAAU,OAAO,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAE/D,IAAA,IAAI,WAAW,QAAA,EAAU;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,gBACI,QAAA,CAAS,KAAA,CAAM,IAAA,GACf,KAAA,GACA,SAAS,KAAA,CAAM;AAAA,OACvB;AAAA,IACJ,CAAA,MAAO;AACH,MAAA,OAAO,QAAA,CAAS,MAAA;AAAA,IACpB;AAAA,EACJ;AACJ;AACA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["// Code generated by @open-rpc/generator DO NOT EDIT.\nimport _ from 'lodash'\n\nimport { RequestPayload, RpcTransport } from '@canton-network/core-types'\n\n/**\n *\n * Structure representing JS commands for transaction execution\n *\n */\nexport interface JsCommands {\n [key: string]: any\n}\nexport type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\nexport type Resource = string\nexport type Body = string\n/**\n *\n * The unique identifier of the Wallet Gateway.\n *\n */\nexport type Id = string\n/**\n *\n * The type of client that implements the Wallet Gateway.\n *\n */\nexport type ClientType = 'browser' | 'desktop' | 'mobile' | 'remote'\n/**\n *\n * The URL of the Wallet Gateway.\n *\n */\nexport type Url = string\n/**\n *\n * Represents a Wallet Gateway.\n *\n */\nexport interface KernelInfo {\n id: Id\n clientType: ClientType\n url?: Url\n [k: string]: any\n}\n/**\n *\n * Whether or not a connection to a network is established.\n *\n */\nexport type IsConnected = boolean\n/**\n *\n * The network ID the wallet corresponds to.\n *\n */\nexport type NetworkId = string\nexport interface StatusEvent {\n kernel: KernelInfo\n isConnected: IsConnected\n networkId?: NetworkId\n [k: string]: any\n}\n/**\n *\n * JWT authentication token (if applicable).\n *\n */\nexport type SessionToken = string\nexport type Dar = string\nexport type Dars = Dar[]\n/**\n *\n * The prepared transaction data.\n *\n */\nexport type PreparedTransaction = string\n/**\n *\n * The hash of the prepared transaction.\n *\n */\nexport type PreparedTransactionHash = string\n/**\n *\n * Structure representing the result of a prepareReturn call\n *\n */\nexport interface JsPrepareSubmissionResponse {\n preparedTransaction?: PreparedTransaction\n preparedTransactionHash?: PreparedTransactionHash\n [k: string]: any\n}\n/**\n *\n * A URL that points to a user interface.\n *\n */\nexport type UserUrl = string\nexport type Response = string\n/**\n *\n * Set as primary wallet for dApp usage.\n *\n */\nexport type Primary = boolean\n/**\n *\n * The party ID corresponding to the wallet.\n *\n */\nexport type PartyId = string\n/**\n *\n * The party hint and name of the wallet.\n *\n */\nexport type Hint = string\n/**\n *\n * The public key of the party.\n *\n */\nexport type PublicKey = string\n/**\n *\n * The namespace of the party.\n *\n */\nexport type Namespace = string\n/**\n *\n * The signing provider ID the wallet corresponds to.\n *\n */\nexport type SigningProviderId = string\n/**\n *\n * Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway.\n *\n */\nexport type ExternalTxId = string\n/**\n *\n * The topology transactions\n *\n */\nexport type TopologyTransactions = string\n/**\n *\n * Structure representing a wallet\n *\n */\nexport interface Wallet {\n primary: Primary\n partyId: PartyId\n hint: Hint\n publicKey: PublicKey\n namespace: Namespace\n networkId: NetworkId\n signingProviderId: SigningProviderId\n externalTxId?: ExternalTxId\n topologyTransactions?: TopologyTransactions\n [k: string]: any\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusPending = 'pending'\n/**\n *\n * The unique identifier of the command associated with the transaction.\n *\n */\nexport type CommandId = string\n/**\n *\n * Event emitted when a transaction is pending.\n *\n */\nexport interface TxChangedPendingEvent {\n status: StatusPending\n commandId: CommandId\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusSigned = 'signed'\n/**\n *\n * The signature of the transaction.\n *\n */\nexport type Signature = string\n/**\n *\n * The identifier of the provider that signed the transaction.\n *\n */\nexport type SignedBy = string\n/**\n *\n * The party that signed the transaction.\n *\n */\nexport type Party = string\n/**\n *\n * Payload for the TxChangedSignedEvent.\n *\n */\nexport interface TxChangedSignedPayload {\n signature: Signature\n signedBy: SignedBy\n party: Party\n}\n/**\n *\n * Event emitted when a transaction has been signed.\n *\n */\nexport interface TxChangedSignedEvent {\n status: StatusSigned\n commandId: CommandId\n payload: TxChangedSignedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusExecuted = 'executed'\n/**\n *\n * The update ID corresponding to the transaction.\n *\n */\nexport type UpdateId = string\nexport type CompletionOffset = number\n/**\n *\n * Payload for the TxChangedExecutedEvent.\n *\n */\nexport interface TxChangedExecutedPayload {\n updateId: UpdateId\n completionOffset: CompletionOffset\n}\n/**\n *\n * Event emitted when a transaction is executed against the participant.\n *\n */\nexport interface TxChangedExecutedEvent {\n status: StatusExecuted\n commandId: CommandId\n payload: TxChangedExecutedPayload\n}\n/**\n *\n * The status of the transaction.\n *\n */\nexport type StatusFailed = 'failed'\n/**\n *\n * Event emitted when a transaction has failed.\n *\n */\nexport interface TxChangedFailedEvent {\n status: StatusFailed\n commandId: CommandId\n}\nexport interface PrepareReturnParams {\n commands: JsCommands\n [k: string]: any\n}\nexport interface PrepareExecuteParams {\n commands: JsCommands\n [k: string]: any\n}\nexport interface LedgerApiParams {\n requestMethod: RequestMethod\n resource: Resource\n body?: Body\n [k: string]: any\n}\nexport interface ConnectResult {\n status: StatusEvent\n sessionToken: SessionToken\n [k: string]: any\n}\n/**\n *\n * Represents a null value, used in responses where no data is returned.\n *\n */\nexport type Null = null\nexport interface DarsAvailableResult {\n dars: Dars\n [k: string]: any\n}\nexport type PrepareReturnResult = any\nexport interface PrepareExecuteResult {\n userUrl: UserUrl\n [k: string]: any\n}\n/**\n *\n * Ledger Api configuration options\n *\n */\nexport interface LedgerApiResult {\n response: Response\n [k: string]: any\n}\nexport interface OnConnectedEvent {\n kernel: KernelInfo\n networkId: NetworkId\n sessionToken?: SessionToken\n [k: string]: any\n}\n/**\n *\n * Event emitted when the user's accounts change.\n *\n */\nexport type AccountsChangedEvent = Wallet[]\n/**\n *\n * An array of accounts that the user has authorized the dapp to access..\n *\n */\nexport type RequestAccountsResult = Wallet[]\n/**\n *\n * Event emitted when a transaction changes.\n *\n */\nexport type TxChangedEvent =\n | TxChangedPendingEvent\n | TxChangedSignedEvent\n | TxChangedExecutedEvent\n | TxChangedFailedEvent\n/**\n *\n * Generated! Represents an alias to any of the provided schemas\n *\n */\n\nexport type Status = () => Promise<StatusEvent>\nexport type Connect = () => Promise<ConnectResult>\nexport type Disconnect = () => Promise<Null>\nexport type DarsAvailable = () => Promise<DarsAvailableResult>\nexport type PrepareReturn = (\n params: PrepareReturnParams\n) => Promise<PrepareReturnResult>\nexport type PrepareExecute = (\n params: PrepareExecuteParams\n) => Promise<PrepareExecuteResult>\nexport type LedgerApi = (params: LedgerApiParams) => Promise<LedgerApiResult>\nexport type OnConnected = () => Promise<OnConnectedEvent>\nexport type OnStatusChanged = () => Promise<StatusEvent>\nexport type OnAccountsChanged = () => Promise<AccountsChangedEvent>\nexport type RequestAccounts = () => Promise<RequestAccountsResult>\nexport type OnTxChanged = () => Promise<TxChangedEvent>\n\nexport class SpliceWalletJSONRPCRemoteDAppAPI {\n public transport: RpcTransport\n\n constructor(transport: RpcTransport) {\n this.transport = transport\n }\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'status',\n ...params: Parameters<Status>\n ): ReturnType<Status>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'connect',\n ...params: Parameters<Connect>\n ): ReturnType<Connect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'disconnect',\n ...params: Parameters<Disconnect>\n ): ReturnType<Disconnect>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'darsAvailable',\n ...params: Parameters<DarsAvailable>\n ): ReturnType<DarsAvailable>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareReturn',\n ...params: Parameters<PrepareReturn>\n ): ReturnType<PrepareReturn>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'prepareExecute',\n ...params: Parameters<PrepareExecute>\n ): ReturnType<PrepareExecute>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'ledgerApi',\n ...params: Parameters<LedgerApi>\n ): ReturnType<LedgerApi>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onConnected',\n ...params: Parameters<OnConnected>\n ): ReturnType<OnConnected>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onStatusChanged',\n ...params: Parameters<OnStatusChanged>\n ): ReturnType<OnStatusChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onAccountsChanged',\n ...params: Parameters<OnAccountsChanged>\n ): ReturnType<OnAccountsChanged>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'requestAccounts',\n ...params: Parameters<RequestAccounts>\n ): ReturnType<RequestAccounts>\n\n /**\n *\n */\n // tslint:disable-next-line:max-line-length\n public async request(\n method: 'onTxChanged',\n ...params: Parameters<OnTxChanged>\n ): ReturnType<OnTxChanged>\n\n public async request(\n method: string,\n params?: RequestPayload['params']\n ): Promise<unknown> {\n const response = await this.transport.submit({ method, params })\n\n if ('error' in response) {\n throw new Error(\n 'RPC error: ' +\n response.error.code +\n ' - ' +\n response.error.message\n )\n } else {\n return response.result\n }\n }\n}\nexport default SpliceWalletJSONRPCRemoteDAppAPI\n"]}
|
package/package.json
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-wallet-dapp-remote-rpc-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript client generated by OpenRPC",
|
|
6
6
|
"repository": "github:hyperledger-labs/splice-wallet-kernel",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
|
+
"module": "dist/index.js",
|
|
8
10
|
"types": "dist/index.d.ts",
|
|
9
|
-
"
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
10
19
|
"scripts": {
|
|
11
|
-
"build": "
|
|
12
|
-
"
|
|
20
|
+
"build": "tsup && tsc -p tsconfig.types.json && yarn run docs",
|
|
21
|
+
"docs": "typedoc --tsconfig tsconfig.docs.json",
|
|
22
|
+
"dev": "tsup --watch --onSuccess \"tsc -p tsconfig.types.json && yarn run docs\"",
|
|
13
23
|
"flatpack": "yarn pack --out \"$FLATPACK_OUTDIR\"",
|
|
14
24
|
"clean": "tsc -b --clean; rm -rf dist"
|
|
15
25
|
},
|
|
@@ -20,7 +30,7 @@
|
|
|
20
30
|
"access": "public"
|
|
21
31
|
},
|
|
22
32
|
"dependencies": {
|
|
23
|
-
"@canton-network/core-types": "^0.
|
|
33
|
+
"@canton-network/core-types": "^0.11.0",
|
|
24
34
|
"lodash": "^4.17.15"
|
|
25
35
|
},
|
|
26
36
|
"devDependencies": {
|
|
@@ -31,6 +41,7 @@
|
|
|
31
41
|
"@types/ws": "^6.0.1",
|
|
32
42
|
"globals": "^16.0.0",
|
|
33
43
|
"prettier": "^3.5.2",
|
|
44
|
+
"tsup": "^8.5.0",
|
|
34
45
|
"typedoc": "^0.28.14",
|
|
35
46
|
"typescript": "^5.0.0"
|
|
36
47
|
}
|