@ckb-ccc/connector 0.0.5-alpha.3 → 0.0.5-alpha.5
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/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +17 -15
- package/package.json +2 -2
- package/src/connector/index.ts +17 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,KAAK,CAAC;AAE5D,OAAO,EAAE,GAAG,EAAkB,MAAM,uBAAuB,CAAC;AA0B5D,qBACa,qBAAsB,SAAQ,UAAU;IAEnD,OAAO,CAAC,OAAO,CAA2B;IAEnC,YAAY,CAAC,EAAE,CACpB,UAAU,EAAE,GAAG,CAAC,UAAU,EAC1B,MAAM,EAAE,GAAG,CAAC,MAAM,KACf,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtB,OAAO,CAAC,cAAc,CAAsB;IAGrC,MAAM,EAAE,OAAO,CAAS;IACxB,SAAS,CAAC,MAAM,EAAE,OAAO;IAKzB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAiC;IACnD,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM;IAKnC,OAAO,CAAC,KAAK,CAAiC;IAE9C,OAAO,CAAC,cAAc,CAAC,CAAoB;IAE3C,OAAO,CAAC,cAAc,CAAC,CAAiB;IAGxC,OAAO,CAAC,UAAU,CAAC,CAAS;IAE5B,OAAO,CAAC,UAAU,CAAC,CAAS;IAErB,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IAG/B,OAAO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;YAUhB,aAAa;IAYpB,UAAU;IAQjB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAUtB,iBAAiB,IAAI,IAAI;IAMzB,UAAU,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAoCnD,OAAO,CAAC,aAAa;YA2FP,SAAS;IAyCvB,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,CAAe;IAC3C,SAAS,EAAE,GAAG,CAAC,cAAc,CAAC,CAAe;IAC7C,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,CAAe;IAE3C,MAAM;IA2GN,OAAO;IAUP,OAAO,CAAC,aAAa,CAgBnB;IAEF,OAAO,CAAC,qBAAqB,CAsB3B;IAEF,MAAM,CAAC,MAAM,0BAsPX;CACH"}
|
package/dist/connector/index.js
CHANGED
|
@@ -53,23 +53,24 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
|
|
|
53
53
|
}
|
|
54
54
|
this.isOpen = false;
|
|
55
55
|
};
|
|
56
|
-
this.signerSelectedHandler = (wallet,
|
|
56
|
+
this.signerSelectedHandler = (wallet, signerInfo) => {
|
|
57
57
|
this.scene = Scene.Connecting;
|
|
58
58
|
this.selectedWallet = wallet;
|
|
59
|
-
this.selectedSigner =
|
|
59
|
+
this.selectedSigner = signerInfo;
|
|
60
60
|
(async () => {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const { signer } = signerInfo;
|
|
62
|
+
await signer.connect();
|
|
63
|
+
if (!(await signer.isConnected())) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
this.scene = Scene.Connected;
|
|
66
67
|
this.walletName = wallet.name;
|
|
67
|
-
this.signerName =
|
|
68
|
+
this.signerName = signerInfo.name;
|
|
68
69
|
this.saveConnection();
|
|
69
70
|
this.closedHandler();
|
|
70
|
-
this.internalAddress = await signer.
|
|
71
|
-
this.recommendAddress = await signer.
|
|
72
|
-
this.balance = await signer.
|
|
71
|
+
this.internalAddress = await signer.getInternalAddress();
|
|
72
|
+
this.recommendAddress = await signer.getRecommendedAddress();
|
|
73
|
+
this.balance = await signer.getBalance();
|
|
73
74
|
})();
|
|
74
75
|
};
|
|
75
76
|
}
|
|
@@ -80,12 +81,13 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
|
|
|
80
81
|
this.client = client;
|
|
81
82
|
}
|
|
82
83
|
async updateSignerInfo() {
|
|
83
|
-
|
|
84
|
+
const signer = this.signer?.signer;
|
|
85
|
+
if (!signer) {
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
|
-
this.recommendAddress = await
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
88
|
+
this.recommendAddress = await signer.getRecommendedAddress();
|
|
89
|
+
this.internalAddress = await signer.getInternalAddress();
|
|
90
|
+
this.balance = await signer.getBalance();
|
|
89
91
|
}
|
|
90
92
|
async prepareSigner() {
|
|
91
93
|
if (this.signer && (await this.signer.signer.isConnected())) {
|
|
@@ -125,10 +127,10 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
|
|
|
125
127
|
changedProperties.has("signerFilter")) {
|
|
126
128
|
this.reloadSigners();
|
|
127
129
|
}
|
|
128
|
-
if (changedProperties.has("
|
|
130
|
+
if ((changedProperties.has("scene") && this.scene === Scene.Connected) ||
|
|
129
131
|
changedProperties.has("wallets") ||
|
|
130
|
-
changedProperties.has("
|
|
131
|
-
changedProperties.has("
|
|
132
|
+
changedProperties.has("walletName") ||
|
|
133
|
+
changedProperties.has("signerName")) {
|
|
132
134
|
(async () => {
|
|
133
135
|
const wallet = this.wallets.find(({ name }) => name === this.walletName);
|
|
134
136
|
const signer = wallet?.signers.find(({ name }) => name === this.signerName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/connector",
|
|
3
|
-
"version": "0.0.5-alpha.
|
|
3
|
+
"version": "0.0.5-alpha.5",
|
|
4
4
|
"description": "Common Chains Connector UI",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@ckb-ccc/ccc": "0.0.5-alpha.2",
|
|
41
41
|
"lit": "^3.1.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9edf0173bf9010862b14a13366404feb47a4dd7f"
|
|
44
44
|
}
|
package/src/connector/index.ts
CHANGED
|
@@ -80,12 +80,13 @@ export class WebComponentConnector extends LitElement {
|
|
|
80
80
|
private balance?: ccc.Num;
|
|
81
81
|
|
|
82
82
|
private async updateSignerInfo() {
|
|
83
|
-
|
|
83
|
+
const signer = this.signer?.signer;
|
|
84
|
+
if (!signer) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
this.recommendAddress = await
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
87
|
+
this.recommendAddress = await signer.getRecommendedAddress();
|
|
88
|
+
this.internalAddress = await signer.getInternalAddress();
|
|
89
|
+
this.balance = await signer.getBalance();
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
private async prepareSigner() {
|
|
@@ -144,10 +145,10 @@ export class WebComponentConnector extends LitElement {
|
|
|
144
145
|
this.reloadSigners();
|
|
145
146
|
}
|
|
146
147
|
if (
|
|
147
|
-
changedProperties.has("
|
|
148
|
+
(changedProperties.has("scene") && this.scene === Scene.Connected) ||
|
|
148
149
|
changedProperties.has("wallets") ||
|
|
149
|
-
changedProperties.has("
|
|
150
|
-
changedProperties.has("
|
|
150
|
+
changedProperties.has("walletName") ||
|
|
151
|
+
changedProperties.has("signerName")
|
|
151
152
|
) {
|
|
152
153
|
(async () => {
|
|
153
154
|
const wallet = this.wallets.find(
|
|
@@ -445,24 +446,25 @@ export class WebComponentConnector extends LitElement {
|
|
|
445
446
|
|
|
446
447
|
private signerSelectedHandler = (
|
|
447
448
|
wallet: WalletWithSigners,
|
|
448
|
-
|
|
449
|
+
signerInfo: ccc.SignerInfo,
|
|
449
450
|
) => {
|
|
450
451
|
this.scene = Scene.Connecting;
|
|
451
452
|
this.selectedWallet = wallet;
|
|
452
|
-
this.selectedSigner =
|
|
453
|
+
this.selectedSigner = signerInfo;
|
|
453
454
|
(async () => {
|
|
454
|
-
|
|
455
|
-
|
|
455
|
+
const { signer } = signerInfo;
|
|
456
|
+
await signer.connect();
|
|
457
|
+
if (!(await signer.isConnected())) {
|
|
456
458
|
return;
|
|
457
459
|
}
|
|
458
460
|
this.scene = Scene.Connected;
|
|
459
461
|
this.walletName = wallet.name;
|
|
460
|
-
this.signerName =
|
|
462
|
+
this.signerName = signerInfo.name;
|
|
461
463
|
this.saveConnection();
|
|
462
464
|
this.closedHandler();
|
|
463
|
-
this.internalAddress = await signer.
|
|
464
|
-
this.recommendAddress = await signer.
|
|
465
|
-
this.balance = await signer.
|
|
465
|
+
this.internalAddress = await signer.getInternalAddress();
|
|
466
|
+
this.recommendAddress = await signer.getRecommendedAddress();
|
|
467
|
+
this.balance = await signer.getBalance();
|
|
466
468
|
})();
|
|
467
469
|
};
|
|
468
470
|
|