@cartridge/controller 0.11.3 → 0.12.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/.turbo/turbo-build$colon$deps.log +13 -13
- package/.turbo/turbo-build.log +12 -12
- package/dist/controller.d.ts +2 -2
- package/dist/iframe/keychain.d.ts +1 -1
- package/dist/index.js +161 -159
- package/dist/index.js.map +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/{provider-DCZ6z1Gs.js → provider-BYY0uIsZ.js} +2 -2
- package/dist/{provider-DCZ6z1Gs.js.map → provider-BYY0uIsZ.js.map} +1 -1
- package/dist/session.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +2 -2
- package/src/controller.ts +7 -2
- package/src/iframe/keychain.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cartridge/controller",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Cartridge Controller",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"vite-plugin-node-polyfills": "^0.23.0",
|
|
51
51
|
"vite-plugin-top-level-await": "^1.4.4",
|
|
52
52
|
"vite-plugin-wasm": "^3.4.1",
|
|
53
|
-
"@cartridge/tsconfig": "0.
|
|
53
|
+
"@cartridge/tsconfig": "0.12.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build:deps": "pnpm build",
|
package/src/controller.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { NotReadyToConnect } from "./errors";
|
|
|
14
14
|
import { KeychainIFrame } from "./iframe";
|
|
15
15
|
import BaseProvider from "./provider";
|
|
16
16
|
import {
|
|
17
|
+
AuthOptions,
|
|
17
18
|
Chain,
|
|
18
19
|
ConnectError,
|
|
19
20
|
ConnectReply,
|
|
@@ -224,7 +225,9 @@ export default class ControllerProvider extends BaseProvider {
|
|
|
224
225
|
return this.account;
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
async connect(
|
|
228
|
+
async connect(
|
|
229
|
+
signupOptions?: AuthOptions,
|
|
230
|
+
): Promise<WalletAccount | undefined> {
|
|
228
231
|
if (!this.iframes) {
|
|
229
232
|
return;
|
|
230
233
|
}
|
|
@@ -248,7 +251,9 @@ export default class ControllerProvider extends BaseProvider {
|
|
|
248
251
|
this.iframes.keychain.open();
|
|
249
252
|
|
|
250
253
|
try {
|
|
251
|
-
|
|
254
|
+
// Use connect() parameter if provided, otherwise fall back to constructor options
|
|
255
|
+
const effectiveOptions = signupOptions ?? this.options.signupOptions;
|
|
256
|
+
let response = await this.keychain.connect(effectiveOptions);
|
|
252
257
|
if (response.code !== ResponseCodes.SUCCESS) {
|
|
253
258
|
throw new Error(response.message);
|
|
254
259
|
}
|
package/src/iframe/keychain.ts
CHANGED
|
@@ -33,11 +33,16 @@ export class KeychainIFrame extends IFrame<Keychain> {
|
|
|
33
33
|
username,
|
|
34
34
|
onSessionCreated,
|
|
35
35
|
encryptedBlob,
|
|
36
|
+
propagateSessionErrors,
|
|
36
37
|
...iframeOptions
|
|
37
38
|
}: KeychainIframeOptions) {
|
|
38
39
|
const _url = new URL(url ?? KEYCHAIN_URL);
|
|
39
40
|
const walletBridge = new WalletBridge();
|
|
40
41
|
|
|
42
|
+
if (propagateSessionErrors) {
|
|
43
|
+
_url.searchParams.set("propagate_error", "true");
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
if (version) {
|
|
42
47
|
_url.searchParams.set("v", encodeURIComponent(version));
|
|
43
48
|
}
|