npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@f8n/foundationkit-core

v0.0.1-alpha.7

Published

JS library for interacting with the Foundation Protocol

Readme

FoundationKit - Core

A set of framework independent functions to interact with Foundation's NFT Market Protocol

Using React? You're probably best using the hooks package. @f8n/foundationkit-hooks

Installation

yarn add @foundationkit/core

Getting Started

You can import the library into your script and setup a Ethereum provider.

<script type="module">
  import { getMarketInfo } from '@foundationkit/core';
  import { ethers } from 'ethers';
  const provider = new ethers.providers.JsonRpcProvider(
    'https://ethereum-node.com',
    'mainnet'
  );

  getMarketInfo({
    provider,
    contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
    tokenId: 8,
  }).then((data) => {
    console.log(data);
  });
</script>

Setting the network

Foundations Market contracts are currently deployed to Mainnet and Göerli on Ethereum. To set the network being used you need to configure the provider being passed into the hooks.

With Ethers.js

<script type="module">
  import { getMarketInfo } from '@foundationkit/core';
  import { ethers } from 'ethers';
  const provider = new ethers.providers.JsonRpcProvider(
    'https://ethereum-node.com',
    'mainnet'
  );

  getMarketInfo({
    provider,
    contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
    tokenId: 8,
  }).then((data) => {
    console.log(data);
  });
</script>

API

getMarketInfo

Function for accessing a NFT's market information.

import { getMarketInfo } from '@foundationkit/core';

Usage

An Provider must be passed in from either a library like wagmi or ethers.js.

import { getMarketInfo } from '@foundationkit/core';

