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,
}).then((data) => {
console.log(data);
});
contractAddress (required)
A valid ethereum address for the smart contract of the NFT you are querying
getMarketInfo({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
console.log(data);
});
tokenId (required)
A valid token ID of the NFT you are querying.
getMarketInfo({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
tokenId: 8,
}).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({
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({
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({
gasMargin: 15,
});
}
sendBid({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
console.log(data);
});
tokenId (required)
A valid token ID of the NFT you are buying.
import { sendBuyNow } from '@foundationkit/core';
sendBuyNow({
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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
tokenId: 8,
}).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({
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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).then((data) => {
console.log(data);
});
ownerAddress (required)
A valid ethereum address for the user who has provided approval.
import { getApproval } from '@foundationkit/core';
getApproval({
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,
}).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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
tokenId: 8,
}).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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
tokenId: 8,
}).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({
amount: '0.1',
}).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({
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({
gasMargin: 15,
});
}
acceptOffer({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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,
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,
}).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({
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,
}).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({
contractAddress: '0x47609b1a83B2Fc92C8AD632aE093AC61d9A85295',
}).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({
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,
gasMargin: 15,
}).then((data) => {
console.log(data);
});