@orbi-wallet/sdk 0.1.1 → 0.1.2

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/client.js CHANGED
@@ -53,12 +53,21 @@ class OrbiClient {
53
53
  */
54
54
  async connect(opts = {}) {
55
55
  const chain = opts.chain ?? this.chain;
56
- // A cached session only satisfies a connect for the *same* chain — the
57
- // address differs per chain, so a Stellar session can't stand in for a
58
- // BotChain connect (or vice versa).
59
56
  const cached = this.getSession();
60
- if (cached && cached.chain === chain)
61
- return cached;
57
+ if (cached) {
58
+ // Already on the requested chain — nothing to do.
59
+ if (cached.chain === chain)
60
+ return cached;
61
+ // Switching chains: if a prior connect already derived this chain's
62
+ // address (the popup returns both at once), switch instantly with no
63
+ // re-prompt — just re-point the active chain/address.
64
+ const known = cached.addresses?.[chain];
65
+ if (known) {
66
+ const switched = { ...cached, walletAddress: known, chain };
67
+ localStorage.setItem(SESSION_KEY, JSON.stringify(switched));
68
+ return switched;
69
+ }
70
+ }
62
71
  const wallet = await this.openPopup({
63
72
  path: '/connect',
64
73
  params: { chain },
@@ -68,6 +77,7 @@ class OrbiClient {
68
77
  credentialId: msg.credentialId ?? '',
69
78
  passkeyId: msg.passkeyId ?? '',
70
79
  chain: (msg.chain ?? chain),
80
+ addresses: msg.addresses,
71
81
  }),
72
82
  });
73
83
  localStorage.setItem(SESSION_KEY, JSON.stringify(wallet));
package/dist/types.d.ts CHANGED
@@ -12,6 +12,12 @@ export interface ConnectedWallet {
12
12
  credentialId: string;
13
13
  passkeyId: string;
14
14
  chain: OrbiChain;
15
+ /**
16
+ * All per-chain addresses derived from this passkey, when the wallet
17
+ * provided them. Lets `connect()` switch chains without re-prompting once an
18
+ * address is known.
19
+ */
20
+ addresses?: Partial<Record<OrbiChain, string>>;
15
21
  }
16
22
  export interface SignResult {
17
23
  signedXdr: string;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const SDK_NAME = "@orbi-wallet/sdk";
2
- export declare const SDK_VERSION = "0.1.1";
2
+ export declare const SDK_VERSION = "0.1.2";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = exports.SDK_NAME = void 0;
4
4
  // Generated by scripts/generate-version.js from package.json — do not edit.
5
5
  exports.SDK_NAME = "@orbi-wallet/sdk";
6
- exports.SDK_VERSION = "0.1.1";
6
+ exports.SDK_VERSION = "0.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbi-wallet/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Orbi Smart Wallet SDK — connect any Stellar or BotChain dApp to Orbi passkey wallets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",