@stakekit/widget 0.0.285 → 0.0.286
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.
|
@@ -30119,7 +30119,7 @@ var layer = /*#__PURE__*/ layerMergedContext(/*#__PURE__*/ succeed$4(/* @__PURE_
|
|
|
30119
30119
|
})));
|
|
30120
30120
|
//#endregion
|
|
30121
30121
|
//#region package.json
|
|
30122
|
-
var version$1 = "0.0.
|
|
30122
|
+
var version$1 = "0.0.286";
|
|
30123
30123
|
//#endregion
|
|
30124
30124
|
//#region src/generated/api/borrow-client.ts
|
|
30125
30125
|
var make$2 = (httpClient, options = {}) => {
|
|
@@ -57309,20 +57309,24 @@ var ExternalProvider = class {
|
|
|
57309
57309
|
this.variantProvider = variantProvider;
|
|
57310
57310
|
}
|
|
57311
57311
|
sendTransaction(tx, txMeta) {
|
|
57312
|
-
|
|
57313
|
-
|
|
57314
|
-
|
|
57315
|
-
|
|
57316
|
-
|
|
57317
|
-
|
|
57312
|
+
return suspend$1(() => {
|
|
57313
|
+
const sendTransaction = this.variantProvider.current.provider.sendTransaction;
|
|
57314
|
+
if (!sendTransaction) return fail$4(new ExternalProviderError({
|
|
57315
|
+
customMessage: null,
|
|
57316
|
+
message: "Invalid provider type"
|
|
57317
|
+
}));
|
|
57318
|
+
return sendExternalTransaction(() => sendTransaction(tx, txMeta));
|
|
57319
|
+
});
|
|
57318
57320
|
}
|
|
57319
57321
|
sendBorrowTransaction(tx, txMeta) {
|
|
57320
|
-
|
|
57321
|
-
|
|
57322
|
-
|
|
57323
|
-
|
|
57324
|
-
|
|
57325
|
-
|
|
57322
|
+
return suspend$1(() => {
|
|
57323
|
+
const config = this.variantProvider.current;
|
|
57324
|
+
if (!isBorrowExternalProvider(config)) return fail$4(new ExternalProviderError({
|
|
57325
|
+
customMessage: null,
|
|
57326
|
+
message: "Borrow transaction capability is unavailable"
|
|
57327
|
+
}));
|
|
57328
|
+
return sendExternalTransaction(() => config.provider.sendBorrowTransaction(tx, txMeta));
|
|
57329
|
+
});
|
|
57326
57330
|
}
|
|
57327
57331
|
switchChain({ chainId }) {
|
|
57328
57332
|
return tryPromise({
|
|
@@ -57341,14 +57345,16 @@ var ExternalProvider = class {
|
|
|
57341
57345
|
});
|
|
57342
57346
|
}
|
|
57343
57347
|
signTypedData(typedData) {
|
|
57344
|
-
|
|
57345
|
-
|
|
57346
|
-
|
|
57347
|
-
|
|
57348
|
-
|
|
57349
|
-
|
|
57350
|
-
|
|
57351
|
-
|
|
57348
|
+
return suspend$1(() => {
|
|
57349
|
+
const signTypedData = this.variantProvider.current.provider.signTypedData;
|
|
57350
|
+
if (!signTypedData) return fail$4(new ExternalProviderError({
|
|
57351
|
+
customMessage: null,
|
|
57352
|
+
message: "Typed-data signing capability is unavailable"
|
|
57353
|
+
}));
|
|
57354
|
+
return tryPromise({
|
|
57355
|
+
try: () => signTypedData(typedData),
|
|
57356
|
+
catch: toExternalProviderError
|
|
57357
|
+
});
|
|
57352
57358
|
});
|
|
57353
57359
|
}
|
|
57354
57360
|
};
|
|
@@ -57397,15 +57403,21 @@ var externalProviderConnector = (variant, runWalletEffect) => ({
|
|
|
57397
57403
|
iconUrl: config.appIcon
|
|
57398
57404
|
},
|
|
57399
57405
|
createConnector: () => createConnector((connectorConfig) => {
|
|
57400
|
-
const
|
|
57401
|
-
|
|
57406
|
+
const resolveSupportedChains = (supportedChainIds) => {
|
|
57407
|
+
const supported = supportedChainIds === void 0 ? null : new Set(supportedChainIds);
|
|
57408
|
+
const chains = supported ? connectorConfig.chains.filter((chain) => supported.has(chain.id)) : connectorConfig.chains;
|
|
57409
|
+
if (chains.length === 0) throw new WalletRuntimeInvariantError({ reason: "external-provider-no-supported-chains" });
|
|
57410
|
+
return chains;
|
|
57411
|
+
};
|
|
57412
|
+
const filteredChains = makeCurrentValueStream(resolveSupportedChains(variant.current.supportedChainIds));
|
|
57402
57413
|
const provider = new ExternalProvider(variant);
|
|
57403
57414
|
const getFirstFilteredChain = () => head(filteredChains.get()).pipe(getOrThrowWith(() => /* @__PURE__ */ new Error("No supported chains found!")));
|
|
57404
|
-
const getAccounts = async () => [variant.current.currentAddress];
|
|
57405
|
-
const getChainId = async () => getFirstFilteredChain().id;
|
|
57415
|
+
const getAccounts = async () => variant.current.currentAddress ? [variant.current.currentAddress] : [];
|
|
57416
|
+
const getChainId = async () => variant.current.currentChain ?? getFirstFilteredChain().id;
|
|
57406
57417
|
const connect = async (args) => {
|
|
57407
57418
|
connectorConfig.emitter.emit("message", { type: "connecting" });
|
|
57408
57419
|
const [accounts, chainId] = await Promise.all([getAccounts(), getChainId()]);
|
|
57420
|
+
if (accounts.length === 0) throw new Error("External provider has no connected account");
|
|
57409
57421
|
return wagmiConnectResult(args?.withCapabilities, accounts, chainId);
|
|
57410
57422
|
};
|
|
57411
57423
|
const switchChain = async ({ chainId }) => {
|
|
@@ -57417,7 +57429,7 @@ var externalProviderConnector = (variant, runWalletEffect) => ({
|
|
|
57417
57429
|
};
|
|
57418
57430
|
const disconnect = async () => {};
|
|
57419
57431
|
const getProvider = async () => ({});
|
|
57420
|
-
const isAuthorized = async () =>
|
|
57432
|
+
const isAuthorized = async () => Boolean(variant.current.currentAddress);
|
|
57421
57433
|
const onDisconnect = () => {
|
|
57422
57434
|
connectorConfig.emitter.emit("disconnect");
|
|
57423
57435
|
};
|
|
@@ -57425,11 +57437,16 @@ var externalProviderConnector = (variant, runWalletEffect) => ({
|
|
|
57425
57437
|
connectorConfig.emitter.emit("change", { chainId: normalizeChainId(chainId) });
|
|
57426
57438
|
};
|
|
57427
57439
|
const onAccountsChanged = (accounts) => {
|
|
57428
|
-
|
|
57440
|
+
const connectedAccounts = accounts.filter((account) => !!account);
|
|
57441
|
+
if (connectedAccounts.length === 0) {
|
|
57442
|
+
onDisconnect();
|
|
57443
|
+
return;
|
|
57444
|
+
}
|
|
57445
|
+
connectorConfig.emitter.emit("change", { accounts: connectedAccounts });
|
|
57429
57446
|
};
|
|
57430
57447
|
const onSupportedChainsChanged = ({ currentChainId, supportedChainIds }) => {
|
|
57431
|
-
filteredChains.set(
|
|
57432
|
-
if (filteredChains.get().every((c) => c.id !== currentChainId))
|
|
57448
|
+
filteredChains.set(resolveSupportedChains(supportedChainIds));
|
|
57449
|
+
if (variant.current.currentChain === void 0 && filteredChains.get().every((c) => c.id !== currentChainId)) onChainChanged(getFirstFilteredChain().id.toString());
|
|
57433
57450
|
};
|
|
57434
57451
|
return {
|
|
57435
57452
|
id: configMeta.id,
|
|
@@ -57802,15 +57819,22 @@ var buildWagmiConfig = (opts, buildActions, stellarWalletsKitPlatform) => gen(fu
|
|
|
57802
57819
|
const connectors = walletList.length > 0 ? connectorsForWallets(walletList, connectorOptions) : [];
|
|
57803
57820
|
const queryNetwork = val.queryParams.network;
|
|
57804
57821
|
const queryParamsInitChainId = queryNetwork ? (val.evmConfig.evmChainsMap[queryNetwork] ?? val.cosmosConfig.cosmosChainsMap[queryNetwork] ?? val.miscConfig.miscChainsMap[queryNetwork] ?? val.substrateConfig.substrateChainsMap[queryNetwork])?.wagmiChain.id : void 0;
|
|
57805
|
-
const wagmiConfig =
|
|
57806
|
-
|
|
57807
|
-
|
|
57808
|
-
chain
|
|
57809
|
-
|
|
57822
|
+
const wagmiConfig = yield* try_$1({
|
|
57823
|
+
try: () => createConfig({
|
|
57824
|
+
chains: wagmiChains,
|
|
57825
|
+
client: ({ chain }) => createClient({
|
|
57826
|
+
chain,
|
|
57827
|
+
transport: http()
|
|
57828
|
+
}),
|
|
57829
|
+
multiInjectedProviderDiscovery: false,
|
|
57830
|
+
storage: opts.externalProviders ? null : void 0,
|
|
57831
|
+
connectors
|
|
57810
57832
|
}),
|
|
57811
|
-
|
|
57812
|
-
|
|
57813
|
-
|
|
57833
|
+
catch: (cause) => new WalletIntegrationError({
|
|
57834
|
+
cause,
|
|
57835
|
+
message: "Could not create wallet configuration",
|
|
57836
|
+
operation: "create-config"
|
|
57837
|
+
})
|
|
57814
57838
|
});
|
|
57815
57839
|
if (multiInjectedProviderDiscovery && evmConfig.evmChains.length > 0) {
|
|
57816
57840
|
const mipdStore = createStore$2();
|
|
@@ -58369,18 +58393,22 @@ var installExternalProviderSynchronization = fn("installExternalProviderSynchron
|
|
|
58369
58393
|
if (connection.connector && !isExternalProviderConnector(connection.connector)) return yield* failInvariant("external-provider-connector-mismatch");
|
|
58370
58394
|
const snapshot = bootstrap.externalProviders.current;
|
|
58371
58395
|
const currentChainId = snapshot.currentChain ?? connection.chainId ?? bootstrap.controller.wagmiConfig.state.chainId;
|
|
58372
|
-
const supportedChainIds = snapshot.supportedChainIds
|
|
58396
|
+
const supportedChainIds = snapshot.supportedChainIds;
|
|
58373
58397
|
const currentMemory = yield* get$5(memory);
|
|
58374
|
-
const supportedChainsKey = `${connector.uid}:${currentChainId}:${supportedChainIds
|
|
58398
|
+
const supportedChainsKey = `${connector.uid}:${currentChainId}:${supportedChainIds?.join(",") ?? "all"}`;
|
|
58375
58399
|
if (currentMemory.supportedChainsNotification !== supportedChainsKey) {
|
|
58376
58400
|
yield* update(memory, (current) => ({
|
|
58377
58401
|
...current,
|
|
58378
58402
|
supportedChainsNotification: supportedChainsKey
|
|
58379
58403
|
}));
|
|
58380
|
-
yield*
|
|
58404
|
+
const notification = yield* try_$1(() => connector.onSupportedChainsChanged({
|
|
58381
58405
|
currentChainId,
|
|
58382
58406
|
supportedChainIds
|
|
58383
|
-
}));
|
|
58407
|
+
})).pipe(result$1);
|
|
58408
|
+
if (isFailure$1(notification)) {
|
|
58409
|
+
const cause = notification.failure.cause;
|
|
58410
|
+
return yield* failInvariant(cause instanceof WalletRuntimeInvariantError ? cause.reason : "external-provider-supported-chains-update-failed", { cause });
|
|
58411
|
+
}
|
|
58384
58412
|
}
|
|
58385
58413
|
if (connection.status === "disconnected" && snapshot.currentAddress && currentMemory.connecting === null) {
|
|
58386
58414
|
const address = snapshot.currentAddress;
|
|
@@ -58476,7 +58504,7 @@ var makeWalletLifecyclePolicy = gen(function* () {
|
|
|
58476
58504
|
}];
|
|
58477
58505
|
}
|
|
58478
58506
|
if (state.status === "connecting") return [null, current];
|
|
58479
|
-
if (state.status !== "unsupported" || !state.connector || !state.chain) return [null, initialMemory];
|
|
58507
|
+
if (state.status !== "unsupported" || !state.connector || !state.chain || isExternalProviderConnector(state.connector)) return [null, initialMemory];
|
|
58480
58508
|
const connectionKey = `${state.connector.uid}:${state.address}:${state.chain.id}`;
|
|
58481
58509
|
if (current.unsupportedConnection === connectionKey) return [null, {
|
|
58482
58510
|
...current,
|
|
@@ -58981,14 +59009,16 @@ var decodeProjectionFacts = ({ additionalAddresses, connection, connectorChains,
|
|
|
58981
59009
|
const rawAddress = forceAddress || connection.address || null;
|
|
58982
59010
|
const address = rawAddress ? decodeSync(WalletAddress$1)(rawAddress) : null;
|
|
58983
59011
|
const chain = connection.chain ?? null;
|
|
59012
|
+
const connector = connection.connector ?? null;
|
|
59013
|
+
const isChainExcluded = chain !== null && connector !== null && isExternalProviderConnector(connector) && !connectorChains.some((supportedChain) => supportedChain.id === chain.id);
|
|
58984
59014
|
return {
|
|
58985
59015
|
additionalAddresses,
|
|
58986
59016
|
address,
|
|
58987
59017
|
chain,
|
|
58988
59018
|
common,
|
|
58989
|
-
connector
|
|
59019
|
+
connector,
|
|
58990
59020
|
ledgerState,
|
|
58991
|
-
network: chain ? wagmiNetworkToSKNetwork({
|
|
59021
|
+
network: chain && !isChainExcluded ? wagmiNetworkToSKNetwork({
|
|
58992
59022
|
chain,
|
|
58993
59023
|
cosmosChainsMap: controller.cosmosConfig.cosmosChainsMap,
|
|
58994
59024
|
evmChainsMap: controller.evmConfig.evmChainsMap,
|
|
@@ -59030,11 +59060,22 @@ var connectingWalletState = (facts) => {
|
|
|
59030
59060
|
status: "connecting"
|
|
59031
59061
|
};
|
|
59032
59062
|
}
|
|
59033
|
-
if (previous?.address && previous.network && previous.chain && previous.connector && previous.ledgerAccounts)
|
|
59034
|
-
|
|
59035
|
-
|
|
59036
|
-
|
|
59037
|
-
|
|
59063
|
+
if (previous?.address && previous.network && previous.chain && previous.connector && previous.ledgerAccounts) {
|
|
59064
|
+
if (isExternalProviderConnector(previous.connector) && !common.connectorChains.some((supportedChain) => supportedChain.id === previous.chain.id)) return {
|
|
59065
|
+
...previous,
|
|
59066
|
+
...common,
|
|
59067
|
+
additionalAddresses: null,
|
|
59068
|
+
isLedgerLiveAccountPlaceholder: false,
|
|
59069
|
+
ledgerAccounts: null,
|
|
59070
|
+
network: null,
|
|
59071
|
+
status: "unsupported"
|
|
59072
|
+
};
|
|
59073
|
+
return {
|
|
59074
|
+
...previous,
|
|
59075
|
+
...common,
|
|
59076
|
+
status: "connecting"
|
|
59077
|
+
};
|
|
59078
|
+
}
|
|
59038
59079
|
return {
|
|
59039
59080
|
...disconnectedNormalizedWalletState,
|
|
59040
59081
|
...common,
|
|
@@ -59085,7 +59126,12 @@ var normalizeWalletState = (input) => {
|
|
|
59085
59126
|
};
|
|
59086
59127
|
var transitionalWalletState = (input) => {
|
|
59087
59128
|
if (input.connection.status === "disconnected") return normalizeWalletState(input);
|
|
59088
|
-
|
|
59129
|
+
const previous = input.previous;
|
|
59130
|
+
const connectorChains = previous?.connector && isExternalProviderConnector(previous.connector) && (!input.connection.connector || previous.connector.uid === input.connection.connector.uid) ? previous.connectorChains : input.connectorChains;
|
|
59131
|
+
return connectingWalletState(decodeProjectionFacts({
|
|
59132
|
+
...input,
|
|
59133
|
+
connectorChains
|
|
59134
|
+
}));
|
|
59089
59135
|
};
|
|
59090
59136
|
var makeConnectorChainsStream = ({ connector, defaultEvmChains }) => {
|
|
59091
59137
|
if (!connector || !isConnectorWithFilteredChains(connector)) return succeed$6(defaultEvmChains);
|
|
@@ -61160,6 +61206,7 @@ var WagmiConfigProvider = (t0) => {
|
|
|
61160
61206
|
const $ = (0, import_compiler_runtime.c)(5);
|
|
61161
61207
|
const { children } = t0;
|
|
61162
61208
|
const walletConfigResult = useWalletConfig();
|
|
61209
|
+
const walletStateResult = useAtomValue(currentWalletStateResultAtom);
|
|
61163
61210
|
let t1;
|
|
61164
61211
|
if ($[0] !== walletConfigResult) {
|
|
61165
61212
|
t1 = walletConfigResult.pipe(value$2, getOrUndefined$1);
|
|
@@ -61168,9 +61215,11 @@ var WagmiConfigProvider = (t0) => {
|
|
|
61168
61215
|
} else t1 = $[1];
|
|
61169
61216
|
const walletConfig = t1;
|
|
61170
61217
|
const walletConfigError = walletConfigResult.pipe(error, getOrUndefined$1);
|
|
61218
|
+
const walletStateError = walletStateResult.pipe(error, getOrUndefined$1);
|
|
61171
61219
|
const [fallbackConfig] = useState(makeDefaultConfig);
|
|
61172
61220
|
const geoBlock = useGeoBlock();
|
|
61173
61221
|
if (walletConfigError && !geoBlock) throw walletConfigError;
|
|
61222
|
+
if (walletStateError && !geoBlock) throw walletStateError;
|
|
61174
61223
|
const value = walletConfig ?? fallbackConfig;
|
|
61175
61224
|
let t2;
|
|
61176
61225
|
if ($[2] !== children || $[3] !== value) {
|