@pollar/stellar-wallets-kit-adapter 0.9.0-rc.0 → 0.10.0-rc.8
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/README.md +6 -1
- package/dist/{factory-D58ktBBa.d.mts → factory-D5jFO9d8.d.mts} +17 -8
- package/dist/{factory-D58ktBBa.d.ts → factory-D5jFO9d8.d.ts} +17 -8
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +35 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -9
- package/dist/index.mjs.map +1 -1
- package/dist/picker.d.mts +5 -5
- package/dist/picker.d.ts +5 -5
- package/dist/picker.js +39 -24
- package/dist/picker.js.map +1 -1
- package/dist/picker.mjs +27 -12
- package/dist/picker.mjs.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -52,6 +52,11 @@ Rabet, …) inside `LoginModal`, also pass the picker — see
|
|
|
52
52
|
|
|
53
53
|
The kit is a global singleton. `stellarWalletsKit(...)` returns a resolver and `StellarWalletsKit.init(...)` is called once on the first `loginWallet` call.
|
|
54
54
|
|
|
55
|
+
> **0.9.0** — `connect()` resolves to `{ address }` only (the duplicate
|
|
56
|
+
> `publicKey` field is gone, matching the new `ConnectWalletResponse`). Requires
|
|
57
|
+
> `@pollar/core@^0.9.0` / `@pollar/react@^0.9.0`. Adds `logLevel` / `logger`
|
|
58
|
+
> options (set once at init — the kit is a global singleton).
|
|
59
|
+
>
|
|
55
60
|
> **0.8.0** — `network` is **required**. The previous `Networks.TESTNET`
|
|
56
61
|
> default was removed because the kit is a global singleton, and silently
|
|
57
62
|
> picking testnet for the consumer risked signing real-looking transactions
|
|
@@ -254,7 +259,7 @@ import { StellarWalletsKitAdapter } from '@pollar/stellar-wallets-kit-adapter';
|
|
|
254
259
|
StellarWalletsKit.init({ network: Networks.PUBLIC, modules: [new FreighterModule()] });
|
|
255
260
|
|
|
256
261
|
const adapter = new StellarWalletsKitAdapter('freighter');
|
|
257
|
-
const {
|
|
262
|
+
const { address } = await adapter.connect();
|
|
258
263
|
```
|
|
259
264
|
|
|
260
265
|
## Writing a custom resolver
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Networks, ModuleInterface } from '@creit.tech/stellar-wallets-kit';
|
|
2
|
-
import {
|
|
2
|
+
import { LogLevel, PollarLogger, WalletAdapter } from '@pollar/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on
|
|
@@ -52,23 +52,32 @@ interface StellarWalletsKitAdapterOptions {
|
|
|
52
52
|
* itself ignores them.
|
|
53
53
|
*/
|
|
54
54
|
picker?: KitPickerOptions;
|
|
55
|
+
/**
|
|
56
|
+
* Minimum log severity. `silent` disables logging; otherwise `error` < `warn`
|
|
57
|
+
* < `info` < `debug`. Defaults to `'info'`. Since the kit is a global
|
|
58
|
+
* singleton, this is set once at init.
|
|
59
|
+
*/
|
|
60
|
+
logLevel?: LogLevel;
|
|
61
|
+
/** Sink for logs. Defaults to the global `console`. */
|
|
62
|
+
logger?: PollarLogger;
|
|
55
63
|
}
|
|
56
64
|
/**
|
|
57
|
-
* Build
|
|
58
|
-
*
|
|
59
|
-
* the
|
|
65
|
+
* Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one
|
|
66
|
+
* per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter
|
|
67
|
+
* carries the module's name/icon as its button `meta`. `picker.wallets` (subset)
|
|
68
|
+
* and `picker.labels` (overrides) are honored if provided.
|
|
60
69
|
*
|
|
61
70
|
* @example
|
|
62
71
|
* ```ts
|
|
63
|
-
* import {
|
|
72
|
+
* import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';
|
|
64
73
|
* import { Networks } from '@creit.tech/stellar-wallets-kit';
|
|
65
74
|
*
|
|
66
75
|
* const client = new PollarClient({
|
|
67
76
|
* apiKey: '…',
|
|
68
|
-
*
|
|
77
|
+
* walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),
|
|
69
78
|
* });
|
|
70
79
|
* ```
|
|
71
80
|
*/
|
|
72
|
-
declare function
|
|
81
|
+
declare function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[];
|
|
73
82
|
|
|
74
|
-
export { type KitPickerOptions as K, type StellarWalletsKitAdapterOptions as S,
|
|
83
|
+
export { type KitPickerOptions as K, type StellarWalletsKitAdapterOptions as S, stellarWalletsKitAdapters as s };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Networks, ModuleInterface } from '@creit.tech/stellar-wallets-kit';
|
|
2
|
-
import {
|
|
2
|
+
import { LogLevel, PollarLogger, WalletAdapter } from '@pollar/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on
|
|
@@ -52,23 +52,32 @@ interface StellarWalletsKitAdapterOptions {
|
|
|
52
52
|
* itself ignores them.
|
|
53
53
|
*/
|
|
54
54
|
picker?: KitPickerOptions;
|
|
55
|
+
/**
|
|
56
|
+
* Minimum log severity. `silent` disables logging; otherwise `error` < `warn`
|
|
57
|
+
* < `info` < `debug`. Defaults to `'info'`. Since the kit is a global
|
|
58
|
+
* singleton, this is set once at init.
|
|
59
|
+
*/
|
|
60
|
+
logLevel?: LogLevel;
|
|
61
|
+
/** Sink for logs. Defaults to the global `console`. */
|
|
62
|
+
logger?: PollarLogger;
|
|
55
63
|
}
|
|
56
64
|
/**
|
|
57
|
-
* Build
|
|
58
|
-
*
|
|
59
|
-
* the
|
|
65
|
+
* Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one
|
|
66
|
+
* per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter
|
|
67
|
+
* carries the module's name/icon as its button `meta`. `picker.wallets` (subset)
|
|
68
|
+
* and `picker.labels` (overrides) are honored if provided.
|
|
60
69
|
*
|
|
61
70
|
* @example
|
|
62
71
|
* ```ts
|
|
63
|
-
* import {
|
|
72
|
+
* import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';
|
|
64
73
|
* import { Networks } from '@creit.tech/stellar-wallets-kit';
|
|
65
74
|
*
|
|
66
75
|
* const client = new PollarClient({
|
|
67
76
|
* apiKey: '…',
|
|
68
|
-
*
|
|
77
|
+
* walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),
|
|
69
78
|
* });
|
|
70
79
|
* ```
|
|
71
80
|
*/
|
|
72
|
-
declare function
|
|
81
|
+
declare function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[];
|
|
73
82
|
|
|
74
|
-
export { type KitPickerOptions as K, type StellarWalletsKitAdapterOptions as S,
|
|
83
|
+
export { type KitPickerOptions as K, type StellarWalletsKitAdapterOptions as S, stellarWalletsKitAdapters as s };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletAdapter, WalletId, ConnectWalletResponse, SignTransactionOptions, SignTransactionResponse, SignAuthEntryOptions, SignAuthEntryResponse } from '@pollar/core';
|
|
2
|
-
export { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions, s as
|
|
1
|
+
import { WalletAdapter, WalletId, WalletAdapterMeta, ConnectWalletResponse, SignTransactionOptions, SignTransactionResponse, SignAuthEntryOptions, SignAuthEntryResponse } from '@pollar/core';
|
|
2
|
+
export { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions, s as stellarWalletsKitAdapters } from './factory-D5jFO9d8.mjs';
|
|
3
3
|
import '@creit.tech/stellar-wallets-kit';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,8 +10,10 @@ import '@creit.tech/stellar-wallets-kit';
|
|
|
10
10
|
*/
|
|
11
11
|
declare class StellarWalletsKitAdapter implements WalletAdapter {
|
|
12
12
|
readonly type: WalletId;
|
|
13
|
+
readonly meta: WalletAdapterMeta;
|
|
14
|
+
readonly custody: "external";
|
|
13
15
|
private _address;
|
|
14
|
-
constructor(walletId: WalletId);
|
|
16
|
+
constructor(walletId: WalletId, meta: WalletAdapterMeta);
|
|
15
17
|
isAvailable(): Promise<boolean>;
|
|
16
18
|
connect(): Promise<ConnectWalletResponse>;
|
|
17
19
|
disconnect(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletAdapter, WalletId, ConnectWalletResponse, SignTransactionOptions, SignTransactionResponse, SignAuthEntryOptions, SignAuthEntryResponse } from '@pollar/core';
|
|
2
|
-
export { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions, s as
|
|
1
|
+
import { WalletAdapter, WalletId, WalletAdapterMeta, ConnectWalletResponse, SignTransactionOptions, SignTransactionResponse, SignAuthEntryOptions, SignAuthEntryResponse } from '@pollar/core';
|
|
2
|
+
export { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions, s as stellarWalletsKitAdapters } from './factory-D5jFO9d8.js';
|
|
3
3
|
import '@creit.tech/stellar-wallets-kit';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,8 +10,10 @@ import '@creit.tech/stellar-wallets-kit';
|
|
|
10
10
|
*/
|
|
11
11
|
declare class StellarWalletsKitAdapter implements WalletAdapter {
|
|
12
12
|
readonly type: WalletId;
|
|
13
|
+
readonly meta: WalletAdapterMeta;
|
|
14
|
+
readonly custody: "external";
|
|
13
15
|
private _address;
|
|
14
|
-
constructor(walletId: WalletId);
|
|
16
|
+
constructor(walletId: WalletId, meta: WalletAdapterMeta);
|
|
15
17
|
isAvailable(): Promise<boolean>;
|
|
16
18
|
connect(): Promise<ConnectWalletResponse>;
|
|
17
19
|
disconnect(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var stellarWalletsKit
|
|
3
|
+
var stellarWalletsKit = require('@creit.tech/stellar-wallets-kit');
|
|
4
4
|
var albedo = require('@creit.tech/stellar-wallets-kit/modules/albedo');
|
|
5
5
|
var bitget = require('@creit.tech/stellar-wallets-kit/modules/bitget');
|
|
6
6
|
var cactuslink = require('@creit.tech/stellar-wallets-kit/modules/cactuslink');
|
|
@@ -13,10 +13,15 @@ var lobstr = require('@creit.tech/stellar-wallets-kit/modules/lobstr');
|
|
|
13
13
|
var onekey = require('@creit.tech/stellar-wallets-kit/modules/onekey');
|
|
14
14
|
var rabet = require('@creit.tech/stellar-wallets-kit/modules/rabet');
|
|
15
15
|
var xbull = require('@creit.tech/stellar-wallets-kit/modules/xbull');
|
|
16
|
+
var core = require('@pollar/core');
|
|
16
17
|
|
|
17
18
|
// src/StellarWalletsKitAdapter.ts
|
|
18
19
|
var initialised = false;
|
|
19
20
|
var initNetwork = null;
|
|
21
|
+
var _log = console;
|
|
22
|
+
function getKitLogger() {
|
|
23
|
+
return _log;
|
|
24
|
+
}
|
|
20
25
|
function buildDefaultModules() {
|
|
21
26
|
return [
|
|
22
27
|
new albedo.AlbedoModule(),
|
|
@@ -34,9 +39,12 @@ function buildDefaultModules() {
|
|
|
34
39
|
];
|
|
35
40
|
}
|
|
36
41
|
function ensureInit(options) {
|
|
42
|
+
if (options.logLevel !== void 0 || options.logger !== void 0) {
|
|
43
|
+
_log = core.createLogger(options.logLevel ?? "info", options.logger);
|
|
44
|
+
}
|
|
37
45
|
if (initialised) {
|
|
38
46
|
if (options.network && options.network !== initNetwork) {
|
|
39
|
-
|
|
47
|
+
_log.warn(
|
|
40
48
|
`[StellarWalletsKit] Already initialised with network "${initNetwork}". Ignoring attempted reconfiguration to "${options.network}". The kit is a global singleton \u2014 reload the page to change networks.`
|
|
41
49
|
);
|
|
42
50
|
}
|
|
@@ -47,7 +55,7 @@ function ensureInit(options) {
|
|
|
47
55
|
"[StellarWalletsKit] `network` is required \u2014 pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init."
|
|
48
56
|
);
|
|
49
57
|
}
|
|
50
|
-
stellarWalletsKit
|
|
58
|
+
stellarWalletsKit.StellarWalletsKit.init({
|
|
51
59
|
network: options.network,
|
|
52
60
|
modules: options.modules ?? buildDefaultModules()
|
|
53
61
|
});
|
|
@@ -60,32 +68,39 @@ function getInitNetwork() {
|
|
|
60
68
|
}
|
|
61
69
|
return initNetwork;
|
|
62
70
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
function stellarWalletsKitAdapters(options) {
|
|
72
|
+
ensureInit(options);
|
|
73
|
+
const modules = options.modules ?? buildDefaultModules();
|
|
74
|
+
const wanted = options.picker?.wallets;
|
|
75
|
+
return modules.filter((m) => !wanted || wanted.includes(m.productId)).map(
|
|
76
|
+
(m) => new StellarWalletsKitAdapter(m.productId, {
|
|
77
|
+
label: options.picker?.labels?.[m.productId] ?? m.productName,
|
|
78
|
+
iconUrl: m.productIcon
|
|
79
|
+
})
|
|
80
|
+
);
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
// src/StellarWalletsKitAdapter.ts
|
|
71
84
|
var StellarWalletsKitAdapter = class {
|
|
72
|
-
constructor(walletId) {
|
|
85
|
+
constructor(walletId, meta) {
|
|
86
|
+
this.custody = "external";
|
|
73
87
|
this._address = null;
|
|
74
88
|
this.type = walletId;
|
|
89
|
+
this.meta = meta;
|
|
75
90
|
}
|
|
76
91
|
async isAvailable() {
|
|
77
92
|
try {
|
|
78
|
-
const supported = await stellarWalletsKit
|
|
93
|
+
const supported = await stellarWalletsKit.StellarWalletsKit.refreshSupportedWallets();
|
|
79
94
|
const wallet = supported.find((w) => w.id === String(this.type));
|
|
80
95
|
return wallet?.isAvailable ?? false;
|
|
81
96
|
} catch (err) {
|
|
82
|
-
|
|
97
|
+
getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for "${this.type}"`, err);
|
|
83
98
|
return false;
|
|
84
99
|
}
|
|
85
100
|
}
|
|
86
101
|
async connect() {
|
|
87
|
-
stellarWalletsKit
|
|
88
|
-
const { address } = await stellarWalletsKit
|
|
102
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
103
|
+
const { address } = await stellarWalletsKit.StellarWalletsKit.fetchAddress();
|
|
89
104
|
if (!address) {
|
|
90
105
|
throw new Error(`[StellarWalletsKit] Empty address returned for wallet "${this.type}"`);
|
|
91
106
|
}
|
|
@@ -94,7 +109,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
94
109
|
}
|
|
95
110
|
async disconnect() {
|
|
96
111
|
try {
|
|
97
|
-
await stellarWalletsKit
|
|
112
|
+
await stellarWalletsKit.StellarWalletsKit.disconnect();
|
|
98
113
|
} finally {
|
|
99
114
|
this._address = null;
|
|
100
115
|
}
|
|
@@ -102,7 +117,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
102
117
|
async getPublicKey() {
|
|
103
118
|
if (this._address) return this._address;
|
|
104
119
|
try {
|
|
105
|
-
const { address } = await stellarWalletsKit
|
|
120
|
+
const { address } = await stellarWalletsKit.StellarWalletsKit.getAddress();
|
|
106
121
|
this._address = address ?? null;
|
|
107
122
|
return this._address;
|
|
108
123
|
} catch {
|
|
@@ -115,15 +130,15 @@ var StellarWalletsKitAdapter = class {
|
|
|
115
130
|
`[StellarWalletsKit] networkPassphrase override "${options.networkPassphrase}" does not match the network configured at init ("${getInitNetwork()}"). The kit is a global singleton \u2014 configure one network at \`stellarWalletsKit({ network })\` and use that for every call.`
|
|
116
131
|
);
|
|
117
132
|
}
|
|
118
|
-
stellarWalletsKit
|
|
119
|
-
const result = await stellarWalletsKit
|
|
133
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
134
|
+
const result = await stellarWalletsKit.StellarWalletsKit.signTransaction(xdr, {
|
|
120
135
|
...options?.accountToSign !== void 0 && { address: options.accountToSign }
|
|
121
136
|
});
|
|
122
137
|
return { signedTxXdr: result.signedTxXdr };
|
|
123
138
|
}
|
|
124
139
|
async signAuthEntry(entryXdr, options) {
|
|
125
|
-
stellarWalletsKit
|
|
126
|
-
const result = await stellarWalletsKit
|
|
140
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
141
|
+
const result = await stellarWalletsKit.StellarWalletsKit.signAuthEntry(entryXdr, {
|
|
127
142
|
...options?.accountToSign !== void 0 && { address: options.accountToSign }
|
|
128
143
|
});
|
|
129
144
|
return { signedAuthEntry: result.signedAuthEntry };
|
|
@@ -131,6 +146,6 @@ var StellarWalletsKitAdapter = class {
|
|
|
131
146
|
};
|
|
132
147
|
|
|
133
148
|
exports.StellarWalletsKitAdapter = StellarWalletsKitAdapter;
|
|
134
|
-
exports.
|
|
149
|
+
exports.stellarWalletsKitAdapters = stellarWalletsKitAdapters;
|
|
135
150
|
//# sourceMappingURL=index.js.map
|
|
136
151
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/factory.ts","../src/StellarWalletsKitAdapter.ts"],"names":["AlbedoModule","BitgetModule","CactusLinkModule","FordefiModule","FreighterModule","HanaModule","HotWalletModule","KleverModule","LobstrModule","OneKeyModule","RabetModule","xBullModule","StellarWalletsKit"],"mappings":";;;;;;;;;;;;;;;;;AAmEA,IAAI,WAAA,GAAc,KAAA;AAClB,IAAI,WAAA,GAA+B,IAAA;AAG5B,SAAS,mBAAA,GAAyC;AACvD,EAAA,OAAO;AAAA,IACL,IAAIA,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,2BAAA,EAAiB;AAAA,IACrB,IAAIC,qBAAA,EAAc;AAAA,IAClB,IAAIC,yBAAA,EAAgB;AAAA,IACpB,IAAIC,eAAA,EAAW;AAAA,IACf,IAAIC,yBAAA,EAAgB;AAAA,IACpB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,E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it } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport type { WalletAdapterResolver, WalletId } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n console.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build a {@link WalletAdapterResolver} backed by Stellar Wallets Kit. Pass\n * the result to `PollarClientConfig.walletAdapter` so Pollar can use any of\n * the kit's modules without `@pollar/core` having to depend on the kit.\n *\n * @example\n * ```ts\n * import { stellarWalletsKit } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapter: stellarWalletsKit({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKit(options: StellarWalletsKitAdapterOptions): WalletAdapterResolver {\n return (id: WalletId) => {\n ensureInit(options);\n return new StellarWalletsKitAdapter(id);\n };\n}\n","import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n private _address: string | null = null;\n\n constructor(walletId: WalletId) {\n this.type = walletId;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n console.warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/factory.ts","../src/StellarWalletsKitAdapter.ts"],"names":["AlbedoModule","BitgetModule","CactusLinkModule","FordefiModule","FreighterModule","HanaModule","HotWalletModule","KleverModule","LobstrModule","OneKeyModule","RabetModule","xBullModule","createLogger","StellarWalletsKit"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAI,WAAA,GAAc,KAAA;AAClB,IAAI,WAAA,GAA+B,IAAA;AACnC,IAAI,IAAA,GAAqB,OAAA;AAGlB,SAAS,YAAA,GAA6B;AAC3C,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,mBAAA,GAAyC;AACvD,EAAA,OAAO;AAAA,IACL,IAAIA,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,2BAAA,EAAiB;AAAA,IACrB,IAAIC,qBAAA,EAAc;AAAA,IAClB,IAAIC,yBAAA,EAAgB;AAAA,IACpB,IAAIC,eAAA,EAAW;AAAA,IACf,IAAIC,yBAAA,EAAgB;AAAA,IACpB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,mBAAA,EAAa;AAAA,IACjB,IAAIC,iBAAA,EAAY;AAAA,IAChB,IAAIC,iBAAA;AAAY,GAClB;AACF;AAUO,SAAS,WAAW,OAAA,EAAyD;AAClF,EAAA,IAAI,OAAA,CAAQ,QAAA,KAAa,MAAA,IAAa,OAAA,CAAQ,WAAW,MAAA,EAAW;AAClE,IAAA,IAAA,GAAOC,iBAAA,CAAa,OAAA,CAAQ,QAAA,IAAY,MAAA,EAAQ,QAAQ,MAAM,CAAA;AAAA,EAChE;AACA,EAAA,IAAI,WAAA,EAAa;AAIf,IAAA,IAAI,OAAA,CAAQ,OAAA,IAA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C,IAAA,MAAM,MAAA,GAAS,MAAMA,mCAAAA,CAAkB,aAAA,CAAc,QAAA,EAAU;AAAA,MAC7D,GAAI,OAAA,EAAS,aAAA,KAAkB,UAAa,EAAE,OAAA,EAAS,QAAQ,aAAA;AAAc,KAC9E,CAAA;AACD,IAAA,OAAO,EAAE,eAAA,EAAiB,MAAA,CAAO,eAAA,EAAgB;AAAA,EACnD;AACF","file":"index.js","sourcesContent":["import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport { createLogger, type LogLevel, type PollarLogger, type WalletAdapter } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n /**\n * Minimum log severity. `silent` disables logging; otherwise `error` < `warn`\n * < `info` < `debug`. Defaults to `'info'`. Since the kit is a global\n * singleton, this is set once at init.\n */\n logLevel?: LogLevel;\n /** Sink for logs. Defaults to the global `console`. */\n logger?: PollarLogger;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\nlet _log: PollarLogger = console;\n\n/** The kit's configured logger (set at init). Used by the adapter + picker. */\nexport function getKitLogger(): PollarLogger {\n return _log;\n}\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (options.logLevel !== undefined || options.logger !== undefined) {\n _log = createLogger(options.logLevel ?? 'info', options.logger);\n }\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n _log.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one\n * per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter\n * carries the module's name/icon as its button `meta`. `picker.wallets` (subset)\n * and `picker.labels` (overrides) are honored if provided.\n *\n * @example\n * ```ts\n * import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[] {\n ensureInit(options);\n const modules = options.modules ?? buildDefaultModules();\n const wanted = options.picker?.wallets;\n return modules\n .filter((m) => !wanted || wanted.includes(m.productId))\n .map(\n (m) =>\n new StellarWalletsKitAdapter(m.productId, {\n label: options.picker?.labels?.[m.productId] ?? m.productName,\n iconUrl: m.productIcon,\n }),\n );\n}\n","import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletAdapterMeta,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork, getKitLogger } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n readonly meta: WalletAdapterMeta;\n readonly custody = 'external' as const;\n private _address: string | null = null;\n\n constructor(walletId: WalletId, meta: WalletAdapterMeta) {\n this.type = walletId;\n this.meta = meta;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -11,10 +11,15 @@ import { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';
|
|
|
11
11
|
import { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';
|
|
12
12
|
import { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';
|
|
13
13
|
import { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';
|
|
14
|
+
import { createLogger } from '@pollar/core';
|
|
14
15
|
|
|
15
16
|
// src/StellarWalletsKitAdapter.ts
|
|
16
17
|
var initialised = false;
|
|
17
18
|
var initNetwork = null;
|
|
19
|
+
var _log = console;
|
|
20
|
+
function getKitLogger() {
|
|
21
|
+
return _log;
|
|
22
|
+
}
|
|
18
23
|
function buildDefaultModules() {
|
|
19
24
|
return [
|
|
20
25
|
new AlbedoModule(),
|
|
@@ -32,9 +37,12 @@ function buildDefaultModules() {
|
|
|
32
37
|
];
|
|
33
38
|
}
|
|
34
39
|
function ensureInit(options) {
|
|
40
|
+
if (options.logLevel !== void 0 || options.logger !== void 0) {
|
|
41
|
+
_log = createLogger(options.logLevel ?? "info", options.logger);
|
|
42
|
+
}
|
|
35
43
|
if (initialised) {
|
|
36
44
|
if (options.network && options.network !== initNetwork) {
|
|
37
|
-
|
|
45
|
+
_log.warn(
|
|
38
46
|
`[StellarWalletsKit] Already initialised with network "${initNetwork}". Ignoring attempted reconfiguration to "${options.network}". The kit is a global singleton \u2014 reload the page to change networks.`
|
|
39
47
|
);
|
|
40
48
|
}
|
|
@@ -58,18 +66,25 @@ function getInitNetwork() {
|
|
|
58
66
|
}
|
|
59
67
|
return initNetwork;
|
|
60
68
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
function stellarWalletsKitAdapters(options) {
|
|
70
|
+
ensureInit(options);
|
|
71
|
+
const modules = options.modules ?? buildDefaultModules();
|
|
72
|
+
const wanted = options.picker?.wallets;
|
|
73
|
+
return modules.filter((m) => !wanted || wanted.includes(m.productId)).map(
|
|
74
|
+
(m) => new StellarWalletsKitAdapter(m.productId, {
|
|
75
|
+
label: options.picker?.labels?.[m.productId] ?? m.productName,
|
|
76
|
+
iconUrl: m.productIcon
|
|
77
|
+
})
|
|
78
|
+
);
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
// src/StellarWalletsKitAdapter.ts
|
|
69
82
|
var StellarWalletsKitAdapter = class {
|
|
70
|
-
constructor(walletId) {
|
|
83
|
+
constructor(walletId, meta) {
|
|
84
|
+
this.custody = "external";
|
|
71
85
|
this._address = null;
|
|
72
86
|
this.type = walletId;
|
|
87
|
+
this.meta = meta;
|
|
73
88
|
}
|
|
74
89
|
async isAvailable() {
|
|
75
90
|
try {
|
|
@@ -77,7 +92,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
77
92
|
const wallet = supported.find((w) => w.id === String(this.type));
|
|
78
93
|
return wallet?.isAvailable ?? false;
|
|
79
94
|
} catch (err) {
|
|
80
|
-
|
|
95
|
+
getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for "${this.type}"`, err);
|
|
81
96
|
return false;
|
|
82
97
|
}
|
|
83
98
|
}
|
|
@@ -128,6 +143,6 @@ var StellarWalletsKitAdapter = class {
|
|
|
128
143
|
}
|
|
129
144
|
};
|
|
130
145
|
|
|
131
|
-
export { StellarWalletsKitAdapter,
|
|
146
|
+
export { StellarWalletsKitAdapter, stellarWalletsKitAdapters };
|
|
132
147
|
//# sourceMappingURL=index.mjs.map
|
|
133
148
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/factory.ts","../src/StellarWalletsKitAdapter.ts"],"names":["StellarWalletsKit"],"mappings":";;;;;;;;;;;;;;;AAmEA,IAAI,WAAA,GAAc,KAAA;AAClB,IAAI,WAAA,GAA+B,IAAA;AAG5B,SAAS,mBAAA,GAAyC;AACvD,EAAA,OAAO;AAAA,IACL,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,gBAAA,EAAiB;AAAA,IACrB,IAAI,aAAA,EAAc;AAAA,IAClB,IAAI,eAAA,EAAgB;AAAA,IACpB,IA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;AACD,IAAA,OAAO,EAAE,eAAA,EAAiB,MAAA,CAAO,eAAA,EAAgB;AAAA,EACnD;AACF","file":"index.mjs","sourcesContent":["import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport type { WalletAdapterResolver, WalletId } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n console.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build a {@link WalletAdapterResolver} backed by Stellar Wallets Kit. Pass\n * the result to `PollarClientConfig.walletAdapter` so Pollar can use any of\n * the kit's modules without `@pollar/core` having to depend on the kit.\n *\n * @example\n * ```ts\n * import { stellarWalletsKit } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapter: stellarWalletsKit({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKit(options: StellarWalletsKitAdapterOptions): WalletAdapterResolver {\n return (id: WalletId) => {\n ensureInit(options);\n return new StellarWalletsKitAdapter(id);\n };\n}\n","import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n private _address: string | null = null;\n\n constructor(walletId: WalletId) {\n this.type = walletId;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n console.warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/factory.ts","../src/StellarWalletsKitAdapter.ts"],"names":["StellarWalletsKit"],"mappings":";;;;;;;;;;;;;;;;AA2EA,IAAI,WAAA,GAAc,KAAA;AAClB,IAAI,WAAA,GAA+B,IAAA;AACnC,IAAI,IAAA,GAAqB,OAAA;AAGlB,SAAS,YAAA,GAA6B;AAC3C,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,mBAAA,GAAyC;AACvD,EAAA,OAAO;AAAA,IACL,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,gBAAA,EAAiB;AAAA,IACrB,IAAI,aAAA,EAAc;AAAA,IAClB,IAAI,eAAA,EAAgB;AAAA,IACpB,IAAI,UAAA,EAAW;AAAA,IACf,IAAI,eAAA,EAAgB;AAAA,IACpB,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,YAAA,EAAa;AAAA,IACjB,IAAI,WAAA,EAAY;AAAA,IAChB,IAAI,WAAA;AAAY,GAClB;AACF;AAUO,SAAS,WAAW,OAAA,EAAyD;AAClF,EAAA,IAAI,OAAA,CAAQ,QAAA,KAAa,MAAA,IAAa,OAAA,CAAQ,WAAW,MAAA,EAAW;AAClE,IAAA,IAAA,GAAO,YAAA,CAAa,OAAA,CAAQ,QAAA,IAAY,MAAA,EAAQ,QAAQ,MAAM,CAAA;AAAA,EAChE;AACA,EAAA,IAAI,WAAA,EAAa;AAIf,IAAA,IAAI,OAAA,CAAQ,OAAA,IAAW,OAAA,CAA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,MAAA,GAAS,MAAMA,iBAAAA,CAAkB,aAAA,CAAc,QAAA,EAAU;AAAA,MAC7D,GAAI,OAAA,EAAS,aAAA,KAAkB,UAAa,EAAE,OAAA,EAAS,QAAQ,aAAA;AAAc,KAC9E,CAAA;AACD,IAAA,OAAO,EAAE,eAAA,EAAiB,MAAA,CAAO,eAAA,EAAgB;AAAA,EACnD;AACF","file":"index.mjs","sourcesContent":["import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport { createLogger, type LogLevel, type PollarLogger, type WalletAdapter } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n /**\n * Minimum log severity. `silent` disables logging; otherwise `error` < `warn`\n * < `info` < `debug`. Defaults to `'info'`. Since the kit is a global\n * singleton, this is set once at init.\n */\n logLevel?: LogLevel;\n /** Sink for logs. Defaults to the global `console`. */\n logger?: PollarLogger;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\nlet _log: PollarLogger = console;\n\n/** The kit's configured logger (set at init). Used by the adapter + picker. */\nexport function getKitLogger(): PollarLogger {\n return _log;\n}\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (options.logLevel !== undefined || options.logger !== undefined) {\n _log = createLogger(options.logLevel ?? 'info', options.logger);\n }\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n _log.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one\n * per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter\n * carries the module's name/icon as its button `meta`. `picker.wallets` (subset)\n * and `picker.labels` (overrides) are honored if provided.\n *\n * @example\n * ```ts\n * import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[] {\n ensureInit(options);\n const modules = options.modules ?? buildDefaultModules();\n const wanted = options.picker?.wallets;\n return modules\n .filter((m) => !wanted || wanted.includes(m.productId))\n .map(\n (m) =>\n new StellarWalletsKitAdapter(m.productId, {\n label: options.picker?.labels?.[m.productId] ?? m.productName,\n iconUrl: m.productIcon,\n }),\n );\n}\n","import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletAdapterMeta,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork, getKitLogger } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n readonly meta: WalletAdapterMeta;\n readonly custody = 'external' as const;\n private _address: string | null = null;\n\n constructor(walletId: WalletId, meta: WalletAdapterMeta) {\n this.type = walletId;\n this.meta = meta;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n"]}
|
package/dist/picker.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Networks, ModuleInterface } from '@creit.tech/stellar-wallets-kit';
|
|
3
3
|
import { RenderWalletsProps, RenderWalletsSlot } from '@pollar/react';
|
|
4
|
-
import { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions } from './factory-
|
|
5
|
-
import {
|
|
4
|
+
import { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions } from './factory-D5jFO9d8.mjs';
|
|
5
|
+
import { WalletAdapter } from '@pollar/core';
|
|
6
6
|
|
|
7
7
|
interface KitWalletPickerProps extends RenderWalletsProps {
|
|
8
8
|
network?: Networks;
|
|
@@ -12,8 +12,8 @@ interface KitWalletPickerProps extends RenderWalletsProps {
|
|
|
12
12
|
declare function KitWalletPicker({ onConnect, authState, network, modules, picker }: KitWalletPickerProps): react_jsx_runtime.JSX.Element;
|
|
13
13
|
|
|
14
14
|
interface StellarWalletsKitBundle {
|
|
15
|
-
/** Pass to `PollarClientConfig.
|
|
16
|
-
|
|
15
|
+
/** Pass to `PollarClientConfig.walletAdapters`. */
|
|
16
|
+
walletAdapters: WalletAdapter[];
|
|
17
17
|
/** Pass to `<PollarProvider ui={{ renderWallets }}>`. */
|
|
18
18
|
renderWallets: RenderWalletsSlot;
|
|
19
19
|
}
|
|
@@ -35,7 +35,7 @@ interface StellarWalletsKitBundle {
|
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
37
|
* <PollarProvider
|
|
38
|
-
* client={{ apiKey: '…',
|
|
38
|
+
* client={{ apiKey: '…', walletAdapters: bundle.walletAdapters }}
|
|
39
39
|
* ui={{ renderWallets: bundle.renderWallets }}
|
|
40
40
|
* />
|
|
41
41
|
* ```
|
package/dist/picker.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Networks, ModuleInterface } from '@creit.tech/stellar-wallets-kit';
|
|
3
3
|
import { RenderWalletsProps, RenderWalletsSlot } from '@pollar/react';
|
|
4
|
-
import { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions } from './factory-
|
|
5
|
-
import {
|
|
4
|
+
import { K as KitPickerOptions, S as StellarWalletsKitAdapterOptions } from './factory-D5jFO9d8.js';
|
|
5
|
+
import { WalletAdapter } from '@pollar/core';
|
|
6
6
|
|
|
7
7
|
interface KitWalletPickerProps extends RenderWalletsProps {
|
|
8
8
|
network?: Networks;
|
|
@@ -12,8 +12,8 @@ interface KitWalletPickerProps extends RenderWalletsProps {
|
|
|
12
12
|
declare function KitWalletPicker({ onConnect, authState, network, modules, picker }: KitWalletPickerProps): react_jsx_runtime.JSX.Element;
|
|
13
13
|
|
|
14
14
|
interface StellarWalletsKitBundle {
|
|
15
|
-
/** Pass to `PollarClientConfig.
|
|
16
|
-
|
|
15
|
+
/** Pass to `PollarClientConfig.walletAdapters`. */
|
|
16
|
+
walletAdapters: WalletAdapter[];
|
|
17
17
|
/** Pass to `<PollarProvider ui={{ renderWallets }}>`. */
|
|
18
18
|
renderWallets: RenderWalletsSlot;
|
|
19
19
|
}
|
|
@@ -35,7 +35,7 @@ interface StellarWalletsKitBundle {
|
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
37
|
* <PollarProvider
|
|
38
|
-
* client={{ apiKey: '…',
|
|
38
|
+
* client={{ apiKey: '…', walletAdapters: bundle.walletAdapters }}
|
|
39
39
|
* ui={{ renderWallets: bundle.renderWallets }}
|
|
40
40
|
* />
|
|
41
41
|
* ```
|
package/dist/picker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var stellarWalletsKit
|
|
3
|
+
var stellarWalletsKit = require('@creit.tech/stellar-wallets-kit');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var albedo = require('@creit.tech/stellar-wallets-kit/modules/albedo');
|
|
6
6
|
var bitget = require('@creit.tech/stellar-wallets-kit/modules/bitget');
|
|
@@ -14,27 +14,30 @@ var lobstr = require('@creit.tech/stellar-wallets-kit/modules/lobstr');
|
|
|
14
14
|
var onekey = require('@creit.tech/stellar-wallets-kit/modules/onekey');
|
|
15
15
|
var rabet = require('@creit.tech/stellar-wallets-kit/modules/rabet');
|
|
16
16
|
var xbull = require('@creit.tech/stellar-wallets-kit/modules/xbull');
|
|
17
|
+
var core = require('@pollar/core');
|
|
17
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
18
19
|
|
|
19
20
|
// src/picker/KitWalletPicker.tsx
|
|
20
21
|
var StellarWalletsKitAdapter = class {
|
|
21
|
-
constructor(walletId) {
|
|
22
|
+
constructor(walletId, meta) {
|
|
23
|
+
this.custody = "external";
|
|
22
24
|
this._address = null;
|
|
23
25
|
this.type = walletId;
|
|
26
|
+
this.meta = meta;
|
|
24
27
|
}
|
|
25
28
|
async isAvailable() {
|
|
26
29
|
try {
|
|
27
|
-
const supported = await stellarWalletsKit
|
|
30
|
+
const supported = await stellarWalletsKit.StellarWalletsKit.refreshSupportedWallets();
|
|
28
31
|
const wallet = supported.find((w) => w.id === String(this.type));
|
|
29
32
|
return wallet?.isAvailable ?? false;
|
|
30
33
|
} catch (err) {
|
|
31
|
-
|
|
34
|
+
getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for "${this.type}"`, err);
|
|
32
35
|
return false;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
async connect() {
|
|
36
|
-
stellarWalletsKit
|
|
37
|
-
const { address } = await stellarWalletsKit
|
|
39
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
40
|
+
const { address } = await stellarWalletsKit.StellarWalletsKit.fetchAddress();
|
|
38
41
|
if (!address) {
|
|
39
42
|
throw new Error(`[StellarWalletsKit] Empty address returned for wallet "${this.type}"`);
|
|
40
43
|
}
|
|
@@ -43,7 +46,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
43
46
|
}
|
|
44
47
|
async disconnect() {
|
|
45
48
|
try {
|
|
46
|
-
await stellarWalletsKit
|
|
49
|
+
await stellarWalletsKit.StellarWalletsKit.disconnect();
|
|
47
50
|
} finally {
|
|
48
51
|
this._address = null;
|
|
49
52
|
}
|
|
@@ -51,7 +54,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
51
54
|
async getPublicKey() {
|
|
52
55
|
if (this._address) return this._address;
|
|
53
56
|
try {
|
|
54
|
-
const { address } = await stellarWalletsKit
|
|
57
|
+
const { address } = await stellarWalletsKit.StellarWalletsKit.getAddress();
|
|
55
58
|
this._address = address ?? null;
|
|
56
59
|
return this._address;
|
|
57
60
|
} catch {
|
|
@@ -64,15 +67,15 @@ var StellarWalletsKitAdapter = class {
|
|
|
64
67
|
`[StellarWalletsKit] networkPassphrase override "${options.networkPassphrase}" does not match the network configured at init ("${getInitNetwork()}"). The kit is a global singleton \u2014 configure one network at \`stellarWalletsKit({ network })\` and use that for every call.`
|
|
65
68
|
);
|
|
66
69
|
}
|
|
67
|
-
stellarWalletsKit
|
|
68
|
-
const result = await stellarWalletsKit
|
|
70
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
71
|
+
const result = await stellarWalletsKit.StellarWalletsKit.signTransaction(xdr, {
|
|
69
72
|
...options?.accountToSign !== void 0 && { address: options.accountToSign }
|
|
70
73
|
});
|
|
71
74
|
return { signedTxXdr: result.signedTxXdr };
|
|
72
75
|
}
|
|
73
76
|
async signAuthEntry(entryXdr, options) {
|
|
74
|
-
stellarWalletsKit
|
|
75
|
-
const result = await stellarWalletsKit
|
|
77
|
+
stellarWalletsKit.StellarWalletsKit.setWallet(String(this.type));
|
|
78
|
+
const result = await stellarWalletsKit.StellarWalletsKit.signAuthEntry(entryXdr, {
|
|
76
79
|
...options?.accountToSign !== void 0 && { address: options.accountToSign }
|
|
77
80
|
});
|
|
78
81
|
return { signedAuthEntry: result.signedAuthEntry };
|
|
@@ -82,6 +85,10 @@ var StellarWalletsKitAdapter = class {
|
|
|
82
85
|
// src/factory.ts
|
|
83
86
|
var initialised = false;
|
|
84
87
|
var initNetwork = null;
|
|
88
|
+
var _log = console;
|
|
89
|
+
function getKitLogger() {
|
|
90
|
+
return _log;
|
|
91
|
+
}
|
|
85
92
|
function buildDefaultModules() {
|
|
86
93
|
return [
|
|
87
94
|
new albedo.AlbedoModule(),
|
|
@@ -99,9 +106,12 @@ function buildDefaultModules() {
|
|
|
99
106
|
];
|
|
100
107
|
}
|
|
101
108
|
function ensureInit(options) {
|
|
109
|
+
if (options.logLevel !== void 0 || options.logger !== void 0) {
|
|
110
|
+
_log = core.createLogger(options.logLevel ?? "info", options.logger);
|
|
111
|
+
}
|
|
102
112
|
if (initialised) {
|
|
103
113
|
if (options.network && options.network !== initNetwork) {
|
|
104
|
-
|
|
114
|
+
_log.warn(
|
|
105
115
|
`[StellarWalletsKit] Already initialised with network "${initNetwork}". Ignoring attempted reconfiguration to "${options.network}". The kit is a global singleton \u2014 reload the page to change networks.`
|
|
106
116
|
);
|
|
107
117
|
}
|
|
@@ -112,7 +122,7 @@ function ensureInit(options) {
|
|
|
112
122
|
"[StellarWalletsKit] `network` is required \u2014 pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init."
|
|
113
123
|
);
|
|
114
124
|
}
|
|
115
|
-
stellarWalletsKit
|
|
125
|
+
stellarWalletsKit.StellarWalletsKit.init({
|
|
116
126
|
network: options.network,
|
|
117
127
|
modules: options.modules ?? buildDefaultModules()
|
|
118
128
|
});
|
|
@@ -125,11 +135,16 @@ function getInitNetwork() {
|
|
|
125
135
|
}
|
|
126
136
|
return initNetwork;
|
|
127
137
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
function stellarWalletsKitAdapters(options) {
|
|
139
|
+
ensureInit(options);
|
|
140
|
+
const modules = options.modules ?? buildDefaultModules();
|
|
141
|
+
const wanted = options.picker?.wallets;
|
|
142
|
+
return modules.filter((m) => !wanted || wanted.includes(m.productId)).map(
|
|
143
|
+
(m) => new StellarWalletsKitAdapter(m.productId, {
|
|
144
|
+
label: options.picker?.labels?.[m.productId] ?? m.productName,
|
|
145
|
+
iconUrl: m.productIcon
|
|
146
|
+
})
|
|
147
|
+
);
|
|
133
148
|
}
|
|
134
149
|
var CONNECTING_STEPS = /* @__PURE__ */ new Set(["connecting_wallet", "authenticating_wallet", "authenticating"]);
|
|
135
150
|
function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }) {
|
|
@@ -141,11 +156,11 @@ function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }
|
|
|
141
156
|
if (network !== void 0) initOpts.network = network;
|
|
142
157
|
if (modules !== void 0) initOpts.modules = modules;
|
|
143
158
|
ensureInit(initOpts);
|
|
144
|
-
stellarWalletsKit
|
|
159
|
+
stellarWalletsKit.StellarWalletsKit.refreshSupportedWallets().then((list) => {
|
|
145
160
|
if (cancelled) return;
|
|
146
161
|
setWallets(list);
|
|
147
162
|
}).catch((err) => {
|
|
148
|
-
|
|
163
|
+
getKitLogger().error("[KitWalletPicker] refreshSupportedWallets failed", err);
|
|
149
164
|
if (!cancelled) setWallets([]);
|
|
150
165
|
});
|
|
151
166
|
return () => {
|
|
@@ -165,7 +180,7 @@ function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }
|
|
|
165
180
|
result.push(w);
|
|
166
181
|
} else if (!warnedRef.current.has(id)) {
|
|
167
182
|
warnedRef.current.add(id);
|
|
168
|
-
|
|
183
|
+
getKitLogger().warn(`[KitWalletPicker] wallet id "${id}" not present in the active kit modules \u2014 skipped`);
|
|
169
184
|
}
|
|
170
185
|
}
|
|
171
186
|
} else {
|
|
@@ -245,7 +260,7 @@ function buttonStyle(layout, disabled) {
|
|
|
245
260
|
return { ...base, flexDirection: "column", justifyContent: "center", textAlign: "center", minHeight: 92 };
|
|
246
261
|
}
|
|
247
262
|
function createStellarWalletsKitBundle(options) {
|
|
248
|
-
const
|
|
263
|
+
const walletAdapters = stellarWalletsKitAdapters(options);
|
|
249
264
|
const renderWallets = (slot) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
250
265
|
KitWalletPicker,
|
|
251
266
|
{
|
|
@@ -256,7 +271,7 @@ function createStellarWalletsKitBundle(options) {
|
|
|
256
271
|
...options.picker !== void 0 && { picker: options.picker }
|
|
257
272
|
}
|
|
258
273
|
);
|
|
259
|
-
return {
|
|
274
|
+
return { walletAdapters, renderWallets };
|
|
260
275
|
}
|
|
261
276
|
|
|
262
277
|
exports.KitWalletPicker = KitWalletPicker;
|
package/dist/picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/StellarWalletsKitAdapter.ts","../src/factory.ts","../src/picker/KitWalletPicker.tsx","../src/picker/bundle.tsx"],"names":["StellarWalletsKit","AlbedoModule","BitgetModule","CactusLinkModule","FordefiModule","FreighterModule","HanaModule","HotWalletModule","KleverModule","LobstrModule","OneKeyModule","RabetModule","xBullModule","useState","useRef","useEffect","useMemo","jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,IAAM,2BAAN,MAAwD;AAAA,EAI7D,YAAY,QAAA,EAAoB;AAFhC,IAAA,IAAA,CAAQ,QAAA,GAA0B,IAAA;AAGhC,IAAA,IAAA,CAAK,IAAA,GAAO,QAAA;AAAA,EACd;AAAA,EAEA,MAAM,WAAA,GAAgC;AAMpC,IAAA,IAAI;AACF,MAAA,MAAM,SAAA,GAAY,MAAMA,qCAAA,CAAkB,uBAAA,EAAwB;AAClE,MAAA,MAAM,MAAA,GAAS,SAAA,CAAU,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAA,KAAO,MAAA,CAAO,IAAA,CAAK,IAAI,CAAC,CAAA;AAC/D,MAAA,OAAO,QAAQ,WAAA,IAAe,KAAA;AAAA,IAChC,SAAS,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,kDAAA,EAAqD,IAAA,CAAK,IAAI,KAAK,GAAG,CAAA;AACnF,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAM,OAAA,GAA0C;AAC9C,IAAAA,qCAAA,CAAkB,SAAA,CAAU,MAAA,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,OAAA,KAAY,UAAa,EAAE,OAAA,EAAS,QAAQ,OAAA,EAAQ;AAAA,MAChE,GAAI,OAAA,CAAQ,MAAA,KAAW,UAAa,EAAE,MAAA,EAAQ,QAAQ,MAAA;AAAO;AAAA,GAChE;AAEF,EAAA,OAAO,EAAE,eAAe,aAAA,EAAc;AACxC","file":"picker.js","sourcesContent":["import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n private _address: string | null = null;\n\n constructor(walletId: WalletId) {\n this.type = walletId;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n console.warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n","import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport type { WalletAdapterResolver, WalletId } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n console.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build a {@link WalletAdapterResolver} backed by Stellar Wallets Kit. Pass\n * the result to `PollarClientConfig.walletAdapter` so Pollar can use any of\n * the kit's modules without `@pollar/core` having to depend on the kit.\n *\n * @example\n * ```ts\n * import { stellarWalletsKit } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapter: stellarWalletsKit({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKit(options: StellarWalletsKitAdapterOptions): WalletAdapterResolver {\n return (id: WalletId) => {\n ensureInit(options);\n return new StellarWalletsKitAdapter(id);\n };\n}\n","'use client';\n\nimport { type ISupportedWallet, type ModuleInterface, type Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type { RenderWalletsProps } from '@pollar/react';\nimport { type CSSProperties, useEffect, useMemo, useRef, useState } from 'react';\nimport { ensureInit, type KitPickerOptions } from '../factory';\n\nexport interface KitWalletPickerProps extends RenderWalletsProps {\n network?: Networks;\n modules?: ModuleInterface[];\n picker?: KitPickerOptions;\n}\n\nconst CONNECTING_STEPS = new Set(['connecting_wallet', 'authenticating_wallet', 'authenticating']);\n\nexport function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }: KitWalletPickerProps) {\n const [wallets, setWallets] = useState<ISupportedWallet[] | null>(null);\n const warnedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n let cancelled = false;\n const initOpts: { network?: Networks; modules?: ModuleInterface[] } = {};\n if (network !== undefined) initOpts.network = network;\n if (modules !== undefined) initOpts.modules = modules;\n ensureInit(initOpts);\n StellarWalletsKit.refreshSupportedWallets()\n .then((list) => {\n if (cancelled) return;\n setWallets(list);\n })\n .catch((err) => {\n console.error('[KitWalletPicker] refreshSupportedWallets failed', err);\n if (!cancelled) setWallets([]);\n });\n return () => {\n cancelled = true;\n };\n }, [network, modules]);\n\n const filtered = useMemo(() => {\n if (!wallets) return null;\n const { wallets: allowedIds, order = 'as-given', showInstalledOnly = false, labels } = picker;\n\n const byId = new Map(wallets.map((w) => [w.id, w]));\n let result: ISupportedWallet[];\n\n if (allowedIds && allowedIds.length > 0) {\n // Build the base list in `allowedIds` order; warn once per unknown id.\n // A later `order` setting may re-sort this list.\n result = [];\n for (const id of allowedIds) {\n const w = byId.get(id);\n if (w) {\n result.push(w);\n } else if (!warnedRef.current.has(id)) {\n warnedRef.current.add(id);\n console.warn(`[KitWalletPicker] wallet id \"${id}\" not present in the active kit modules — skipped`);\n }\n }\n } else {\n result = [...wallets];\n }\n\n if (showInstalledOnly) {\n result = result.filter((w) => w.isAvailable);\n }\n\n if (order === 'alphabetical') {\n result = [...result].sort((a, b) => labelOf(a, labels).localeCompare(labelOf(b, labels)));\n } else if (order === 'installed-first') {\n result = [...result].sort((a, b) => {\n if (a.isAvailable === b.isAvailable) return 0;\n return a.isAvailable ? -1 : 1;\n });\n }\n // 'as-given' keeps whatever order we built above.\n\n return result;\n }, [wallets, picker]);\n\n const isBusy = CONNECTING_STEPS.has(authState.step);\n const layout = picker.layout ?? 'grid';\n const theme = picker.theme;\n const rootStyle: CSSProperties = {\n display: layout === 'list' ? 'flex' : 'grid',\n flexDirection: layout === 'list' ? 'column' : undefined,\n gridTemplateColumns: layout === 'grid' ? 'repeat(auto-fill, minmax(140px, 1fr))' : undefined,\n gap: '0.5rem',\n width: '100%',\n ...(theme?.accent !== undefined && { ['--pollar-accent' as never]: theme.accent }),\n ...(theme?.mode === 'dark' && { colorScheme: 'dark' as const }),\n };\n\n // Still loading the wallet list.\n if (filtered === null) {\n return (\n <div role=\"status\" aria-busy=\"true\" style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n Loading wallets…\n </div>\n );\n }\n\n // Empty state: showInstalledOnly hid every wallet, or the filter list is empty.\n if (filtered.length === 0) {\n return (\n <div style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n {picker.showInstalledOnly\n ? 'No supported Stellar wallets detected. Install Freighter / xBull / Lobstr to continue.'\n : 'No wallets to show.'}\n </div>\n );\n }\n\n return (\n <div style={rootStyle}>\n {filtered.map((w) => {\n const label = labelOf(w, picker.labels);\n const disabled = isBusy || (picker.showInstalledOnly ? false : !w.isAvailable);\n return (\n <button\n key={w.id}\n type=\"button\"\n disabled={disabled}\n onClick={() => onConnect(w.id)}\n style={buttonStyle(layout, disabled)}\n title={!w.isAvailable && !picker.showInstalledOnly ? `${label} not detected` : label}\n >\n <img src={w.icon} alt=\"\" width={32} height={32} style={{ borderRadius: 6, opacity: w.isAvailable ? 1 : 0.5 }} />\n <span style={{ fontSize: '0.85rem', fontWeight: 500 }}>{label}</span>\n {!w.isAvailable && <span style={{ fontSize: '0.7rem', opacity: 0.6 }}>not installed</span>}\n </button>\n );\n })}\n </div>\n );\n}\n\nfunction labelOf(w: ISupportedWallet, labels: Record<string, string> | undefined): string {\n return labels?.[w.id] ?? w.name;\n}\n\nfunction buttonStyle(layout: 'grid' | 'list', disabled: boolean): CSSProperties {\n const base: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.55 : 1,\n background: 'transparent',\n border: '1px solid var(--pollar-border, #e5e7eb)',\n borderRadius: 'var(--pollar-buttons-border-radius, 6px)',\n color: 'var(--pollar-text, inherit)',\n padding: '0.6rem',\n gap: '0.6rem',\n };\n if (layout === 'list') {\n return { ...base, justifyContent: 'flex-start', width: '100%', height: 'var(--pollar-buttons-height, 44px)' };\n }\n return { ...base, flexDirection: 'column', justifyContent: 'center', textAlign: 'center', minHeight: 92 };\n}\n","'use client';\n\nimport type { WalletAdapterResolver } from '@pollar/core';\nimport type { RenderWalletsSlot } from '@pollar/react';\nimport { stellarWalletsKit, type StellarWalletsKitAdapterOptions } from '../factory';\nimport { KitWalletPicker } from './KitWalletPicker';\n\nexport interface StellarWalletsKitBundle {\n /** Pass to `PollarClientConfig.walletAdapter`. */\n walletAdapter: WalletAdapterResolver;\n /** Pass to `<PollarProvider ui={{ renderWallets }}>`. */\n renderWallets: RenderWalletsSlot;\n}\n\n/**\n * One-shot helper that builds both halves of the integration from a single\n * options object: the `walletAdapter` (a `WalletAdapterResolver` for the SDK)\n * and `renderWallets` (a slot for `<PollarProvider ui={{ ... }}>`). The same\n * `network` / `modules` / `picker` opts power both, so the picker shows the\n * exact wallets that signing will actually work with.\n *\n * @example\n * ```tsx\n * import { createStellarWalletsKitBundle } from '@pollar/stellar-wallets-kit-adapter/picker';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const bundle = createStellarWalletsKitBundle({\n * network: Networks.PUBLIC,\n * picker: { wallets: ['xbull', 'lobstr', 'freighter'] },\n * });\n *\n * <PollarProvider\n * client={{ apiKey: '…', walletAdapter: bundle.walletAdapter }}\n * ui={{ renderWallets: bundle.renderWallets }}\n * />\n * ```\n */\nexport function createStellarWalletsKitBundle(options: StellarWalletsKitAdapterOptions): StellarWalletsKitBundle {\n const walletAdapter = stellarWalletsKit(options);\n const renderWallets: RenderWalletsSlot = (slot) => (\n <KitWalletPicker\n onConnect={slot.onConnect}\n authState={slot.authState}\n network={options.network}\n {...(options.modules !== undefined && { modules: options.modules })}\n {...(options.picker !== undefined && { picker: options.picker })}\n />\n );\n return { walletAdapter, renderWallets };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/StellarWalletsKitAdapter.ts","../src/factory.ts","../src/picker/KitWalletPicker.tsx","../src/picker/bundle.tsx"],"names":["StellarWalletsKit","AlbedoModule","BitgetModule","CactusLinkModule","FordefiModule","FreighterModule","HanaModule","HotWalletModule","KleverModule","LobstrModule","OneKeyModule","RabetModule","xBullModule","createLogger","useState","useRef","useEffect","useMemo","jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBO,IAAM,2BAAN,MAAwD;AAAA,EAM7D,WAAA,CAAY,UAAoB,IAAA,EAAyB;AAHzD,IAAA,IAAA,CAAS,OAAA,GAAU,UAAA;AACnB,IAAA,IAAA,CAAQ,QAAA,GAA0B,IAAA;AAGhC,IAAA,IA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A;AAAA,MAChB,SAAS,OAAA,CAAQ,OAAA;AAAA,MAChB,GAAI,OAAA,CAAQ,OAAA,KAAY,UAAa,EAAE,OAAA,EAAS,QAAQ,OAAA,EAAQ;AAAA,MAChE,GAAI,OAAA,CAAQ,MAAA,KAAW,UAAa,EAAE,MAAA,EAAQ,QAAQ,MAAA;AAAO;AAAA,GAChE;AAEF,EAAA,OAAO,EAAE,gBAAgB,aAAA,EAAc;AACzC","file":"picker.js","sourcesContent":["import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletAdapterMeta,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork, getKitLogger } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n readonly meta: WalletAdapterMeta;\n readonly custody = 'external' as const;\n private _address: string | null = null;\n\n constructor(walletId: WalletId, meta: WalletAdapterMeta) {\n this.type = walletId;\n this.meta = meta;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n","import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport { createLogger, type LogLevel, type PollarLogger, type WalletAdapter } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n /**\n * Minimum log severity. `silent` disables logging; otherwise `error` < `warn`\n * < `info` < `debug`. Defaults to `'info'`. Since the kit is a global\n * singleton, this is set once at init.\n */\n logLevel?: LogLevel;\n /** Sink for logs. Defaults to the global `console`. */\n logger?: PollarLogger;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\nlet _log: PollarLogger = console;\n\n/** The kit's configured logger (set at init). Used by the adapter + picker. */\nexport function getKitLogger(): PollarLogger {\n return _log;\n}\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (options.logLevel !== undefined || options.logger !== undefined) {\n _log = createLogger(options.logLevel ?? 'info', options.logger);\n }\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n _log.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one\n * per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter\n * carries the module's name/icon as its button `meta`. `picker.wallets` (subset)\n * and `picker.labels` (overrides) are honored if provided.\n *\n * @example\n * ```ts\n * import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[] {\n ensureInit(options);\n const modules = options.modules ?? buildDefaultModules();\n const wanted = options.picker?.wallets;\n return modules\n .filter((m) => !wanted || wanted.includes(m.productId))\n .map(\n (m) =>\n new StellarWalletsKitAdapter(m.productId, {\n label: options.picker?.labels?.[m.productId] ?? m.productName,\n iconUrl: m.productIcon,\n }),\n );\n}\n","'use client';\n\nimport { type ISupportedWallet, type ModuleInterface, type Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type { RenderWalletsProps } from '@pollar/react';\nimport { type CSSProperties, useEffect, useMemo, useRef, useState } from 'react';\nimport { ensureInit, getKitLogger, type KitPickerOptions } from '../factory';\n\nexport interface KitWalletPickerProps extends RenderWalletsProps {\n network?: Networks;\n modules?: ModuleInterface[];\n picker?: KitPickerOptions;\n}\n\nconst CONNECTING_STEPS = new Set(['connecting_wallet', 'authenticating_wallet', 'authenticating']);\n\nexport function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }: KitWalletPickerProps) {\n const [wallets, setWallets] = useState<ISupportedWallet[] | null>(null);\n const warnedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n let cancelled = false;\n const initOpts: { network?: Networks; modules?: ModuleInterface[] } = {};\n if (network !== undefined) initOpts.network = network;\n if (modules !== undefined) initOpts.modules = modules;\n ensureInit(initOpts);\n StellarWalletsKit.refreshSupportedWallets()\n .then((list) => {\n if (cancelled) return;\n setWallets(list);\n })\n .catch((err) => {\n getKitLogger().error('[KitWalletPicker] refreshSupportedWallets failed', err);\n if (!cancelled) setWallets([]);\n });\n return () => {\n cancelled = true;\n };\n }, [network, modules]);\n\n const filtered = useMemo(() => {\n if (!wallets) return null;\n const { wallets: allowedIds, order = 'as-given', showInstalledOnly = false, labels } = picker;\n\n const byId = new Map(wallets.map((w) => [w.id, w]));\n let result: ISupportedWallet[];\n\n if (allowedIds && allowedIds.length > 0) {\n // Build the base list in `allowedIds` order; warn once per unknown id.\n // A later `order` setting may re-sort this list.\n result = [];\n for (const id of allowedIds) {\n const w = byId.get(id);\n if (w) {\n result.push(w);\n } else if (!warnedRef.current.has(id)) {\n warnedRef.current.add(id);\n getKitLogger().warn(`[KitWalletPicker] wallet id \"${id}\" not present in the active kit modules — skipped`);\n }\n }\n } else {\n result = [...wallets];\n }\n\n if (showInstalledOnly) {\n result = result.filter((w) => w.isAvailable);\n }\n\n if (order === 'alphabetical') {\n result = [...result].sort((a, b) => labelOf(a, labels).localeCompare(labelOf(b, labels)));\n } else if (order === 'installed-first') {\n result = [...result].sort((a, b) => {\n if (a.isAvailable === b.isAvailable) return 0;\n return a.isAvailable ? -1 : 1;\n });\n }\n // 'as-given' keeps whatever order we built above.\n\n return result;\n }, [wallets, picker]);\n\n const isBusy = CONNECTING_STEPS.has(authState.step);\n const layout = picker.layout ?? 'grid';\n const theme = picker.theme;\n const rootStyle: CSSProperties = {\n display: layout === 'list' ? 'flex' : 'grid',\n flexDirection: layout === 'list' ? 'column' : undefined,\n gridTemplateColumns: layout === 'grid' ? 'repeat(auto-fill, minmax(140px, 1fr))' : undefined,\n gap: '0.5rem',\n width: '100%',\n ...(theme?.accent !== undefined && { ['--pollar-accent' as never]: theme.accent }),\n ...(theme?.mode === 'dark' && { colorScheme: 'dark' as const }),\n };\n\n // Still loading the wallet list.\n if (filtered === null) {\n return (\n <div role=\"status\" aria-busy=\"true\" style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n Loading wallets…\n </div>\n );\n }\n\n // Empty state: showInstalledOnly hid every wallet, or the filter list is empty.\n if (filtered.length === 0) {\n return (\n <div style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n {picker.showInstalledOnly\n ? 'No supported Stellar wallets detected. Install Freighter / xBull / Lobstr to continue.'\n : 'No wallets to show.'}\n </div>\n );\n }\n\n return (\n <div style={rootStyle}>\n {filtered.map((w) => {\n const label = labelOf(w, picker.labels);\n const disabled = isBusy || (picker.showInstalledOnly ? false : !w.isAvailable);\n return (\n <button\n key={w.id}\n type=\"button\"\n disabled={disabled}\n onClick={() => onConnect(w.id)}\n style={buttonStyle(layout, disabled)}\n title={!w.isAvailable && !picker.showInstalledOnly ? `${label} not detected` : label}\n >\n <img src={w.icon} alt=\"\" width={32} height={32} style={{ borderRadius: 6, opacity: w.isAvailable ? 1 : 0.5 }} />\n <span style={{ fontSize: '0.85rem', fontWeight: 500 }}>{label}</span>\n {!w.isAvailable && <span style={{ fontSize: '0.7rem', opacity: 0.6 }}>not installed</span>}\n </button>\n );\n })}\n </div>\n );\n}\n\nfunction labelOf(w: ISupportedWallet, labels: Record<string, string> | undefined): string {\n return labels?.[w.id] ?? w.name;\n}\n\nfunction buttonStyle(layout: 'grid' | 'list', disabled: boolean): CSSProperties {\n const base: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.55 : 1,\n background: 'transparent',\n border: '1px solid var(--pollar-border, #e5e7eb)',\n borderRadius: 'var(--pollar-buttons-border-radius, 6px)',\n color: 'var(--pollar-text, inherit)',\n padding: '0.6rem',\n gap: '0.6rem',\n };\n if (layout === 'list') {\n return { ...base, justifyContent: 'flex-start', width: '100%', height: 'var(--pollar-buttons-height, 44px)' };\n }\n return { ...base, flexDirection: 'column', justifyContent: 'center', textAlign: 'center', minHeight: 92 };\n}\n","'use client';\n\nimport type { WalletAdapter } from '@pollar/core';\nimport type { RenderWalletsSlot } from '@pollar/react';\nimport { stellarWalletsKitAdapters, type StellarWalletsKitAdapterOptions } from '../factory';\nimport { KitWalletPicker } from './KitWalletPicker';\n\nexport interface StellarWalletsKitBundle {\n /** Pass to `PollarClientConfig.walletAdapters`. */\n walletAdapters: WalletAdapter[];\n /** Pass to `<PollarProvider ui={{ renderWallets }}>`. */\n renderWallets: RenderWalletsSlot;\n}\n\n/**\n * One-shot helper that builds both halves of the integration from a single\n * options object: the `walletAdapter` (a `WalletAdapterResolver` for the SDK)\n * and `renderWallets` (a slot for `<PollarProvider ui={{ ... }}>`). The same\n * `network` / `modules` / `picker` opts power both, so the picker shows the\n * exact wallets that signing will actually work with.\n *\n * @example\n * ```tsx\n * import { createStellarWalletsKitBundle } from '@pollar/stellar-wallets-kit-adapter/picker';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const bundle = createStellarWalletsKitBundle({\n * network: Networks.PUBLIC,\n * picker: { wallets: ['xbull', 'lobstr', 'freighter'] },\n * });\n *\n * <PollarProvider\n * client={{ apiKey: '…', walletAdapters: bundle.walletAdapters }}\n * ui={{ renderWallets: bundle.renderWallets }}\n * />\n * ```\n */\nexport function createStellarWalletsKitBundle(options: StellarWalletsKitAdapterOptions): StellarWalletsKitBundle {\n const walletAdapters = stellarWalletsKitAdapters(options);\n const renderWallets: RenderWalletsSlot = (slot) => (\n <KitWalletPicker\n onConnect={slot.onConnect}\n authState={slot.authState}\n network={options.network}\n {...(options.modules !== undefined && { modules: options.modules })}\n {...(options.picker !== undefined && { picker: options.picker })}\n />\n );\n return { walletAdapters, renderWallets };\n}\n"]}
|
package/dist/picker.mjs
CHANGED
|
@@ -12,13 +12,16 @@ import { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';
|
|
|
12
12
|
import { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';
|
|
13
13
|
import { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';
|
|
14
14
|
import { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';
|
|
15
|
+
import { createLogger } from '@pollar/core';
|
|
15
16
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
17
|
|
|
17
18
|
// src/picker/KitWalletPicker.tsx
|
|
18
19
|
var StellarWalletsKitAdapter = class {
|
|
19
|
-
constructor(walletId) {
|
|
20
|
+
constructor(walletId, meta) {
|
|
21
|
+
this.custody = "external";
|
|
20
22
|
this._address = null;
|
|
21
23
|
this.type = walletId;
|
|
24
|
+
this.meta = meta;
|
|
22
25
|
}
|
|
23
26
|
async isAvailable() {
|
|
24
27
|
try {
|
|
@@ -26,7 +29,7 @@ var StellarWalletsKitAdapter = class {
|
|
|
26
29
|
const wallet = supported.find((w) => w.id === String(this.type));
|
|
27
30
|
return wallet?.isAvailable ?? false;
|
|
28
31
|
} catch (err) {
|
|
29
|
-
|
|
32
|
+
getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for "${this.type}"`, err);
|
|
30
33
|
return false;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -80,6 +83,10 @@ var StellarWalletsKitAdapter = class {
|
|
|
80
83
|
// src/factory.ts
|
|
81
84
|
var initialised = false;
|
|
82
85
|
var initNetwork = null;
|
|
86
|
+
var _log = console;
|
|
87
|
+
function getKitLogger() {
|
|
88
|
+
return _log;
|
|
89
|
+
}
|
|
83
90
|
function buildDefaultModules() {
|
|
84
91
|
return [
|
|
85
92
|
new AlbedoModule(),
|
|
@@ -97,9 +104,12 @@ function buildDefaultModules() {
|
|
|
97
104
|
];
|
|
98
105
|
}
|
|
99
106
|
function ensureInit(options) {
|
|
107
|
+
if (options.logLevel !== void 0 || options.logger !== void 0) {
|
|
108
|
+
_log = createLogger(options.logLevel ?? "info", options.logger);
|
|
109
|
+
}
|
|
100
110
|
if (initialised) {
|
|
101
111
|
if (options.network && options.network !== initNetwork) {
|
|
102
|
-
|
|
112
|
+
_log.warn(
|
|
103
113
|
`[StellarWalletsKit] Already initialised with network "${initNetwork}". Ignoring attempted reconfiguration to "${options.network}". The kit is a global singleton \u2014 reload the page to change networks.`
|
|
104
114
|
);
|
|
105
115
|
}
|
|
@@ -123,11 +133,16 @@ function getInitNetwork() {
|
|
|
123
133
|
}
|
|
124
134
|
return initNetwork;
|
|
125
135
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
function stellarWalletsKitAdapters(options) {
|
|
137
|
+
ensureInit(options);
|
|
138
|
+
const modules = options.modules ?? buildDefaultModules();
|
|
139
|
+
const wanted = options.picker?.wallets;
|
|
140
|
+
return modules.filter((m) => !wanted || wanted.includes(m.productId)).map(
|
|
141
|
+
(m) => new StellarWalletsKitAdapter(m.productId, {
|
|
142
|
+
label: options.picker?.labels?.[m.productId] ?? m.productName,
|
|
143
|
+
iconUrl: m.productIcon
|
|
144
|
+
})
|
|
145
|
+
);
|
|
131
146
|
}
|
|
132
147
|
var CONNECTING_STEPS = /* @__PURE__ */ new Set(["connecting_wallet", "authenticating_wallet", "authenticating"]);
|
|
133
148
|
function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }) {
|
|
@@ -143,7 +158,7 @@ function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }
|
|
|
143
158
|
if (cancelled) return;
|
|
144
159
|
setWallets(list);
|
|
145
160
|
}).catch((err) => {
|
|
146
|
-
|
|
161
|
+
getKitLogger().error("[KitWalletPicker] refreshSupportedWallets failed", err);
|
|
147
162
|
if (!cancelled) setWallets([]);
|
|
148
163
|
});
|
|
149
164
|
return () => {
|
|
@@ -163,7 +178,7 @@ function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }
|
|
|
163
178
|
result.push(w);
|
|
164
179
|
} else if (!warnedRef.current.has(id)) {
|
|
165
180
|
warnedRef.current.add(id);
|
|
166
|
-
|
|
181
|
+
getKitLogger().warn(`[KitWalletPicker] wallet id "${id}" not present in the active kit modules \u2014 skipped`);
|
|
167
182
|
}
|
|
168
183
|
}
|
|
169
184
|
} else {
|
|
@@ -243,7 +258,7 @@ function buttonStyle(layout, disabled) {
|
|
|
243
258
|
return { ...base, flexDirection: "column", justifyContent: "center", textAlign: "center", minHeight: 92 };
|
|
244
259
|
}
|
|
245
260
|
function createStellarWalletsKitBundle(options) {
|
|
246
|
-
const
|
|
261
|
+
const walletAdapters = stellarWalletsKitAdapters(options);
|
|
247
262
|
const renderWallets = (slot) => /* @__PURE__ */ jsx(
|
|
248
263
|
KitWalletPicker,
|
|
249
264
|
{
|
|
@@ -254,7 +269,7 @@ function createStellarWalletsKitBundle(options) {
|
|
|
254
269
|
...options.picker !== void 0 && { picker: options.picker }
|
|
255
270
|
}
|
|
256
271
|
);
|
|
257
|
-
return {
|
|
272
|
+
return { walletAdapters, renderWallets };
|
|
258
273
|
}
|
|
259
274
|
|
|
260
275
|
export { KitWalletPicker, createStellarWalletsKitBundle };
|
package/dist/picker.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/StellarWalletsKitAdapter.ts","../src/factory.ts","../src/picker/KitWalletPicker.tsx","../src/picker/bundle.tsx"],"names":["StellarWalletsKit","jsx"],"mappings":";;;;;;;;;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AS,QAAA;AAAA,IACT,GAAA,EAAK;AAAA,GACP;AACA,EAAA,IAAI,WAAW,MAAA,EAAQ;AACrB,IAAA,OAAO,EAAE,GAAG,IAAA,EAAM,cAAA,EAAgB,cAAc,KAAA,EAAO,MAAA,EAAQ,QAAQ,oCAAA,EAAqC;AAAA,EAC9G;AACA,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,aAAA,EAAe,QAAA,EAAU,gBAAgB,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,EAAW,EAAA,EAAG;AAC1G;ACzHO,SAAS,8BAA8B,OAAA,EAAmE;AAC/G,EAAA,MAAM,aAAA,GAAgB,kBAAkB,OAAO,CAAA;AAC/C,EAAA,MAAM,aAAA,GAAmC,CAAC,IAAA,qBACxCC,GAAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,SAAS,OAAA,CAAQ,OAAA;AAAA,MAChB,GAAI,OAAA,CAAQ,OAAA,KAAY,UAAa,EAAE,OAAA,EAAS,QAAQ,OAAA,EAAQ;AAAA,MAChE,GAAI,OAAA,CAAQ,MAAA,KAAW,UAAa,EAAE,MAAA,EAAQ,QAAQ,MAAA;AAAO;AAAA,GAChE;AAEF,EAAA,OAAO,EAAE,eAAe,aAAA,EAAc;AACxC","file":"picker.mjs","sourcesContent":["import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n private _address: string | null = null;\n\n constructor(walletId: WalletId) {\n this.type = walletId;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n console.warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n","import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport type { WalletAdapterResolver, WalletId } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n console.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build a {@link WalletAdapterResolver} backed by Stellar Wallets Kit. Pass\n * the result to `PollarClientConfig.walletAdapter` so Pollar can use any of\n * the kit's modules without `@pollar/core` having to depend on the kit.\n *\n * @example\n * ```ts\n * import { stellarWalletsKit } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapter: stellarWalletsKit({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKit(options: StellarWalletsKitAdapterOptions): WalletAdapterResolver {\n return (id: WalletId) => {\n ensureInit(options);\n return new StellarWalletsKitAdapter(id);\n };\n}\n","'use client';\n\nimport { type ISupportedWallet, type ModuleInterface, type Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type { RenderWalletsProps } from '@pollar/react';\nimport { type CSSProperties, useEffect, useMemo, useRef, useState } from 'react';\nimport { ensureInit, type KitPickerOptions } from '../factory';\n\nexport interface KitWalletPickerProps extends RenderWalletsProps {\n network?: Networks;\n modules?: ModuleInterface[];\n picker?: KitPickerOptions;\n}\n\nconst CONNECTING_STEPS = new Set(['connecting_wallet', 'authenticating_wallet', 'authenticating']);\n\nexport function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }: KitWalletPickerProps) {\n const [wallets, setWallets] = useState<ISupportedWallet[] | null>(null);\n const warnedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n let cancelled = false;\n const initOpts: { network?: Networks; modules?: ModuleInterface[] } = {};\n if (network !== undefined) initOpts.network = network;\n if (modules !== undefined) initOpts.modules = modules;\n ensureInit(initOpts);\n StellarWalletsKit.refreshSupportedWallets()\n .then((list) => {\n if (cancelled) return;\n setWallets(list);\n })\n .catch((err) => {\n console.error('[KitWalletPicker] refreshSupportedWallets failed', err);\n if (!cancelled) setWallets([]);\n });\n return () => {\n cancelled = true;\n };\n }, [network, modules]);\n\n const filtered = useMemo(() => {\n if (!wallets) return null;\n const { wallets: allowedIds, order = 'as-given', showInstalledOnly = false, labels } = picker;\n\n const byId = new Map(wallets.map((w) => [w.id, w]));\n let result: ISupportedWallet[];\n\n if (allowedIds && allowedIds.length > 0) {\n // Build the base list in `allowedIds` order; warn once per unknown id.\n // A later `order` setting may re-sort this list.\n result = [];\n for (const id of allowedIds) {\n const w = byId.get(id);\n if (w) {\n result.push(w);\n } else if (!warnedRef.current.has(id)) {\n warnedRef.current.add(id);\n console.warn(`[KitWalletPicker] wallet id \"${id}\" not present in the active kit modules — skipped`);\n }\n }\n } else {\n result = [...wallets];\n }\n\n if (showInstalledOnly) {\n result = result.filter((w) => w.isAvailable);\n }\n\n if (order === 'alphabetical') {\n result = [...result].sort((a, b) => labelOf(a, labels).localeCompare(labelOf(b, labels)));\n } else if (order === 'installed-first') {\n result = [...result].sort((a, b) => {\n if (a.isAvailable === b.isAvailable) return 0;\n return a.isAvailable ? -1 : 1;\n });\n }\n // 'as-given' keeps whatever order we built above.\n\n return result;\n }, [wallets, picker]);\n\n const isBusy = CONNECTING_STEPS.has(authState.step);\n const layout = picker.layout ?? 'grid';\n const theme = picker.theme;\n const rootStyle: CSSProperties = {\n display: layout === 'list' ? 'flex' : 'grid',\n flexDirection: layout === 'list' ? 'column' : undefined,\n gridTemplateColumns: layout === 'grid' ? 'repeat(auto-fill, minmax(140px, 1fr))' : undefined,\n gap: '0.5rem',\n width: '100%',\n ...(theme?.accent !== undefined && { ['--pollar-accent' as never]: theme.accent }),\n ...(theme?.mode === 'dark' && { colorScheme: 'dark' as const }),\n };\n\n // Still loading the wallet list.\n if (filtered === null) {\n return (\n <div role=\"status\" aria-busy=\"true\" style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n Loading wallets…\n </div>\n );\n }\n\n // Empty state: showInstalledOnly hid every wallet, or the filter list is empty.\n if (filtered.length === 0) {\n return (\n <div style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n {picker.showInstalledOnly\n ? 'No supported Stellar wallets detected. Install Freighter / xBull / Lobstr to continue.'\n : 'No wallets to show.'}\n </div>\n );\n }\n\n return (\n <div style={rootStyle}>\n {filtered.map((w) => {\n const label = labelOf(w, picker.labels);\n const disabled = isBusy || (picker.showInstalledOnly ? false : !w.isAvailable);\n return (\n <button\n key={w.id}\n type=\"button\"\n disabled={disabled}\n onClick={() => onConnect(w.id)}\n style={buttonStyle(layout, disabled)}\n title={!w.isAvailable && !picker.showInstalledOnly ? `${label} not detected` : label}\n >\n <img src={w.icon} alt=\"\" width={32} height={32} style={{ borderRadius: 6, opacity: w.isAvailable ? 1 : 0.5 }} />\n <span style={{ fontSize: '0.85rem', fontWeight: 500 }}>{label}</span>\n {!w.isAvailable && <span style={{ fontSize: '0.7rem', opacity: 0.6 }}>not installed</span>}\n </button>\n );\n })}\n </div>\n );\n}\n\nfunction labelOf(w: ISupportedWallet, labels: Record<string, string> | undefined): string {\n return labels?.[w.id] ?? w.name;\n}\n\nfunction buttonStyle(layout: 'grid' | 'list', disabled: boolean): CSSProperties {\n const base: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.55 : 1,\n background: 'transparent',\n border: '1px solid var(--pollar-border, #e5e7eb)',\n borderRadius: 'var(--pollar-buttons-border-radius, 6px)',\n color: 'var(--pollar-text, inherit)',\n padding: '0.6rem',\n gap: '0.6rem',\n };\n if (layout === 'list') {\n return { ...base, justifyContent: 'flex-start', width: '100%', height: 'var(--pollar-buttons-height, 44px)' };\n }\n return { ...base, flexDirection: 'column', justifyContent: 'center', textAlign: 'center', minHeight: 92 };\n}\n","'use client';\n\nimport type { WalletAdapterResolver } from '@pollar/core';\nimport type { RenderWalletsSlot } from '@pollar/react';\nimport { stellarWalletsKit, type StellarWalletsKitAdapterOptions } from '../factory';\nimport { KitWalletPicker } from './KitWalletPicker';\n\nexport interface StellarWalletsKitBundle {\n /** Pass to `PollarClientConfig.walletAdapter`. */\n walletAdapter: WalletAdapterResolver;\n /** Pass to `<PollarProvider ui={{ renderWallets }}>`. */\n renderWallets: RenderWalletsSlot;\n}\n\n/**\n * One-shot helper that builds both halves of the integration from a single\n * options object: the `walletAdapter` (a `WalletAdapterResolver` for the SDK)\n * and `renderWallets` (a slot for `<PollarProvider ui={{ ... }}>`). The same\n * `network` / `modules` / `picker` opts power both, so the picker shows the\n * exact wallets that signing will actually work with.\n *\n * @example\n * ```tsx\n * import { createStellarWalletsKitBundle } from '@pollar/stellar-wallets-kit-adapter/picker';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const bundle = createStellarWalletsKitBundle({\n * network: Networks.PUBLIC,\n * picker: { wallets: ['xbull', 'lobstr', 'freighter'] },\n * });\n *\n * <PollarProvider\n * client={{ apiKey: '…', walletAdapter: bundle.walletAdapter }}\n * ui={{ renderWallets: bundle.renderWallets }}\n * />\n * ```\n */\nexport function createStellarWalletsKitBundle(options: StellarWalletsKitAdapterOptions): StellarWalletsKitBundle {\n const walletAdapter = stellarWalletsKit(options);\n const renderWallets: RenderWalletsSlot = (slot) => (\n <KitWalletPicker\n onConnect={slot.onConnect}\n authState={slot.authState}\n network={options.network}\n {...(options.modules !== undefined && { modules: options.modules })}\n {...(options.picker !== undefined && { picker: options.picker })}\n />\n );\n return { walletAdapter, renderWallets };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/StellarWalletsKitAdapter.ts","../src/factory.ts","../src/picker/KitWalletPicker.tsx","../src/picker/bundle.tsx"],"names":["StellarWalletsKit","jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAmBO,IAAM,2BAAN,MAAwD;AAAA,EAM7D,WAAA,CAAY,UAAoB,IAAA,EAAyB;AAHzD,IAAA,IAAA,CAAS,OAAA,GAAU,UAAA;AACnB,IAAA,IAAA,CAAQ,QAAA,GAA0B,IAAA;AAGhC,IAAA,IAAA,CAAK,IAAA,GAAO,QAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AAAA,EAEA,MAAM,WAAA,GAAgC;AAMpC,IAAA,IAAI;AACF,MAAA,MAAM,SAAA,GAAY,MAAM,iBAAA,CAAkB,uBAAA,EAAwB;AAClE,MAAA,MAAM,MAAA,GAAS,SAAA,CAAU,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,EAAA,KAAO,MAAA,CAAO,IAAA,CAAK,IAAI,CAAC,CAAA;AAC/D,MAAA,OAAO,QAAQ,WAAA,IAAe,KAAA;AAAA,IAChC,SAAS,GAAA,EAAK;AACZ,MAAA,YAAA,GAAe,IAAA,CAAK,CAAA,kDAAA,EAAqD,IAAA,CAAK,IAAI,KAAK,GAAG,CAAA;AAC1F,MAAA,OAAO,KAAA;AAAA,IACT;AAAA,EACF;AAAA,EAEA,MAAM,OAAA,GAA0C;AAC9C,IAAA,iBAAA,CAAkB,SAAA,CAAU,MAAA,CAAO,IAAA,CAAK,IAAI,CAAC,CAAA;AAC7C,IAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,MAAM,kBA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AM,cAAA,EAAgB,cAAc,KAAA,EAAO,MAAA,EAAQ,QAAQ,oCAAA,EAAqC;AAAA,EAC9G;AACA,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,aAAA,EAAe,QAAA,EAAU,gBAAgB,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,EAAW,EAAA,EAAG;AAC1G;ACzHO,SAAS,8BAA8B,OAAA,EAAmE;AAC/G,EAAA,MAAM,cAAA,GAAiB,0BAA0B,OAAO,CAAA;AACxD,EAAA,MAAM,aAAA,GAAmC,CAAC,IAAA,qBACxCC,GAAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,SAAS,OAAA,CAAQ,OAAA;AAAA,MAChB,GAAI,OAAA,CAAQ,OAAA,KAAY,UAAa,EAAE,OAAA,EAAS,QAAQ,OAAA,EAAQ;AAAA,MAChE,GAAI,OAAA,CAAQ,MAAA,KAAW,UAAa,EAAE,MAAA,EAAQ,QAAQ,MAAA;AAAO;AAAA,GAChE;AAEF,EAAA,OAAO,EAAE,gBAAgB,aAAA,EAAc;AACzC","file":"picker.mjs","sourcesContent":["import { StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type {\n ConnectWalletResponse,\n SignAuthEntryOptions,\n SignAuthEntryResponse,\n SignTransactionOptions,\n SignTransactionResponse,\n WalletAdapter,\n WalletAdapterMeta,\n WalletId,\n} from '@pollar/core';\nimport { getInitNetwork, getKitLogger } from './factory';\n\n/**\n * Wraps Stellar Wallets Kit so it satisfies the `@pollar/core` `WalletAdapter`\n * contract. The kit is a global singleton — `setWallet` is called before every\n * operation so the correct module handles the request, which lets a single\n * `StellarWalletsKit.init(...)` cover many wallet modules.\n */\nexport class StellarWalletsKitAdapter implements WalletAdapter {\n readonly type: WalletId;\n readonly meta: WalletAdapterMeta;\n readonly custody = 'external' as const;\n private _address: string | null = null;\n\n constructor(walletId: WalletId, meta: WalletAdapterMeta) {\n this.type = walletId;\n this.meta = meta;\n }\n\n async isAvailable(): Promise<boolean> {\n // `refreshSupportedWallets()` probes every module's own `isAvailable()`\n // hook (modules promise <1000ms per the kit contract) and returns a\n // static snapshot. This avoids the old false-positive where we always\n // claimed availability and let `connect()` fail later — the picker / UI\n // can now short-circuit on `wallet_not_installed` immediately.\n try {\n const supported = await StellarWalletsKit.refreshSupportedWallets();\n const wallet = supported.find((w) => w.id === String(this.type));\n return wallet?.isAvailable ?? false;\n } catch (err) {\n getKitLogger().warn(`[StellarWalletsKit] isAvailable probe failed for \"${this.type}\"`, err);\n return false;\n }\n }\n\n async connect(): Promise<ConnectWalletResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const { address } = await StellarWalletsKit.fetchAddress();\n if (!address) {\n throw new Error(`[StellarWalletsKit] Empty address returned for wallet \"${this.type}\"`);\n }\n this._address = address;\n return { address };\n }\n\n async disconnect(): Promise<void> {\n try {\n await StellarWalletsKit.disconnect();\n } finally {\n this._address = null;\n }\n }\n\n async getPublicKey(): Promise<string | null> {\n if (this._address) return this._address;\n try {\n const { address } = await StellarWalletsKit.getAddress();\n this._address = address ?? null;\n return this._address;\n } catch {\n return null;\n }\n }\n\n async signTransaction(xdr: string, options?: SignTransactionOptions): Promise<SignTransactionResponse> {\n if (options?.networkPassphrase !== undefined && options.networkPassphrase !== getInitNetwork()) {\n throw new Error(\n `[StellarWalletsKit] networkPassphrase override \"${options.networkPassphrase}\" does not match the network configured at init (\"${getInitNetwork()}\"). The kit is a global singleton — configure one network at \\`stellarWalletsKit({ network })\\` and use that for every call.`,\n );\n }\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signTransaction(xdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedTxXdr: result.signedTxXdr };\n }\n\n async signAuthEntry(entryXdr: string, options?: SignAuthEntryOptions): Promise<SignAuthEntryResponse> {\n StellarWalletsKit.setWallet(String(this.type));\n const result = await StellarWalletsKit.signAuthEntry(entryXdr, {\n ...(options?.accountToSign !== undefined && { address: options.accountToSign }),\n });\n return { signedAuthEntry: result.signedAuthEntry };\n }\n}\n","import { type ModuleInterface, Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport { AlbedoModule } from '@creit.tech/stellar-wallets-kit/modules/albedo';\nimport { BitgetModule } from '@creit.tech/stellar-wallets-kit/modules/bitget';\nimport { CactusLinkModule } from '@creit.tech/stellar-wallets-kit/modules/cactuslink';\nimport { FordefiModule } from '@creit.tech/stellar-wallets-kit/modules/fordefi';\nimport { FreighterModule } from '@creit.tech/stellar-wallets-kit/modules/freighter';\nimport { HanaModule } from '@creit.tech/stellar-wallets-kit/modules/hana';\nimport { HotWalletModule } from '@creit.tech/stellar-wallets-kit/modules/hotwallet';\nimport { KleverModule } from '@creit.tech/stellar-wallets-kit/modules/klever';\nimport { LobstrModule } from '@creit.tech/stellar-wallets-kit/modules/lobstr';\nimport { OneKeyModule } from '@creit.tech/stellar-wallets-kit/modules/onekey';\nimport { RabetModule } from '@creit.tech/stellar-wallets-kit/modules/rabet';\nimport { xBullModule } from '@creit.tech/stellar-wallets-kit/modules/xbull';\nimport { createLogger, type LogLevel, type PollarLogger, type WalletAdapter } from '@pollar/core';\nimport { StellarWalletsKitAdapter } from './StellarWalletsKitAdapter';\n\n/**\n * Options that shape `<KitWalletPicker>` (from the `/picker` subpath). Kept on\n * `StellarWalletsKitAdapterOptions` so `createStellarWalletsKitBundle()` can\n * receive everything (network + modules + UI) in one call.\n */\nexport interface KitPickerOptions {\n /** Subset of wallet ids to show. Defaults to every wallet the kit reports. */\n wallets?: string[];\n /** Render order. Default `'as-given'` (the kit's own order). */\n order?: 'as-given' | 'installed-first' | 'alphabetical';\n /** Hide wallets whose `isAvailable` is false. Default `false`. */\n showInstalledOnly?: boolean;\n /** Per-wallet label overrides. Key = wallet id. */\n labels?: Record<string, string>;\n /** Visual layout. Default `'grid'`. */\n layout?: 'grid' | 'list';\n /** Theme passthrough — applied as CSS custom properties on the picker root. */\n theme?: { accent?: string; mode?: 'light' | 'dark' };\n}\n\nexport interface StellarWalletsKitAdapterOptions {\n /**\n * Stellar network the kit will use for signing. Required — there is no\n * default. The kit is a global singleton, so picking the network silently\n * for a consumer would risk signing real-looking transactions on the wrong\n * chain (testnet xdr signed on mainnet, etc.). Pass `Networks.TESTNET` or\n * `Networks.PUBLIC` explicitly.\n */\n network: Networks;\n /**\n * Wallet modules the kit should drive. Defaults to every module that works\n * out of the box (Albedo, Bitget, CactusLink, Fordefi, Freighter, Hana,\n * HotWallet, Klever, Lobstr, OneKey, Rabet, xBull). Pass an explicit list\n * to add Ledger / Trezor / WalletConnect — those need extra setup (a\n * Buffer polyfill for Ledger; constructor params for the other two) so we\n * don't auto-include them.\n *\n * Import modules from their kit subpaths so the bundle stays lean:\n * ```ts\n * import { WalletConnectModule } from '@creit.tech/stellar-wallets-kit/modules/wallet-connect';\n * ```\n */\n modules?: ModuleInterface[];\n /**\n * Picker-specific options. Only consumed by `<KitWalletPicker>` /\n * `createStellarWalletsKitBundle` (the `/picker` subpath). The resolver\n * itself ignores them.\n */\n picker?: KitPickerOptions;\n /**\n * Minimum log severity. `silent` disables logging; otherwise `error` < `warn`\n * < `info` < `debug`. Defaults to `'info'`. Since the kit is a global\n * singleton, this is set once at init.\n */\n logLevel?: LogLevel;\n /** Sink for logs. Defaults to the global `console`. */\n logger?: PollarLogger;\n}\n\nlet initialised = false;\nlet initNetwork: Networks | null = null;\nlet _log: PollarLogger = console;\n\n/** The kit's configured logger (set at init). Used by the adapter + picker. */\nexport function getKitLogger(): PollarLogger {\n return _log;\n}\n\n/** @internal — used by the `/picker` subpath. */\nexport function buildDefaultModules(): ModuleInterface[] {\n return [\n new AlbedoModule(),\n new BitgetModule(),\n new CactusLinkModule(),\n new FordefiModule(),\n new FreighterModule(),\n new HanaModule(),\n new HotWalletModule(),\n new KleverModule(),\n new LobstrModule(),\n new OneKeyModule(),\n new RabetModule(),\n new xBullModule(),\n ];\n}\n\n/**\n * @internal — used by the `/picker` subpath.\n *\n * Accepts `Partial<...>` because the picker may be mounted in a flow where\n * `stellarWalletsKit({ network })` has already initialised the kit elsewhere;\n * in that case the call no-ops and the missing `network` is fine. On the\n * first-time init path `network` is required and we throw if it's absent.\n */\nexport function ensureInit(options: Partial<StellarWalletsKitAdapterOptions>): void {\n if (options.logLevel !== undefined || options.logger !== undefined) {\n _log = createLogger(options.logLevel ?? 'info', options.logger);\n }\n if (initialised) {\n // The kit is a global singleton — a second call with a different network\n // would be silently ignored. Warn so the developer notices the\n // misconfiguration instead of debugging wrong-chain signatures later.\n if (options.network && options.network !== initNetwork) {\n _log.warn(\n `[StellarWalletsKit] Already initialised with network \"${initNetwork}\". Ignoring attempted reconfiguration to \"${options.network}\". The kit is a global singleton — reload the page to change networks.`,\n );\n }\n return;\n }\n if (!options.network) {\n throw new Error(\n '[StellarWalletsKit] `network` is required — pass `Networks.TESTNET` or `Networks.PUBLIC` to `stellarWalletsKit({ network })`. The kit is a global singleton, so the network has to be chosen explicitly at init.',\n );\n }\n StellarWalletsKit.init({\n network: options.network,\n modules: options.modules ?? buildDefaultModules(),\n });\n initNetwork = options.network;\n initialised = true;\n}\n\n/** @internal — used by `StellarWalletsKitAdapter` to reject per-call network overrides that don't match init. */\nexport function getInitNetwork(): Networks {\n if (initNetwork === null) {\n throw new Error('[StellarWalletsKit] not initialised — call `stellarWalletsKit({ network })` first');\n }\n return initNetwork;\n}\n\n/**\n * Build the list of {@link WalletAdapter}s backed by Stellar Wallets Kit — one\n * per kit module — to pass to `PollarClientConfig.walletAdapters`. Each adapter\n * carries the module's name/icon as its button `meta`. `picker.wallets` (subset)\n * and `picker.labels` (overrides) are honored if provided.\n *\n * @example\n * ```ts\n * import { stellarWalletsKitAdapters } from '@pollar/stellar-wallets-kit-adapter';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const client = new PollarClient({\n * apiKey: '…',\n * walletAdapters: stellarWalletsKitAdapters({ network: Networks.PUBLIC }),\n * });\n * ```\n */\nexport function stellarWalletsKitAdapters(options: StellarWalletsKitAdapterOptions): WalletAdapter[] {\n ensureInit(options);\n const modules = options.modules ?? buildDefaultModules();\n const wanted = options.picker?.wallets;\n return modules\n .filter((m) => !wanted || wanted.includes(m.productId))\n .map(\n (m) =>\n new StellarWalletsKitAdapter(m.productId, {\n label: options.picker?.labels?.[m.productId] ?? m.productName,\n iconUrl: m.productIcon,\n }),\n );\n}\n","'use client';\n\nimport { type ISupportedWallet, type ModuleInterface, type Networks, StellarWalletsKit } from '@creit.tech/stellar-wallets-kit';\nimport type { RenderWalletsProps } from '@pollar/react';\nimport { type CSSProperties, useEffect, useMemo, useRef, useState } from 'react';\nimport { ensureInit, getKitLogger, type KitPickerOptions } from '../factory';\n\nexport interface KitWalletPickerProps extends RenderWalletsProps {\n network?: Networks;\n modules?: ModuleInterface[];\n picker?: KitPickerOptions;\n}\n\nconst CONNECTING_STEPS = new Set(['connecting_wallet', 'authenticating_wallet', 'authenticating']);\n\nexport function KitWalletPicker({ onConnect, authState, network, modules, picker = {} }: KitWalletPickerProps) {\n const [wallets, setWallets] = useState<ISupportedWallet[] | null>(null);\n const warnedRef = useRef<Set<string>>(new Set());\n\n useEffect(() => {\n let cancelled = false;\n const initOpts: { network?: Networks; modules?: ModuleInterface[] } = {};\n if (network !== undefined) initOpts.network = network;\n if (modules !== undefined) initOpts.modules = modules;\n ensureInit(initOpts);\n StellarWalletsKit.refreshSupportedWallets()\n .then((list) => {\n if (cancelled) return;\n setWallets(list);\n })\n .catch((err) => {\n getKitLogger().error('[KitWalletPicker] refreshSupportedWallets failed', err);\n if (!cancelled) setWallets([]);\n });\n return () => {\n cancelled = true;\n };\n }, [network, modules]);\n\n const filtered = useMemo(() => {\n if (!wallets) return null;\n const { wallets: allowedIds, order = 'as-given', showInstalledOnly = false, labels } = picker;\n\n const byId = new Map(wallets.map((w) => [w.id, w]));\n let result: ISupportedWallet[];\n\n if (allowedIds && allowedIds.length > 0) {\n // Build the base list in `allowedIds` order; warn once per unknown id.\n // A later `order` setting may re-sort this list.\n result = [];\n for (const id of allowedIds) {\n const w = byId.get(id);\n if (w) {\n result.push(w);\n } else if (!warnedRef.current.has(id)) {\n warnedRef.current.add(id);\n getKitLogger().warn(`[KitWalletPicker] wallet id \"${id}\" not present in the active kit modules — skipped`);\n }\n }\n } else {\n result = [...wallets];\n }\n\n if (showInstalledOnly) {\n result = result.filter((w) => w.isAvailable);\n }\n\n if (order === 'alphabetical') {\n result = [...result].sort((a, b) => labelOf(a, labels).localeCompare(labelOf(b, labels)));\n } else if (order === 'installed-first') {\n result = [...result].sort((a, b) => {\n if (a.isAvailable === b.isAvailable) return 0;\n return a.isAvailable ? -1 : 1;\n });\n }\n // 'as-given' keeps whatever order we built above.\n\n return result;\n }, [wallets, picker]);\n\n const isBusy = CONNECTING_STEPS.has(authState.step);\n const layout = picker.layout ?? 'grid';\n const theme = picker.theme;\n const rootStyle: CSSProperties = {\n display: layout === 'list' ? 'flex' : 'grid',\n flexDirection: layout === 'list' ? 'column' : undefined,\n gridTemplateColumns: layout === 'grid' ? 'repeat(auto-fill, minmax(140px, 1fr))' : undefined,\n gap: '0.5rem',\n width: '100%',\n ...(theme?.accent !== undefined && { ['--pollar-accent' as never]: theme.accent }),\n ...(theme?.mode === 'dark' && { colorScheme: 'dark' as const }),\n };\n\n // Still loading the wallet list.\n if (filtered === null) {\n return (\n <div role=\"status\" aria-busy=\"true\" style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n Loading wallets…\n </div>\n );\n }\n\n // Empty state: showInstalledOnly hid every wallet, or the filter list is empty.\n if (filtered.length === 0) {\n return (\n <div style={{ padding: '1rem', textAlign: 'center', fontSize: '0.9rem' }}>\n {picker.showInstalledOnly\n ? 'No supported Stellar wallets detected. Install Freighter / xBull / Lobstr to continue.'\n : 'No wallets to show.'}\n </div>\n );\n }\n\n return (\n <div style={rootStyle}>\n {filtered.map((w) => {\n const label = labelOf(w, picker.labels);\n const disabled = isBusy || (picker.showInstalledOnly ? false : !w.isAvailable);\n return (\n <button\n key={w.id}\n type=\"button\"\n disabled={disabled}\n onClick={() => onConnect(w.id)}\n style={buttonStyle(layout, disabled)}\n title={!w.isAvailable && !picker.showInstalledOnly ? `${label} not detected` : label}\n >\n <img src={w.icon} alt=\"\" width={32} height={32} style={{ borderRadius: 6, opacity: w.isAvailable ? 1 : 0.5 }} />\n <span style={{ fontSize: '0.85rem', fontWeight: 500 }}>{label}</span>\n {!w.isAvailable && <span style={{ fontSize: '0.7rem', opacity: 0.6 }}>not installed</span>}\n </button>\n );\n })}\n </div>\n );\n}\n\nfunction labelOf(w: ISupportedWallet, labels: Record<string, string> | undefined): string {\n return labels?.[w.id] ?? w.name;\n}\n\nfunction buttonStyle(layout: 'grid' | 'list', disabled: boolean): CSSProperties {\n const base: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.55 : 1,\n background: 'transparent',\n border: '1px solid var(--pollar-border, #e5e7eb)',\n borderRadius: 'var(--pollar-buttons-border-radius, 6px)',\n color: 'var(--pollar-text, inherit)',\n padding: '0.6rem',\n gap: '0.6rem',\n };\n if (layout === 'list') {\n return { ...base, justifyContent: 'flex-start', width: '100%', height: 'var(--pollar-buttons-height, 44px)' };\n }\n return { ...base, flexDirection: 'column', justifyContent: 'center', textAlign: 'center', minHeight: 92 };\n}\n","'use client';\n\nimport type { WalletAdapter } from '@pollar/core';\nimport type { RenderWalletsSlot } from '@pollar/react';\nimport { stellarWalletsKitAdapters, type StellarWalletsKitAdapterOptions } from '../factory';\nimport { KitWalletPicker } from './KitWalletPicker';\n\nexport interface StellarWalletsKitBundle {\n /** Pass to `PollarClientConfig.walletAdapters`. */\n walletAdapters: WalletAdapter[];\n /** Pass to `<PollarProvider ui={{ renderWallets }}>`. */\n renderWallets: RenderWalletsSlot;\n}\n\n/**\n * One-shot helper that builds both halves of the integration from a single\n * options object: the `walletAdapter` (a `WalletAdapterResolver` for the SDK)\n * and `renderWallets` (a slot for `<PollarProvider ui={{ ... }}>`). The same\n * `network` / `modules` / `picker` opts power both, so the picker shows the\n * exact wallets that signing will actually work with.\n *\n * @example\n * ```tsx\n * import { createStellarWalletsKitBundle } from '@pollar/stellar-wallets-kit-adapter/picker';\n * import { Networks } from '@creit.tech/stellar-wallets-kit';\n *\n * const bundle = createStellarWalletsKitBundle({\n * network: Networks.PUBLIC,\n * picker: { wallets: ['xbull', 'lobstr', 'freighter'] },\n * });\n *\n * <PollarProvider\n * client={{ apiKey: '…', walletAdapters: bundle.walletAdapters }}\n * ui={{ renderWallets: bundle.renderWallets }}\n * />\n * ```\n */\nexport function createStellarWalletsKitBundle(options: StellarWalletsKitAdapterOptions): StellarWalletsKitBundle {\n const walletAdapters = stellarWalletsKitAdapters(options);\n const renderWallets: RenderWalletsSlot = (slot) => (\n <KitWalletPicker\n onConnect={slot.onConnect}\n authState={slot.authState}\n network={options.network}\n {...(options.modules !== undefined && { modules: options.modules })}\n {...(options.picker !== undefined && { picker: options.picker })}\n />\n );\n return { walletAdapters, renderWallets };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pollar/stellar-wallets-kit-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-rc.8",
|
|
4
4
|
"description": "Stellar Wallets Kit adapter for @pollar/core — plug additional wallet modules (xBull, Lobstr, WalletConnect, hardware wallets…) into Pollar without bundling them into @pollar/core.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@creit.tech/stellar-wallets-kit": "^2.0.0",
|
|
45
|
-
"@pollar/core": "0.
|
|
46
|
-
"@pollar/react": "0.
|
|
45
|
+
"@pollar/core": "^0.10.0-rc.0",
|
|
46
|
+
"@pollar/react": "^0.10.0-rc.0",
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
49
49
|
},
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@pollar/core": "0.
|
|
62
|
+
"@pollar/core": "^0.10.0-rc.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@creit.tech/stellar-wallets-kit": "^2.
|
|
66
|
-
"@eslint/js": "^
|
|
65
|
+
"@creit.tech/stellar-wallets-kit": "^2.3.0",
|
|
66
|
+
"@eslint/js": "^10.0.1",
|
|
67
67
|
"@pollar/react": "*",
|
|
68
68
|
"@types/react": "^18.0.0",
|
|
69
|
-
"eslint": "^
|
|
69
|
+
"eslint": "^10.5.0",
|
|
70
70
|
"react": "^18.0.0",
|
|
71
|
-
"tsup": "^8.
|
|
72
|
-
"typescript": "^
|
|
73
|
-
"typescript-eslint": "^8.
|
|
71
|
+
"tsup": "^8.5.1",
|
|
72
|
+
"typescript": "^6.0.3",
|
|
73
|
+
"typescript-eslint": "^8.61.0"
|
|
74
74
|
}
|
|
75
75
|
}
|