
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
@f8n/foundationkit-core
Advanced tools
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
yarn add @foundationkit/core
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>
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.
<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>
getMarketInfosendBidsendBuyNowsendOffergetLastSoldPricegetApprovalsetApprovalsetReserveAuctionsetBuyNowcancelBuyNowcancelReserveAuctionacceptOfferfinalizeReserveAuctiongetBalancesgetMintedDatewithdrawFethgetMarketInfoFunction for accessing a NFT's market information.
import { getMarketInfo } from '@foundationkit/core';
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);
});
{
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;
}
}
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);
});
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);
});
A valid token ID of the NFT you are querying.
getMarketInfo({
// provider,
// contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
tokenId: 8,
}).then((data) => {
console.log(data);
});
sendBidHook for placing a bid for a NFT that is currently in escrow of the Foundation Market contract.
import { sendBid } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
sendBuyNowFunction 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';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
sendOfferFunction for placing an offer on an NFT.
import { sendOffer } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
getLastSoldPriceFunction for fetching the last sold price of an NFT within Foundation's Market.
import { getLastSoldPrice } from '@foundationkit/core';
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);
});
{
value: BigNumber;
formatted: string;
}
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);
});
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);
});
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);
});
getApprovalFunction for checking if an address has approved Foundation's market contract.
import { getApproval } from '@foundationkit/core';
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);
});
isApproved: boolean;
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);
});
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);
});
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);
});
setApprovalFunction for setting approval for the Foundation Market contract to perform actions on an NFT you own.
import { setApproval } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
setReserveAuctionFunction for creating a reserve auction & setting a reserve price on Foundation's market contract.
import { setReserveAuction } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
setBuyNowFunction for listing an NFT with a Buy Now price.
import { setBuyNow } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
cancelBuyNowFunction to cancel a Buy Now listing.
import { cancelBuyNow } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
cancelReserveAuctionFunction to cancel a Reserve auction liting. This will only work if the auction has not started yet.
import { cancelReserveAuction } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
acceptOfferFunction to accept an active offer on an NFT you own.
import { acceptOffer } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
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);
});
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);
});
finalizeReserveAuctionFunction 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';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
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);
});
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);
});
getBalancesFunction 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';
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);
});
{
ensName: string;
ethBalance: {
value: BigNumber;
formatted: string;
}
availableFethBalance: {
value: BigNumber;
formatted: string;
}
lockedFethBalance: {
value: BigNumber;
formatted: string;
}
}
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);
});
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);
});
getMintedDateFunction for fetching the timestamp that a NFT was minted at.
import { getMintedDate } from '@foundationkit/core';
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);
});
mintedDate: number;
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);
});
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);
});
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);
});
withdrawFethFunction to withdraw your Foundation Marketplace balance (FETH) into ETH.
import { withdrawFeth } from '@foundationkit/core';
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);
});
txResponse: Promise<TransactionResponse>
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);
});
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);
});
FAQs
JS library for interacting with the Foundation Protocol
The npm package @f8n/foundationkit-core receives a total of 0 weekly downloads. As such, @f8n/foundationkit-core popularity was classified as not popular.
We found that @f8n/foundationkit-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.