@getpara/web-sdk 2.26.0 → 3.0.0-alpha.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/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/utils/chainIcons.d.ts +2 -0
- package/dist/utils/chainIcons.js +41 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/isMobile.d.ts +1 -0
- package/dist/utils/isMobile.js +30 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Para as ParaWeb } from './ParaWeb.js';
|
|
|
3
3
|
import ParaCore from '@getpara/core-sdk';
|
|
4
4
|
export { type StorageUtils, type ConstructorOpts, Environment, type OnRampConfig, type OnRampAssets, } from '@getpara/core-sdk';
|
|
5
5
|
export { createCredential, generateSignature, parseCredentialCreationRes } from './cryptography/webAuth.js';
|
|
6
|
-
export { truncateEthAddress, isPasskeySupported, offRampSend } from './utils/index.js';
|
|
6
|
+
export { truncateEthAddress, isPasskeySupported, offRampSend, getChainLogoUrl, getCurrencyLogoUrl } from './utils/index.js';
|
|
7
7
|
export * from './utils/isMobile.js';
|
|
8
8
|
export * from './types/index.js';
|
|
9
9
|
export { ParaWeb, ParaCore };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Environment
|
|
8
8
|
} from "@getpara/core-sdk";
|
|
9
9
|
import { createCredential, generateSignature, parseCredentialCreationRes } from "./cryptography/webAuth.js";
|
|
10
|
-
import { truncateEthAddress, isPasskeySupported, offRampSend } from "./utils/index.js";
|
|
10
|
+
import { truncateEthAddress, isPasskeySupported, offRampSend, getChainLogoUrl, getCurrencyLogoUrl } from "./utils/index.js";
|
|
11
11
|
export * from "./utils/isMobile.js";
|
|
12
12
|
export * from "./types/index.js";
|
|
13
13
|
var src_default = ParaWeb;
|
|
@@ -18,6 +18,8 @@ export {
|
|
|
18
18
|
createCredential,
|
|
19
19
|
src_default as default,
|
|
20
20
|
generateSignature,
|
|
21
|
+
getChainLogoUrl,
|
|
22
|
+
getCurrencyLogoUrl,
|
|
21
23
|
isPasskeySupported,
|
|
22
24
|
offRampSend,
|
|
23
25
|
parseCredentialCreationRes,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-YJOFEY2L.js";
|
|
3
|
+
const LLAMA_CDN = "https://icons.llamao.fi/icons/chains/rsz_";
|
|
4
|
+
const CHAIN_ID_TO_LLAMA = {
|
|
5
|
+
"56": "bsc",
|
|
6
|
+
"100": "gnosis",
|
|
7
|
+
"324": "zksync-era",
|
|
8
|
+
"1101": "polygon-zkevm"
|
|
9
|
+
};
|
|
10
|
+
const CURRENCY_TO_LLAMA = {
|
|
11
|
+
ETH: "ethereum",
|
|
12
|
+
BNB: "bsc",
|
|
13
|
+
MATIC: "polygon",
|
|
14
|
+
POL: "polygon",
|
|
15
|
+
AVAX: "avalanche",
|
|
16
|
+
FTM: "fantom",
|
|
17
|
+
CELO: "celo",
|
|
18
|
+
xDAI: "gnosis",
|
|
19
|
+
CRO: "cronos",
|
|
20
|
+
GLMR: "moonbeam",
|
|
21
|
+
MOVR: "moonriver",
|
|
22
|
+
MNT: "mantle",
|
|
23
|
+
ONE: "harmony",
|
|
24
|
+
METIS: "metis",
|
|
25
|
+
KAVA: "kava",
|
|
26
|
+
FUSE: "fuse",
|
|
27
|
+
ATOM: "cosmos"
|
|
28
|
+
};
|
|
29
|
+
function getChainLogoUrl(chainId, chainName) {
|
|
30
|
+
var _a;
|
|
31
|
+
const name = (_a = CHAIN_ID_TO_LLAMA[chainId]) != null ? _a : chainName.toLowerCase().replace(/\s+/g, "-");
|
|
32
|
+
return `${LLAMA_CDN}${name}.jpg`;
|
|
33
|
+
}
|
|
34
|
+
function getCurrencyLogoUrl(symbol) {
|
|
35
|
+
const name = CURRENCY_TO_LLAMA[symbol];
|
|
36
|
+
return name ? `${LLAMA_CDN}${name}.jpg` : null;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
getChainLogoUrl,
|
|
40
|
+
getCurrencyLogoUrl
|
|
41
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/dist/utils/isMobile.d.ts
CHANGED
package/dist/utils/isMobile.js
CHANGED
|
@@ -41,6 +41,34 @@ function isMobileSafari() {
|
|
|
41
41
|
function isTelegram() {
|
|
42
42
|
return typeof window !== "undefined" && (Boolean(window.TelegramWebviewProxy) || Boolean(window.Telegram) || Boolean(window.TelegramWebviewProxyProto));
|
|
43
43
|
}
|
|
44
|
+
const openMobileUrl = (url) => {
|
|
45
|
+
if (typeof window === "undefined") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (isMobile()) {
|
|
49
|
+
if (!url) return;
|
|
50
|
+
if (isTelegram()) {
|
|
51
|
+
let href = url;
|
|
52
|
+
if (isAndroid()) {
|
|
53
|
+
try {
|
|
54
|
+
const decoded = decodeURI(url);
|
|
55
|
+
href = decoded === url ? encodeURI(url) : url;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
href = encodeURI(url);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
window.open(href, "_blank", "noreferrer noopener");
|
|
61
|
+
} else if (url.startsWith("http")) {
|
|
62
|
+
const link = document.createElement("a");
|
|
63
|
+
link.href = url;
|
|
64
|
+
link.target = "_blank";
|
|
65
|
+
link.rel = "noreferrer noopener";
|
|
66
|
+
link.click();
|
|
67
|
+
} else {
|
|
68
|
+
window.location.href = url;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
44
72
|
export {
|
|
45
73
|
isAndroid,
|
|
46
74
|
isIOS,
|
|
@@ -51,5 +79,6 @@ export {
|
|
|
51
79
|
isSafari,
|
|
52
80
|
isSmallIOS,
|
|
53
81
|
isTablet,
|
|
54
|
-
isTelegram
|
|
82
|
+
isTelegram,
|
|
83
|
+
openMobileUrl
|
|
55
84
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/web-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/core-sdk": "
|
|
6
|
-
"@getpara/user-management-client": "
|
|
5
|
+
"@getpara/core-sdk": "3.0.0-alpha.1",
|
|
6
|
+
"@getpara/user-management-client": "3.0.0-alpha.1",
|
|
7
7
|
"base64url": "^3.0.1",
|
|
8
8
|
"buffer": "6.0.3",
|
|
9
9
|
"cbor-web": "^9.0.2",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist",
|
|
30
30
|
"package.json"
|
|
31
31
|
],
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "839d225579de67feb5be4da225d232290b2a2a04",
|
|
33
33
|
"main": "dist/index.js",
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",
|