@canton-network/dapp-sdk 0.1.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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # SDK
2
+
3
+ Connects your Splice dApp to Wallet Client users.
4
+
5
+ ## Build
6
+
7
+ Generate the client code and build the SDK:
8
+
9
+ ```sh
10
+ yarn build
11
+ ```
@@ -0,0 +1,3 @@
1
+ export * from './connect';
2
+ export * as dappAPI from '@canton-network/core-wallet-dapp-rpc-client';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,OAAO,KAAK,OAAO,MAAM,6CAA6C,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './connect';
2
+ export * as dappAPI from '@canton-network/core-wallet-dapp-rpc-client';
@@ -0,0 +1,8 @@
1
+ import { DiscoverResult } from '@canton-network/core-types';
2
+ import * as dappAPI from '@canton-network/core-wallet-dapp-rpc-client';
3
+ export declare const getKernelDiscovery: () => DiscoverResult | undefined;
4
+ export declare const setKernelDiscovery: (discovery: DiscoverResult) => void;
5
+ export declare const getKernelSession: () => dappAPI.OnConnectedEvent | undefined;
6
+ export declare const setKernelSession: (session: dappAPI.OnConnectedEvent) => void;
7
+ export declare const removeKernelSession: () => void;
8
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,OAAO,MAAM,6CAA6C,CAAA;AAOtE,eAAO,MAAM,kBAAkB,QAAO,cAAc,GAAG,SAUtD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,WAAW,cAAc,KAAG,IAK9D,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,OAAO,CAAC,gBAAgB,GAAG,SAU9D,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,CAAC,gBAAgB,KAAG,IAEpE,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAO,IAEtC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { DiscoverResult } from '@canton-network/core-types';
2
+ var LOCAL_STORAGE;
3
+ (function (LOCAL_STORAGE) {
4
+ LOCAL_STORAGE["KERNEL_DISCOVERY"] = "splice_wallet_kernel_discovery";
5
+ LOCAL_STORAGE["KERNEL_SESSION"] = "splice_wallet_kernel_session";
6
+ })(LOCAL_STORAGE || (LOCAL_STORAGE = {}));
7
+ export const getKernelDiscovery = () => {
8
+ const discovery = localStorage.getItem(LOCAL_STORAGE.KERNEL_DISCOVERY);
9
+ if (discovery) {
10
+ try {
11
+ return DiscoverResult.parse(JSON.parse(discovery));
12
+ }
13
+ catch (e) {
14
+ console.error('Failed to parse stored kernel discovery:', e);
15
+ }
16
+ }
17
+ return undefined;
18
+ };
19
+ export const setKernelDiscovery = (discovery) => {
20
+ localStorage.setItem(LOCAL_STORAGE.KERNEL_DISCOVERY, JSON.stringify(discovery));
21
+ };
22
+ export const getKernelSession = () => {
23
+ const session = localStorage.getItem(LOCAL_STORAGE.KERNEL_SESSION);
24
+ if (session) {
25
+ try {
26
+ return JSON.parse(session);
27
+ }
28
+ catch (e) {
29
+ console.error('Failed to parse stored kernel session:', e);
30
+ }
31
+ }
32
+ return undefined;
33
+ };
34
+ export const setKernelSession = (session) => {
35
+ localStorage.setItem(LOCAL_STORAGE.KERNEL_SESSION, JSON.stringify(session));
36
+ };
37
+ export const removeKernelSession = () => {
38
+ localStorage.removeItem(LOCAL_STORAGE.KERNEL_SESSION);
39
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@canton-network/dapp-sdk",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "description": "Browser SDK for dApp development on the Canton Network",
6
+ "repository": "https://github.com/hyperledger-labs/splice-wallet-kernel",
7
+ "license": "Apache-2.0",
8
+ "author": "Marc Juchli <marc.juchli@digitalasset.com>",
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "scripts": {
12
+ "build": "tsc -b",
13
+ "dev": "tsc -b --watch",
14
+ "clean": "tsc -b --clean; rm -rf dist",
15
+ "test": "echo \"Warning: no test specified\""
16
+ },
17
+ "dependencies": {
18
+ "@canton-network/core-splice-provider": "^0.1.0",
19
+ "@canton-network/core-types": "^0.1.0",
20
+ "@canton-network/core-wallet-dapp-rpc-client": "^0.1.0",
21
+ "@canton-network/core-wallet-ui-components": "^0.1.0"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.8.3"
25
+ },
26
+ "files": [
27
+ "dist/*"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ }
32
+ }