Skip to content

Commit e5b73f1

Browse files
committed
fix(superise): use type-only imports for bridge API types
1 parent c77501d commit e5b73f1

File tree

5 files changed

+11
-29
lines changed

5 files changed

+11
-29
lines changed

packages/superise/package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323
"import": "./dist/barrel.js",
2424
"require": "./dist.commonjs/barrel.js",
2525
"default": "./dist.commonjs/barrel.js"
26-
},
27-
"./advancedBarrel": {
28-
"import": "./dist/advancedBarrel.js",
29-
"require": "./dist.commonjs/advancedBarrel.js",
30-
"default": "./dist.commonjs/advancedBarrel.js"
31-
},
32-
"./advanced": {
33-
"import": "./dist/advanced.js",
34-
"require": "./dist.commonjs/advanced.js",
35-
"default": "./dist.commonjs/advanced.js"
3626
}
3727
},
3828
"scripts": {

packages/superise/src/advanced.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/superise/src/advancedBarrel.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/superise/src/ckb/index.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { ccc } from "@ckb-ccc/core";
2-
import type {
3-
Bridge,
4-
CkbConnection,
5-
SignCkbHashAllMetadata,
6-
} from "../advancedBarrel";
2+
import type SupeRISE from '@superise/bridge-api-types'
73

84
export class CkbSigner extends ccc.Signer {
95
get type() {
@@ -16,12 +12,12 @@ export class CkbSigner extends ccc.Signer {
1612

1713
private connectionStorageKey = "superise-ckb-connection";
1814

19-
private connection?: CkbConnection;
15+
private connection?: SupeRISE.CkbConnection;
2016

21-
private _uiMetadataMap: Record<string, SignCkbHashAllMetadata> = {};
17+
private _uiMetadataMap: Record<string, SupeRISE.SignCkbHashAllMetadata> = {};
2218

2319
constructor(
24-
private readonly bridge: Bridge,
20+
private readonly bridge: SupeRISE.Bridge,
2521
client: ccc.Client,
2622
) {
2723
super(client);
@@ -38,7 +34,7 @@ export class CkbSigner extends ccc.Signer {
3834
const connection = localStorage.getItem(this.connectionStorageKey);
3935
if (!connection) return;
4036
try {
41-
this.connection = JSON.parse(connection) as CkbConnection;
37+
this.connection = JSON.parse(connection) as SupeRISE.CkbConnection;
4238
} catch (error) {
4339
console.error("Failed to restore superise connection:", error);
4440
}
@@ -140,7 +136,7 @@ export class CkbSigner extends ccc.Signer {
140136

141137
public setUiMetadataForTx(
142138
tx: ccc.TransactionLike,
143-
metadata: SignCkbHashAllMetadata,
139+
metadata: SupeRISE.SignCkbHashAllMetadata,
144140
) {
145141
const txHash = ccc.Transaction.from(tx).hash();
146142
this._uiMetadataMap[txHash] = metadata;

packages/superise/src/signersFactory.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ccc } from "@ckb-ccc/core";
2-
import "@superise/bridge-api-types";
3-
import { CkbSigner } from "./ckb";
2+
import type SupeRISE from "@superise/bridge-api-types";
3+
import { CkbSigner } from "./ckb/index.js";
44

55
/**
66
* @public
@@ -9,7 +9,9 @@ export function getSupeRISESigners(
99
client: ccc.Client,
1010
_preferredNetworks?: ccc.NetworkPreference[],
1111
): ccc.SignerInfo[] {
12-
const windowRef = window;
12+
const windowRef = window as {
13+
superise?: SupeRISE.Bridge;
14+
};
1315

1416
if (typeof windowRef.superise === "undefined") {
1517
return [];

0 commit comments

Comments
 (0)