Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@funkit/api-base

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@funkit/api-base - npm Package Compare versions

Comparing version 1.4.2 to 1.5.0

dist/src/services/fw-access/endpoints.d.ts

10

CHANGELOG.md
# @funkit/api-base
## 1.5.0
### Minor Changes
- 68af67d: feat: add mesh information persistence support
### Patch Changes
- eb0f97b: refactor: migrate AccessControlApis, GroupApis, NftApis, PaymasterApis
## 1.4.2

@@ -4,0 +14,0 @@

230

dist/index.js
// src/consts/api.ts
var API_BASE_URL = false ? "https://api.fun.xyz/staging/v1" : false ? "https://api.fun.xyz/testing/v1" : false ? "http://127.0.0.1:3000" : (
// Production
"https://api.fun.xyz/v1"
);
var API_BASE_URL = "https://api.fun.xyz/v1";
var MESH_API_BASE_URL = "https://frog.fun.xyz";
var FUN_FAUCET_URL = "https://api.fun.xyz/demo-faucet";

@@ -331,2 +329,21 @@

}
async function getNftName({
chainId,
nftAddress,
apiKey
}) {
return await sendGetRequest({
uri: `${API_BASE_URL}/asset/nft/${chainId}/${nftAddress}`,
apiKey
});
}
async function getNftAddress({
name,
apiKey
}) {
return await sendGetRequest({
uri: `${API_BASE_URL}/asset/nft?name=${name}`,
apiKey
});
}

@@ -591,2 +608,73 @@ // src/services/checkout/endpoints.ts

// src/services/fw-access/endpoints.ts
async function initializeWalletAccess({
walletAddr,
creatorAddr,
apiKey
}) {
await sendPostRequest({
uri: `${API_BASE_URL}/access/wallet`,
body: { walletAddr, creatorAddr },
apiKey
});
}
async function checkWalletAccessInitialization({
walletAddr,
apiKey
}) {
return (await sendGetRequest({
uri: `${API_BASE_URL}/access/wallet/${walletAddr}`,
apiKey
})).initialized;
}
// src/services/fw-group/endpoints.ts
async function getGroups({
groupIds,
chainId,
apiKey
}) {
return (await sendPostRequest({
uri: `${API_BASE_URL}/group/get-groups`,
body: { groupIds, chainId },
apiKey
})).groups;
}
// src/services/fw-paymaster/endpoints.ts
async function addTransaction({
chainId,
timestamp,
txid,
transaction,
paymasterType,
sponsorAddress,
apiKey
}) {
try {
return await sendPostRequest({
uri: `${API_BASE_URL}/dashboard/paymasters/add-transaction`,
body: {
chain: chainId,
sponsorAddress,
type: paymasterType,
timestamp,
transaction,
txid
},
apiKey
});
} catch (_err) {
}
}
// src/services/fw-paymaster/types.ts
var PaymasterType = /* @__PURE__ */ ((PaymasterType2) => {
PaymasterType2["BaseSponsor"] = "base";
PaymasterType2["GaslessSponsor"] = "gasless";
PaymasterType2["TokenSponsor"] = "token";
PaymasterType2["CheckoutSponsor"] = "checkout";
return PaymasterType2;
})(PaymasterType || {});
// src/services/mesh/endpoints.ts

