@embarkai/ui-kit 0.4.32 → 0.4.34
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 +71 -64
- package/dist/index.cjs +2945 -3128
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2531 -2713
- package/dist/styles.css +1 -1
- 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.34</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, {
|
|
@@ -4764,9 +4770,10 @@ var BinanceOnrampAPI = class {
|
|
|
4764
4770
|
}
|
|
4765
4771
|
}
|
|
4766
4772
|
// QUERIES & MUTATIONS
|
|
4773
|
+
/** https://developers.binance.com/docs/binance_connect/on-ramp-buy-apis/1.get-trading-pairs */
|
|
4767
4774
|
async getTradingPairsQuery(accessToken) {
|
|
4768
4775
|
try {
|
|
4769
|
-
const response = await fetch(`${
|
|
4776
|
+
const response = await fetch(`${API_URL2}/binance/pairs`, {
|
|
4770
4777
|
method: "POST",
|
|
4771
4778
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4772
4779
|
});
|
|
@@ -4776,9 +4783,10 @@ var BinanceOnrampAPI = class {
|
|
|
4776
4783
|
throw error;
|
|
4777
4784
|
}
|
|
4778
4785
|
}
|
|
4786
|
+
/** https://developers.binance.com/docs/binance_connect/on-ramp-buy-apis/2.get-crypto-networks */
|
|
4779
4787
|
async getSupportedNetworksQuery(accessToken) {
|
|
4780
4788
|
try {
|
|
4781
|
-
const response = await fetch(`${
|
|
4789
|
+
const response = await fetch(`${API_URL2}/binance/networks`, {
|
|
4782
4790
|
method: "POST",
|
|
4783
4791
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4784
4792
|
});
|
|
@@ -4790,7 +4798,7 @@ var BinanceOnrampAPI = class {
|
|
|
4790
4798
|
}
|
|
4791
4799
|
async getPaymentMethodsQuery(payload, accessToken) {
|
|
4792
4800
|
try {
|
|
4793
|
-
const response = await fetch(`${
|
|
4801
|
+
const response = await fetch(`${API_URL2}/binance/modes`, {
|
|
4794
4802
|
method: "POST",
|
|
4795
4803
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4796
4804
|
body: JSON.stringify(payload)
|
|
@@ -4803,7 +4811,7 @@ var BinanceOnrampAPI = class {
|
|
|
4803
4811
|
}
|
|
4804
4812
|
async getQuoteQuery(payload, accessToken) {
|
|
4805
4813
|
try {
|
|
4806
|
-
const response = await fetch(`${
|
|
4814
|
+
const response = await fetch(`${API_URL2}/binance/quote`, {
|
|
4807
4815
|
method: "POST",
|
|
4808
4816
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4809
4817
|
body: JSON.stringify(payload)
|
|
@@ -4816,7 +4824,7 @@ var BinanceOnrampAPI = class {
|
|
|
4816
4824
|
}
|
|
4817
4825
|
async createPreorderMutation(payload, accessToken) {
|
|
4818
4826
|
try {
|
|
4819
|
-
const response = await fetch(`${
|
|
4827
|
+
const response = await fetch(`${API_URL2}/binance/pre-order`, {
|
|
4820
4828
|
method: "POST",
|
|
4821
4829
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
4822
4830
|
body: JSON.stringify(payload)
|
|
@@ -4830,7 +4838,7 @@ var BinanceOnrampAPI = class {
|
|
|
4830
4838
|
async getTransactionList(params, accessToken) {
|
|
4831
4839
|
try {
|
|
4832
4840
|
const txStatus = Array.isArray(params.txStatuses) ? (params.txStatuses || []).join(",") : null;
|
|
4833
|
-
const apiUrl = new URL(`${
|
|
4841
|
+
const apiUrl = new URL(`${API_URL2}/binance/transactions`);
|
|
4834
4842
|
apiUrl.searchParams.append("walletAddress", params.walletAddress);
|
|
4835
4843
|
if (!!txStatus?.length) apiUrl.searchParams.append("txStatus", txStatus);
|
|
4836
4844
|
if (!!params.page) apiUrl.searchParams.append("page", params.page.toString());
|
|
@@ -4861,7 +4869,10 @@ var BinanceOnrampAPI = class {
|
|
|
4861
4869
|
this.sendResponseFn(messageId, supportedNetworksResponse, origin);
|
|
4862
4870
|
break;
|
|
4863
4871
|
case "BINANCE_GET_PAYMENT_METHODS_QUERY":
|
|
4864
|
-
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
4872
|
+
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
4873
|
+
payload,
|
|
4874
|
+
accessToken
|
|
4875
|
+
);
|
|
4865
4876
|
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
4866
4877
|
break;
|
|
4867
4878
|
case "BINANCE_GET_QUOTE_QUERY":
|
|
@@ -4891,18 +4902,22 @@ var BinanceOnrampAPI = class {
|
|
|
4891
4902
|
};
|
|
4892
4903
|
|
|
4893
4904
|
// src/iframe/lib/onramp/finchpay.ts
|
|
4894
|
-
var
|
|
4905
|
+
var API_URL3 = (
|
|
4906
|
+
// checks for custom service url
|
|
4907
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
4908
|
+
);
|
|
4895
4909
|
var FinchPayRampAPI = class {
|
|
4896
4910
|
constructor(sendResponseFn, broadcastFn) {
|
|
4897
4911
|
this.sseAbortController = null;
|
|
4898
4912
|
this.sendResponseFn = sendResponseFn;
|
|
4899
4913
|
this.broadcastFn = broadcastFn;
|
|
4900
4914
|
}
|
|
4901
|
-
connectSseTxTracing(
|
|
4915
|
+
connectSseTxTracing(payload, accessToken, origin) {
|
|
4916
|
+
const { walletAddress } = payload;
|
|
4902
4917
|
this.disconnectSse();
|
|
4903
4918
|
const controller = new AbortController();
|
|
4904
4919
|
this.sseAbortController = controller;
|
|
4905
|
-
const url = `${
|
|
4920
|
+
const url = `${API_URL3}/sse/events?walletAddress=${encodeURIComponent(walletAddress)}`;
|
|
4906
4921
|
const start = async () => {
|
|
4907
4922
|
try {
|
|
4908
4923
|
const response = await fetch(url, {
|
|
@@ -4954,12 +4969,12 @@ var FinchPayRampAPI = class {
|
|
|
4954
4969
|
// QUERIES & MUTATIONS
|
|
4955
4970
|
async getCurrencies(accessToken) {
|
|
4956
4971
|
try {
|
|
4957
|
-
const response = await fetch(`${
|
|
4972
|
+
const response = await fetch(`${API_URL3}/finchpay/currencies`, {
|
|
4958
4973
|
method: "GET",
|
|
4959
4974
|
headers: { ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
4960
4975
|
});
|
|
4961
4976
|
const data = await response.json();
|
|
4962
|
-
if (!data.
|
|
4977
|
+
if (!data.length) {
|
|
4963
4978
|
console.warn("[FINCHPAY] Failed to fetch currencies:", data);
|
|
4964
4979
|
throw new Error(`${data.code}: ${data.message}`);
|
|
4965
4980
|
}
|
|
@@ -4969,7 +4984,7 @@ var FinchPayRampAPI = class {
|
|
|
4969
4984
|
}
|
|
4970
4985
|
}
|
|
4971
4986
|
async getLimits(payload, accessToken) {
|
|
4972
|
-
const response = await fetch(`${
|
|
4987
|
+
const response = await fetch(`${API_URL3}/finchpay/limits`, {
|
|
4973
4988
|
method: "POST",
|
|
4974
4989
|
body: JSON.stringify(payload),
|
|
4975
4990
|
headers: {
|
|
@@ -4978,14 +4993,14 @@ var FinchPayRampAPI = class {
|
|
|
4978
4993
|
}
|
|
4979
4994
|
});
|
|
4980
4995
|
const data = await response.json();
|
|
4981
|
-
if (!data
|
|
4996
|
+
if (!data?.currency) {
|
|
4982
4997
|
console.warn("[FINCHPAY] Failed to fetch limits:", data);
|
|
4983
4998
|
throw new Error(`${data.code}: ${data.message}`);
|
|
4984
4999
|
}
|
|
4985
5000
|
return data;
|
|
4986
5001
|
}
|
|
4987
5002
|
async getLimitsSummary(payload, accessToken) {
|
|
4988
|
-
const response = await fetch(`${
|
|
5003
|
+
const response = await fetch(`${API_URL3}/finchpay/limits/summary`, {
|
|
4989
5004
|
method: "POST",
|
|
4990
5005
|
body: JSON.stringify(payload),
|
|
4991
5006
|
headers: {
|
|
@@ -4994,14 +5009,14 @@ var FinchPayRampAPI = class {
|
|
|
4994
5009
|
}
|
|
4995
5010
|
});
|
|
4996
5011
|
const data = await response.json();
|
|
4997
|
-
if (!data
|
|
5012
|
+
if (!data?.currency) {
|
|
4998
5013
|
console.warn("[FINCHPAY] Failed to fetch limits summary:", data);
|
|
4999
5014
|
throw new Error(`${data.code}: ${data.message}`);
|
|
5000
5015
|
}
|
|
5001
5016
|
return data;
|
|
5002
5017
|
}
|
|
5003
5018
|
async getEstimates(payload, accessToken) {
|
|
5004
|
-
const response = await fetch(`${
|
|
5019
|
+
const response = await fetch(`${API_URL3}/finchpay/estimates`, {
|
|
5005
5020
|
method: "POST",
|
|
5006
5021
|
body: JSON.stringify(payload),
|
|
5007
5022
|
headers: {
|
|
@@ -5010,15 +5025,15 @@ var FinchPayRampAPI = class {
|
|
|
5010
5025
|
}
|
|
5011
5026
|
});
|
|
5012
5027
|
const data = await response.json();
|
|
5013
|
-
if (!data
|
|
5028
|
+
if (!data) {
|
|
5014
5029
|
console.warn("[FINCHPAY] Failed to fetch estimates:", data);
|
|
5015
5030
|
throw new Error(`${data.code}: ${data.message}`);
|
|
5016
5031
|
}
|
|
5017
5032
|
return data;
|
|
5018
5033
|
}
|
|
5019
|
-
async getTransactionStatus(
|
|
5034
|
+
async getTransactionStatus(payload, accessToken) {
|
|
5020
5035
|
try {
|
|
5021
|
-
const response = await fetch(`${
|
|
5036
|
+
const response = await fetch(`${API_URL3}/finchpay/transaction/${payload?.transactionId}`, {
|
|
5022
5037
|
method: "GET",
|
|
5023
5038
|
headers: {
|
|
5024
5039
|
"Content-Type": "application/json",
|
|
@@ -5026,10 +5041,6 @@ var FinchPayRampAPI = class {
|
|
|
5026
5041
|
}
|
|
5027
5042
|
});
|
|
5028
5043
|
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
5044
|
return data;
|
|
5034
5045
|
} catch (error) {
|
|
5035
5046
|
throw error;
|
|
@@ -5037,7 +5048,7 @@ var FinchPayRampAPI = class {
|
|
|
5037
5048
|
}
|
|
5038
5049
|
async getWidgetUrl(payload, accessToken) {
|
|
5039
5050
|
try {
|
|
5040
|
-
const response = await fetch(`${
|
|
5051
|
+
const response = await fetch(`${API_URL3}/finchpay/widget-url`, {
|
|
5041
5052
|
method: "POST",
|
|
5042
5053
|
body: JSON.stringify(payload),
|
|
5043
5054
|
headers: {
|
|
@@ -5046,10 +5057,6 @@ var FinchPayRampAPI = class {
|
|
|
5046
5057
|
}
|
|
5047
5058
|
});
|
|
5048
5059
|
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
5060
|
return data;
|
|
5054
5061
|
} catch (error) {
|
|
5055
5062
|
throw error;
|
|
@@ -5058,7 +5065,7 @@ var FinchPayRampAPI = class {
|
|
|
5058
5065
|
async getTransactionList(params, accessToken) {
|
|
5059
5066
|
try {
|
|
5060
5067
|
const txStatus = Array.isArray(params.txStatuses) ? (params.txStatuses || []).join(",") : null;
|
|
5061
|
-
const apiUrl = new URL(`${
|
|
5068
|
+
const apiUrl = new URL(`${API_URL3}/finchpay/tx-trace`);
|
|
5062
5069
|
apiUrl.searchParams.append("walletAddress", params.walletAddress);
|
|
5063
5070
|
if (!!txStatus?.length) apiUrl.searchParams.append("txStatus", txStatus);
|
|
5064
5071
|
if (!!params.page) apiUrl.searchParams.append("page", params.page.toString());
|
|
@@ -5088,7 +5095,10 @@ var FinchPayRampAPI = class {
|
|
|
5088
5095
|
this.sendResponseFn(messageId, limitsResponse, origin);
|
|
5089
5096
|
break;
|
|
5090
5097
|
case "FINCHPAY_GET_LIMITS_SUMMARY_QUERY":
|
|
5091
|
-
const limitsSummaryResponse = await this.getLimitsSummary(
|
|
5098
|
+
const limitsSummaryResponse = await this.getLimitsSummary(
|
|
5099
|
+
data.payload,
|
|
5100
|
+
accessToken
|
|
5101
|
+
);
|
|
5092
5102
|
this.sendResponseFn(messageId, limitsSummaryResponse, origin);
|
|
5093
5103
|
break;
|
|
5094
5104
|
case "FINCHPAY_GET_ESTIMATES_QUERY":
|
|
@@ -5096,7 +5106,10 @@ var FinchPayRampAPI = class {
|
|
|
5096
5106
|
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
5097
5107
|
break;
|
|
5098
5108
|
case "FINCHPAY_GET_TRANSACTION_STATUS_QUERY":
|
|
5099
|
-
const transactionStatusResponse = await this.getTransactionStatus(
|
|
5109
|
+
const transactionStatusResponse = await this.getTransactionStatus(
|
|
5110
|
+
data.payload,
|
|
5111
|
+
accessToken
|
|
5112
|
+
);
|
|
5100
5113
|
this.sendResponseFn(messageId, transactionStatusResponse, origin);
|
|
5101
5114
|
break;
|
|
5102
5115
|
case "FINCHPAY_GET_WIDGET_URL_QUERY":
|
|
@@ -5108,7 +5121,7 @@ var FinchPayRampAPI = class {
|
|
|
5108
5121
|
this.sendResponseFn(messageId, txListResponse, origin);
|
|
5109
5122
|
break;
|
|
5110
5123
|
case "FINCHPAY_CONNECT_TX_TRACING":
|
|
5111
|
-
this.connectSseTxTracing(data.payload
|
|
5124
|
+
this.connectSseTxTracing(data.payload, accessToken, origin);
|
|
5112
5125
|
this.sendResponseFn(messageId, { connected: true }, origin);
|
|
5113
5126
|
break;
|
|
5114
5127
|
case "FINCHPAY_DISCONNECT_TX_TRACING":
|
|
@@ -5121,23 +5134,17 @@ var FinchPayRampAPI = class {
|
|
|
5121
5134
|
}
|
|
5122
5135
|
};
|
|
5123
5136
|
|
|
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
5137
|
// src/iframe/lib/onramp/rampnow.ts
|
|
5134
|
-
var
|
|
5138
|
+
var API_DOMAIN = (
|
|
5139
|
+
// checks for custom service url
|
|
5140
|
+
typeof window.__EMBARK_SERVICES__ !== "undefined" && window.__EMBARK_SERVICES__?.assetApiUrl || "https://api.embarkai.io/on-ramp/api"
|
|
5141
|
+
);
|
|
5135
5142
|
var RampnowOnrampAPI = class {
|
|
5136
5143
|
constructor(sendResponseFn) {
|
|
5137
5144
|
this.sendResponseFn = sendResponseFn;
|
|
5138
5145
|
}
|
|
5139
5146
|
async getRampnowConfigQuery(accessToken) {
|
|
5140
|
-
const response = await fetch(`${
|
|
5147
|
+
const response = await fetch(`${API_DOMAIN}/rampnow/cfg`, {
|
|
5141
5148
|
method: "GET",
|
|
5142
5149
|
headers: { ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
5143
5150
|
});
|
|
@@ -5145,7 +5152,7 @@ var RampnowOnrampAPI = class {
|
|
|
5145
5152
|
return data;
|
|
5146
5153
|
}
|
|
5147
5154
|
async getRampOrderQuoteQuery(payload, accessToken) {
|
|
5148
|
-
const response = await fetch(`${
|
|
5155
|
+
const response = await fetch(`${API_DOMAIN}/rampnow/quote`, {
|
|
5149
5156
|
method: "POST",
|
|
5150
5157
|
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
5151
5158
|
body: JSON.stringify(payload)
|
|
@@ -5160,7 +5167,7 @@ var RampnowOnrampAPI = class {
|
|
|
5160
5167
|
if (typeof payload !== "object" || payload === null || typeof payload?.paymentMode !== "string" || typeof payload?.srcAmount !== "number" || typeof payload?.walletAddress !== "string") {
|
|
5161
5168
|
throw new Error("Invalid Ramp order quote payload");
|
|
5162
5169
|
}
|
|
5163
|
-
return
|
|
5170
|
+
return omit_default(payload, "accessToken");
|
|
5164
5171
|
}
|
|
5165
5172
|
// UNUSED due to Rampnow APP redirect order flow
|
|
5166
5173
|
// async ctreateChekoutOrderMutation(payload: CreateCheckoutOrderMutationPayload) {
|
|
@@ -5938,7 +5945,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
5938
5945
|
super();
|
|
5939
5946
|
this.wasmLoaded = false;
|
|
5940
5947
|
this.explorerUrl = "https://beam-explorer.lumia.org";
|
|
5941
|
-
this.METADATA_API_URL = "https://dashboard.
|
|
5948
|
+
this.METADATA_API_URL = "https://dashboard.embarkai.io/api/public/project";
|
|
5942
5949
|
this.METADATA_CACHE_TTL = 36e5;
|
|
5943
5950
|
// 1 hour in milliseconds
|
|
5944
5951
|
this.metadataCache = /* @__PURE__ */ new Map();
|
|
@@ -6384,7 +6391,7 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
6384
6391
|
};
|
|
6385
6392
|
|
|
6386
6393
|
// src/iframe/main.ts
|
|
6387
|
-
var IFRAME_VERSION = "0.4.
|
|
6394
|
+
var IFRAME_VERSION = "0.4.34";
|
|
6388
6395
|
var IframeWallet = class {
|
|
6389
6396
|
constructor() {
|
|
6390
6397
|
console.log("=".repeat(60));
|
|
@@ -6429,8 +6436,8 @@ var IframeWallet = class {
|
|
|
6429
6436
|
this.rampnow = new RampnowOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
6430
6437
|
}
|
|
6431
6438
|
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
|
|
6439
|
+
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("embarkai.com")) {
|
|
6440
|
+
console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin!: ", window.location.hostname);
|
|
6434
6441
|
}
|
|
6435
6442
|
await Promise.all([this.dkgManager.initialize(), this.signingManager.initialize()]);
|
|
6436
6443
|
this.messenger.setupListener(async (message, origin) => {
|