@worldcoin/minikit-js 2.0.0-dev.1 → 2.0.1
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/build/{chunk-2UPJKPQ6.js → chunk-6SCI6OTQ.js} +1 -1
- package/build/{chunk-LHHKY77D.js → chunk-IYL4VCWR.js} +7 -40
- package/build/{chunk-EHBM7OXH.js → chunk-MOORQBWF.js} +18 -4
- package/build/{chunk-TGXD24YD.js → chunk-QX4OA3EY.js} +1 -1
- package/build/{chunk-Z2UGRZJ2.js → chunk-XHYUUG6Y.js} +7 -3
- package/build/command-exports.cjs +6 -2
- package/build/command-exports.d.cts +4 -4
- package/build/command-exports.d.ts +4 -4
- package/build/command-exports.js +2 -2
- package/build/connector/index.cjs +23 -5
- package/build/connector/index.js +5 -5
- package/build/index.cjs +23 -5
- package/build/index.d.cts +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +4 -4
- package/build/minikit-provider.cjs +23 -5
- package/build/minikit-provider.js +4 -4
- package/build/siwe-exports.cjs +6 -38
- package/build/siwe-exports.d.cts +1 -1
- package/build/siwe-exports.d.ts +1 -1
- package/build/siwe-exports.js +1 -1
- package/build/{types-CC2x79HX.d.ts → types-BV7utGi5.d.ts} +1 -1
- package/build/{types-_jfLbcJW.d.cts → types-CBzfDT31.d.cts} +1 -1
- package/build/{types-CSyzFDPt.d.ts → types-UxYgWVfF.d.cts} +9 -1
- package/build/{types-CSyzFDPt.d.cts → types-UxYgWVfF.d.ts} +9 -1
- package/package.json +1 -1
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
createPublicClient,
|
|
4
4
|
getContract,
|
|
5
5
|
hashMessage,
|
|
6
|
-
http
|
|
7
|
-
recoverAddress
|
|
6
|
+
http
|
|
8
7
|
} from "viem";
|
|
9
8
|
import { worldchain } from "viem/chains";
|
|
10
9
|
var PREAMBLE = " wants you to sign in with your Ethereum account:";
|
|
@@ -16,7 +15,6 @@ var IAT_TAG = "Issued At: ";
|
|
|
16
15
|
var EXP_TAG = "Expiration Time: ";
|
|
17
16
|
var NBF_TAG = "Not Before: ";
|
|
18
17
|
var RID_TAG = "Request ID: ";
|
|
19
|
-
var ERC_191_PREFIX = "Ethereum Signed Message:\n";
|
|
20
18
|
var EIP1271_MAGICVALUE = "0x1626ba7e";
|
|
21
19
|
var SAFE_CONTRACT_ABI = [
|
|
22
20
|
{
|
|
@@ -160,14 +158,8 @@ var generateSiweMessage = (siweMessageData) => {
|
|
|
160
158
|
return siweMessage;
|
|
161
159
|
};
|
|
162
160
|
var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) => {
|
|
163
|
-
if (payload.version
|
|
164
|
-
|
|
165
|
-
payload,
|
|
166
|
-
nonce,
|
|
167
|
-
statement,
|
|
168
|
-
requestId,
|
|
169
|
-
userProvider
|
|
170
|
-
);
|
|
161
|
+
if (payload.version !== 2) {
|
|
162
|
+
throw new Error("Unsupported version returned");
|
|
171
163
|
} else {
|
|
172
164
|
return verifySiweMessageV2(
|
|
173
165
|
payload,
|
|
@@ -208,39 +200,14 @@ var validateMessage = (siweMessageData, nonce, statement, requestId) => {
|
|
|
208
200
|
}
|
|
209
201
|
return true;
|
|
210
202
|
};
|
|
211
|
-
var verifySiweMessageV1 = async (payload, nonce, statement, requestId, userProvider) => {
|
|
212
|
-
if (typeof window !== "undefined") {
|
|
213
|
-
throw new Error("Wallet auth payload can only be verified in the backend");
|
|
214
|
-
}
|
|
215
|
-
const { message, signature, address } = payload;
|
|
216
|
-
const siweMessageData = parseSiweMessage(message);
|
|
217
|
-
validateMessage(siweMessageData, nonce, statement, requestId);
|
|
218
|
-
let provider = userProvider || createPublicClient({ chain: worldchain, transport: http() });
|
|
219
|
-
const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
|
|
220
|
-
const hashedMessage = hashMessage(signedMessage);
|
|
221
|
-
const contract = getContract({
|
|
222
|
-
address,
|
|
223
|
-
abi: SAFE_CONTRACT_ABI,
|
|
224
|
-
client: provider
|
|
225
|
-
});
|
|
226
|
-
try {
|
|
227
|
-
const recoveredAddress = await recoverAddress({
|
|
228
|
-
hash: hashedMessage,
|
|
229
|
-
signature: `0x${signature}`
|
|
230
|
-
});
|
|
231
|
-
const isOwner = await contract.read.isOwner([recoveredAddress]);
|
|
232
|
-
if (!isOwner) {
|
|
233
|
-
throw new Error("Signature verification failed, invalid owner");
|
|
234
|
-
}
|
|
235
|
-
} catch (error) {
|
|
236
|
-
throw new Error("Signature verification failed");
|
|
237
|
-
}
|
|
238
|
-
return { isValid: true, siweMessageData };
|
|
239
|
-
};
|
|
240
203
|
var verifySiweMessageV2 = async (payload, nonce, statement, requestId, userProvider) => {
|
|
241
204
|
if (typeof window !== "undefined") {
|
|
242
205
|
throw new Error("Wallet auth payload can only be verified in the backend");
|
|
243
206
|
}
|
|
207
|
+
const NONCE_REGEX = /^[a-zA-Z0-9]+$/;
|
|
208
|
+
if (!NONCE_REGEX.test(nonce)) {
|
|
209
|
+
throw new Error("Invalid nonce: must be alphanumeric only (per ERC-4361)");
|
|
210
|
+
}
|
|
244
211
|
const { message, signature, address } = payload;
|
|
245
212
|
const siweMessageData = parseSiweMessage(message);
|
|
246
213
|
if (!validateMessage(siweMessageData, nonce, statement, requestId)) {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
signTypedData,
|
|
18
18
|
validateCommands,
|
|
19
19
|
walletAuth
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XHYUUG6Y.js";
|
|
21
21
|
|
|
22
22
|
// src/helpers/microphone.ts
|
|
23
23
|
var microphoneSetupDone = false;
|
|
@@ -132,9 +132,11 @@ var WORLD_APP_LAUNCH_LOCATION_MAP = {
|
|
|
132
132
|
world_chat: "chat" /* Chat */
|
|
133
133
|
};
|
|
134
134
|
function mapWorldAppLaunchLocation(location) {
|
|
135
|
-
if (!location
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
if (!location) return null;
|
|
136
|
+
const raw = typeof location === "object" && "open_origin" in location ? location.open_origin : typeof location === "string" ? location : null;
|
|
137
|
+
if (!raw) return null;
|
|
138
|
+
console.log("MiniKit launch location mapped:", raw);
|
|
139
|
+
return WORLD_APP_LAUNCH_LOCATION_MAP[raw.toLowerCase()] ?? null;
|
|
138
140
|
}
|
|
139
141
|
var _MiniKit = class _MiniKit {
|
|
140
142
|
static getActiveMiniKit() {
|
|
@@ -463,7 +465,19 @@ var _MiniKit = class _MiniKit {
|
|
|
463
465
|
// ============================================================================
|
|
464
466
|
static initFromWorldApp(worldApp) {
|
|
465
467
|
if (!worldApp) return;
|
|
468
|
+
this._user = {};
|
|
469
|
+
this._deviceProperties = {};
|
|
466
470
|
this._user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
471
|
+
this._user.preferredCurrency = worldApp.preferred_currency;
|
|
472
|
+
this._user.pendingNotifications = worldApp.pending_notifications;
|
|
473
|
+
this._user.walletAddress = worldApp.wallet_address;
|
|
474
|
+
if (worldApp.verification_status) {
|
|
475
|
+
this._user.verificationStatus = {
|
|
476
|
+
isOrbVerified: worldApp.verification_status.is_orb_verified,
|
|
477
|
+
isDocumentVerified: worldApp.verification_status.is_document_verified,
|
|
478
|
+
isSecureDocumentVerified: worldApp.verification_status.is_secure_document_verified
|
|
479
|
+
};
|
|
480
|
+
}
|
|
467
481
|
this._deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|
|
468
482
|
this._deviceProperties.deviceOS = worldApp.device_os;
|
|
469
483
|
this._deviceProperties.worldAppVersion = worldApp.world_app_version;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateSiweMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IYL4VCWR.js";
|
|
4
4
|
|
|
5
5
|
// src/commands/types.ts
|
|
6
6
|
var Command = /* @__PURE__ */ ((Command2) => {
|
|
@@ -1514,7 +1514,11 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1514
1514
|
});
|
|
1515
1515
|
const walletAuthPayload = { siweMessage };
|
|
1516
1516
|
const worldAppVersion = ctx.state.deviceProperties.worldAppVersion;
|
|
1517
|
-
|
|
1517
|
+
if (worldAppVersion && worldAppVersion <= 2087900) {
|
|
1518
|
+
throw new Error(
|
|
1519
|
+
"Wallet auth v1 is no longer supported. Please update World App to the latest version."
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1518
1522
|
const finalPayload = await new Promise(
|
|
1519
1523
|
(resolve, reject) => {
|
|
1520
1524
|
try {
|
|
@@ -1524,7 +1528,7 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1524
1528
|
});
|
|
1525
1529
|
sendMiniKitEvent({
|
|
1526
1530
|
command: "wallet-auth" /* WalletAuth */,
|
|
1527
|
-
version:
|
|
1531
|
+
version: COMMAND_VERSIONS["wallet-auth" /* WalletAuth */],
|
|
1528
1532
|
payload: walletAuthPayload
|
|
1529
1533
|
});
|
|
1530
1534
|
} catch (error) {
|
|
@@ -1643,7 +1643,11 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1643
1643
|
});
|
|
1644
1644
|
const walletAuthPayload = { siweMessage };
|
|
1645
1645
|
const worldAppVersion = ctx.state.deviceProperties.worldAppVersion;
|
|
1646
|
-
|
|
1646
|
+
if (worldAppVersion && worldAppVersion <= 2087900) {
|
|
1647
|
+
throw new Error(
|
|
1648
|
+
"Wallet auth v1 is no longer supported. Please update World App to the latest version."
|
|
1649
|
+
);
|
|
1650
|
+
}
|
|
1647
1651
|
const finalPayload = await new Promise(
|
|
1648
1652
|
(resolve, reject) => {
|
|
1649
1653
|
try {
|
|
@@ -1653,7 +1657,7 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1653
1657
|
});
|
|
1654
1658
|
sendMiniKitEvent({
|
|
1655
1659
|
command: "wallet-auth" /* WalletAuth */,
|
|
1656
|
-
version:
|
|
1660
|
+
version: COMMAND_VERSIONS["wallet-auth" /* WalletAuth */],
|
|
1657
1661
|
payload: walletAuthPayload
|
|
1658
1662
|
});
|
|
1659
1663
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as CommandContext, C as CommandResultByVia, W as WalletAuthResult, M as MiniKitWalletAuthOptions } from './types-
|
|
2
|
-
export { f as COMMAND_VERSIONS, e as Command, o as CommandResult, h as CommandState, r as CommandUnavailableError, n as CommandVia, D as DeviceProperties, F as FallbackConfig, p as FallbackReason, q as FallbackRequiredError, m as MiniAppBaseErrorPayload, l as MiniAppBaseSuccessPayload, a as MiniAppLaunchLocation, E as MiniAppLocation, z as MiniAppWalletAuthErrorPayload, A as MiniAppWalletAuthPayload, y as MiniAppWalletAuthSuccessPayload, G as MiniKitInstallErrorCodes, H as MiniKitInstallErrorMessage, b as MiniKitInstallReturnType, R as ResponseEvent, S as SiweMessage, U as User, c as UserNameService, B as WalletAuthError, w as WalletAuthErrorCodes, x as WalletAuthErrorMessage, t as WalletAuthInput, u as WalletAuthPayload, j as WebViewBasePayload, g as isCommandAvailable, i as isInWorldApp, k as sendMiniKitEvent, s as setCommandAvailable, v as validateCommands } from './types-
|
|
3
|
-
import { x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, P as PayResult, a as MiniKitPayOptions, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, S as SendTransactionResult, M as MiniKitSendTransactionOptions, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, T as Tokens } from './types-
|
|
4
|
-
export { F as AttestationError, B as AttestationErrorCodes, A as AttestationInput, ab as CalldataTransaction, J as ChatError, H as ChatErrorCodes, G as ChatInput, aO as Contact, ae as ContractFunctionArgs, ad as ContractFunctionName, aB as FeatureSupport, Q as GetPermissionsError, K as GetPermissionsErrorCodes, ac as LegacyTransaction, D as MiniAppAttestationErrorPayload, E as MiniAppAttestationPayload, I as MiniAppChatErrorPayload, O as MiniAppGetPermissionsErrorPayload, $ as MiniAppPaymentErrorPayload, a0 as MiniAppPaymentPayload, _ as MiniAppPaymentSuccessPayload, a4 as MiniAppRequestPermissionErrorPayload, a8 as MiniAppSendHapticFeedbackErrorPayload, at as MiniAppSendTransactionErrorPayload, aw as MiniAppSendTransactionPayload, aq as MiniAppSendTransactionSuccessPayload, ar as MiniAppSendTransactionV1ErrorPayload, au as MiniAppSendTransactionV1Payload, ao as MiniAppSendTransactionV1SuccessPayload, as as MiniAppSendTransactionV2ErrorPayload, av as MiniAppSendTransactionV2Payload, ap as MiniAppSendTransactionV2SuccessPayload, aQ as MiniAppShareContactsErrorPayload, aR as MiniAppShareContactsPayload, aP as MiniAppShareContactsSuccessPayload, aI as MiniAppShareErrorPayload, aV as MiniAppSignMessageErrorPayload, aW as MiniAppSignMessagePayload, a_ as MiniAppSignTypedDataErrorPayload, ax as MiniKitSendTransactionV1Options, ay as MiniKitSendTransactionV2Options, U as Network, W as PayCommandInput, X as PayCommandPayload, a1 as PayError, Y as PaymentErrorCodes, Z as PaymentErrorMessage, L as Permission, N as PermissionSettings, aa as Permit2, a5 as RequestPermissionError, a3 as RequestPermissionErrorCodes, a2 as RequestPermissionInput, a9 as SendHapticFeedbackError, a7 as SendHapticFeedbackErrorCodes, a6 as SendHapticFeedbackInput, aE as SendTransactionError, am as SendTransactionErrorCodes, an as SendTransactionErrorMessage, ak as SendTransactionInput, al as SendTransactionPayload, ag as SendTransactionV1Input, ah as SendTransactionV1Payload, az as SendTransactionV1Result, ai as SendTransactionV2Input, aj as SendTransactionV2Payload, aA as SendTransactionV2Result, aS as ShareContactsError, aM as ShareContactsErrorCodes, aN as ShareContactsErrorMessage, aK as ShareContactsInput, aL as ShareContactsPayload, aJ as ShareError, aH as ShareFilesErrorCodes, aF as ShareInput, aG as SharePayload, aX as SignMessageError, aU as SignMessageErrorCodes, aT as SignMessageInput, a$ as SignTypedDataError, aZ as SignTypedDataErrorCodes, aY as SignTypedDataInput, R as TokenDecimals, V as TokensPayload, af as Transaction, aD as WEB_FEATURES, aC as WORLD_APP_FEATURES } from './types-
|
|
1
|
+
import { d as CommandContext, C as CommandResultByVia, W as WalletAuthResult, M as MiniKitWalletAuthOptions } from './types-UxYgWVfF.cjs';
|
|
2
|
+
export { f as COMMAND_VERSIONS, e as Command, o as CommandResult, h as CommandState, r as CommandUnavailableError, n as CommandVia, D as DeviceProperties, F as FallbackConfig, p as FallbackReason, q as FallbackRequiredError, m as MiniAppBaseErrorPayload, l as MiniAppBaseSuccessPayload, a as MiniAppLaunchLocation, E as MiniAppLocation, z as MiniAppWalletAuthErrorPayload, A as MiniAppWalletAuthPayload, y as MiniAppWalletAuthSuccessPayload, G as MiniKitInstallErrorCodes, H as MiniKitInstallErrorMessage, b as MiniKitInstallReturnType, R as ResponseEvent, S as SiweMessage, U as User, c as UserNameService, V as VerificationStatus, B as WalletAuthError, w as WalletAuthErrorCodes, x as WalletAuthErrorMessage, t as WalletAuthInput, u as WalletAuthPayload, j as WebViewBasePayload, g as isCommandAvailable, i as isInWorldApp, k as sendMiniKitEvent, s as setCommandAvailable, v as validateCommands } from './types-UxYgWVfF.cjs';
|
|
3
|
+
import { x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, P as PayResult, a as MiniKitPayOptions, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, S as SendTransactionResult, M as MiniKitSendTransactionOptions, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, T as Tokens } from './types-CBzfDT31.cjs';
|
|
4
|
+
export { F as AttestationError, B as AttestationErrorCodes, A as AttestationInput, ab as CalldataTransaction, J as ChatError, H as ChatErrorCodes, G as ChatInput, aO as Contact, ae as ContractFunctionArgs, ad as ContractFunctionName, aB as FeatureSupport, Q as GetPermissionsError, K as GetPermissionsErrorCodes, ac as LegacyTransaction, D as MiniAppAttestationErrorPayload, E as MiniAppAttestationPayload, I as MiniAppChatErrorPayload, O as MiniAppGetPermissionsErrorPayload, $ as MiniAppPaymentErrorPayload, a0 as MiniAppPaymentPayload, _ as MiniAppPaymentSuccessPayload, a4 as MiniAppRequestPermissionErrorPayload, a8 as MiniAppSendHapticFeedbackErrorPayload, at as MiniAppSendTransactionErrorPayload, aw as MiniAppSendTransactionPayload, aq as MiniAppSendTransactionSuccessPayload, ar as MiniAppSendTransactionV1ErrorPayload, au as MiniAppSendTransactionV1Payload, ao as MiniAppSendTransactionV1SuccessPayload, as as MiniAppSendTransactionV2ErrorPayload, av as MiniAppSendTransactionV2Payload, ap as MiniAppSendTransactionV2SuccessPayload, aQ as MiniAppShareContactsErrorPayload, aR as MiniAppShareContactsPayload, aP as MiniAppShareContactsSuccessPayload, aI as MiniAppShareErrorPayload, aV as MiniAppSignMessageErrorPayload, aW as MiniAppSignMessagePayload, a_ as MiniAppSignTypedDataErrorPayload, ax as MiniKitSendTransactionV1Options, ay as MiniKitSendTransactionV2Options, U as Network, W as PayCommandInput, X as PayCommandPayload, a1 as PayError, Y as PaymentErrorCodes, Z as PaymentErrorMessage, L as Permission, N as PermissionSettings, aa as Permit2, a5 as RequestPermissionError, a3 as RequestPermissionErrorCodes, a2 as RequestPermissionInput, a9 as SendHapticFeedbackError, a7 as SendHapticFeedbackErrorCodes, a6 as SendHapticFeedbackInput, aE as SendTransactionError, am as SendTransactionErrorCodes, an as SendTransactionErrorMessage, ak as SendTransactionInput, al as SendTransactionPayload, ag as SendTransactionV1Input, ah as SendTransactionV1Payload, az as SendTransactionV1Result, ai as SendTransactionV2Input, aj as SendTransactionV2Payload, aA as SendTransactionV2Result, aS as ShareContactsError, aM as ShareContactsErrorCodes, aN as ShareContactsErrorMessage, aK as ShareContactsInput, aL as ShareContactsPayload, aJ as ShareError, aH as ShareFilesErrorCodes, aF as ShareInput, aG as SharePayload, aX as SignMessageError, aU as SignMessageErrorCodes, aT as SignMessageInput, a$ as SignTypedDataError, aZ as SignTypedDataErrorCodes, aY as SignTypedDataInput, R as TokenDecimals, V as TokensPayload, af as Transaction, aD as WEB_FEATURES, aC as WORLD_APP_FEATURES } from './types-CBzfDT31.cjs';
|
|
5
5
|
import 'abitype';
|
|
6
6
|
|
|
7
7
|
declare function attestation<TFallback = MiniAppAttestationSuccessPayload>(options: MiniKitAttestationOptions<TFallback>, ctx?: CommandContext): Promise<CommandResultByVia<MiniAppAttestationSuccessPayload, TFallback, 'minikit'>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as CommandContext, C as CommandResultByVia, W as WalletAuthResult, M as MiniKitWalletAuthOptions } from './types-
|
|
2
|
-
export { f as COMMAND_VERSIONS, e as Command, o as CommandResult, h as CommandState, r as CommandUnavailableError, n as CommandVia, D as DeviceProperties, F as FallbackConfig, p as FallbackReason, q as FallbackRequiredError, m as MiniAppBaseErrorPayload, l as MiniAppBaseSuccessPayload, a as MiniAppLaunchLocation, E as MiniAppLocation, z as MiniAppWalletAuthErrorPayload, A as MiniAppWalletAuthPayload, y as MiniAppWalletAuthSuccessPayload, G as MiniKitInstallErrorCodes, H as MiniKitInstallErrorMessage, b as MiniKitInstallReturnType, R as ResponseEvent, S as SiweMessage, U as User, c as UserNameService, B as WalletAuthError, w as WalletAuthErrorCodes, x as WalletAuthErrorMessage, t as WalletAuthInput, u as WalletAuthPayload, j as WebViewBasePayload, g as isCommandAvailable, i as isInWorldApp, k as sendMiniKitEvent, s as setCommandAvailable, v as validateCommands } from './types-
|
|
3
|
-
import { x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, P as PayResult, a as MiniKitPayOptions, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, S as SendTransactionResult, M as MiniKitSendTransactionOptions, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, T as Tokens } from './types-
|
|
4
|
-
export { F as AttestationError, B as AttestationErrorCodes, A as AttestationInput, ab as CalldataTransaction, J as ChatError, H as ChatErrorCodes, G as ChatInput, aO as Contact, ae as ContractFunctionArgs, ad as ContractFunctionName, aB as FeatureSupport, Q as GetPermissionsError, K as GetPermissionsErrorCodes, ac as LegacyTransaction, D as MiniAppAttestationErrorPayload, E as MiniAppAttestationPayload, I as MiniAppChatErrorPayload, O as MiniAppGetPermissionsErrorPayload, $ as MiniAppPaymentErrorPayload, a0 as MiniAppPaymentPayload, _ as MiniAppPaymentSuccessPayload, a4 as MiniAppRequestPermissionErrorPayload, a8 as MiniAppSendHapticFeedbackErrorPayload, at as MiniAppSendTransactionErrorPayload, aw as MiniAppSendTransactionPayload, aq as MiniAppSendTransactionSuccessPayload, ar as MiniAppSendTransactionV1ErrorPayload, au as MiniAppSendTransactionV1Payload, ao as MiniAppSendTransactionV1SuccessPayload, as as MiniAppSendTransactionV2ErrorPayload, av as MiniAppSendTransactionV2Payload, ap as MiniAppSendTransactionV2SuccessPayload, aQ as MiniAppShareContactsErrorPayload, aR as MiniAppShareContactsPayload, aP as MiniAppShareContactsSuccessPayload, aI as MiniAppShareErrorPayload, aV as MiniAppSignMessageErrorPayload, aW as MiniAppSignMessagePayload, a_ as MiniAppSignTypedDataErrorPayload, ax as MiniKitSendTransactionV1Options, ay as MiniKitSendTransactionV2Options, U as Network, W as PayCommandInput, X as PayCommandPayload, a1 as PayError, Y as PaymentErrorCodes, Z as PaymentErrorMessage, L as Permission, N as PermissionSettings, aa as Permit2, a5 as RequestPermissionError, a3 as RequestPermissionErrorCodes, a2 as RequestPermissionInput, a9 as SendHapticFeedbackError, a7 as SendHapticFeedbackErrorCodes, a6 as SendHapticFeedbackInput, aE as SendTransactionError, am as SendTransactionErrorCodes, an as SendTransactionErrorMessage, ak as SendTransactionInput, al as SendTransactionPayload, ag as SendTransactionV1Input, ah as SendTransactionV1Payload, az as SendTransactionV1Result, ai as SendTransactionV2Input, aj as SendTransactionV2Payload, aA as SendTransactionV2Result, aS as ShareContactsError, aM as ShareContactsErrorCodes, aN as ShareContactsErrorMessage, aK as ShareContactsInput, aL as ShareContactsPayload, aJ as ShareError, aH as ShareFilesErrorCodes, aF as ShareInput, aG as SharePayload, aX as SignMessageError, aU as SignMessageErrorCodes, aT as SignMessageInput, a$ as SignTypedDataError, aZ as SignTypedDataErrorCodes, aY as SignTypedDataInput, R as TokenDecimals, V as TokensPayload, af as Transaction, aD as WEB_FEATURES, aC as WORLD_APP_FEATURES } from './types-
|
|
1
|
+
import { d as CommandContext, C as CommandResultByVia, W as WalletAuthResult, M as MiniKitWalletAuthOptions } from './types-UxYgWVfF.js';
|
|
2
|
+
export { f as COMMAND_VERSIONS, e as Command, o as CommandResult, h as CommandState, r as CommandUnavailableError, n as CommandVia, D as DeviceProperties, F as FallbackConfig, p as FallbackReason, q as FallbackRequiredError, m as MiniAppBaseErrorPayload, l as MiniAppBaseSuccessPayload, a as MiniAppLaunchLocation, E as MiniAppLocation, z as MiniAppWalletAuthErrorPayload, A as MiniAppWalletAuthPayload, y as MiniAppWalletAuthSuccessPayload, G as MiniKitInstallErrorCodes, H as MiniKitInstallErrorMessage, b as MiniKitInstallReturnType, R as ResponseEvent, S as SiweMessage, U as User, c as UserNameService, V as VerificationStatus, B as WalletAuthError, w as WalletAuthErrorCodes, x as WalletAuthErrorMessage, t as WalletAuthInput, u as WalletAuthPayload, j as WebViewBasePayload, g as isCommandAvailable, i as isInWorldApp, k as sendMiniKitEvent, s as setCommandAvailable, v as validateCommands } from './types-UxYgWVfF.js';
|
|
3
|
+
import { x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, P as PayResult, a as MiniKitPayOptions, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, S as SendTransactionResult, M as MiniKitSendTransactionOptions, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, T as Tokens } from './types-BV7utGi5.js';
|
|
4
|
+
export { F as AttestationError, B as AttestationErrorCodes, A as AttestationInput, ab as CalldataTransaction, J as ChatError, H as ChatErrorCodes, G as ChatInput, aO as Contact, ae as ContractFunctionArgs, ad as ContractFunctionName, aB as FeatureSupport, Q as GetPermissionsError, K as GetPermissionsErrorCodes, ac as LegacyTransaction, D as MiniAppAttestationErrorPayload, E as MiniAppAttestationPayload, I as MiniAppChatErrorPayload, O as MiniAppGetPermissionsErrorPayload, $ as MiniAppPaymentErrorPayload, a0 as MiniAppPaymentPayload, _ as MiniAppPaymentSuccessPayload, a4 as MiniAppRequestPermissionErrorPayload, a8 as MiniAppSendHapticFeedbackErrorPayload, at as MiniAppSendTransactionErrorPayload, aw as MiniAppSendTransactionPayload, aq as MiniAppSendTransactionSuccessPayload, ar as MiniAppSendTransactionV1ErrorPayload, au as MiniAppSendTransactionV1Payload, ao as MiniAppSendTransactionV1SuccessPayload, as as MiniAppSendTransactionV2ErrorPayload, av as MiniAppSendTransactionV2Payload, ap as MiniAppSendTransactionV2SuccessPayload, aQ as MiniAppShareContactsErrorPayload, aR as MiniAppShareContactsPayload, aP as MiniAppShareContactsSuccessPayload, aI as MiniAppShareErrorPayload, aV as MiniAppSignMessageErrorPayload, aW as MiniAppSignMessagePayload, a_ as MiniAppSignTypedDataErrorPayload, ax as MiniKitSendTransactionV1Options, ay as MiniKitSendTransactionV2Options, U as Network, W as PayCommandInput, X as PayCommandPayload, a1 as PayError, Y as PaymentErrorCodes, Z as PaymentErrorMessage, L as Permission, N as PermissionSettings, aa as Permit2, a5 as RequestPermissionError, a3 as RequestPermissionErrorCodes, a2 as RequestPermissionInput, a9 as SendHapticFeedbackError, a7 as SendHapticFeedbackErrorCodes, a6 as SendHapticFeedbackInput, aE as SendTransactionError, am as SendTransactionErrorCodes, an as SendTransactionErrorMessage, ak as SendTransactionInput, al as SendTransactionPayload, ag as SendTransactionV1Input, ah as SendTransactionV1Payload, az as SendTransactionV1Result, ai as SendTransactionV2Input, aj as SendTransactionV2Payload, aA as SendTransactionV2Result, aS as ShareContactsError, aM as ShareContactsErrorCodes, aN as ShareContactsErrorMessage, aK as ShareContactsInput, aL as ShareContactsPayload, aJ as ShareError, aH as ShareFilesErrorCodes, aF as ShareInput, aG as SharePayload, aX as SignMessageError, aU as SignMessageErrorCodes, aT as SignMessageInput, a$ as SignTypedDataError, aZ as SignTypedDataErrorCodes, aY as SignTypedDataInput, R as TokenDecimals, V as TokensPayload, af as Transaction, aD as WEB_FEATURES, aC as WORLD_APP_FEATURES } from './types-BV7utGi5.js';
|
|
5
5
|
import 'abitype';
|
|
6
6
|
|
|
7
7
|
declare function attestation<TFallback = MiniAppAttestationSuccessPayload>(options: MiniKitAttestationOptions<TFallback>, ctx?: CommandContext): Promise<CommandResultByVia<MiniAppAttestationSuccessPayload, TFallback, 'minikit'>>;
|
package/build/command-exports.js
CHANGED
|
@@ -1645,7 +1645,11 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1645
1645
|
});
|
|
1646
1646
|
const walletAuthPayload = { siweMessage };
|
|
1647
1647
|
const worldAppVersion = ctx.state.deviceProperties.worldAppVersion;
|
|
1648
|
-
|
|
1648
|
+
if (worldAppVersion && worldAppVersion <= 2087900) {
|
|
1649
|
+
throw new Error(
|
|
1650
|
+
"Wallet auth v1 is no longer supported. Please update World App to the latest version."
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1649
1653
|
const finalPayload = await new Promise(
|
|
1650
1654
|
(resolve, reject) => {
|
|
1651
1655
|
try {
|
|
@@ -1655,7 +1659,7 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1655
1659
|
});
|
|
1656
1660
|
sendMiniKitEvent({
|
|
1657
1661
|
command: "wallet-auth" /* WalletAuth */,
|
|
1658
|
-
version:
|
|
1662
|
+
version: COMMAND_VERSIONS["wallet-auth" /* WalletAuth */],
|
|
1659
1663
|
payload: walletAuthPayload
|
|
1660
1664
|
});
|
|
1661
1665
|
} catch (error) {
|
|
@@ -1795,9 +1799,11 @@ var WORLD_APP_LAUNCH_LOCATION_MAP = {
|
|
|
1795
1799
|
world_chat: "chat" /* Chat */
|
|
1796
1800
|
};
|
|
1797
1801
|
function mapWorldAppLaunchLocation(location) {
|
|
1798
|
-
if (!location
|
|
1799
|
-
|
|
1800
|
-
|
|
1802
|
+
if (!location) return null;
|
|
1803
|
+
const raw = typeof location === "object" && "open_origin" in location ? location.open_origin : typeof location === "string" ? location : null;
|
|
1804
|
+
if (!raw) return null;
|
|
1805
|
+
console.log("MiniKit launch location mapped:", raw);
|
|
1806
|
+
return WORLD_APP_LAUNCH_LOCATION_MAP[raw.toLowerCase()] ?? null;
|
|
1801
1807
|
}
|
|
1802
1808
|
var _MiniKit = class _MiniKit {
|
|
1803
1809
|
static getActiveMiniKit() {
|
|
@@ -2126,7 +2132,19 @@ var _MiniKit = class _MiniKit {
|
|
|
2126
2132
|
// ============================================================================
|
|
2127
2133
|
static initFromWorldApp(worldApp2) {
|
|
2128
2134
|
if (!worldApp2) return;
|
|
2135
|
+
this._user = {};
|
|
2136
|
+
this._deviceProperties = {};
|
|
2129
2137
|
this._user.optedIntoOptionalAnalytics = worldApp2.is_optional_analytics;
|
|
2138
|
+
this._user.preferredCurrency = worldApp2.preferred_currency;
|
|
2139
|
+
this._user.pendingNotifications = worldApp2.pending_notifications;
|
|
2140
|
+
this._user.walletAddress = worldApp2.wallet_address;
|
|
2141
|
+
if (worldApp2.verification_status) {
|
|
2142
|
+
this._user.verificationStatus = {
|
|
2143
|
+
isOrbVerified: worldApp2.verification_status.is_orb_verified,
|
|
2144
|
+
isDocumentVerified: worldApp2.verification_status.is_document_verified,
|
|
2145
|
+
isSecureDocumentVerified: worldApp2.verification_status.is_secure_document_verified
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2130
2148
|
this._deviceProperties.safeAreaInsets = worldApp2.safe_area_insets;
|
|
2131
2149
|
this._deviceProperties.deviceOS = worldApp2.device_os;
|
|
2132
2150
|
this._deviceProperties.worldAppVersion = worldApp2.world_app_version;
|
package/build/connector/index.js
CHANGED
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
_getAddress,
|
|
4
4
|
_setAddress,
|
|
5
5
|
getWorldAppProvider
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-QX4OA3EY.js";
|
|
7
7
|
import {
|
|
8
8
|
setWagmiConfig
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-6SCI6OTQ.js";
|
|
10
10
|
import {
|
|
11
11
|
MiniKit
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-MOORQBWF.js";
|
|
13
|
+
import "../chunk-XHYUUG6Y.js";
|
|
14
|
+
import "../chunk-IYL4VCWR.js";
|
|
15
15
|
|
|
16
16
|
// src/connector/connector.ts
|
|
17
17
|
function worldApp(options = {}) {
|
package/build/index.cjs
CHANGED
|
@@ -1368,7 +1368,11 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1368
1368
|
});
|
|
1369
1369
|
const walletAuthPayload = { siweMessage };
|
|
1370
1370
|
const worldAppVersion = ctx.state.deviceProperties.worldAppVersion;
|
|
1371
|
-
|
|
1371
|
+
if (worldAppVersion && worldAppVersion <= 2087900) {
|
|
1372
|
+
throw new Error(
|
|
1373
|
+
"Wallet auth v1 is no longer supported. Please update World App to the latest version."
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1372
1376
|
const finalPayload = await new Promise(
|
|
1373
1377
|
(resolve, reject) => {
|
|
1374
1378
|
try {
|
|
@@ -1378,7 +1382,7 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1378
1382
|
});
|
|
1379
1383
|
sendMiniKitEvent({
|
|
1380
1384
|
command: "wallet-auth" /* WalletAuth */,
|
|
1381
|
-
version:
|
|
1385
|
+
version: COMMAND_VERSIONS["wallet-auth" /* WalletAuth */],
|
|
1382
1386
|
payload: walletAuthPayload
|
|
1383
1387
|
});
|
|
1384
1388
|
} catch (error) {
|
|
@@ -1518,9 +1522,11 @@ var WORLD_APP_LAUNCH_LOCATION_MAP = {
|
|
|
1518
1522
|
world_chat: "chat" /* Chat */
|
|
1519
1523
|
};
|
|
1520
1524
|
function mapWorldAppLaunchLocation(location) {
|
|
1521
|
-
if (!location
|
|
1522
|
-
|
|
1523
|
-
|
|
1525
|
+
if (!location) return null;
|
|
1526
|
+
const raw = typeof location === "object" && "open_origin" in location ? location.open_origin : typeof location === "string" ? location : null;
|
|
1527
|
+
if (!raw) return null;
|
|
1528
|
+
console.log("MiniKit launch location mapped:", raw);
|
|
1529
|
+
return WORLD_APP_LAUNCH_LOCATION_MAP[raw.toLowerCase()] ?? null;
|
|
1524
1530
|
}
|
|
1525
1531
|
var _MiniKit = class _MiniKit {
|
|
1526
1532
|
static getActiveMiniKit() {
|
|
@@ -1849,7 +1855,19 @@ var _MiniKit = class _MiniKit {
|
|
|
1849
1855
|
// ============================================================================
|
|
1850
1856
|
static initFromWorldApp(worldApp) {
|
|
1851
1857
|
if (!worldApp) return;
|
|
1858
|
+
this._user = {};
|
|
1859
|
+
this._deviceProperties = {};
|
|
1852
1860
|
this._user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
1861
|
+
this._user.preferredCurrency = worldApp.preferred_currency;
|
|
1862
|
+
this._user.pendingNotifications = worldApp.pending_notifications;
|
|
1863
|
+
this._user.walletAddress = worldApp.wallet_address;
|
|
1864
|
+
if (worldApp.verification_status) {
|
|
1865
|
+
this._user.verificationStatus = {
|
|
1866
|
+
isOrbVerified: worldApp.verification_status.is_orb_verified,
|
|
1867
|
+
isDocumentVerified: worldApp.verification_status.is_document_verified,
|
|
1868
|
+
isSecureDocumentVerified: worldApp.verification_status.is_secure_document_verified
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1853
1871
|
this._deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|
|
1854
1872
|
this._deviceProperties.deviceOS = worldApp.device_os;
|
|
1855
1873
|
this._deviceProperties.worldAppVersion = worldApp.world_app_version;
|
package/build/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalletAuthResult, M as MiniKitWalletAuthOptions, C as CommandResultByVia, i as isInWorldApp, U as User, D as DeviceProperties, a as MiniAppLaunchLocation, R as ResponseEvent, b as MiniKitInstallReturnType, c as UserNameService } from './types-
|
|
2
|
-
import { S as SendTransactionResult, M as MiniKitSendTransactionOptions, P as PayResult, a as MiniKitPayOptions, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions } from './types-
|
|
1
|
+
import { W as WalletAuthResult, M as MiniKitWalletAuthOptions, C as CommandResultByVia, i as isInWorldApp, U as User, D as DeviceProperties, a as MiniAppLaunchLocation, R as ResponseEvent, b as MiniKitInstallReturnType, c as UserNameService } from './types-UxYgWVfF.cjs';
|
|
2
|
+
import { S as SendTransactionResult, M as MiniKitSendTransactionOptions, P as PayResult, a as MiniKitPayOptions, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions } from './types-CBzfDT31.cjs';
|
|
3
3
|
export { W as WorldAppProvider, g as getWorldAppProvider } from './provider-DeDUsLbs.cjs';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalletAuthResult, M as MiniKitWalletAuthOptions, C as CommandResultByVia, i as isInWorldApp, U as User, D as DeviceProperties, a as MiniAppLaunchLocation, R as ResponseEvent, b as MiniKitInstallReturnType, c as UserNameService } from './types-
|
|
2
|
-
import { S as SendTransactionResult, M as MiniKitSendTransactionOptions, P as PayResult, a as MiniKitPayOptions, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions } from './types-
|
|
1
|
+
import { W as WalletAuthResult, M as MiniKitWalletAuthOptions, C as CommandResultByVia, i as isInWorldApp, U as User, D as DeviceProperties, a as MiniAppLaunchLocation, R as ResponseEvent, b as MiniKitInstallReturnType, c as UserNameService } from './types-UxYgWVfF.js';
|
|
2
|
+
import { S as SendTransactionResult, M as MiniKitSendTransactionOptions, P as PayResult, a as MiniKitPayOptions, b as ShareContactsResult, c as MiniKitShareContactsOptions, d as MiniAppSignMessageSuccessPayload, e as MiniKitSignMessageOptions, f as MiniAppSignTypedDataPayload, g as MiniKitSignTypedDataOptions, h as MiniAppSignTypedDataSuccessPayload, i as MiniAppChatPayload, j as MiniKitChatOptions, k as MiniAppChatSuccessPayload, l as MiniAppSharePayload, m as MiniKitShareOptions, n as MiniAppShareSuccessPayload, o as MiniAppGetPermissionsPayload, p as MiniKitGetPermissionsOptions, q as MiniAppGetPermissionsSuccessPayload, r as MiniAppRequestPermissionPayload, s as MiniKitRequestPermissionOptions, t as MiniAppRequestPermissionSuccessPayload, u as MiniAppSendHapticFeedbackPayload, v as MiniKitSendHapticFeedbackOptions, w as MiniAppSendHapticFeedbackSuccessPayload, x as MiniAppAttestationSuccessPayload, y as MiniKitAttestationOptions, C as CloseMiniAppResult, z as MiniKitCloseMiniAppOptions } from './types-BV7utGi5.js';
|
|
3
3
|
export { W as WorldAppProvider, g as getWorldAppProvider } from './provider-DeDUsLbs.js';
|
|
4
4
|
import 'abitype';
|
|
5
5
|
|
package/build/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getWorldAppProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QX4OA3EY.js";
|
|
4
4
|
import {
|
|
5
5
|
MiniKit
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-MOORQBWF.js";
|
|
7
|
+
import "./chunk-XHYUUG6Y.js";
|
|
8
|
+
import "./chunk-IYL4VCWR.js";
|
|
9
9
|
export {
|
|
10
10
|
MiniKit,
|
|
11
11
|
getWorldAppProvider
|
|
@@ -1648,7 +1648,11 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1648
1648
|
});
|
|
1649
1649
|
const walletAuthPayload = { siweMessage };
|
|
1650
1650
|
const worldAppVersion = ctx.state.deviceProperties.worldAppVersion;
|
|
1651
|
-
|
|
1651
|
+
if (worldAppVersion && worldAppVersion <= 2087900) {
|
|
1652
|
+
throw new Error(
|
|
1653
|
+
"Wallet auth v1 is no longer supported. Please update World App to the latest version."
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1652
1656
|
const finalPayload = await new Promise(
|
|
1653
1657
|
(resolve, reject) => {
|
|
1654
1658
|
try {
|
|
@@ -1658,7 +1662,7 @@ async function nativeWalletAuth(options, ctx) {
|
|
|
1658
1662
|
});
|
|
1659
1663
|
sendMiniKitEvent({
|
|
1660
1664
|
command: "wallet-auth" /* WalletAuth */,
|
|
1661
|
-
version:
|
|
1665
|
+
version: COMMAND_VERSIONS["wallet-auth" /* WalletAuth */],
|
|
1662
1666
|
payload: walletAuthPayload
|
|
1663
1667
|
});
|
|
1664
1668
|
} catch (error) {
|
|
@@ -1798,9 +1802,11 @@ var WORLD_APP_LAUNCH_LOCATION_MAP = {
|
|
|
1798
1802
|
world_chat: "chat" /* Chat */
|
|
1799
1803
|
};
|
|
1800
1804
|
function mapWorldAppLaunchLocation(location) {
|
|
1801
|
-
if (!location
|
|
1802
|
-
|
|
1803
|
-
|
|
1805
|
+
if (!location) return null;
|
|
1806
|
+
const raw = typeof location === "object" && "open_origin" in location ? location.open_origin : typeof location === "string" ? location : null;
|
|
1807
|
+
if (!raw) return null;
|
|
1808
|
+
console.log("MiniKit launch location mapped:", raw);
|
|
1809
|
+
return WORLD_APP_LAUNCH_LOCATION_MAP[raw.toLowerCase()] ?? null;
|
|
1804
1810
|
}
|
|
1805
1811
|
var _MiniKit = class _MiniKit {
|
|
1806
1812
|
static getActiveMiniKit() {
|
|
@@ -2129,7 +2135,19 @@ var _MiniKit = class _MiniKit {
|
|
|
2129
2135
|
// ============================================================================
|
|
2130
2136
|
static initFromWorldApp(worldApp) {
|
|
2131
2137
|
if (!worldApp) return;
|
|
2138
|
+
this._user = {};
|
|
2139
|
+
this._deviceProperties = {};
|
|
2132
2140
|
this._user.optedIntoOptionalAnalytics = worldApp.is_optional_analytics;
|
|
2141
|
+
this._user.preferredCurrency = worldApp.preferred_currency;
|
|
2142
|
+
this._user.pendingNotifications = worldApp.pending_notifications;
|
|
2143
|
+
this._user.walletAddress = worldApp.wallet_address;
|
|
2144
|
+
if (worldApp.verification_status) {
|
|
2145
|
+
this._user.verificationStatus = {
|
|
2146
|
+
isOrbVerified: worldApp.verification_status.is_orb_verified,
|
|
2147
|
+
isDocumentVerified: worldApp.verification_status.is_document_verified,
|
|
2148
|
+
isSecureDocumentVerified: worldApp.verification_status.is_secure_document_verified
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2133
2151
|
this._deviceProperties.safeAreaInsets = worldApp.safe_area_insets;
|
|
2134
2152
|
this._deviceProperties.deviceOS = worldApp.device_os;
|
|
2135
2153
|
this._deviceProperties.worldAppVersion = worldApp.world_app_version;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
setWagmiConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6SCI6OTQ.js";
|
|
5
5
|
import {
|
|
6
6
|
MiniKit
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-MOORQBWF.js";
|
|
8
|
+
import "./chunk-XHYUUG6Y.js";
|
|
9
|
+
import "./chunk-IYL4VCWR.js";
|
|
10
10
|
|
|
11
11
|
// src/minikit-provider.tsx
|
|
12
12
|
import {
|
package/build/siwe-exports.cjs
CHANGED
|
@@ -37,7 +37,6 @@ var IAT_TAG = "Issued At: ";
|
|
|
37
37
|
var EXP_TAG = "Expiration Time: ";
|
|
38
38
|
var NBF_TAG = "Not Before: ";
|
|
39
39
|
var RID_TAG = "Request ID: ";
|
|
40
|
-
var ERC_191_PREFIX = "Ethereum Signed Message:\n";
|
|
41
40
|
var EIP1271_MAGICVALUE = "0x1626ba7e";
|
|
42
41
|
var SAFE_CONTRACT_ABI = [
|
|
43
42
|
{
|
|
@@ -136,14 +135,8 @@ var parseSiweMessage = (inputString) => {
|
|
|
136
135
|
return siweMessageData;
|
|
137
136
|
};
|
|
138
137
|
var verifySiweMessage = (payload, nonce, statement, requestId, userProvider) => {
|
|
139
|
-
if (payload.version
|
|
140
|
-
|
|
141
|
-
payload,
|
|
142
|
-
nonce,
|
|
143
|
-
statement,
|
|
144
|
-
requestId,
|
|
145
|
-
userProvider
|
|
146
|
-
);
|
|
138
|
+
if (payload.version !== 2) {
|
|
139
|
+
throw new Error("Unsupported version returned");
|
|
147
140
|
} else {
|
|
148
141
|
return verifySiweMessageV2(
|
|
149
142
|
payload,
|
|
@@ -184,39 +177,14 @@ var validateMessage = (siweMessageData, nonce, statement, requestId) => {
|
|
|
184
177
|
}
|
|
185
178
|
return true;
|
|
186
179
|
};
|
|
187
|
-
var verifySiweMessageV1 = async (payload, nonce, statement, requestId, userProvider) => {
|
|
188
|
-
if (typeof window !== "undefined") {
|
|
189
|
-
throw new Error("Wallet auth payload can only be verified in the backend");
|
|
190
|
-
}
|
|
191
|
-
const { message, signature, address } = payload;
|
|
192
|
-
const siweMessageData = parseSiweMessage(message);
|
|
193
|
-
validateMessage(siweMessageData, nonce, statement, requestId);
|
|
194
|
-
let provider = userProvider || (0, import_viem.createPublicClient)({ chain: import_chains.worldchain, transport: (0, import_viem.http)() });
|
|
195
|
-
const signedMessage = `${ERC_191_PREFIX}${message.length}${message}`;
|
|
196
|
-
const hashedMessage = (0, import_viem.hashMessage)(signedMessage);
|
|
197
|
-
const contract = (0, import_viem.getContract)({
|
|
198
|
-
address,
|
|
199
|
-
abi: SAFE_CONTRACT_ABI,
|
|
200
|
-
client: provider
|
|
201
|
-
});
|
|
202
|
-
try {
|
|
203
|
-
const recoveredAddress = await (0, import_viem.recoverAddress)({
|
|
204
|
-
hash: hashedMessage,
|
|
205
|
-
signature: `0x${signature}`
|
|
206
|
-
});
|
|
207
|
-
const isOwner = await contract.read.isOwner([recoveredAddress]);
|
|
208
|
-
if (!isOwner) {
|
|
209
|
-
throw new Error("Signature verification failed, invalid owner");
|
|
210
|
-
}
|
|
211
|
-
} catch (error) {
|
|
212
|
-
throw new Error("Signature verification failed");
|
|
213
|
-
}
|
|
214
|
-
return { isValid: true, siweMessageData };
|
|
215
|
-
};
|
|
216
180
|
var verifySiweMessageV2 = async (payload, nonce, statement, requestId, userProvider) => {
|
|
217
181
|
if (typeof window !== "undefined") {
|
|
218
182
|
throw new Error("Wallet auth payload can only be verified in the backend");
|
|
219
183
|
}
|
|
184
|
+
const NONCE_REGEX = /^[a-zA-Z0-9]+$/;
|
|
185
|
+
if (!NONCE_REGEX.test(nonce)) {
|
|
186
|
+
throw new Error("Invalid nonce: must be alphanumeric only (per ERC-4361)");
|
|
187
|
+
}
|
|
220
188
|
const { message, signature, address } = payload;
|
|
221
189
|
const siweMessageData = parseSiweMessage(message);
|
|
222
190
|
if (!validateMessage(siweMessageData, nonce, statement, requestId)) {
|
package/build/siwe-exports.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-
|
|
2
|
+
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-UxYgWVfF.cjs';
|
|
3
3
|
|
|
4
4
|
declare const parseSiweMessage: (inputString: string) => SiweMessage;
|
|
5
5
|
declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
|
package/build/siwe-exports.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-
|
|
2
|
+
import { S as SiweMessage, y as MiniAppWalletAuthSuccessPayload } from './types-UxYgWVfF.js';
|
|
3
3
|
|
|
4
4
|
declare const parseSiweMessage: (inputString: string) => SiweMessage;
|
|
5
5
|
declare const verifySiweMessage: (payload: MiniAppWalletAuthSuccessPayload, nonce: string, statement?: string, requestId?: string, userProvider?: Client) => Promise<{
|
package/build/siwe-exports.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-
|
|
1
|
+
import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-UxYgWVfF.js';
|
|
2
2
|
import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
|
|
3
3
|
|
|
4
4
|
type AttestationParams = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-
|
|
1
|
+
import { F as FallbackConfig, l as MiniAppBaseSuccessPayload, m as MiniAppBaseErrorPayload } from './types-UxYgWVfF.cjs';
|
|
2
2
|
import { Abi, AbiStateMutability, ExtractAbiFunctionNames, AbiParametersToPrimitiveTypes, ExtractAbiFunction, TypedData, TypedDataDomain } from 'abitype';
|
|
3
3
|
|
|
4
4
|
type AttestationParams = {
|
|
@@ -7,6 +7,11 @@ declare class EventManager {
|
|
|
7
7
|
trigger(event: ResponseEvent, payload: EventPayload): void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
type VerificationStatus = {
|
|
11
|
+
isOrbVerified: boolean;
|
|
12
|
+
isDocumentVerified: boolean;
|
|
13
|
+
isSecureDocumentVerified: boolean;
|
|
14
|
+
};
|
|
10
15
|
type User = {
|
|
11
16
|
walletAddress?: string;
|
|
12
17
|
username?: string;
|
|
@@ -15,7 +20,10 @@ type User = {
|
|
|
15
20
|
notifications: boolean;
|
|
16
21
|
contacts: boolean;
|
|
17
22
|
};
|
|
23
|
+
verificationStatus?: VerificationStatus;
|
|
18
24
|
optedIntoOptionalAnalytics?: boolean;
|
|
25
|
+
preferredCurrency?: string;
|
|
26
|
+
pendingNotifications?: number;
|
|
19
27
|
};
|
|
20
28
|
type DeviceProperties = {
|
|
21
29
|
safeAreaInsets?: {
|
|
@@ -220,4 +228,4 @@ declare class WalletAuthError extends Error {
|
|
|
220
228
|
constructor(code: string, details?: string);
|
|
221
229
|
}
|
|
222
230
|
|
|
223
|
-
export { type MiniAppWalletAuthPayload as A, WalletAuthError as B, type CommandResultByVia as C, type DeviceProperties as D, type MiniAppLocation as E, type FallbackConfig as F, MiniKitInstallErrorCodes as G, MiniKitInstallErrorMessage as H, type MiniKitWalletAuthOptions as M, ResponseEvent as R, type SiweMessage as S, type User as U, type WalletAuthResult as W, MiniAppLaunchLocation as a, type MiniKitInstallReturnType as b, type UserNameService as c, type CommandContext as d, Command as e, COMMAND_VERSIONS as f, isCommandAvailable as g, type CommandState as h, isInWorldApp as i, type WebViewBasePayload as j, sendMiniKitEvent as k, type MiniAppBaseSuccessPayload as l, type MiniAppBaseErrorPayload as m, type CommandVia as n, type CommandResult as o, type FallbackReason as p, FallbackRequiredError as q, CommandUnavailableError as r, setCommandAvailable as s, type WalletAuthInput as t, type WalletAuthPayload as u, validateCommands as v, WalletAuthErrorCodes as w, WalletAuthErrorMessage as x, type MiniAppWalletAuthSuccessPayload as y, type MiniAppWalletAuthErrorPayload as z };
|
|
231
|
+
export { type MiniAppWalletAuthPayload as A, WalletAuthError as B, type CommandResultByVia as C, type DeviceProperties as D, type MiniAppLocation as E, type FallbackConfig as F, MiniKitInstallErrorCodes as G, MiniKitInstallErrorMessage as H, type MiniKitWalletAuthOptions as M, ResponseEvent as R, type SiweMessage as S, type User as U, type VerificationStatus as V, type WalletAuthResult as W, MiniAppLaunchLocation as a, type MiniKitInstallReturnType as b, type UserNameService as c, type CommandContext as d, Command as e, COMMAND_VERSIONS as f, isCommandAvailable as g, type CommandState as h, isInWorldApp as i, type WebViewBasePayload as j, sendMiniKitEvent as k, type MiniAppBaseSuccessPayload as l, type MiniAppBaseErrorPayload as m, type CommandVia as n, type CommandResult as o, type FallbackReason as p, FallbackRequiredError as q, CommandUnavailableError as r, setCommandAvailable as s, type WalletAuthInput as t, type WalletAuthPayload as u, validateCommands as v, WalletAuthErrorCodes as w, WalletAuthErrorMessage as x, type MiniAppWalletAuthSuccessPayload as y, type MiniAppWalletAuthErrorPayload as z };
|
|
@@ -7,6 +7,11 @@ declare class EventManager {
|
|
|
7
7
|
trigger(event: ResponseEvent, payload: EventPayload): void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
type VerificationStatus = {
|
|
11
|
+
isOrbVerified: boolean;
|
|
12
|
+
isDocumentVerified: boolean;
|
|
13
|
+
isSecureDocumentVerified: boolean;
|
|
14
|
+
};
|
|
10
15
|
type User = {
|
|
11
16
|
walletAddress?: string;
|
|
12
17
|
username?: string;
|
|
@@ -15,7 +20,10 @@ type User = {
|
|
|
15
20
|
notifications: boolean;
|
|
16
21
|
contacts: boolean;
|
|
17
22
|
};
|
|
23
|
+
verificationStatus?: VerificationStatus;
|
|
18
24
|
optedIntoOptionalAnalytics?: boolean;
|
|
25
|
+
preferredCurrency?: string;
|
|
26
|
+
pendingNotifications?: number;
|
|
19
27
|
};
|
|
20
28
|
type DeviceProperties = {
|
|
21
29
|
safeAreaInsets?: {
|
|
@@ -220,4 +228,4 @@ declare class WalletAuthError extends Error {
|
|
|
220
228
|
constructor(code: string, details?: string);
|
|
221
229
|
}
|
|
222
230
|
|
|
223
|
-
export { type MiniAppWalletAuthPayload as A, WalletAuthError as B, type CommandResultByVia as C, type DeviceProperties as D, type MiniAppLocation as E, type FallbackConfig as F, MiniKitInstallErrorCodes as G, MiniKitInstallErrorMessage as H, type MiniKitWalletAuthOptions as M, ResponseEvent as R, type SiweMessage as S, type User as U, type WalletAuthResult as W, MiniAppLaunchLocation as a, type MiniKitInstallReturnType as b, type UserNameService as c, type CommandContext as d, Command as e, COMMAND_VERSIONS as f, isCommandAvailable as g, type CommandState as h, isInWorldApp as i, type WebViewBasePayload as j, sendMiniKitEvent as k, type MiniAppBaseSuccessPayload as l, type MiniAppBaseErrorPayload as m, type CommandVia as n, type CommandResult as o, type FallbackReason as p, FallbackRequiredError as q, CommandUnavailableError as r, setCommandAvailable as s, type WalletAuthInput as t, type WalletAuthPayload as u, validateCommands as v, WalletAuthErrorCodes as w, WalletAuthErrorMessage as x, type MiniAppWalletAuthSuccessPayload as y, type MiniAppWalletAuthErrorPayload as z };
|
|
231
|
+
export { type MiniAppWalletAuthPayload as A, WalletAuthError as B, type CommandResultByVia as C, type DeviceProperties as D, type MiniAppLocation as E, type FallbackConfig as F, MiniKitInstallErrorCodes as G, MiniKitInstallErrorMessage as H, type MiniKitWalletAuthOptions as M, ResponseEvent as R, type SiweMessage as S, type User as U, type VerificationStatus as V, type WalletAuthResult as W, MiniAppLaunchLocation as a, type MiniKitInstallReturnType as b, type UserNameService as c, type CommandContext as d, Command as e, COMMAND_VERSIONS as f, isCommandAvailable as g, type CommandState as h, isInWorldApp as i, type WebViewBasePayload as j, sendMiniKitEvent as k, type MiniAppBaseSuccessPayload as l, type MiniAppBaseErrorPayload as m, type CommandVia as n, type CommandResult as o, type FallbackReason as p, FallbackRequiredError as q, CommandUnavailableError as r, setCommandAvailable as s, type WalletAuthInput as t, type WalletAuthPayload as u, validateCommands as v, WalletAuthErrorCodes as w, WalletAuthErrorMessage as x, type MiniAppWalletAuthSuccessPayload as y, type MiniAppWalletAuthErrorPayload as z };
|