@coinlist-co/react 0.10.0 → 0.10.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/{chunk-GSSAB4K5.js → chunk-AQVCOWOV.js} +163 -69
- package/dist/chunk-AQVCOWOV.js.map +1 -0
- package/dist/{chunk-7BJ2HAG7.js → chunk-TBU3EBNM.js} +2 -2
- package/dist/{chunk-TUZKKFNW.js → chunk-UOHD7US2.js} +53 -34
- package/dist/chunk-UOHD7US2.js.map +1 -0
- package/dist/client/index.cjs +292 -295
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +5 -4
- package/dist/client/index.js.map +1 -1
- package/dist/{collections-ZYLKp8JB.d.ts → collections-Bv1Oxzu_.d.ts} +1 -1
- package/dist/{collections-CJ24dOda.d.cts → collections-DDyxbOPZ.d.cts} +1 -1
- package/dist/{requirement-CDi5NJI8.d.cts → requirement-oVZA1INj.d.cts} +5 -1
- package/dist/{requirement-CDi5NJI8.d.ts → requirement-oVZA1INj.d.ts} +5 -1
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +3 -5
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +4 -4
- package/dist/shared/index.d.ts +4 -4
- package/dist/shared/index.js +12 -92
- package/dist/shared/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-AAER5LOL.js +0 -22
- package/dist/chunk-AAER5LOL.js.map +0 -1
- package/dist/chunk-GSSAB4K5.js.map +0 -1
- package/dist/chunk-TUZKKFNW.js.map +0 -1
- /package/dist/{chunk-7BJ2HAG7.js.map → chunk-TBU3EBNM.js.map} +0 -0
package/dist/client/index.cjs
CHANGED
|
@@ -1655,6 +1655,117 @@ var PaginationParams = {
|
|
|
1655
1655
|
}
|
|
1656
1656
|
};
|
|
1657
1657
|
|
|
1658
|
+
// src/shared/types/blockchain/ui.ts
|
|
1659
|
+
var ShortenedWalletAddress = (value) => value;
|
|
1660
|
+
var FormattedAmountAssetUi = (value) => value;
|
|
1661
|
+
|
|
1662
|
+
// src/shared/core/blockchain/formatters.ts
|
|
1663
|
+
var import_viem3 = require("viem");
|
|
1664
|
+
function shortenAddress(address) {
|
|
1665
|
+
const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
1666
|
+
return ShortenedWalletAddress(short);
|
|
1667
|
+
}
|
|
1668
|
+
function formatRawAmount(amount) {
|
|
1669
|
+
return (0, import_viem3.formatUnits)(amount.raw, amount.decimals);
|
|
1670
|
+
}
|
|
1671
|
+
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
1672
|
+
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
1673
|
+
|
|
1674
|
+
// src/shared/core/blockchain/swap/constants.ts
|
|
1675
|
+
var SWAP_POLL_INTERVAL_MS = 15e3;
|
|
1676
|
+
var SLIPPAGE_OPTIONS_BPS = [25n, 50n, 100n, 200n, 500n].map(
|
|
1677
|
+
(n) => Bps(n)
|
|
1678
|
+
);
|
|
1679
|
+
var DEFAULT_SLIPPAGE_BPS = Bps(50n);
|
|
1680
|
+
var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("0x84f8e9a6C9Cc12fe911259372EfCa5582C4ae557");
|
|
1681
|
+
|
|
1682
|
+
// src/shared/core/blockchain/swap/quote.ts
|
|
1683
|
+
var SwapQuote = {
|
|
1684
|
+
/**
|
|
1685
|
+
* Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
|
|
1686
|
+
* input and fee are denominated in the input token; the output in the output
|
|
1687
|
+
* token.
|
|
1688
|
+
*/
|
|
1689
|
+
fromPreview: (preview, inputDecimals, outputDecimals) => ({
|
|
1690
|
+
inputTokenAmount: BlockchainAmount({
|
|
1691
|
+
raw: preview.inputAmount,
|
|
1692
|
+
decimals: inputDecimals
|
|
1693
|
+
}),
|
|
1694
|
+
fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),
|
|
1695
|
+
outputTokenAmount: BlockchainAmount({
|
|
1696
|
+
raw: preview.outputAmount,
|
|
1697
|
+
decimals: outputDecimals
|
|
1698
|
+
})
|
|
1699
|
+
})
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
// src/shared/core/blockchain/token-registry.ts
|
|
1703
|
+
var USDC_SYMBOL = StablecoinSymbol("USDC");
|
|
1704
|
+
var USDC = {
|
|
1705
|
+
name: "USD Coin",
|
|
1706
|
+
symbol: USDC_SYMBOL,
|
|
1707
|
+
decimals: AssetDecimals(6)
|
|
1708
|
+
};
|
|
1709
|
+
var USDT_SYMBOL = StablecoinSymbol("USDT");
|
|
1710
|
+
var USDT = {
|
|
1711
|
+
name: "Tether USD",
|
|
1712
|
+
symbol: USDT_SYMBOL,
|
|
1713
|
+
decimals: AssetDecimals(6)
|
|
1714
|
+
};
|
|
1715
|
+
var USDC_ADDRESSES = {
|
|
1716
|
+
ethereum_mainnet: EvmContractAddress(
|
|
1717
|
+
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
|
1718
|
+
),
|
|
1719
|
+
ethereum_sepolia: EvmContractAddress(
|
|
1720
|
+
"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
1721
|
+
)
|
|
1722
|
+
};
|
|
1723
|
+
var USDT_ADDRESSES = {
|
|
1724
|
+
ethereum_mainnet: EvmContractAddress(
|
|
1725
|
+
"0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
1726
|
+
),
|
|
1727
|
+
ethereum_sepolia: EvmContractAddress(
|
|
1728
|
+
"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06"
|
|
1729
|
+
)
|
|
1730
|
+
};
|
|
1731
|
+
var TOKEN_REGISTRY = {
|
|
1732
|
+
erc20: (symbol) => {
|
|
1733
|
+
switch (symbol) {
|
|
1734
|
+
case "USDC":
|
|
1735
|
+
return USDC;
|
|
1736
|
+
case "USDT":
|
|
1737
|
+
return USDT;
|
|
1738
|
+
default:
|
|
1739
|
+
throw new Error(`Unknown asset symbol: ${symbol}`);
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
contractAddress: (symbol, chain) => {
|
|
1743
|
+
switch (symbol) {
|
|
1744
|
+
case "USDC":
|
|
1745
|
+
return USDC_ADDRESSES[chain];
|
|
1746
|
+
case "USDT":
|
|
1747
|
+
return USDT_ADDRESSES[chain];
|
|
1748
|
+
default:
|
|
1749
|
+
throw new Error(`Unknown asset symbol: ${symbol}`);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
|
|
1754
|
+
// src/shared/core/erc20-namespace.ts
|
|
1755
|
+
var Erc20NamespaceImpl = class {
|
|
1756
|
+
constructor(ctx) {
|
|
1757
|
+
this.ctx = ctx;
|
|
1758
|
+
}
|
|
1759
|
+
async getTokenAllowance(params) {
|
|
1760
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1761
|
+
return getTokenAllowance(this.ctx.api, params);
|
|
1762
|
+
}
|
|
1763
|
+
async getTokenBalance(params) {
|
|
1764
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1765
|
+
return getTokenBalance(this.ctx.api, params);
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1658
1769
|
// src/shared/types/participation.ts
|
|
1659
1770
|
var ParticipationId = (value) => value;
|
|
1660
1771
|
var Blockchain = (value) => value;
|
|
@@ -1702,85 +1813,6 @@ var CreateParticipationParams = {
|
|
|
1702
1813
|
})
|
|
1703
1814
|
};
|
|
1704
1815
|
|
|
1705
|
-
// src/client/core/blockchain/token-sale-flow.ts
|
|
1706
|
-
async function executeTokenSale(params) {
|
|
1707
|
-
const {
|
|
1708
|
-
erc20,
|
|
1709
|
-
tokenSale,
|
|
1710
|
-
wallet,
|
|
1711
|
-
offerId,
|
|
1712
|
-
offerOptionId,
|
|
1713
|
-
assetId,
|
|
1714
|
-
paymentTokenAddress,
|
|
1715
|
-
fundingContractAddress,
|
|
1716
|
-
chain,
|
|
1717
|
-
amount,
|
|
1718
|
-
onProgress
|
|
1719
|
-
} = params;
|
|
1720
|
-
const emit = (phase) => onProgress?.(phase);
|
|
1721
|
-
emit("checking-allowance");
|
|
1722
|
-
let currentAllowance;
|
|
1723
|
-
try {
|
|
1724
|
-
const allowance = await erc20.getTokenAllowance({
|
|
1725
|
-
tokenAddress: paymentTokenAddress,
|
|
1726
|
-
owner: wallet.address,
|
|
1727
|
-
spender: fundingContractAddress,
|
|
1728
|
-
chain
|
|
1729
|
-
});
|
|
1730
|
-
currentAllowance = allowance.allowance;
|
|
1731
|
-
} catch {
|
|
1732
|
-
return { type: "error", error: { step: "allowance-check" } };
|
|
1733
|
-
}
|
|
1734
|
-
if (currentAllowance > 0n) {
|
|
1735
|
-
const reset = await submitErc20Approval({
|
|
1736
|
-
wallet,
|
|
1737
|
-
tokenAddress: paymentTokenAddress,
|
|
1738
|
-
spender: fundingContractAddress,
|
|
1739
|
-
chain,
|
|
1740
|
-
value: 0n,
|
|
1741
|
-
pending: "resetting-allowance",
|
|
1742
|
-
confirming: "confirming-allowance-reset",
|
|
1743
|
-
emit
|
|
1744
|
-
});
|
|
1745
|
-
if (reset.type === "error") {
|
|
1746
|
-
return {
|
|
1747
|
-
type: "error",
|
|
1748
|
-
error: reset.error.step === "approval-reverted" ? { step: "allowance-reset-reverted" } : { step: "allowance-reset", cause: reset.error.cause }
|
|
1749
|
-
};
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
const approve = await submitErc20Approval({
|
|
1753
|
-
wallet,
|
|
1754
|
-
tokenAddress: paymentTokenAddress,
|
|
1755
|
-
spender: fundingContractAddress,
|
|
1756
|
-
chain,
|
|
1757
|
-
value: amount.raw,
|
|
1758
|
-
pending: "approving",
|
|
1759
|
-
confirming: "confirming-approval",
|
|
1760
|
-
emit
|
|
1761
|
-
});
|
|
1762
|
-
if (approve.type === "error") {
|
|
1763
|
-
return { type: "error", error: approve.error };
|
|
1764
|
-
}
|
|
1765
|
-
const approvalTxHash = approve.txHash;
|
|
1766
|
-
emit("recording-participation");
|
|
1767
|
-
let participation;
|
|
1768
|
-
try {
|
|
1769
|
-
participation = await tokenSale.createParticipation({
|
|
1770
|
-
offerId,
|
|
1771
|
-
offerOptionId,
|
|
1772
|
-
chain: Blockchain(chain),
|
|
1773
|
-
walletAddress: WalletAddress(wallet.address),
|
|
1774
|
-
amount: amount.raw.toString(),
|
|
1775
|
-
assetId,
|
|
1776
|
-
approvalTransactionHash: approvalTxHash
|
|
1777
|
-
});
|
|
1778
|
-
} catch {
|
|
1779
|
-
return { type: "error", error: { step: "participation", approvalTxHash } };
|
|
1780
|
-
}
|
|
1781
|
-
return { type: "success", participation, approvalTxHash };
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
1816
|
// src/shared/api/frontline/participations.ts
|
|
1785
1817
|
async function fetchParticipations(api, offerId) {
|
|
1786
1818
|
return fetchAllPages(
|
|
@@ -1828,15 +1860,189 @@ var TokenSaleNamespaceImpl = class {
|
|
|
1828
1860
|
await this.ctx.ensureUserAuthenticated();
|
|
1829
1861
|
return fetchParticipationsPage(this.ctx.api, params);
|
|
1830
1862
|
}
|
|
1831
|
-
async fetchParticipation(id) {
|
|
1832
|
-
await this.ctx.ensureUserAuthenticated();
|
|
1833
|
-
return fetchParticipation(this.ctx.api, id);
|
|
1863
|
+
async fetchParticipation(id) {
|
|
1864
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1865
|
+
return fetchParticipation(this.ctx.api, id);
|
|
1866
|
+
}
|
|
1867
|
+
async createParticipation(params) {
|
|
1868
|
+
await this.ctx.ensureUserAuthenticated();
|
|
1869
|
+
return createParticipation(this.ctx.api, params);
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1873
|
+
// src/shared/types/oauth.ts
|
|
1874
|
+
var AuthorizationCode = (value) => value;
|
|
1875
|
+
var CodeVerifier = (value) => value;
|
|
1876
|
+
var CodeChallenge = (value) => value;
|
|
1877
|
+
var PKCEState = (value) => value;
|
|
1878
|
+
|
|
1879
|
+
// src/shared/pkce.ts
|
|
1880
|
+
async function generatePKCEParams(config) {
|
|
1881
|
+
const state = generateSecureRandomBase64Url(32);
|
|
1882
|
+
const codeVerifier = generateSecureRandomBase64Url(32);
|
|
1883
|
+
const codeChallengeRaw = await sha256(codeVerifier);
|
|
1884
|
+
const codeChallenge = arrayBufferToBase64Url(codeChallengeRaw, false);
|
|
1885
|
+
return {
|
|
1886
|
+
clientId: config.clientId,
|
|
1887
|
+
responseType: "code",
|
|
1888
|
+
redirectUri: config.redirectUri,
|
|
1889
|
+
codeChallenge: CodeChallenge(codeChallenge),
|
|
1890
|
+
codeChallengeMethod: "S256",
|
|
1891
|
+
state: PKCEState(state),
|
|
1892
|
+
codeVerifier: CodeVerifier(codeVerifier)
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// src/shared/types/document-submission.ts
|
|
1897
|
+
var DocumentSubmission = {
|
|
1898
|
+
fromDto: (dto) => ({
|
|
1899
|
+
status: dto.status,
|
|
1900
|
+
formType: dto.form_type
|
|
1901
|
+
})
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
// src/shared/types/errors.ts
|
|
1905
|
+
var NotAuthenticatedError = class extends Error {
|
|
1906
|
+
constructor(message = "The user is not authenticated. Go through the OAuth flow first!") {
|
|
1907
|
+
super(message);
|
|
1908
|
+
this.name = "NotAuthenticatedError";
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
// src/shared/types/kyc.ts
|
|
1913
|
+
var KycToken = {
|
|
1914
|
+
fromDto: (dto) => ({
|
|
1915
|
+
token: dto.token
|
|
1916
|
+
})
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
// src/shared/types/pii.ts
|
|
1920
|
+
var Iso2CountryCode = (value) => value;
|
|
1921
|
+
var PiiJurisdiction = {
|
|
1922
|
+
fromDto: (dto) => ({
|
|
1923
|
+
iso2: Iso2CountryCode(dto.iso_2),
|
|
1924
|
+
name: dto.name
|
|
1925
|
+
})
|
|
1926
|
+
};
|
|
1927
|
+
var PiiAddress = {
|
|
1928
|
+
fromDto: (dto) => ({
|
|
1929
|
+
street: dto.street,
|
|
1930
|
+
city: dto.city,
|
|
1931
|
+
state: dto.state,
|
|
1932
|
+
postalCode: dto.postal_code,
|
|
1933
|
+
country: dto.country
|
|
1934
|
+
})
|
|
1935
|
+
};
|
|
1936
|
+
var Pii = {
|
|
1937
|
+
fromDto: (dto) => ({
|
|
1938
|
+
kind: dto.kind,
|
|
1939
|
+
fullLegalName: dto.full_legal_name,
|
|
1940
|
+
dateOfBirth: dto.date_of_birth,
|
|
1941
|
+
jurisdiction: dto.jurisdiction ? PiiJurisdiction.fromDto(dto.jurisdiction) : null,
|
|
1942
|
+
taxId: dto.tax_id,
|
|
1943
|
+
permanentAddress: PiiAddress.fromDto(dto.permanent_address)
|
|
1944
|
+
})
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
// src/shared/types/requirement.ts
|
|
1948
|
+
var RequirementId = (value) => value;
|
|
1949
|
+
var Requirement = {
|
|
1950
|
+
fromDto: (dto) => ({
|
|
1951
|
+
id: RequirementId(dto.id),
|
|
1952
|
+
type: dto.type,
|
|
1953
|
+
details: dto.details
|
|
1954
|
+
})
|
|
1955
|
+
};
|
|
1956
|
+
var RequirementStatusInfo = {
|
|
1957
|
+
fromStatusesDto: (dto) => Object.entries(dto.statuses).map(
|
|
1958
|
+
([id, value]) => typeof value === "string" ? { id: RequirementId(id), status: value, action: null } : {
|
|
1959
|
+
id: RequirementId(id),
|
|
1960
|
+
status: value.status,
|
|
1961
|
+
action: value.action ?? null,
|
|
1962
|
+
kycLevel: value.kyc_level,
|
|
1963
|
+
kycReset: value.kyc_reset
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
// src/client/core/blockchain/token-sale-flow.ts
|
|
1969
|
+
async function executeTokenSale(params) {
|
|
1970
|
+
const {
|
|
1971
|
+
erc20,
|
|
1972
|
+
tokenSale,
|
|
1973
|
+
wallet,
|
|
1974
|
+
offerId,
|
|
1975
|
+
offerOptionId,
|
|
1976
|
+
assetId,
|
|
1977
|
+
paymentTokenAddress,
|
|
1978
|
+
fundingContractAddress,
|
|
1979
|
+
chain,
|
|
1980
|
+
amount,
|
|
1981
|
+
onProgress
|
|
1982
|
+
} = params;
|
|
1983
|
+
const emit = (phase) => onProgress?.(phase);
|
|
1984
|
+
emit("checking-allowance");
|
|
1985
|
+
let currentAllowance;
|
|
1986
|
+
try {
|
|
1987
|
+
const allowance = await erc20.getTokenAllowance({
|
|
1988
|
+
tokenAddress: paymentTokenAddress,
|
|
1989
|
+
owner: wallet.address,
|
|
1990
|
+
spender: fundingContractAddress,
|
|
1991
|
+
chain
|
|
1992
|
+
});
|
|
1993
|
+
currentAllowance = allowance.allowance;
|
|
1994
|
+
} catch {
|
|
1995
|
+
return { type: "error", error: { step: "allowance-check" } };
|
|
1996
|
+
}
|
|
1997
|
+
if (currentAllowance > 0n) {
|
|
1998
|
+
const reset = await submitErc20Approval({
|
|
1999
|
+
wallet,
|
|
2000
|
+
tokenAddress: paymentTokenAddress,
|
|
2001
|
+
spender: fundingContractAddress,
|
|
2002
|
+
chain,
|
|
2003
|
+
value: 0n,
|
|
2004
|
+
pending: "resetting-allowance",
|
|
2005
|
+
confirming: "confirming-allowance-reset",
|
|
2006
|
+
emit
|
|
2007
|
+
});
|
|
2008
|
+
if (reset.type === "error") {
|
|
2009
|
+
return {
|
|
2010
|
+
type: "error",
|
|
2011
|
+
error: reset.error.step === "approval-reverted" ? { step: "allowance-reset-reverted" } : { step: "allowance-reset", cause: reset.error.cause }
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
const approve = await submitErc20Approval({
|
|
2016
|
+
wallet,
|
|
2017
|
+
tokenAddress: paymentTokenAddress,
|
|
2018
|
+
spender: fundingContractAddress,
|
|
2019
|
+
chain,
|
|
2020
|
+
value: amount.raw,
|
|
2021
|
+
pending: "approving",
|
|
2022
|
+
confirming: "confirming-approval",
|
|
2023
|
+
emit
|
|
2024
|
+
});
|
|
2025
|
+
if (approve.type === "error") {
|
|
2026
|
+
return { type: "error", error: approve.error };
|
|
1834
2027
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
2028
|
+
const approvalTxHash = approve.txHash;
|
|
2029
|
+
emit("recording-participation");
|
|
2030
|
+
let participation;
|
|
2031
|
+
try {
|
|
2032
|
+
participation = await tokenSale.createParticipation({
|
|
2033
|
+
offerId,
|
|
2034
|
+
offerOptionId,
|
|
2035
|
+
chain: Blockchain(chain),
|
|
2036
|
+
walletAddress: WalletAddress(wallet.address),
|
|
2037
|
+
amount: formatRawAmount(amount),
|
|
2038
|
+
assetId,
|
|
2039
|
+
approvalTransactionHash: approvalTxHash
|
|
2040
|
+
});
|
|
2041
|
+
} catch {
|
|
2042
|
+
return { type: "error", error: { step: "participation", approvalTxHash } };
|
|
1838
2043
|
}
|
|
1839
|
-
};
|
|
2044
|
+
return { type: "success", participation, approvalTxHash };
|
|
2045
|
+
}
|
|
1840
2046
|
|
|
1841
2047
|
// src/client/core/client-token-sale-namespace.ts
|
|
1842
2048
|
var ClientTokenSaleNamespaceImpl = class extends TokenSaleNamespaceImpl {
|
|
@@ -1849,14 +2055,6 @@ var ClientTokenSaleNamespaceImpl = class extends TokenSaleNamespaceImpl {
|
|
|
1849
2055
|
}
|
|
1850
2056
|
};
|
|
1851
2057
|
|
|
1852
|
-
// src/shared/types/document-submission.ts
|
|
1853
|
-
var DocumentSubmission = {
|
|
1854
|
-
fromDto: (dto) => ({
|
|
1855
|
-
status: dto.status,
|
|
1856
|
-
formType: dto.form_type
|
|
1857
|
-
})
|
|
1858
|
-
};
|
|
1859
|
-
|
|
1860
2058
|
// src/shared/api/frontline/documents.ts
|
|
1861
2059
|
async function submitDocument(api, documentType, fields) {
|
|
1862
2060
|
const dto = await api.send({
|
|
@@ -1868,13 +2066,6 @@ async function submitDocument(api, documentType, fields) {
|
|
|
1868
2066
|
return DocumentSubmission.fromDto(dto);
|
|
1869
2067
|
}
|
|
1870
2068
|
|
|
1871
|
-
// src/shared/types/kyc.ts
|
|
1872
|
-
var KycToken = {
|
|
1873
|
-
fromDto: (dto) => ({
|
|
1874
|
-
token: dto.token
|
|
1875
|
-
})
|
|
1876
|
-
};
|
|
1877
|
-
|
|
1878
2069
|
// src/shared/api/frontline/kyc.ts
|
|
1879
2070
|
async function createKycToken(api, levelName, reset) {
|
|
1880
2071
|
const dto = await api.send({
|
|
@@ -1918,34 +2109,6 @@ async function fetchOfferDetails(api, id, clientCreds) {
|
|
|
1918
2109
|
return OfferDetail.fromDto(dto);
|
|
1919
2110
|
}
|
|
1920
2111
|
|
|
1921
|
-
// src/shared/types/pii.ts
|
|
1922
|
-
var Iso2CountryCode = (value) => value;
|
|
1923
|
-
var PiiJurisdiction = {
|
|
1924
|
-
fromDto: (dto) => ({
|
|
1925
|
-
iso2: Iso2CountryCode(dto.iso_2),
|
|
1926
|
-
name: dto.name
|
|
1927
|
-
})
|
|
1928
|
-
};
|
|
1929
|
-
var PiiAddress = {
|
|
1930
|
-
fromDto: (dto) => ({
|
|
1931
|
-
street: dto.street,
|
|
1932
|
-
city: dto.city,
|
|
1933
|
-
state: dto.state,
|
|
1934
|
-
postalCode: dto.postal_code,
|
|
1935
|
-
country: dto.country
|
|
1936
|
-
})
|
|
1937
|
-
};
|
|
1938
|
-
var Pii = {
|
|
1939
|
-
fromDto: (dto) => ({
|
|
1940
|
-
kind: dto.kind,
|
|
1941
|
-
fullLegalName: dto.full_legal_name,
|
|
1942
|
-
dateOfBirth: dto.date_of_birth,
|
|
1943
|
-
jurisdiction: dto.jurisdiction ? PiiJurisdiction.fromDto(dto.jurisdiction) : null,
|
|
1944
|
-
taxId: dto.tax_id,
|
|
1945
|
-
permanentAddress: PiiAddress.fromDto(dto.permanent_address)
|
|
1946
|
-
})
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1949
2112
|
// src/shared/api/frontline/pii.ts
|
|
1950
2113
|
async function fetchPii(api) {
|
|
1951
2114
|
const dto = await api.send({
|
|
@@ -1956,27 +2119,6 @@ async function fetchPii(api) {
|
|
|
1956
2119
|
return Pii.fromDto(dto);
|
|
1957
2120
|
}
|
|
1958
2121
|
|
|
1959
|
-
// src/shared/types/requirement.ts
|
|
1960
|
-
var RequirementId = (value) => value;
|
|
1961
|
-
var Requirement = {
|
|
1962
|
-
fromDto: (dto) => ({
|
|
1963
|
-
id: RequirementId(dto.id),
|
|
1964
|
-
type: dto.type,
|
|
1965
|
-
details: dto.details
|
|
1966
|
-
})
|
|
1967
|
-
};
|
|
1968
|
-
var RequirementStatusInfo = {
|
|
1969
|
-
fromStatusesDto: (dto) => Object.entries(dto.statuses).map(
|
|
1970
|
-
([id, value]) => typeof value === "string" ? { id: RequirementId(id), status: value, action: null } : {
|
|
1971
|
-
id: RequirementId(id),
|
|
1972
|
-
status: value.status,
|
|
1973
|
-
action: value.action ?? null,
|
|
1974
|
-
kycLevel: value.kyc_level,
|
|
1975
|
-
kycReset: value.kyc_reset
|
|
1976
|
-
}
|
|
1977
|
-
)
|
|
1978
|
-
};
|
|
1979
|
-
|
|
1980
2122
|
// src/shared/api/frontline/requirements.ts
|
|
1981
2123
|
async function fetchOfferRequirements(api, offerId, clientCreds) {
|
|
1982
2124
|
const response = await api.send({
|
|
@@ -2003,52 +2145,6 @@ async function fetchRequirementStatuses(api, offerId) {
|
|
|
2003
2145
|
return RequirementStatusInfo.fromStatusesDto(response);
|
|
2004
2146
|
}
|
|
2005
2147
|
|
|
2006
|
-
// src/shared/core/erc20-namespace.ts
|
|
2007
|
-
var Erc20NamespaceImpl = class {
|
|
2008
|
-
constructor(ctx) {
|
|
2009
|
-
this.ctx = ctx;
|
|
2010
|
-
}
|
|
2011
|
-
async getTokenAllowance(params) {
|
|
2012
|
-
await this.ctx.ensureUserAuthenticated();
|
|
2013
|
-
return getTokenAllowance(this.ctx.api, params);
|
|
2014
|
-
}
|
|
2015
|
-
async getTokenBalance(params) {
|
|
2016
|
-
await this.ctx.ensureUserAuthenticated();
|
|
2017
|
-
return getTokenBalance(this.ctx.api, params);
|
|
2018
|
-
}
|
|
2019
|
-
};
|
|
2020
|
-
|
|
2021
|
-
// src/shared/types/oauth.ts
|
|
2022
|
-
var AuthorizationCode = (value) => value;
|
|
2023
|
-
var CodeVerifier = (value) => value;
|
|
2024
|
-
var CodeChallenge = (value) => value;
|
|
2025
|
-
var PKCEState = (value) => value;
|
|
2026
|
-
|
|
2027
|
-
// src/shared/pkce.ts
|
|
2028
|
-
async function generatePKCEParams(config) {
|
|
2029
|
-
const state = generateSecureRandomBase64Url(32);
|
|
2030
|
-
const codeVerifier = generateSecureRandomBase64Url(32);
|
|
2031
|
-
const codeChallengeRaw = await sha256(codeVerifier);
|
|
2032
|
-
const codeChallenge = arrayBufferToBase64Url(codeChallengeRaw, false);
|
|
2033
|
-
return {
|
|
2034
|
-
clientId: config.clientId,
|
|
2035
|
-
responseType: "code",
|
|
2036
|
-
redirectUri: config.redirectUri,
|
|
2037
|
-
codeChallenge: CodeChallenge(codeChallenge),
|
|
2038
|
-
codeChallengeMethod: "S256",
|
|
2039
|
-
state: PKCEState(state),
|
|
2040
|
-
codeVerifier: CodeVerifier(codeVerifier)
|
|
2041
|
-
};
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
// src/shared/types/errors.ts
|
|
2045
|
-
var NotAuthenticatedError = class extends Error {
|
|
2046
|
-
constructor(message = "The user is not authenticated. Go through the OAuth flow first!") {
|
|
2047
|
-
super(message);
|
|
2048
|
-
this.name = "NotAuthenticatedError";
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
|
|
2052
2148
|
// src/client/core/coinlist-client.ts
|
|
2053
2149
|
var OAUTH_STATE_KEY = "coinlist.oauth_state";
|
|
2054
2150
|
var OAUTH_CODE_VERIFIER_KEY = "coinlist.oauth_code_verifier";
|
|
@@ -3296,21 +3392,6 @@ function useConnectWallet({
|
|
|
3296
3392
|
return { state, onSign };
|
|
3297
3393
|
}
|
|
3298
3394
|
|
|
3299
|
-
// src/shared/core/blockchain/formatters.ts
|
|
3300
|
-
var import_viem3 = require("viem");
|
|
3301
|
-
|
|
3302
|
-
// src/shared/types/blockchain/ui.ts
|
|
3303
|
-
var ShortenedWalletAddress = (value) => value;
|
|
3304
|
-
var FormattedAmountAssetUi = (value) => value;
|
|
3305
|
-
|
|
3306
|
-
// src/shared/core/blockchain/formatters.ts
|
|
3307
|
-
function shortenAddress(address) {
|
|
3308
|
-
const short = address.length > 10 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
3309
|
-
return ShortenedWalletAddress(short);
|
|
3310
|
-
}
|
|
3311
|
-
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
3312
|
-
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
3313
|
-
|
|
3314
3395
|
// src/client/components/requirements/ConnectWalletModal.tsx
|
|
3315
3396
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3316
3397
|
function ConnectWalletModal({
|
|
@@ -4699,36 +4780,6 @@ function useSwapOutputToken(options) {
|
|
|
4699
4780
|
|
|
4700
4781
|
// src/client/hooks/swap/useSwapQuote.ts
|
|
4701
4782
|
var import_react17 = require("react");
|
|
4702
|
-
|
|
4703
|
-
// src/shared/core/blockchain/swap/constants.ts
|
|
4704
|
-
var SWAP_POLL_INTERVAL_MS = 15e3;
|
|
4705
|
-
var SLIPPAGE_OPTIONS_BPS = [25n, 50n, 100n, 200n, 500n].map(
|
|
4706
|
-
(n) => Bps(n)
|
|
4707
|
-
);
|
|
4708
|
-
var DEFAULT_SLIPPAGE_BPS = Bps(50n);
|
|
4709
|
-
var SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA = EvmContractAddress("0x84f8e9a6C9Cc12fe911259372EfCa5582C4ae557");
|
|
4710
|
-
|
|
4711
|
-
// src/shared/core/blockchain/swap/quote.ts
|
|
4712
|
-
var SwapQuote = {
|
|
4713
|
-
/**
|
|
4714
|
-
* Assembles a {@link SwapQuote} from a raw contract {@link SwapPreview}. The
|
|
4715
|
-
* input and fee are denominated in the input token; the output in the output
|
|
4716
|
-
* token.
|
|
4717
|
-
*/
|
|
4718
|
-
fromPreview: (preview, inputDecimals, outputDecimals) => ({
|
|
4719
|
-
inputTokenAmount: BlockchainAmount({
|
|
4720
|
-
raw: preview.inputAmount,
|
|
4721
|
-
decimals: inputDecimals
|
|
4722
|
-
}),
|
|
4723
|
-
fee: BlockchainAmount({ raw: preview.fee, decimals: inputDecimals }),
|
|
4724
|
-
outputTokenAmount: BlockchainAmount({
|
|
4725
|
-
raw: preview.outputAmount,
|
|
4726
|
-
decimals: outputDecimals
|
|
4727
|
-
})
|
|
4728
|
-
})
|
|
4729
|
-
};
|
|
4730
|
-
|
|
4731
|
-
// src/client/hooks/swap/useSwapQuote.ts
|
|
4732
4783
|
function useSwapQuote(options) {
|
|
4733
4784
|
const {
|
|
4734
4785
|
contractAddress,
|
|
@@ -4812,60 +4863,6 @@ function useSwapQuote(options) {
|
|
|
4812
4863
|
|
|
4813
4864
|
// src/client/hooks/swap/useSwapTokenBalances.ts
|
|
4814
4865
|
var import_react18 = require("react");
|
|
4815
|
-
|
|
4816
|
-
// src/shared/core/blockchain/token-registry.ts
|
|
4817
|
-
var USDC_SYMBOL = StablecoinSymbol("USDC");
|
|
4818
|
-
var USDC = {
|
|
4819
|
-
name: "USD Coin",
|
|
4820
|
-
symbol: USDC_SYMBOL,
|
|
4821
|
-
decimals: AssetDecimals(6)
|
|
4822
|
-
};
|
|
4823
|
-
var USDT_SYMBOL = StablecoinSymbol("USDT");
|
|
4824
|
-
var USDT = {
|
|
4825
|
-
name: "Tether USD",
|
|
4826
|
-
symbol: USDT_SYMBOL,
|
|
4827
|
-
decimals: AssetDecimals(6)
|
|
4828
|
-
};
|
|
4829
|
-
var USDC_ADDRESSES = {
|
|
4830
|
-
ethereum_mainnet: EvmContractAddress(
|
|
4831
|
-
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
|
|
4832
|
-
),
|
|
4833
|
-
ethereum_sepolia: EvmContractAddress(
|
|
4834
|
-
"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
|
|
4835
|
-
)
|
|
4836
|
-
};
|
|
4837
|
-
var USDT_ADDRESSES = {
|
|
4838
|
-
ethereum_mainnet: EvmContractAddress(
|
|
4839
|
-
"0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
4840
|
-
),
|
|
4841
|
-
ethereum_sepolia: EvmContractAddress(
|
|
4842
|
-
"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06"
|
|
4843
|
-
)
|
|
4844
|
-
};
|
|
4845
|
-
var TOKEN_REGISTRY = {
|
|
4846
|
-
erc20: (symbol) => {
|
|
4847
|
-
switch (symbol) {
|
|
4848
|
-
case "USDC":
|
|
4849
|
-
return USDC;
|
|
4850
|
-
case "USDT":
|
|
4851
|
-
return USDT;
|
|
4852
|
-
default:
|
|
4853
|
-
throw new Error(`Unknown asset symbol: ${symbol}`);
|
|
4854
|
-
}
|
|
4855
|
-
},
|
|
4856
|
-
contractAddress: (symbol, chain) => {
|
|
4857
|
-
switch (symbol) {
|
|
4858
|
-
case "USDC":
|
|
4859
|
-
return USDC_ADDRESSES[chain];
|
|
4860
|
-
case "USDT":
|
|
4861
|
-
return USDT_ADDRESSES[chain];
|
|
4862
|
-
default:
|
|
4863
|
-
throw new Error(`Unknown asset symbol: ${symbol}`);
|
|
4864
|
-
}
|
|
4865
|
-
}
|
|
4866
|
-
};
|
|
4867
|
-
|
|
4868
|
-
// src/client/hooks/swap/useSwapTokenBalances.ts
|
|
4869
4866
|
function useSwapTokenBalances(options) {
|
|
4870
4867
|
const {
|
|
4871
4868
|
address,
|