@canton-network/dapp-sdk 0.23.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -10
- package/dist/adapter/extension-adapter.d.ts +12 -1
- package/dist/adapter/extension-adapter.d.ts.map +1 -1
- package/dist/adapter/index.d.ts +1 -0
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/injected-adapter.d.ts +26 -0
- package/dist/adapter/injected-adapter.d.ts.map +1 -0
- package/dist/adapter/remote-adapter.d.ts.map +1 -1
- package/dist/announce-discovery.d.ts +17 -0
- package/dist/announce-discovery.d.ts.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/dapp-api/rpc-gen/typings.d.ts +25 -6
- package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -1
- package/dist/index.cjs +259 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +260 -39
- package/dist/index.js.map +1 -1
- package/dist/injected-discovery.d.ts +9 -0
- package/dist/injected-discovery.d.ts.map +1 -0
- package/dist/sdk-controller.d.ts.map +1 -1
- package/dist/sdk.d.ts +12 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/package.json +9 -8
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { injectProvider, DappAsyncProvider
|
|
2
|
-
import { WalletEvent, DiscoverResult } from '@canton-network/core-types';
|
|
1
|
+
import { DappSyncProvider, injectProvider, DappAsyncProvider } from '@canton-network/core-provider-dapp';
|
|
2
|
+
import { CANTON_ANNOUNCE_PROVIDER_EVENT, CANTON_REQUEST_PROVIDER_EVENT, WalletEvent, DiscoverResult } from '@canton-network/core-types';
|
|
3
3
|
import { pickWallet, popup } from '@canton-network/core-wallet-ui-components';
|
|
4
4
|
import { DiscoveryClient } from '@canton-network/core-wallet-discovery';
|
|
5
5
|
export { DiscoveryClient, DiscoveryError, EventEmitter, NotConnectedError, SessionExpiredError, TimeoutError, UserRejectedError, WalletNotFoundError, WalletNotInstalledError } from '@canton-network/core-wallet-discovery';
|
|
6
|
+
import { WindowTransport } from '@canton-network/core-rpc-transport';
|
|
6
7
|
import * as coreWalletDappRpcClient from '@canton-network/core-wallet-dapp-rpc-client';
|
|
7
8
|
export { coreWalletDappRpcClient as dappAPI };
|
|
8
9
|
|
|
@@ -55,7 +56,6 @@ var removeKernelSession = () => {
|
|
|
55
56
|
var clearAllLocalState = ({
|
|
56
57
|
closePopup
|
|
57
58
|
} = {}) => {
|
|
58
|
-
window.canton = void 0;
|
|
59
59
|
removeKernelSession();
|
|
60
60
|
removeKernelDiscovery();
|
|
61
61
|
if (closePopup) {
|
|
@@ -131,7 +131,8 @@ var DappClient = class {
|
|
|
131
131
|
window.postMessage(
|
|
132
132
|
{
|
|
133
133
|
type: WalletEvent.SPLICE_WALLET_EXT_OPEN,
|
|
134
|
-
url: userUrl
|
|
134
|
+
url: userUrl,
|
|
135
|
+
target: this.options.target
|
|
135
136
|
},
|
|
136
137
|
"*"
|
|
137
138
|
);
|
|
@@ -151,18 +152,26 @@ var DappClient = class {
|
|
|
151
152
|
var BROWSER_PROVIDER_ID = "browser";
|
|
152
153
|
var EXTENSION_DETECT_TIMEOUT_MS = 2e3;
|
|
153
154
|
var ExtensionAdapter = class {
|
|
154
|
-
constructor() {
|
|
155
|
-
__publicField(this, "providerId"
|
|
156
|
-
__publicField(this, "name"
|
|
155
|
+
constructor(config = {}) {
|
|
156
|
+
__publicField(this, "providerId");
|
|
157
|
+
__publicField(this, "name");
|
|
157
158
|
__publicField(this, "type", "browser");
|
|
158
159
|
__publicField(this, "icon");
|
|
160
|
+
__publicField(this, "description");
|
|
161
|
+
__publicField(this, "target");
|
|
162
|
+
this.providerId = config.providerId ?? BROWSER_PROVIDER_ID;
|
|
163
|
+
this.name = config.name ?? "Browser Extension";
|
|
164
|
+
this.icon = config.icon;
|
|
165
|
+
this.description = config.description ?? "Connect via the Splice Wallet browser extension";
|
|
166
|
+
this.target = config.target;
|
|
159
167
|
}
|
|
160
168
|
getInfo() {
|
|
161
169
|
return {
|
|
162
170
|
providerId: this.providerId,
|
|
163
171
|
name: this.name,
|
|
164
172
|
type: this.type,
|
|
165
|
-
description:
|
|
173
|
+
description: this.description,
|
|
174
|
+
icon: this.icon
|
|
166
175
|
};
|
|
167
176
|
}
|
|
168
177
|
async detect() {
|
|
@@ -173,7 +182,7 @@ var ExtensionAdapter = class {
|
|
|
173
182
|
resolve(false);
|
|
174
183
|
}, EXTENSION_DETECT_TIMEOUT_MS);
|
|
175
184
|
const handler = (event) => {
|
|
176
|
-
if (event.data?.type === WalletEvent.SPLICE_WALLET_EXT_ACK) {
|
|
185
|
+
if (event.data?.type === WalletEvent.SPLICE_WALLET_EXT_ACK && (!this.target || event.data?.target === this.target)) {
|
|
177
186
|
clearTimeout(timeout);
|
|
178
187
|
window.removeEventListener("message", handler);
|
|
179
188
|
resolve(true);
|
|
@@ -181,24 +190,88 @@ var ExtensionAdapter = class {
|
|
|
181
190
|
};
|
|
182
191
|
window.addEventListener("message", handler);
|
|
183
192
|
window.postMessage(
|
|
184
|
-
{
|
|
193
|
+
{
|
|
194
|
+
type: WalletEvent.SPLICE_WALLET_EXT_READY,
|
|
195
|
+
target: this.target
|
|
196
|
+
},
|
|
185
197
|
"*"
|
|
186
198
|
);
|
|
187
199
|
});
|
|
188
200
|
}
|
|
189
201
|
provider() {
|
|
202
|
+
if (this.target) {
|
|
203
|
+
return new DappSyncProvider(
|
|
204
|
+
new WindowTransport(window, { target: this.target })
|
|
205
|
+
);
|
|
206
|
+
}
|
|
190
207
|
return new DappSyncProvider();
|
|
191
208
|
}
|
|
192
209
|
teardown() {
|
|
193
210
|
}
|
|
194
211
|
async restore() {
|
|
195
|
-
|
|
212
|
+
const kernel = getKernelDiscovery();
|
|
213
|
+
const kernelMatches = kernel?.walletType === "extension" && (kernel.providerId === void 0 || kernel.providerId === this.providerId);
|
|
214
|
+
const provider = this.provider();
|
|
215
|
+
if (kernelMatches) {
|
|
216
|
+
try {
|
|
217
|
+
await provider.request({ method: "connect" });
|
|
218
|
+
} catch {
|
|
219
|
+
}
|
|
220
|
+
}
|
|
196
221
|
try {
|
|
197
|
-
const provider = new DappSyncProvider();
|
|
198
222
|
const status2 = await provider.request({ method: "status" });
|
|
199
223
|
if (status2.connection.isConnected) {
|
|
200
224
|
return provider;
|
|
201
225
|
}
|
|
226
|
+
} catch {
|
|
227
|
+
if (kernelMatches) {
|
|
228
|
+
return provider;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/adapter/injected-adapter.ts
|
|
236
|
+
var InjectedAdapter = class {
|
|
237
|
+
constructor(config) {
|
|
238
|
+
__publicField(this, "providerId");
|
|
239
|
+
__publicField(this, "name");
|
|
240
|
+
__publicField(this, "type", "browser");
|
|
241
|
+
__publicField(this, "icon");
|
|
242
|
+
__publicField(this, "providerInstance");
|
|
243
|
+
__publicField(this, "description");
|
|
244
|
+
this.providerId = `browser:${config.id}`;
|
|
245
|
+
this.name = config.name;
|
|
246
|
+
this.icon = config.icon;
|
|
247
|
+
this.providerInstance = config.provider;
|
|
248
|
+
this.description = config.description;
|
|
249
|
+
}
|
|
250
|
+
getInfo() {
|
|
251
|
+
return {
|
|
252
|
+
providerId: this.providerId,
|
|
253
|
+
name: this.name,
|
|
254
|
+
type: this.type,
|
|
255
|
+
description: this.description ?? "Connect via an injected CIP-103 provider (window namespace)",
|
|
256
|
+
icon: this.icon
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
async detect() {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
provider() {
|
|
263
|
+
return this.providerInstance;
|
|
264
|
+
}
|
|
265
|
+
teardown() {
|
|
266
|
+
}
|
|
267
|
+
async restore() {
|
|
268
|
+
try {
|
|
269
|
+
const status2 = await this.providerInstance.request({
|
|
270
|
+
method: "status"
|
|
271
|
+
});
|
|
272
|
+
if (status2.connection.isConnected) {
|
|
273
|
+
return this.providerInstance;
|
|
274
|
+
}
|
|
202
275
|
} catch {
|
|
203
276
|
}
|
|
204
277
|
return null;
|
|
@@ -233,7 +306,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
233
306
|
ErrorCode2[ErrorCode2["Other"] = 4] = "Other";
|
|
234
307
|
return ErrorCode2;
|
|
235
308
|
})(ErrorCode || {});
|
|
236
|
-
var withTimeout = (reject, details, timeoutMs =
|
|
309
|
+
var withTimeout = (reject, details, timeoutMs = 5 * 60 * 1e3) => setTimeout(() => {
|
|
237
310
|
console.warn(`SDK: ${details}`);
|
|
238
311
|
reject({
|
|
239
312
|
status: "error",
|
|
@@ -337,17 +410,16 @@ var dappSDKController = (provider) => rpc_gen_default({
|
|
|
337
410
|
txChanged: async () => {
|
|
338
411
|
throw new Error("Only for events.");
|
|
339
412
|
},
|
|
340
|
-
getActiveNetwork:
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
signMessage:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
413
|
+
getActiveNetwork: async () => provider.request({
|
|
414
|
+
method: "getActiveNetwork"
|
|
415
|
+
}),
|
|
416
|
+
signMessage: async (params) => provider.request({
|
|
417
|
+
method: "signMessage",
|
|
418
|
+
params
|
|
419
|
+
}),
|
|
420
|
+
getPrimaryAccount: async () => provider.request({
|
|
421
|
+
method: "getPrimaryAccount"
|
|
422
|
+
})
|
|
351
423
|
});
|
|
352
424
|
|
|
353
425
|
// src/adapter/remote-adapter.ts
|
|
@@ -373,7 +445,8 @@ var RemoteAdapter = class {
|
|
|
373
445
|
type: this.type,
|
|
374
446
|
description: this.description,
|
|
375
447
|
icon: this.icon,
|
|
376
|
-
url: this.rpcUrl
|
|
448
|
+
url: this.rpcUrl,
|
|
449
|
+
reuseGlobalWalletPopup: true
|
|
377
450
|
};
|
|
378
451
|
}
|
|
379
452
|
async detect() {
|
|
@@ -462,6 +535,8 @@ var RemoteMappedProvider = class {
|
|
|
462
535
|
return controller.prepareExecuteAndWait(args.params);
|
|
463
536
|
case "getPrimaryAccount":
|
|
464
537
|
return controller.getPrimaryAccount();
|
|
538
|
+
case "getActiveNetwork":
|
|
539
|
+
return controller.getActiveNetwork();
|
|
465
540
|
default:
|
|
466
541
|
throw new Error("Unsupported method");
|
|
467
542
|
}
|
|
@@ -487,6 +562,75 @@ var gateways_default = [
|
|
|
487
562
|
}
|
|
488
563
|
];
|
|
489
564
|
|
|
565
|
+
// src/injected-discovery.ts
|
|
566
|
+
var DEFAULT_ROOTS = ["canton"];
|
|
567
|
+
var isProviderLike = (obj) => {
|
|
568
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
569
|
+
const p = obj;
|
|
570
|
+
return typeof p.request === "function" && typeof p.on === "function" && typeof p.emit === "function" && typeof p.removeListener === "function";
|
|
571
|
+
};
|
|
572
|
+
function discoverInjectedProviders(roots = DEFAULT_ROOTS) {
|
|
573
|
+
if (typeof window === "undefined") return [];
|
|
574
|
+
const discovered = [];
|
|
575
|
+
const seen = /* @__PURE__ */ new Set();
|
|
576
|
+
const win = window;
|
|
577
|
+
for (const root of roots) {
|
|
578
|
+
const candidate = win[root];
|
|
579
|
+
if (candidate === void 0 || candidate === null) continue;
|
|
580
|
+
if (isProviderLike(candidate) && !seen.has(candidate)) {
|
|
581
|
+
seen.add(candidate);
|
|
582
|
+
discovered.push({
|
|
583
|
+
id: root,
|
|
584
|
+
provider: candidate,
|
|
585
|
+
sourceRoot: root
|
|
586
|
+
});
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
if (typeof candidate === "object") {
|
|
590
|
+
for (const [key, value] of Object.entries(
|
|
591
|
+
candidate
|
|
592
|
+
)) {
|
|
593
|
+
if (isProviderLike(value) && !seen.has(value)) {
|
|
594
|
+
seen.add(value);
|
|
595
|
+
discovered.push({
|
|
596
|
+
id: `${root}.${key}`,
|
|
597
|
+
provider: value,
|
|
598
|
+
sourceRoot: root
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return discovered;
|
|
605
|
+
}
|
|
606
|
+
async function requestAnnouncedProviders(options) {
|
|
607
|
+
if (typeof window === "undefined") return [];
|
|
608
|
+
const timeoutMs = 300;
|
|
609
|
+
const discovered = /* @__PURE__ */ new Map();
|
|
610
|
+
const handler = (event) => {
|
|
611
|
+
const ce = event;
|
|
612
|
+
const detail = ce.detail;
|
|
613
|
+
if (!detail?.id || !detail.name) return;
|
|
614
|
+
if (discovered.has(detail.id)) return;
|
|
615
|
+
discovered.set(detail.id, {
|
|
616
|
+
id: detail.id,
|
|
617
|
+
name: detail.name,
|
|
618
|
+
icon: detail.icon,
|
|
619
|
+
target: detail.target
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
window.addEventListener(CANTON_ANNOUNCE_PROVIDER_EVENT, handler);
|
|
623
|
+
try {
|
|
624
|
+
window.dispatchEvent(
|
|
625
|
+
new CustomEvent(CANTON_REQUEST_PROVIDER_EVENT, { detail: {} })
|
|
626
|
+
);
|
|
627
|
+
await new Promise((resolve) => setTimeout(resolve, timeoutMs));
|
|
628
|
+
} finally {
|
|
629
|
+
window.removeEventListener(CANTON_ANNOUNCE_PROVIDER_EVENT, handler);
|
|
630
|
+
}
|
|
631
|
+
return Array.from(discovered.values());
|
|
632
|
+
}
|
|
633
|
+
|
|
490
634
|
// src/sdk.ts
|
|
491
635
|
var DappSDK = class {
|
|
492
636
|
constructor(options) {
|
|
@@ -512,6 +656,46 @@ var DappSDK = class {
|
|
|
512
656
|
}
|
|
513
657
|
}
|
|
514
658
|
}
|
|
659
|
+
async registerInjectedNamespaceAdapters(discovery) {
|
|
660
|
+
const existingIds = new Set(
|
|
661
|
+
discovery.listAdapters().map((a) => a.providerId)
|
|
662
|
+
);
|
|
663
|
+
const injected = discoverInjectedProviders();
|
|
664
|
+
for (const item of injected) {
|
|
665
|
+
const id = `browser:${item.id}`;
|
|
666
|
+
if (existingIds.has(id)) continue;
|
|
667
|
+
const key = `${item.id} (injected)`;
|
|
668
|
+
const adapter = new InjectedAdapter({
|
|
669
|
+
id: item.id,
|
|
670
|
+
name: key,
|
|
671
|
+
provider: item.provider,
|
|
672
|
+
description: `Injected provider from window.${item.id}`
|
|
673
|
+
});
|
|
674
|
+
discovery.registerAdapter(adapter);
|
|
675
|
+
existingIds.add(id);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
async registerAnnouncedAdapters(discovery) {
|
|
679
|
+
const existingIds = new Set(
|
|
680
|
+
discovery.listAdapters().map((a) => a.providerId)
|
|
681
|
+
);
|
|
682
|
+
const announced = await requestAnnouncedProviders();
|
|
683
|
+
for (const item of announced) {
|
|
684
|
+
const id = `browser:ext:${item.id}`;
|
|
685
|
+
if (existingIds.has(id)) continue;
|
|
686
|
+
const adapter = new ExtensionAdapter({
|
|
687
|
+
providerId: id,
|
|
688
|
+
name: item.name,
|
|
689
|
+
icon: item.icon,
|
|
690
|
+
description: "Connect via a browser extension wallet",
|
|
691
|
+
target: item.target ?? item.id
|
|
692
|
+
});
|
|
693
|
+
if (await adapter.detect()) {
|
|
694
|
+
discovery.registerAdapter(adapter);
|
|
695
|
+
existingIds.add(id);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
515
699
|
async ensureDiscovery(config) {
|
|
516
700
|
const defaultAdapters = config?.defaultAdapters ?? createDefaultAdapters(gateways_default);
|
|
517
701
|
if (this.discovery) {
|
|
@@ -520,6 +704,20 @@ var DappSDK = class {
|
|
|
520
704
|
this.discovery,
|
|
521
705
|
config?.additionalAdapters
|
|
522
706
|
);
|
|
707
|
+
await this.registerInjectedNamespaceAdapters(this.discovery);
|
|
708
|
+
await this.registerAnnouncedAdapters(this.discovery);
|
|
709
|
+
await this.discovery.restorePersistedSessionIfNeeded();
|
|
710
|
+
if (!this.client) {
|
|
711
|
+
const session2 = this.discovery.getActiveSession();
|
|
712
|
+
if (session2) {
|
|
713
|
+
const providerType = session2.adapter.getInfo().type;
|
|
714
|
+
const target = session2.adapter instanceof ExtensionAdapter ? session2.adapter.target : void 0;
|
|
715
|
+
this.client = new DappClient(session2.provider, {
|
|
716
|
+
providerType,
|
|
717
|
+
target
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
523
721
|
return this.discovery;
|
|
524
722
|
}
|
|
525
723
|
const initialAdapters = await this.collectDetectedAdapters([
|
|
@@ -530,10 +728,17 @@ var DappSDK = class {
|
|
|
530
728
|
walletPicker: this.walletPicker,
|
|
531
729
|
adapters: initialAdapters
|
|
532
730
|
});
|
|
731
|
+
await this.registerInjectedNamespaceAdapters(this.discovery);
|
|
732
|
+
await this.registerAnnouncedAdapters(this.discovery);
|
|
733
|
+
await this.discovery.restorePersistedSessionIfNeeded();
|
|
533
734
|
const session = this.discovery.getActiveSession();
|
|
534
735
|
if (session) {
|
|
535
736
|
const providerType = session.adapter.getInfo().type;
|
|
536
|
-
|
|
737
|
+
const target = session.adapter instanceof ExtensionAdapter ? session.adapter.target : void 0;
|
|
738
|
+
this.client = new DappClient(session.provider, {
|
|
739
|
+
providerType,
|
|
740
|
+
target
|
|
741
|
+
});
|
|
537
742
|
}
|
|
538
743
|
return this.discovery;
|
|
539
744
|
}
|
|
@@ -572,9 +777,22 @@ var DappSDK = class {
|
|
|
572
777
|
throw new Error("Not connected \u2014 call connect() first");
|
|
573
778
|
return this.client;
|
|
574
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* Returns the raw connected provider instance (if any).
|
|
782
|
+
*
|
|
783
|
+
* This is useful for advanced integrations that need to call methods that
|
|
784
|
+
* are not wrapped by the higher-level SDK helpers.
|
|
785
|
+
*/
|
|
786
|
+
getConnectedProvider() {
|
|
787
|
+
const session = this.discovery?.getActiveSession();
|
|
788
|
+
if (!session) return null;
|
|
789
|
+
return session.provider;
|
|
790
|
+
}
|
|
575
791
|
async connect(options) {
|
|
576
792
|
await this.ensureInit(options);
|
|
577
793
|
const discovery = this.discovery;
|
|
794
|
+
await this.registerInjectedNamespaceAdapters(discovery);
|
|
795
|
+
await this.registerAnnouncedAdapters(discovery);
|
|
578
796
|
await this.registerAdapters(discovery, options?.defaultAdapters);
|
|
579
797
|
await this.registerAdapters(discovery, options?.additionalAdapters);
|
|
580
798
|
clearAllLocalState();
|
|
@@ -586,7 +804,8 @@ var DappSDK = class {
|
|
|
586
804
|
type: info2.type,
|
|
587
805
|
description: info2.description,
|
|
588
806
|
icon: info2.icon,
|
|
589
|
-
url: info2.url
|
|
807
|
+
url: info2.url,
|
|
808
|
+
reuseGlobalWalletPopup: info2.reuseGlobalWalletPopup
|
|
590
809
|
};
|
|
591
810
|
});
|
|
592
811
|
const picked = await this.walletPicker(entries);
|
|
@@ -613,10 +832,14 @@ var DappSDK = class {
|
|
|
613
832
|
setKernelDiscovery({ walletType: "remote", url: info.url });
|
|
614
833
|
this.saveRecentGateway(info.name, info.url);
|
|
615
834
|
} else if (info.type === "browser") {
|
|
616
|
-
setKernelDiscovery({
|
|
835
|
+
setKernelDiscovery({
|
|
836
|
+
walletType: "extension",
|
|
837
|
+
providerId: info.providerId
|
|
838
|
+
});
|
|
617
839
|
}
|
|
618
840
|
this.client = new DappClient(session.provider, {
|
|
619
|
-
providerType: info.type
|
|
841
|
+
providerType: info.type,
|
|
842
|
+
target: session.adapter instanceof ExtensionAdapter ? session.adapter.target : void 0
|
|
620
843
|
});
|
|
621
844
|
const s = await this.client.status();
|
|
622
845
|
return s.connection;
|
|
@@ -690,6 +913,7 @@ var prepareExecute = (params) => sdk.prepareExecute(params);
|
|
|
690
913
|
var prepareExecuteAndWait = (params) => sdk.prepareExecuteAndWait(params);
|
|
691
914
|
var ledgerApi = (params) => sdk.ledgerApi(params);
|
|
692
915
|
var open = () => sdk.open();
|
|
916
|
+
var getConnectedProvider = () => sdk.getConnectedProvider();
|
|
693
917
|
var onStatusChanged = (listener) => sdk.onStatusChanged(listener);
|
|
694
918
|
var onAccountsChanged = (listener) => sdk.onAccountsChanged(listener);
|
|
695
919
|
var onTxChanged = (listener) => sdk.onTxChanged(listener);
|
|
@@ -697,17 +921,14 @@ var removeOnStatusChanged = (listener) => sdk.removeOnStatusChanged(listener);
|
|
|
697
921
|
var removeOnAccountsChanged = (listener) => sdk.removeOnAccountsChanged(listener);
|
|
698
922
|
var removeOnTxChanged = (listener) => sdk.removeOnTxChanged(listener);
|
|
699
923
|
function createDefaultAdapters(defaultGatewayConfigs) {
|
|
700
|
-
return
|
|
701
|
-
new
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
})
|
|
707
|
-
)
|
|
708
|
-
];
|
|
924
|
+
return defaultGatewayConfigs.map(
|
|
925
|
+
(config) => new RemoteAdapter({
|
|
926
|
+
...config,
|
|
927
|
+
icon: config.icon ?? CANTON_LOGO_PNG
|
|
928
|
+
})
|
|
929
|
+
);
|
|
709
930
|
}
|
|
710
931
|
|
|
711
|
-
export { CANTON_LOGO_PNG, DappClient, DappSDK, ErrorCode, ExtensionAdapter, RemoteAdapter, WALLET_GATEWAY_ICON, connect, sdk as dappSDK, disconnect, ledgerApi, listAccounts, onAccountsChanged, onStatusChanged, onTxChanged, open, prepareExecute, prepareExecuteAndWait, removeOnAccountsChanged, removeOnStatusChanged, removeOnTxChanged, status };
|
|
932
|
+
export { CANTON_LOGO_PNG, DappClient, DappSDK, ErrorCode, ExtensionAdapter, InjectedAdapter, RemoteAdapter, WALLET_GATEWAY_ICON, connect, sdk as dappSDK, disconnect, getConnectedProvider, ledgerApi, listAccounts, onAccountsChanged, onStatusChanged, onTxChanged, open, prepareExecute, prepareExecuteAndWait, removeOnAccountsChanged, removeOnStatusChanged, removeOnTxChanged, status };
|
|
712
933
|
//# sourceMappingURL=index.js.map
|
|
713
934
|
//# sourceMappingURL=index.js.map
|