@@ -605,2 +693,13 @@ async function meshGetCryptocurrencyHoldings({

}
async function meshGetCryptocurrencyHoldingsProxy({
apiKey,
...props
}) {
const res = await sendPostRequest({
uri: `${MESH_API_BASE_URL}/mesh/holdings/get`,
body: { ...props },
apiKey
});
return res;
}
async function meshGetTransferIntegrations({

@@ -622,12 +721,8 @@ apiKey

}) {
let body = { userId };
if (integrationId) {
body = { ...body, integrationId };
}
if (restrictMultipleAccounts) {
body = { ...body, restrictMultipleAccounts };
}
if (transferOptions) {
body = { ...body, transferOptions };
}
const body = {
userId,
...integrationId && { integrationId },
...restrictMultipleAccounts && { restrictMultipleAccounts },
...transferOptions && { transferOptions }
};
const res = await sendPostRequest({

@@ -653,27 +748,14 @@ uri: `${API_BASE_URL}/mesh/linktoken`,

}) {
let body = { fromAuthToken, fromType };
if (toAuthToken) {
body = { ...body, toAuthToken };
}
if (toType) {
body = { ...body, toType };
}
if (networkId) {
body = { ...body, networkId };
}
if (symbol) {
body = { ...body, symbol };
}
if (toAddress) {
body = { ...body, toAddress };
}
if (amount) {
body = { ...body, amount };
}
if (amountInFiat) {
body = { ...body, amountInFiat };
}
if (fiatCurrency) {
body = { ...body, fiatCurrency };
}
const body = {
fromAuthToken,
fromType,
...toAuthToken && { toAuthToken },
...toType && { toType },
...networkId && { networkId },
...symbol && { symbol },
...toAddress && { toAddress },
...amount && { amount },
...amountInFiat && { amountInFiat },
...fiatCurrency && { fiatCurrency }
};
const res = await sendPostRequest({

@@ -687,2 +769,15 @@ uri: `${API_BASE_URL}/mesh/transfers/managed/preview`,

}
async function meshPreviewTransferProxy({
apiKey,
...props
}) {
const body = { ...props };
const res = await sendPostRequest({
uri: `${MESH_API_BASE_URL}/mesh/transfers/managed/preview`,
body,
apiKey,
retryOptions: { maxAttempts: 1 }
});
return res;
}
async function meshExecuteTransfer({

@@ -695,6 +790,8 @@ fromAuthToken,

}) {
let body = { fromAuthToken, fromType, previewId };
if (mfaCode) {
body = { ...body, mfaCode };
}
const body = {
fromAuthToken,
fromType,
previewId,
...mfaCode && { mfaCode }
};
const res = await sendPostRequest({

@@ -707,2 +804,36 @@ uri: `${API_BASE_URL}/mesh/transfers/managed/execute`,

}
async function meshExecuteTransferProxy({
apiKey,
...props
}) {
const body = { ...props };
const res = await sendPostRequest({
uri: `${MESH_API_BASE_URL}/mesh/transfers/managed/execute`,
body,
apiKey
});
return res;
}
async function saveTokensToMeshProxy({
apiKey,
...props
}) {
const body = { ...props };
const res = await sendPostRequest({
uri: `${MESH_API_BASE_URL}/api/tokens`,
body,
apiKey
});
return res;
}
async function removeTokensFromMeshProxy({
apiKey,
...props
}) {
const body = { ...props };
return await sendDeleteRequest({
uri: `${MESH_API_BASE_URL}/api/tokens?deviceId=${body.deviceId}&brokerType=${body.brokerType}`,
apiKey
});
}

@@ -875,4 +1006,8 @@ // src/services/mesh/types.ts

FUN_FAUCET_URL,
MESH_API_BASE_URL,
MeshExecuteTransferMfaType,
MeshExecuteTransferStatus,
PaymasterType,
addTransaction,
checkWalletAccessInitialization,
createStripeBuySession,

@@ -894,4 +1029,7 @@ deactivateCheckout,

getCheckoutsByUserId,
getGroups,
getMoonpayBuyQuoteForCreditCard,
getMoonpayUrlSignature,
getNftAddress,
getNftName,
getPaymasterDataForCheckoutSponsoredTransfer,

@@ -904,9 +1042,15 @@ getRiskAssessmentForAddress,

initializeCheckoutTokenTransferAddress,
initializeWalletAccess,
meshExecuteTransfer,
meshExecuteTransferProxy,
meshGetCryptocurrencyHoldings,
meshGetCryptocurrencyHoldingsProxy,
meshGetLinkToken,
meshGetTransferIntegrations,
meshPreviewTransfer,
meshPreviewTransferProxy,
randomBytes,
removeTokensFromMeshProxy,
roundToNearestBottomTenth,
saveTokensToMeshProxy,
sendDeleteRequest,

@@ -913,0 +1057,0 @@ sendGetRequest,

export declare const API_BASE_URL: string;
export declare const MESH_API_BASE_URL = "https://frog.fun.xyz";
export declare const FUN_FAUCET_URL = "https://api.fun.xyz/demo-faucet";

17

dist/src/services/assets/endpoints.d.ts

@@ -1,6 +0,2 @@

import type { GetAllWalletNFTsByChainIdRequest, GetAllWalletNFTsByChainIdResponse, GetAllWalletNFTsRequest, GetAllWalletNFTsResponse, GetAllWalletTokensByChainIdRequest, GetAllWalletTokensByChainIdResponse, GetAllWalletTokensRequest, GetAllWalletTokensResponse, GetAllowedAssetsRequest, GetAllowedAssetsResponse, GetAssetPriceInfoRequest, GetAssetPriceInfoResponse, GetWalletLidoWithdrawalsByChainId, GetWalletLidoWithdrawalsByChainIdResponse } from './types';
/**===========================================================
* REFERENCE CORE FILE: /packages/core/src/apis/AssetApis.ts
* TODO: Remove this comment once migration is complete
*===========================================================*/
import type { GetAllWalletNFTsByChainIdRequest, GetAllWalletNFTsByChainIdResponse, GetAllWalletNFTsRequest, GetAllWalletNFTsResponse, GetAllWalletTokensByChainIdRequest, GetAllWalletTokensByChainIdResponse, GetAllWalletTokensRequest, GetAllWalletTokensResponse, GetAllowedAssetsRequest, GetAllowedAssetsResponse, GetAssetPriceInfoRequest, GetAssetPriceInfoResponse, GetNftAddressRequest, GetNftNameRequest, GetWalletLidoWithdrawalsByChainId, GetWalletLidoWithdrawalsByChainIdResponse, NftAssetInfo } from './types';
/**

@@ -57,1 +53,12 @@ * Gets the estimated dollar unit price of a tokenAddress for checkout

export declare function getWalletLidoWithdrawalsByChainId({ chainId, walletAddress, apiKey, }: GetWalletLidoWithdrawalsByChainId): Promise<GetWalletLidoWithdrawalsByChainIdResponse>;
/**
* Get the name of an NFT collection
* @param {string} chainId https://chainlist.org/
* @param {string} nftAddress Address of NFT
*/
export declare function getNftName({ chainId, nftAddress, apiKey, }: GetNftNameRequest): Promise<NftAssetInfo>;
/**
* Get the address and chainId of an NFT collection
* @param {string} name Name of NFT
*/
export declare function getNftAddress({ name, apiKey, }: GetNftAddressRequest): Promise<NftAssetInfo>;

@@ -74,2 +74,14 @@ import type { Address } from 'viem';

export type GetWalletLidoWithdrawalsByChainIdResponse = [number[], number[]];
export interface GetNftNameRequest extends BaseApiRequest {
chainId: string;
nftAddress: string;
}
export interface GetNftAddressRequest extends BaseApiRequest {
name: string;
}
export interface NftAssetInfo {
address: Address;
chain: string;
name: string;
}
export {};

@@ -127,3 +127,3 @@ /**===============*

export type RiskAssessmentParams = {
address: Address | `dydx${string}`;
address: FunAddress;
apiKey: string;

@@ -133,3 +133,3 @@ };

name: string;
address: Address | `dydx${string}`;
address: FunAddress;
category: string;

@@ -169,3 +169,4 @@ description: string;

};
export type FunAddress = Address | `dydx${string}`;
export type DydxAddress = `dydx${string}`;
export type FunAddress = Address | DydxAddress;
export type RiskAssessmentResponse = {

@@ -172,0 +173,0 @@ address: FunAddress;

export * from './assets';
export * from './checkout';
export * from './faucet';
export * from './fw-access';
export * from './fw-group';
export * from './fw-paymaster';
export * from './mesh';

@@ -5,0 +8,0 @@ export * from './moonpay';

@@ -1,2 +0,2 @@

import type { GetCryptocurrencyHoldingsRequest, GetLinkTokenRequest, GetLinkTokenResponse, GetTransferIntegrationsRequest, GetTransferIntegrationsResponse, MeshExecuteTransferRequest, MeshExecuteTransferResponse, PreviewTransferRequest, PreviewTransferResponse } from './types';
import type { GetCryptocurrencyHoldingsRequest, GetCryptocurrencyHoldingsRequestProxy, GetLinkTokenRequest, GetLinkTokenResponse, GetTransferIntegrationsRequest, GetTransferIntegrationsResponse, MeshExecuteTransferRequest, MeshExecuteTransferRequestProxy, MeshExecuteTransferResponse, PreviewTransferRequest, PreviewTransferRequestProxy, PreviewTransferResponse } from './types';
/**

@@ -8,2 +8,3 @@ * @param authToken The authentication token to send the asset from.

export declare function meshGetCryptocurrencyHoldings({ authToken, type, apiKey, }: GetCryptocurrencyHoldingsRequest): Promise<any>;
export declare function meshGetCryptocurrencyHoldingsProxy({ apiKey, ...props }: GetCryptocurrencyHoldingsRequestProxy): Promise<any>;
/**

@@ -38,2 +39,3 @@ * @return https://docs.meshconnect.com/api-reference/managed-transfers/get-integrations

export declare function meshPreviewTransfer({ fromAuthToken, fromType, toAuthToken, toType, networkId, symbol, toAddress, amount, amountInFiat, fiatCurrency, apiKey, }: PreviewTransferRequest): Promise<PreviewTransferResponse>;
export declare function meshPreviewTransferProxy({ apiKey, ...props }: PreviewTransferRequestProxy): Promise<PreviewTransferResponse>;
/**

@@ -48,1 +50,32 @@ *

export declare function meshExecuteTransfer({ fromAuthToken, fromType, previewId, mfaCode, apiKey, }: MeshExecuteTransferRequest): Promise<MeshExecuteTransferResponse>;
export declare function meshExecuteTransferProxy({ apiKey, ...props }: MeshExecuteTransferRequestProxy): Promise<MeshExecuteTransferResponse>;
interface SaveTokensToMeshProxyRequestBody {
deviceId?: string | null;
brokerType: string;
accessToken: string;
refreshToken: string | null;
accessTokenExpiresIn: number;
accessTokenExpiresAt: string;
refreshTokenExpiresAt?: string | null;
apiKey: string;
}
interface SaveTokensToMeshProxyResponseBody {
id: number;
createdAt: Date;
updatedAt: Date;
deviceId: string;
integrationId: string;
accessToken: string;
accessTokenExpiresAt: Date | null;
accessTokenExpiresIn: number | null;
refreshToken: string | null;
refreshTokenExpiresAt: Date | null;
}
export declare function saveTokensToMeshProxy({ apiKey, ...props }: SaveTokensToMeshProxyRequestBody): Promise<SaveTokensToMeshProxyResponseBody>;
interface RemoveTokensFromMeshProxyRequestBody {
deviceId: string;
brokerType: string;
apiKey: string;
}
export declare function removeTokensFromMeshProxy({ apiKey, ...props }: RemoveTokensFromMeshProxyRequestBody): Promise<void>;
export {};

@@ -6,2 +6,6 @@ export interface GetCryptocurrencyHoldingsRequest {

}
export interface GetCryptocurrencyHoldingsRequestProxy extends Omit<GetCryptocurrencyHoldingsRequest, 'authToken' | 'type'> {
deviceId: string;
brokerType: string;
}
export interface GetTransferIntegrationsRequest {

@@ -50,2 +54,6 @@ apiKey: string;

}
export interface PreviewTransferRequestProxy extends Omit<PreviewTransferRequest, 'fromAuthToken' | 'fromType'> {
deviceId: string;
brokerType: string;
}
export interface MeshExecuteTransferRequest {

@@ -58,2 +66,6 @@ apiKey: string;

}
export interface MeshExecuteTransferRequestProxy extends Omit<MeshExecuteTransferRequest, 'fromAuthToken' | 'fromType'> {
deviceId: string;
brokerType: string;
}
export declare enum MeshExecuteTransferStatus {

@@ -95,2 +107,5 @@ succeeded = "succeeded",

}
export interface MeshProxyUnauthorizedResponse {
error: string;
}
export interface PreviewTransferResponse {

@@ -97,0 +112,0 @@ /** The status of the operation. */

{
"name": "@funkit/api-base",
"version": "1.4.2",
"version": "1.5.0",
"description": "Base API for Funkit",

@@ -18,3 +18,2 @@ "main": "dist/index.js",

"@types/big.js": "^6.2.2",
"ts-node": "^10.9.1",
"typescript": "^5.4.3",

@@ -21,0 +20,0 @@ "vitest": "^2.0.5"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc