@embarkai/ui-kit 0.4.32 → 0.4.33
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/iframe/_headers +3 -3
- package/dist/iframe/index.html +2 -2
- package/dist/iframe/main.js +69 -64
- package/dist/index.cjs +402 -286
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +319 -203
- package/package.json +2 -2
package/dist/iframe/_headers
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Cloudflare Pages Headers Configuration for Iframe Wallet
|
|
2
|
-
# This file configures security headers for the iframe at auth.
|
|
2
|
+
# This file configures security headers for the iframe at auth.embarkai.io
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
# Content Security Policy - Strict security policy for iframe
|
|
6
6
|
# IMPORTANT: frame-ancestors 'https:' allows embedding on any HTTPS site
|
|
7
7
|
# Domain validation is performed via projectId check in JavaScript
|
|
8
|
-
# connect-src whitelist: only allowed TSS servers (where the second key share is stored) and
|
|
8
|
+
# connect-src whitelist: only allowed TSS servers (where the second key share is stored) and embarkai.io subdomains
|
|
9
9
|
# script-src: Added https://telegram.org for Telegram Login Widget
|
|
10
10
|
# script-src: Added 'unsafe-eval' required by Telegram Widget (uses eval for callbacks)
|
|
11
11
|
# frame-src: Added https://oauth.telegram.org for Telegram OAuth iframe
|
|
12
12
|
# NOTE: http://localhost:* in frame-ancestors is for development testing only
|
|
13
|
-
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval' https://telegram.org https://static.sumsub.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: blob:; font-src 'self'; connect-src 'self' https://*.
|
|
13
|
+
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval' https://telegram.org https://static.sumsub.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: blob:; font-src 'self'; connect-src 'self' https://*.embarkai.io https://*.sumsub.com; frame-src https://oauth.telegram.org https://*.sumsub.com; frame-ancestors https: http://localhost:*; base-uri 'self'; form-action 'self';
|
|
14
14
|
|
|
15
15
|
# Allow iframe embedding from HTTPS sites (domain validation in JS)
|
|
16
16
|
# X-Frame-Options is NOT set (CSP frame-ancestors takes precedence)
|
package/dist/iframe/index.html
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
<!-- WARNING: localhost is allowed ONLY for local development, production CSP in _headers is stricter -->
|
|
11
11
|
<meta
|
|
12
12
|
http-equiv="Content-Security-Policy"
|
|
13
|
-
content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval' https://telegram.org; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: blob:; font-src 'self'; connect-src 'self' http://localhost:* https://*.
|
|
13
|
+
content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval' https://telegram.org; style-src 'self' 'unsafe-inline'; img-src 'self' data: https: blob:; font-src 'self'; connect-src 'self' http://localhost:* https://*.embarkai.io; frame-src https://oauth.telegram.org; base-uri 'self'; form-action 'self';"
|
|
14
14
|
/>
|
|
15
15
|
<meta http-equiv="X-Content-Type-Options" content="nosniff" />
|
|
16
16
|
<meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
|
|
17
17
|
|
|
18
|
-
<title>EmbarkAI Secure Wallet - iframe version 0.4.
|
|
18
|
+
<title>EmbarkAI Secure Wallet - iframe version 0.4.33</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -494,6 +494,7 @@ async function getShareVaultToken(scopes, accessToken) {
|
|
|
494
494
|
body: JSON.stringify({
|
|
495
495
|
scopes,
|
|
496
496
|
audience: "lumia-passport-share-vault-service",
|
|
497
|
+
// TODO: embarkai audience ?
|
|
497
498
|
ttl: 300
|
|
498
499
|
})
|
|
499
500
|
});
|
|
@@ -573,8 +574,8 @@ var SHARE_VAULT_URL, TSS_URL;
|
|
|
573
574
|
var init_server_backup = __esm({
|
|
574
575
|
"src/iframe/lib/backup/server-backup.ts"() {
|
|
575
576
|
init_crypto_utils();
|
|
576
|
-
SHARE_VAULT_URL = "https://api.
|
|
577
|
-
TSS_URL = "https://api.
|
|
577
|
+
SHARE_VAULT_URL = "https://api.embarkai.io/vault";
|
|
578
|
+
TSS_URL = "https://api.embarkai.io/tss";
|
|
578
579
|
}
|
|
579
580
|
});
|
|
580
581
|
|
|
@@ -1596,7 +1597,7 @@ function buildConfirmTxTemplateData(project, origin, transaction, risk, metadata
|
|
|
1596
1597
|
var AuthorizationManager = class {
|
|
1597
1598
|
constructor() {
|
|
1598
1599
|
this.STORAGE_KEY_PREFIX = "auth";
|
|
1599
|
-
this.METADATA_API_URL = "https://dashboard.
|
|
1600
|
+
this.METADATA_API_URL = "https://dashboard.embarkai.io/api/public/project";
|
|
1600
1601
|
this.METADATA_CACHE_TTL = 36e5;
|
|
1601
1602
|
// 1 hour in milliseconds
|
|
1602
1603
|
this.metadataCache = /* @__PURE__ */ new Map();
|
|
@@ -2078,7 +2079,7 @@ init_server_backup();
|
|
|
2078
2079
|
var TokenRefreshApiClient = class {
|
|
2079
2080
|
constructor() {
|
|
2080
2081
|
this.pendingTokenRefresh = null;
|
|
2081
|
-
this.tssUrl = "https://api.
|
|
2082
|
+
this.tssUrl = "https://api.embarkai.io/tss";
|
|
2082
2083
|
}
|
|
2083
2084
|
/**
|
|
2084
2085
|
* Make API call with automatic token refresh on 401
|
|
@@ -3056,8 +3057,10 @@ var DKGManager = class extends TokenRefreshApiClient {
|
|
|
3056
3057
|
};
|
|
3057
3058
|
|
|
3058
3059
|
// src/iframe/lib/hyperlane/hyperlane.ts
|
|
3059
|
-
var
|
|
3060
|
-
|
|
3060
|
+
var API_URL = (
|
|
3061
|
+
// checks for custom service url
|
|
3062
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
3063
|
+
);
|
|
3061
3064
|
var HyperlaneAPI = class {
|
|
3062
3065
|
// private sseAbortController: AbortController | null = null
|
|
3063
3066
|
constructor(sendResponseFn) {
|
|
@@ -3066,7 +3069,7 @@ var HyperlaneAPI = class {
|
|
|
3066
3069
|
// API METHODS
|
|
3067
3070
|
/** available warp routes */
|
|
3068
3071
|
async getHyperlaneWarpRoutes(accessToken) {
|
|
3069
|
-
const result = await fetch(`${API_URL}/
|
|
3072
|
+
const result = await fetch(`${API_URL}/hyperlane/warp-routes`, {
|
|
3070
3073
|
method: "GET",
|
|
3071
3074
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
3072
3075
|
});
|
|
@@ -3075,7 +3078,7 @@ var HyperlaneAPI = class {
|
|
|
3075
3078
|
}
|
|
3076
3079
|
/** bridging quote */
|
|
3077
3080
|
async estimateHyperlaneQuote(payload, accessToken) {
|
|
3078
|
-
const result = await fetch(`${API_URL}/
|
|
3081
|
+
const result = await fetch(`${API_URL}/hyperlane/estimate-quote`, {
|
|
3079
3082
|
method: "POST",
|
|
3080
3083
|
body: JSON.stringify(payload),
|
|
3081
3084
|
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken}` }
|
|
@@ -3085,7 +3088,7 @@ var HyperlaneAPI = class {
|
|
|
3085
3088
|
}
|
|
3086
3089
|
/** list of pre-cooked TXs by Hyperlane SDK */
|
|
3087
3090
|
async bridgeHyperlaneAsset(payload, accessToken) {
|
|
3088
|
-
const result = await fetch(`${API_URL}/
|
|
3091
|
+
const result = await fetch(`${API_URL}/hyperlane/bridge-asset`, {
|
|
3089
3092
|
method: "POST",
|
|
3090
3093
|
body: JSON.stringify(payload),
|
|
3091
3094
|
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken}` }
|
|
@@ -3096,7 +3099,7 @@ var HyperlaneAPI = class {
|
|
|
3096
3099
|
/** bridge history */
|
|
3097
3100
|
async getHyperlaneBridgeHistory(pagination, accessToken) {
|
|
3098
3101
|
const { page, pageSize } = pagination;
|
|
3099
|
-
const url = new URL(`${API_URL}/
|
|
3102
|
+
const url = new URL(`${API_URL}/hyperlane/bridge-history`);
|
|
3100
3103
|
if (page) url.searchParams.append("page", page.toString());
|
|
3101
3104
|
if (pageSize) url.searchParams.append("pageSize", pageSize.toString());
|
|
3102
3105
|
const result = await fetch(url.toString(), { method: "GET", headers: { Authorization: `Bearer ${accessToken}` } });
|
|
@@ -3105,7 +3108,7 @@ var HyperlaneAPI = class {
|
|
|
3105
3108
|
}
|
|
3106
3109
|
/** patch initiated bridge transaction */
|
|
3107
3110
|
async patchInitiatedBridgeTxStatus(payload, accessToken) {
|
|
3108
|
-
const result = await fetch(`${API_URL}/
|
|
3111
|
+
const result = await fetch(`${API_URL}/hyperlane/patch-bridge-tx-status`, {
|
|
3109
3112
|
method: "PATCH",
|
|
3110
3113
|
body: JSON.stringify(payload),
|
|
3111
3114
|
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken}` }
|
|
@@ -3114,7 +3117,7 @@ var HyperlaneAPI = class {
|
|
|
3114
3117
|
return response;
|
|
3115
3118
|
}
|
|
3116
3119
|
async patchInitiatedBridgeTxOpHashes(payload, accessToken) {
|
|
3117
|
-
const result = await fetch(`${API_URL}/
|
|
3120
|
+
const result = await fetch(`${API_URL}/hyperlane/patch-bridge-op-hashes`, {
|
|
3118
3121
|
method: "PATCH",
|
|
3119
3122
|
body: JSON.stringify(payload),
|
|
3120
3123
|
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${accessToken}` }
|
|
@@ -4703,7 +4706,10 @@ var omit = flatRest_default(function(object, paths) {
|
|
|
4703
4706
|
var omit_default = omit;
|
|
4704
4707
|
|
|
4705
4708
|
// src/iframe/lib/onramp/binance.ts
|
|
4706
|
-
var
|
|
4709
|
+
var API_URL2 = (
|
|
4710
|
+
// checks for custom service url
|
|
4711
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
4712
|
+
);
|
|
4707
4713
|
var BinanceOnrampAPI = class {
|
|
4708
4714
|
constructor(sendResponseFn, broadcastFn) {
|
|
4709
4715
|
this.sseAbortController = null;
|
|
@@ -4714,7 +4720,7 @@ var BinanceOnrampAPI = class {
|
|
|
4714
4720
|
this.disconnectSse();
|
|
4715
4721
|
const controller = new AbortController();
|
|
4716
4722
|
this.sseAbortController = controller;
|
|
4717
|
-
const url = `${
|
|
4723
|
+
const url = `${API_URL2}/sse/events?walletAddress=${encodeURIComponent(walletAddress)}`;
|
|
4718
4724
|
const start = async () => {
|
|
4719
4725
|
try {
|
|
4720
4726
|
const response = await fetch(url, {
|
|
@@ -4766,7 +4772,7 @@ var BinanceOnrampAPI = class {
|
|
|
4766
4772
|
// QUERIES & MUTATIONS
|
|
4767
4773
|
async getTradingPairsQuery(accessToken) {
|
|
4768
4774
|
try {
|
|
4769
|
-
const response = await fetch(`${
|
|
4775
|
+
const response = await fetch(`${API_URL2}/binance/pairs`, {
|
|
4770
4776
|
method: "POST",
|
|
4771
4777
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4772
4778
|
});
|
|
@@ -4778,7 +4784,7 @@ var BinanceOnrampAPI = class {
|
|
|
4778
4784
|
}
|
|
4779
4785
|
async getSupportedNetworksQuery(accessToken) {
|
|
4780
4786
|
try {
|
|
4781
|
-
const response = await fetch(`${
|
|
4787
|
+
const response = await fetch(`${API_URL2}/binance/networks`, {
|
|
4782
4788
|
method: "POST",
|
|
4783
4789
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4784
4790
|
});
|
|
@@ -4790,7 +4796,7 @@ var BinanceOnrampAPI = class {
|
|
|
4790
4796
|
}
|
|
4791
4797
|
async getPaymentMethodsQuery(payload, accessToken) {
|
|
4792
4798
|
try {
|
|
4793
|
-
const response = await fetch(`${
|
|
4799
|
+
const response = await fetch(`${API_URL2}/binance/modes`, {
|
|
4794
4800
|
method: "POST",
|
|
4795
4801
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4796
4802
|
body: JSON.stringify(payload)
|
|
@@ -4803,7 +4809,7 @@ var BinanceOnrampAPI = class {
|
|
|
4803
4809
|
}
|
|
4804
4810
|
async getQuoteQuery(payload, accessToken) {
|
|
4805
4811
|
try {
|
|
4806
|
-
const response = await fetch(`${
|
|
4812
|
+
const response = await fetch(`${API_URL2}/binance/quote`, {
|
|
4807
4813
|
method: "POST",
|
|
4808
4814
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4809
4815
|
body: JSON.stringify(payload)
|
|
@@ -4816,7 +4822,7 @@ var BinanceOnrampAPI = class {
|
|
|
4816
4822
|
}
|
|
4817
4823
|
async createPreorderMutation(payload, accessToken) {
|
|
4818
4824
|
try {
|
|
4819
|
-
const response = await fetch(`${
|
|
4825
|
+
const response = await fetch(`${API_URL2}/binance/pre-order`, {
|
|
4820
4826
|
method: "POST",
|
|
4821
4827
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4822
4828
|
body: JSON.stringify(payload)
|
|
@@ -4830,7 +4836,7 @@ var BinanceOnrampAPI = class {
|
|
|
4830
4836
|
async getTransactionList(params, accessToken) {
|
|
4831
4837
|
try {
|
|
4832
4838
|
const txStatus = Array.isArray(params.txStatuses) ? (params.txStatuses || []).join(",") : null;
|
|
4833
|
-
const apiUrl = new URL(`${
|
|
4839
|
+
const apiUrl = new URL(`${API_URL2}/binance/transactions`);
|
|
4834
4840
|
apiUrl.searchParams.append("walletAddress", params.walletAddress);
|
|
4835
4841
|
if (!!txStatus?.length) apiUrl.searchParams.append("txStatus", txStatus);
|
|
4836
4842
|
if (!!params.page) apiUrl.searchParams.append("page", params.page.toString());
|
|
@@ -4861,7 +4867,10 @@ var BinanceOnrampAPI = class {
|
|
|
4861
4867
|
this.sendResponseFn(messageId, supportedNetworksResponse, origin);
|
|
4862
4868
|
break;
|
|
4863
4869
|
case "BINANCE_GET_PAYMENT_METHODS_QUERY":
|
|
4864
|
-
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
4870
|
+
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
4871
|
+
payload,
|
|
4872
|
+
accessToken
|
|
4873
|
+
);
|
|
4865
4874
|
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
4866
4875
|
break;
|
|
4867
4876
|
case "BINANCE_GET_QUOTE_QUERY":
|
|
@@ -4891,18 +4900,22 @@ var BinanceOnrampAPI = class {
|
|
|
4891
4900
|
};
|
|
4892
4901
|
|
|
4893
4902
|
// src/iframe/lib/onramp/finchpay.ts
|
|
4894
|
-
var
|
|
4903
|
+
var API_URL3 = (
|
|
4904
|
+
// checks for custom service url
|
|
4905
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
4906
|
+
);
|
|
4895
4907
|
var FinchPayRampAPI = class {
|
|
4896
4908
|
constructor(sendResponseFn, broadcastFn) {
|
|
4897
4909
|
this.sseAbortController = null;
|
|
4898
4910
|
this.sendResponseFn = sendResponseFn;
|
|
4899
4911
|
this.broadcastFn = broadcastFn;
|
|
4900
4912
|
}
|
|
4901
|
-
connectSseTxTracing(
|
|
4913
|
+
connectSseTxTracing(payload, accessToken, origin) {
|
|
4914
|
+
const { walletAddress } = payload;
|
|
4902
4915
|
this.disconnectSse();
|
|
4903
4916
|
const controller = new AbortController();
|
|
4904
4917
|
this.sseAbortController = controller;
|
|
4905
|
-
const url = `${
|
|
4918
|
+
const url = `${API_URL3}/sse/events?walletAddress=${encodeURIComponent(walletAddress)}`;
|
|
4906
4919
|
const start = async () => {
|
|
4907
4920
|
try {
|
|
4908
4921
|
const response = await fetch(url, {
|
|
@@ -4954,12 +4967,12 @@ var FinchPayRampAPI = class {
|
|
|
4954
4967
|
// QUERIES & MUTATIONS
|
|
4955
4968
|
async getCurrencies(accessToken) {
|
|
4956
4969
|
try {
|
|
4957
|
-
const response = await fetch(`${
|
|
4970
|
+
const response = await fetch(`${API_URL3}/finchpay/currencies`, {
|
|
4958
4971
|
method: "GET",
|
|
4959
4972
|
headers: { ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4960
4973
|
});
|
|
4961
4974
|
const data = await response.json();
|
|
4962
|
-
if (!data.
|
|
4975
|
+
if (!data.length) {
|
|
4963
4976
|
console.warn("[FINCHPAY] Failed to fetch currencies:", data);
|
|
4964
4977
|
throw new Error(`${data.code}: ${data.message}`);
|
|
4965
4978
|
}
|
|
@@ -4969,7 +4982,7 @@ var FinchPayRampAPI = class {
|
|
|
4969
4982
|
}
|
|
4970
4983
|
}
|
|
4971
4984
|
async getLimits(payload, accessToken) {
|
|
4972
|
-
const response = await fetch(`${
|
|
4985
|
+
const response = await fetch(`${API_URL3}/finchpay/limits`, {
|
|
4973
4986
|
method: "POST",
|
|
4974
4987
|
body: JSON.stringify(payload),
|
|
4975
4988
|
headers: {
|
|
@@ -4978,14 +4991,14 @@ var FinchPayRampAPI = class {
|
|
|
4978
4991
|
}
|
|
4979
4992
|
});
|
|
4980
4993
|
const data = await response.json();
|
|
4981
|
-
if (!data
|
|
4994
|
+
if (!data?.currency) {
|
|
4982
4995
|
console.warn("[FINCHPAY] Failed to fetch limits:", data);
|
|
4983
4996
|
throw new Error(`${data.code}: ${data.message}`);
|
|
4984
4997
|
}
|
|
4985
4998
|
return data;
|
|
4986
4999
|
}
|
|
4987
5000
|
async getLimitsSummary(payload, accessToken) {
|
|
4988
|
-
const response = await fetch(`${
|
|
5001
|
+
const response = await fetch(`${API_URL3}/finchpay/limits/summary`, {
|
|
4989
5002
|
method: "POST",
|
|
4990
5003
|
body: JSON.stringify(payload),
|
|
4991
5004
|
headers: {
|
|
@@ -4994,14 +5007,14 @@ var FinchPayRampAPI = class {
|
|
|
4994
5007
|
}
|
|
4995
5008
|
});
|
|
4996
5009
|
const data = await response.json();
|
|
4997
|
-
if (!data
|
|
5010
|
+
if (!data?.currency) {
|
|
4998
5011
|
console.warn("[FINCHPAY] Failed to fetch limits summary:", data);
|
|
4999
5012
|
throw new Error(`${data.code}: ${data.message}`);
|
|
5000
5013
|
}
|
|
5001
5014
|
return data;
|
|
5002
5015
|
}
|
|
5003
5016
|
async getEstimates(payload, accessToken) {
|
|
5004
|
-
const response = await fetch(`${
|
|
5017
|
+
const response = await fetch(`${API_URL3}/finchpay/estimates`, {
|
|
5005
5018
|
method: "POST",
|
|
5006
5019
|
body: JSON.stringify(payload),
|
|
5007
5020
|
headers: {
|
|
@@ -5010,15 +5023,15 @@ var FinchPayRampAPI = class {
|
|
|
5010
5023
|
}
|
|
5011
5024
|
});
|
|
5012
5025
|
const data = await response.json();
|
|
5013
|
-
if (!data
|
|
5026
|
+
if (!data) {
|
|
5014
5027
|
console.warn("[FINCHPAY] Failed to fetch estimates:", data);
|
|
5015
5028
|
throw new Error(`${data.code}: ${data.message}`);
|
|
5016
5029
|
}
|
|
5017
5030
|
return data;
|
|
5018
5031
|
}
|
|
5019
|
-
async getTransactionStatus(
|
|
5032
|
+
async getTransactionStatus(payload, accessToken) {
|
|
5020
5033
|
try {
|
|
5021
|
-
const response = await fetch(`${
|
|
5034
|
+
const response = await fetch(`${API_URL3}/finchpay/transaction/${payload?.transactionId}`, {
|
|
5022
5035
|
method: "GET",
|
|
5023
5036
|
headers: {
|
|
5024
5037
|
"Content-Type": "application/json",
|
|
@@ -5026,10 +5039,6 @@ var FinchPayRampAPI = class {
|
|
|
5026
5039
|
}
|
|
5027
5040
|
});
|
|
5028
5041
|
const data = await response.json();
|
|
5029
|
-
if (!data.success) {
|
|
5030
|
-
console.warn("[FINCHPAY] Failed to fetch transaction status:", data);
|
|
5031
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
5032
|
-
}
|
|
5033
5042
|
return data;
|
|
5034
5043
|
} catch (error) {
|
|
5035
5044
|
throw error;
|
|
@@ -5037,7 +5046,7 @@ var FinchPayRampAPI = class {
|
|
|
5037
5046
|
}
|
|
5038
5047
|
async getWidgetUrl(payload, accessToken) {
|
|
5039
5048
|
try {
|
|
5040
|
-
const response = await fetch(`${
|
|
5049
|
+
const response = await fetch(`${API_URL3}/finchpay/widget-url`, {
|
|
5041
5050
|
method: "POST",
|
|
5042
5051
|
body: JSON.stringify(payload),
|
|
5043
5052
|
headers: {
|
|
@@ -5046,10 +5055,6 @@ var FinchPayRampAPI = class {
|
|
|
5046
5055
|
}
|
|
5047
5056
|
});
|
|
5048
5057
|
const data = await response.json();
|
|
5049
|
-
if (!data.success) {
|
|
5050
|
-
console.warn("[FINCHPAY] Failed to fetch widget URL:", data);
|
|
5051
|
-
throw new Error(`${data.code}: ${data.message}`);
|
|
5052
|
-
}
|
|
5053
5058
|
return data;
|
|
5054
5059
|
} catch (error) {
|
|
5055
5060
|
throw error;
|
|
@@ -5058,7 +5063,7 @@ var FinchPayRampAPI = class {
|
|
|
5058
5063
|
async getTransactionList(params, accessToken) {
|
|
5059
5064
|
try {
|
|
5060
5065
|
const txStatus = Array.isArray(params.txStatuses) ? (params.txStatuses || []).join(",") : null;
|
|
5061
|
-
const apiUrl = new URL(`${
|
|
5066
|
+
const apiUrl = new URL(`${API_URL3}/finchpay/tx-trace`);
|
|
5062
5067
|
apiUrl.searchParams.append("walletAddress", params.walletAddress);
|
|
5063
5068
|
if (!!txStatus?.length) apiUrl.searchParams.append("txStatus", txStatus);
|
|
5064
5069
|
if (!!params.page) apiUrl.searchParams.append("page", params.page.toString());
|
|
@@ -5088,7 +5093,10 @@ var FinchPayRampAPI = class {
|
|
|
5088
5093
|
this.sendResponseFn(messageId, limitsResponse, origin);
|
|
5089
5094
|
break;
|
|
5090
5095
|
case "FINCHPAY_GET_LIMITS_SUMMARY_QUERY":
|
|
5091
|
-
const limitsSummaryResponse = await this.getLimitsSummary(
|
|
5096
|
+
const limitsSummaryResponse = await this.getLimitsSummary(
|
|
5097
|
+
data.payload,
|
|
5098
|
+
accessToken
|
|
5099
|
+
);
|
|
5092
5100
|
this.sendResponseFn(messageId, limitsSummaryResponse, origin);
|
|
5093
5101
|
break;
|
|
5094
5102
|
case "FINCHPAY_GET_ESTIMATES_QUERY":
|
|
@@ -5096,7 +5104,10 @@ var FinchPayRampAPI = class {
|
|
|
5096
5104
|
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
5097
5105
|
break;
|
|
5098
5106
|
case "FINCHPAY_GET_TRANSACTION_STATUS_QUERY":
|
|
5099
|
-
const transactionStatusResponse = await this.getTransactionStatus(
|
|
5107
|
+
const transactionStatusResponse = await this.getTransactionStatus(
|
|
5108
|
+
data.payload,
|
|
5109
|
+
accessToken
|
|
5110
|
+
);
|
|
5100
5111
|
this.sendResponseFn(messageId, transactionStatusResponse, origin);
|
|
5101
5112
|
break;
|
|
5102
5113
|
case "FINCHPAY_GET_WIDGET_URL_QUERY":
|
|
@@ -5108,7 +5119,7 @@ var FinchPayRampAPI = class {
|
|
|
5108
5119
|
this.sendResponseFn(messageId, txListResponse, origin);
|
|
5109
5120
|
break;
|
|
5110
5121
|
case "FINCHPAY_CONNECT_TX_TRACING":
|
|
5111
|
-
this.connectSseTxTracing(data.payload
|
|
5122
|
+
this.connectSseTxTracing(data.payload, accessToken, origin);
|
|
5112
5123
|
this.sendResponseFn(messageId, { connected: true }, origin);
|
|
5113
5124
|
break;
|
|
5114
5125
|
case "FINCHPAY_DISCONNECT_TX_TRACING":
|
|
@@ -5121,23 +5132,17 @@ var FinchPayRampAPI = class {
|
|
|
5121
5132
|
}
|
|
5122
5133
|
};
|
|
5123
5134
|
|
|
5124
|
-
// src/iframe/lib/onramp/utils.ts
|
|
5125
|
-
function omit2(object, ...keys2) {
|
|
5126
|
-
const result = { ...object };
|
|
5127
|
-
for (const key of keys2) {
|
|
5128
|
-
delete result[key];
|
|
5129
|
-
}
|
|
5130
|
-
return result;
|
|
5131
|
-
}
|
|
5132
|
-
|
|
5133
5135
|
// src/iframe/lib/onramp/rampnow.ts
|
|
5134
|
-
var
|
|
5136
|
+
var API_DOMAIN = (
|
|
5137
|
+
// checks for custom service url
|
|
5138
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
5139
|
+
);
|
|
5135
5140
|
var RampnowOnrampAPI = class {
|
|
5136
5141
|
constructor(sendResponseFn) {
|
|
5137
5142
|
this.sendResponseFn = sendResponseFn;
|
|
5138
5143
|
}
|
|
5139
5144
|
async getRampnowConfigQuery(accessToken) {
|
|
5140
|
-
const response = await fetch(`${
|
|
5145
|
+
const response = await fetch(`${API_DOMAIN}/rampnow/cfg`, {
|
|
5141
5146
|
method: "GET",
|
|
5142
5147
|
headers: { ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
5143
5148
|
});
|
|
@@ -5145,7 +5150,7 @@ var RampnowOnrampAPI = class {
|
|
|
5145
5150
|
return data;
|
|
5146
5151
|
}
|
|
5147
5152
|
async getRampOrderQuoteQuery(payload, accessToken) {
|
|
5148
|
-
const response = await fetch(`${
|
|
5153
|
+
const response = await fetch(`${API_DOMAIN}/rampnow/quote`, {
|
|
5149
5154
|
method: "POST",
|
|
5150
5155
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
5151
5156
|
body: JSON.stringify(payload)
|
|
@@ -5160,7 +5165,7 @@ var RampnowOnrampAPI = class {
|
|
|
5160
5165
|
if (typeof payload !== "object" || payload === null || typeof payload?.paymentMode !== "string" || typeof payload?.srcAmount !== "number" || typeof payload?.walletAddress !== "string") {
|
|
5161
5166
|
throw new Error("Invalid Ramp order quote payload");
|
|
5162
5167
|
}
|
|
5163
|
-
return
|
|
5168
|
+
return omit_default(payload, "accessToken");
|
|
5164
5169
|
}
|
|
5165
5170
|
// UNUSED due to Rampnow APP redirect order flow
|
|
5166
5171
|
// async ctreateChekoutOrderMutation(payload: CreateCheckoutOrderMutationPayload) {
|
|
@@ -5938,7 +5943,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
5938
5943
|
super();
|
|
5939
5944
|
this.wasmLoaded = false;
|
|
5940
5945
|
this.explorerUrl = "https://beam-explorer.lumia.org";
|
|
5941
|
-
this.METADATA_API_URL = "https://dashboard.
|
|
5946
|
+
this.METADATA_API_URL = "https://dashboard.embarkai.io/api/public/project";
|
|
5942
5947
|
this.METADATA_CACHE_TTL = 36e5;
|
|
5943
5948
|
// 1 hour in milliseconds
|
|
5944
5949
|
this.metadataCache = /* @__PURE__ */ new Map();
|
|
@@ -6384,7 +6389,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
6384
6389
|
};
|
|
6385
6390
|
|
|
6386
6391
|
// src/iframe/main.ts
|
|
6387
|
-
var IFRAME_VERSION = "0.4.
|
|
6392
|
+
var IFRAME_VERSION = "0.4.33";
|
|
6388
6393
|
var IframeWallet = class {
|
|
6389
6394
|
constructor() {
|
|
6390
6395
|
console.log("=".repeat(60));
|
|
@@ -6429,8 +6434,8 @@ var IframeWallet = class {
|
|
|
6429
6434
|
this.rampnow = new RampnowOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
6430
6435
|
}
|
|
6431
6436
|
async initialize() {
|
|
6432
|
-
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("
|
|
6433
|
-
console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin
|
|
6437
|
+
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("embarkai.com")) {
|
|
6438
|
+
console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin!: ", window.location.hostname);
|
|
6434
6439
|
}
|
|
6435
6440
|
await Promise.all([this.dkgManager.initialize(), this.signingManager.initialize()]);
|
|
6436
6441
|
this.messenger.setupListener(async (message, origin) => {
|