@canton-network/core-splice-provider 0.3.3 → 0.5.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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -15
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare enum ProviderType {
|
|
|
10
10
|
WINDOW = 0,
|
|
11
11
|
HTTP = 1
|
|
12
12
|
}
|
|
13
|
-
export declare function injectSpliceProvider(
|
|
13
|
+
export declare function injectSpliceProvider(provider: SpliceProvider): SpliceProvider;
|
|
14
14
|
export * from './SpliceProvider';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
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,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,MAAM,CAAC,EAAE,cAAc,CAAA;QACvB,MAAM,CAAC,EAAE,cAAc,CAAA;QACvB,QAAQ,CAAC,EAAE,cAAc,CAAA;KAC5B;CACJ;AAED,oBAAY,YAAY;IACpB,MAAM,IAAA;IACN,IAAI,IAAA;CACP;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,CAa7E;AAED,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { SpliceProviderHttp } from './SpliceProviderHttp';
|
|
4
|
-
import { SpliceProviderWindow } from './SpliceProviderWindow';
|
|
5
3
|
export var ProviderType;
|
|
6
4
|
(function (ProviderType) {
|
|
7
5
|
ProviderType[ProviderType["WINDOW"] = 0] = "WINDOW";
|
|
8
6
|
ProviderType[ProviderType["HTTP"] = 1] = "HTTP";
|
|
9
7
|
})(ProviderType || (ProviderType = {}));
|
|
10
|
-
export function injectSpliceProvider(
|
|
8
|
+
export function injectSpliceProvider(provider) {
|
|
11
9
|
// Check if the provider is already injected
|
|
12
10
|
const existing = window.splice || window.canton || window.ethereum;
|
|
13
11
|
if (existing)
|
|
14
12
|
return existing;
|
|
15
13
|
// Inject the SpliceProvider instance
|
|
16
|
-
|
|
17
|
-
window.splice = new SpliceProviderWindow();
|
|
18
|
-
}
|
|
19
|
-
else if (providerType === ProviderType.HTTP) {
|
|
20
|
-
if (!url || !(url instanceof URL)) {
|
|
21
|
-
throw new Error('Invalid URL for HTTP provider. Please provide a valid URL instance.');
|
|
22
|
-
}
|
|
23
|
-
window.splice = new SpliceProviderHttp(url, sessionToken);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
throw new Error('Invalid provider type. Use ProviderType.WINDOW or ProviderType.HTTP.');
|
|
27
|
-
}
|
|
14
|
+
window.splice = provider;
|
|
28
15
|
window.canton = window.splice; // For compatibility with Canton dApps
|
|
29
16
|
window.ethereum = window.splice; // For EIP-1193 compatibility
|
|
30
17
|
console.log('Splice provider injected successfully.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-splice-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A JavaScript Splice Provider API (EIP-1193 compliant).",
|
|
6
6
|
"repository": "github:hyperledger-labs/splice-wallet-kernel",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"typescript": "^5.8.3"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@canton-network/core-types": "^0.
|
|
22
|
-
"@canton-network/core-wallet-ui-components": "^0.
|
|
21
|
+
"@canton-network/core-types": "^0.5.0",
|
|
22
|
+
"@canton-network/core-wallet-ui-components": "^0.5.0",
|
|
23
23
|
"socket.io-client": "^4.8.1"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|