getMarketInfo({
  provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

{
  ownerAddress: string;
  isInEscrow: boolean;
  auction?: {
    isAuctionLive: boolean;
    highestBidderAddress: string;
    endsAt: number;
    currentBidAmount: {
      value: BigNumber;
      formatted: string;
    }
    id: number;
    link: string;
  }
  buyNow?: {
    amount: {
      value: BigNumber;
      formatted: string;
    }
    link: string;
  }
  offer?: {
    amount: {
      value: BigNumber;
      formatted: string;
    }
    offererAddress: string;
    offerExpiresAt: number;
    link: string;
  }
}

Configuration

provider (required)

An Ethereum Provider must be provided from a library like ethers.js.

const provider = new ethers.providers.JsonRpcProvider(
  'https://ethereum-node.com',
  'mainnet'
);

getMarketInfo({
  provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are querying

getMarketInfo({
  // provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are querying.

getMarketInfo({
  // provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

sendBid

Hook for placing a bid for a NFT that is currently in escrow of the Foundation Market contract.

import { sendBid } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

sendBid({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { sendBid } from '@foundationkit/core';

sendBid({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are placing a bid on.

import { sendBid } from '@foundationkit/core';

sendBid({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are placing a bid on.

import { sendBid } from '@foundationkit/core';

sendBid({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
amount (required)

A string value representing the bid amount you are placing, it is read as eth.

import { useSendBid } from '@foundationkit/core';

sendBid({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});
referrer

A valid Ethereum address that will receive a referral fee of 1% of the sale price, if this NFT is bought via this hook. Learn more about referrals

import { sendBid } from '@foundationkit/core';

sendBid({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  referrer: '0x165CD37b4C644C2921454429E7F9358d18A45e14',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { sendBid } from '@foundationkit/core';

function App() {
  const sendBid = useSendBid({
    // Will send 15% more gas, based on the estimate gas calculation
    gasMargin: 15,
  });
}
sendBid({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

sendBuyNow

Function for buying at a Buy Now price for a NFT that is currently in escrow of the Foundation Market contract.

import { sendBuyNow } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are buying.

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are buying.

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});
referrer

A valid Ethereum address that will receive a referral fee of 1% of the sale price, if this NFT is bought via this hook. Learn more about referrals

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  referrer: '0x165CD37b4C644C2921454429E7F9358d18A45e14',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { sendBuyNow } from '@foundationkit/core';

sendBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

sendOffer

Function for placing an offer on an NFT.

import { sendOffer } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are making an offer on.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are making an offer on.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
amount (required)

A string value representing the offer amount, it is read as eth.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});
referrer

A valid Ethereum address that will receive a referral fee of 1% of the sale price, if this NFT is bought via this hook. Learn more about referrals

import { sendOffer } from '@foundationkit/core';

sendOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  referrer: '0x165CD37b4C644C2921454429E7F9358d18A45e14',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { sendOffer } from '@foundationkit/core';

sendOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

getLastSoldPrice

Function for fetching the last sold price of an NFT within Foundation's Market.

import { getLastSoldPrice } from '@foundationkit/core';

Usage

An Provider must be passed in from either a library like wagmi or ethers.js.

import { getLastSoldPrice } from '@foundationkit/core';

getLastSoldPrice({
  provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

{
  value: BigNumber;
  formatted: string;
}

Configuration

provider (required)

An Ethereum Provider must be provided from a library like ethers.js.

import { getLastSoldPrice } from '@foundationkit/core';

getLastSoldPrice({
  provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are fetching the last sold price for.

import { getLastSoldPrice } from '@foundationkit/core';

getLastSoldPrice({
  // provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are fetching the last sold price for.

import { getLastSoldPrice } from '@foundationkit/core';

getLastSoldPrice({
  // provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

getApproval

Function for checking if an address has approved Foundation's market contract.

import { getApproval } from '@foundationkit/core';

Usage

A Provider must be passed in from either a library like ethers.js.

import { getApproval } from '@foundationkit/core';

getApproval({
  provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  ownerAddress: '0x2ae5f36c77a736f76d61f3eec06f12caf2963fd6',
}).then((data) => {
  console.log(data);
});

Return Value

isApproved: boolean;

Configuration

provider (required)

An Ethereum Provider must be provided from a library like ethers.js.

import { getApproval } from '@foundationkit/core';

getApproval({
  provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // ownerAddress: '0x2ae5f36c77a736f76d61f3eec06f12caf2963fd6',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are checking is approved.

import { getApproval } from '@foundationkit/core';

getApproval({
  // provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // ownerAddress: '0x2ae5f36c77a736f76d61f3eec06f12caf2963fd6',
}).then((data) => {
  console.log(data);
});
ownerAddress (required)

A valid ethereum address for the user who has provided approval.

import { getApproval } from '@foundationkit/core';

getApproval({
  // provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  ownerAddress: '0x2ae5f36c77a736f76d61f3eec06f12caf2963fd6',
}).then((data) => {
  console.log(data);
});

setApproval

Function for setting approval for the Foundation Market contract to perform actions on an NFT you own.

import { setApproval } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { setApproval } from '@foundationkit/core';

setApproval({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { setApproval } from '@foundationkit/core';

setApproval({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you would like to approve.

import { setApproval } from '@foundationkit/core';

setApproval({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { setApproval } from '@foundationkit/core';

setApproval({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

setReserveAuction

Function for creating a reserve auction & setting a reserve price on Foundation's market contract.

import { setReserveAuction } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are listing in the auction.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are listing in the auction.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});
amount (required)

A string value representing the reserve price for the NFT being listed.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { setReserveAuction } from '@foundationkit/core';

setReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

setBuyNow

Function for listing an NFT with a Buy Now price.

import { setBuyNow } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are listing with a Buy Now price.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are listing with a Buy Now price.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  // amount: '1.1',
}).then((data) => {
  console.log(data);
});
amount (required)

A string value representing the Buy Now price for the NFT being listed.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '1.1',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { setBuyNow } from '@foundationkit/core';

setBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '1.1',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

cancelBuyNow

Function to cancel a Buy Now listing.

import { cancelBuyNow } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { cancelBuyNow } from '@foundationkit/core';

cancelBuyNow({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { cancelBuyNow } from '@foundationkit/core';

cancelBuyNow({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are cancelling the listing for.

import { cancelBuyNow } from '@foundationkit/core';

cancelBuyNow({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are cancelling the listing for.

import { cancelBuyNow } from '@foundationkit/core';

cancelBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { cancelBuyNow } from '@foundationkit/core';

cancelBuyNow({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

cancelReserveAuction

Function to cancel a Reserve auction liting. This will only work if the auction has not started yet.

import { cancelReserveAuction } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { cancelReserveAuction } from '@foundationkit/core';

cancelReserveAuction({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { cancelReserveAuction } from '@foundationkit/core';

cancelReserveAuction({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are cancelling the listing for.

import { cancelReserveAuction } from '@foundationkit/core';

cancelReserveAuction({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are cancelling the listing for.

import { cancelReserveAuction } from '@foundationkit/core';

cancelReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { cancelReserveAuction } from '@foundationkit/core';

cancelReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

acceptOffer

Function to accept an active offer on an NFT you own.

import { acceptOffer } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  amount: '0.1',
  offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like ethers.js.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '0.1',
  // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are accepting an offer for.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '0.1',
  // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are accepting an offer for.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  // amount: '0.1',
  // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});
amount (required)

The amount the offer is for that you wish to accept. You can get this value from the getMarketInfo function.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  amount: '0.1',
  // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});
offererAddress (required)

The Ethereum address of the person making the offer. You can get this value from the getMarketInfo function.

import { acceptOffer } from '@foundationkit/core';

acceptOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '0.1',
  offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { acceptOffer } from '@foundationkit/core';

function App() {
  const acceptOffer = acceptOffer({
    // signer,
    // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
    // tokenId: 8,
    // amount: '0.1',
    // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
    // Will send 15% more gas, based on the estimate gas calculation
    gasMargin: 15,
  });
}

acceptOffer({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
  // amount: '0.1',
  // offererAddress: '0x7E6d171d288ecED6eB2D070D8e46Aa905b0f94aE',
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

finalizeReserveAuction

Function to finalize an reserve auction, it initiates the transfer of the NFT to the new owner and the payment amount to the seller and can be called by anyone.

import { finalizeReserveAuction } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { finalizeReserveAuction } from '@foundationkit/core';

finalizeReserveAuction({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like wagmi or ethers.js.

import { finalizeReserveAuction } from '@foundationkit/core';

finalizeReserveAuction({
  signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are finalizing the auction for.

import { finalizeReserveAuction } from '@foundationkit/core';

finalizeReserveAuction({
  // signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are finalizing the auction for.

import { finalizeReserveAuction } from '@foundationkit/core';

finalizeReserveAuction({
  // signer,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { finalizeReserveAuction } from '@foundationkit/core';

finalizeReserveAuction({
  signer,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});

getBalances

Function for accessing an accounts ETH and FETH balances, these can be locked and available depending if offers have been placed and expired. Learn more about Marketplace balances

import { getBalances } from '@foundationkit/core';

Usage

A Provider must be passed in from either a library like ethers.js.

import { getBalances } from '@foundationkit/core';

function App() {
  const { data, isLoading } = useBalances({
    provider,
    accountAddress: '0x61bC292750B648Fa9502f8FEBeBd806c3b484ACe',
  });
}

getBalances({
  provider,
  accountAddress: '0x61bC292750B648Fa9502f8FEBeBd806c3b484ACe',
}).then((data) => {
  console.log(data);
});

Return Value

{
  ensName: string;
  ethBalance: {
    value: BigNumber;
    formatted: string;
  }
  availableFethBalance: {
    value: BigNumber;
    formatted: string;
  }
  lockedFethBalance: {
    value: BigNumber;
    formatted: string;
  }
}

Configuration

provider (required)

An Ethereum Provider must be provided from a library like ethers.js.

import { getBalances } from '@foundationkit/core';

getBalances({
  provider,
  // accountAddress: '0x61bC292750B648Fa9502f8FEBeBd806c3b484ACe',
}).then((data) => {
  console.log(data);
});
accountAddress (required)

A valid ethereum address for the account you are looking up balances for.

import { getBalances } from '@foundationkit/core';

getBalances({
  // provider,
  accountAddress: '0x61bC292750B648Fa9502f8FEBeBd806c3b484ACe',
}).then((data) => {
  console.log(data);
});

getMintedDate

Function for fetching the timestamp that a NFT was minted at.

import { getMintedDate } from '@foundationkit/core';

Usage

An Provider must be passed in from either a library like ethers.js.

import { getMintedDate } from '@foundationkit/core';

getMintedDate({
  provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

Return Value

mintedDate: number;

Configuration

provider (required)

An Ethereum Provider must be provided from a library like ethers.js.

import { getMintedDate } from '@foundationkit/core';

getMintedDate({
  provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
contractAddress (required)

A valid ethereum address for the smart contract of the NFT you are fetching the minted date for.

import { getMintedDate } from '@foundationkit/core';

getMintedDate({
  // provider,
  contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  // tokenId: 8,
}).then((data) => {
  console.log(data);
});
tokenId (required)

A valid token ID of the NFT you are fetching the minted date for.

import { getMintedDate } from '@foundationkit/core';

getMintedDate({
  // provider,
  // contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
  tokenId: 8,
}).then((data) => {
  console.log(data);
});

withdrawFeth

Function to withdraw your Foundation Marketplace balance (FETH) into ETH.

import { withdrawFeth } from '@foundationkit/core';

Usage

An Signer must be passed in from either a library like ethers.js.

import { withdrawFeth } from '@foundationkit/core';

withdrawFeth({
  signer,
}).then((data) => {
  console.log(data);
});

Return Value

txResponse: Promise<TransactionResponse>

Configuration

signer (required)

An Ethereum Signer must be provided from a library like wagmi or ethers.js.

import { withdrawFeth } from '@foundationkit/core';

withdrawFeth({
  signer,
}).then((data) => {
  console.log(data);
});
gasMargin

By default we add a 10% gas margin to ensure tx's are processed (a good default to mitigate edge cases and ensuring there is a gas buffer), you can override this by passing a number that represents a % of the original gas estimation.

import { withdrawFeth } from '@foundationkit/core';

withdrawFeth({
  signer,
  // Will send 15% more gas, based on the estimate gas calculation
  gasMargin: 15,
}).then((data) => {
  console.log(data);
});