Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
dr497 committed Apr 1, 2024
1 parent 32308b4 commit 50d6892
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 40 deletions.
64 changes: 45 additions & 19 deletions docs/marketplace.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ <h1 class="menu-title">Solana Name Service Guide</h1>
<main>
<h1 id="marketplace"><a class="header" href="#marketplace">Marketplace</a></h1>
<h2 id="sns-marketplace"><a class="header" href="#sns-marketplace">SNS Marketplace</a></h2>
<p>The SNS Marketplace program makes it possible to integrate the purchase and sale of SNS domains directly into your own applications. Interact with the SNS Marketplace smart contract using our JS SDK linked below.</p>
<h3 id="deployment"><a class="header" href="#deployment">Deployment:</a></h3>
<ul>
<li>Program ID: <code>85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29</code></li>
Expand All @@ -189,6 +190,7 @@ <h3 id="deployment"><a class="header" href="#deployment">Deployment:</a></h3>
<li>Category</li>
<li>P2P</li>
</ul>
<p>The functions from our SDK detailed below will return instructions that you can use to build transactions.</p>
<p>Fixed price and unsolicited offers support the following tokens as quote currency: SOL, FIDA, USDC, USDT, mSOL, BONK, BAT, PYTH and bSOL.</p>
<p>All these listings can be accessed on <a href="https://www.sns.id/">sns.id</a></p>
<h3 id="fixed-price-offers"><a class="header" href="#fixed-price-offers">Fixed Price Offers</a></h3>
Expand Down Expand Up @@ -217,22 +219,31 @@ <h3 id="fixed-price-offers"><a class="header" href="#fixed-price-offers">Fixed P
const seller = new PublicKey(&quot;...&quot;); // Public key of the seller i.e domain owner
const mint = new PublicKey(&quot;EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&quot;); // USDC mint
const amount = 1 * 1e6; // Amount with decimals, here 1 USDC
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key

const ix = await makeFixedPriceOffer(
connection,
amount,
mint,
seller,
pubkey,
NAME_OFFERS_ID
domainKey,
NAME_OFFERS_ID // The program ID that can be imported directly from our SDK
);
</code></pre>
<p>Buying a fixed price offer is facilitated through the <code>buyFixedPrice</code> function, which ensures the transfer of the domain to the buyer and the payment to the seller:</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const fixedPriceKey = new PublicKey(&quot;...&quot;); // Public key of the fixed price offer account
const buyer = new PublicKey(&quot;...&quot;); // Public key of the offer buyer
const source = new PublicKey(&quot;...&quot;); // Source of the funds used to purchase the offer. In case of SOL it's the same as `buyer`, in the token case it's the ATA of the buyer for the given mint
const source = new PublicKey(&quot;...&quot;); // Source of the funds used to purchase the offer. In case of SOL it's the same as `buyer`. If another token is used, it's the ATA of the buyer for the given mint.
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key

// Use a util function from our SDK to get fixed price offers by name, by owner, or all fixed price offers.
const fixedPriceOffers = await getFixedPriceOffersForName(
connection,
domainKey
);

// This example arbitrarily selects the first fixed price offer in the list. Filter offers based on the your needs.
const fixedPriceKey = fixedPriceOffers[0].pubkey;

const ix = await buyFixedPrice(
connection,
Expand Down Expand Up @@ -267,13 +278,13 @@ <h3 id="unsolicited-offers"><a class="header" href="#unsolicited-offers">Unsolic
<p>Placing an unsolicited offers is handled by the <code>makeOffer</code> function</p>
<pre><code class="language-ts">const mint = new PublicKey(&quot;EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&quot;); // USDC mint
const amount = 1 * 1e6; // Amount with decimals, here 1 USDC
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const owner = new PublicKey(&quot;...&quot;); // Owner of the unsolicited offer
const tokenSource = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const tokenSource = new PublicKey(&quot;...&quot;); // Token source used to place the offer. In case of SOL it's the same as `owner`. If another token is used, it's the ATA of the owner for the given mint.

const ix = await makeOffer(
amount,
pubkey,
domainKey,
owner,
mint,
tokenSource,
Expand All @@ -282,20 +293,25 @@ <h3 id="unsolicited-offers"><a class="header" href="#unsolicited-offers">Unsolic
</code></pre>
<p>An unsolicited offer can be accepted by the domain owner using the <code>acceptOffer</code> function:</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const offerKey = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const offerOwner = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const domainOwner = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const domainOwner = new PublicKey(&quot;...&quot;); // Current domain owner
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const offerEscrow = new PublicKey(&quot;...&quot;); // PDA used to store the funds of the offer, the address is written in the state
const destination = new PublicKey(&quot;...&quot;); // The token account used to receive the funds from the escrow

// Use a util function from the SDK to get offers by domain name, by domain owner, etc.
const offers = await getOffersForName(connection, &quot;something.sol&quot;);

// This example arbitrarily selects the first offer in the list. Filter offers based on your needs.
const offerKey = offers[0].pubkey;
const offerOwner = offers[0].owner;

const ix = await acceptOffer(
connection,
NAME_OFFERS_ID,
key,
offerKey,
offerOwner,
publicKey,
pubkey,
domainKey,
offerEscrow,
destination
);
Expand Down Expand Up @@ -323,11 +339,17 @@ <h3 id="category-offers"><a class="header" href="#category-offers">Category offe
<span class="boring">}</span></code></pre></pre>
<p>Category Offers allow buyers to bid on an entire domain category. Sellers can accept these offers, selling domains within the specified category.</p>
<p>The creation of a category offer is managed by the <code>makeCategoryOffer</code> function, which specifies the number of domains, the SOL price per domain, and the category:</p>
<pre><code class="language-ts">const amount = 10 * LAMPORTS_PER_SOL; // Amount of the offer in lamports here 10 SOL
<pre><code class="language-ts">import { CATEGORIES } from &quot;@bonfida/sns-categories&quot;; // Map of current categories

const amount = 10 * LAMPORTS_PER_SOL; // Amount of the offer in lamports here 10 SOL
const nbDomains = 10; // Number of domains the buyer wants to buy
const categoryKey = new PublicKey(&quot;...&quot;); // Public key of the category
const buyer = new PublicKey(&quot;...&quot;);

// Filter CATEGORIES to find the categoryKey which is the Public key of the category.
const categoryKey = [...CATEGORIES].find(
([, value]) =&gt; value === &quot;999-club&quot;
)?.[0];

const ix = await makeCategoryOffer(
amount,
nbDomains,
Expand All @@ -338,16 +360,20 @@ <h3 id="category-offers"><a class="header" href="#category-offers">Category offe
</code></pre>
<p>Taking a category offer is facilitated through the <code>takeCategoryOffer</code> function, allowing sellers to sell domains within the category at the specified price.</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const categoryOfferKey = new PublicKey(&quot;...&quot;); // Public key of the category offer
const { pubkey } = getDomainKeySync(&quot;999.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;999.sol&quot;); // Domain public key
const memberKey = CategoryMember.findKey(&quot;999&quot;, categoryKey); // Membership of the domain to the category
const seller = new PublicKey(&quot;...&quot;); // Seller of the domain here 999.sol

// Use a util function from the SDK to get category offers by category, category offers for a specific owner, etc.
const categoryOffers = await getCategoryOffer(connection, categoryKey);
// This example arbitrarily selects the first category offer in the list. Filter offers based on your needs.
const categoryOfferKey = categoryOffers[0].pubkey;

const ix = await takeCategoryOffer(
connection,
NAME_OFFERS_ID,
categoryOfferKey,
pubkey,
domainKey,
memberKey,
seller
);
Expand Down
64 changes: 45 additions & 19 deletions docs/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,7 @@ <h3 id="domains-for-owner"><a class="header" href="#domains-for-owner">Domains f
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h1 id="marketplace"><a class="header" href="#marketplace">Marketplace</a></h1>
<h2 id="sns-marketplace"><a class="header" href="#sns-marketplace">SNS Marketplace</a></h2>
<p>The SNS Marketplace program makes it possible to integrate the purchase and sale of SNS domains directly into your own applications. Interact with the SNS Marketplace smart contract using our JS SDK linked below.</p>
<h3 id="deployment-1"><a class="header" href="#deployment-1">Deployment:</a></h3>
<ul>
<li>Program ID: <code>85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29</code></li>
Expand All @@ -2514,6 +2515,7 @@ <h3 id="deployment-1"><a class="header" href="#deployment-1">Deployment:</a></h3
<li>Category</li>
<li>P2P</li>
</ul>
<p>The functions from our SDK detailed below will return instructions that you can use to build transactions.</p>
<p>Fixed price and unsolicited offers support the following tokens as quote currency: SOL, FIDA, USDC, USDT, mSOL, BONK, BAT, PYTH and bSOL.</p>
<p>All these listings can be accessed on <a href="https://www.sns.id/">sns.id</a></p>
<h3 id="fixed-price-offers"><a class="header" href="#fixed-price-offers">Fixed Price Offers</a></h3>
Expand Down Expand Up @@ -2542,22 +2544,31 @@ <h3 id="fixed-price-offers"><a class="header" href="#fixed-price-offers">Fixed P
const seller = new PublicKey(&quot;...&quot;); // Public key of the seller i.e domain owner
const mint = new PublicKey(&quot;EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&quot;); // USDC mint
const amount = 1 * 1e6; // Amount with decimals, here 1 USDC
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key

const ix = await makeFixedPriceOffer(
connection,
amount,
mint,
seller,
pubkey,
NAME_OFFERS_ID
domainKey,
NAME_OFFERS_ID // The program ID that can be imported directly from our SDK
);
</code></pre>
<p>Buying a fixed price offer is facilitated through the <code>buyFixedPrice</code> function, which ensures the transfer of the domain to the buyer and the payment to the seller:</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const fixedPriceKey = new PublicKey(&quot;...&quot;); // Public key of the fixed price offer account
const buyer = new PublicKey(&quot;...&quot;); // Public key of the offer buyer
const source = new PublicKey(&quot;...&quot;); // Source of the funds used to purchase the offer. In case of SOL it's the same as `buyer`, in the token case it's the ATA of the buyer for the given mint
const source = new PublicKey(&quot;...&quot;); // Source of the funds used to purchase the offer. In case of SOL it's the same as `buyer`. If another token is used, it's the ATA of the buyer for the given mint.
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key

// Use a util function from our SDK to get fixed price offers by name, by owner, or all fixed price offers.
const fixedPriceOffers = await getFixedPriceOffersForName(
connection,
domainKey
);

// This example arbitrarily selects the first fixed price offer in the list. Filter offers based on the your needs.
const fixedPriceKey = fixedPriceOffers[0].pubkey;

const ix = await buyFixedPrice(
connection,
Expand Down Expand Up @@ -2592,13 +2603,13 @@ <h3 id="unsolicited-offers"><a class="header" href="#unsolicited-offers">Unsolic
<p>Placing an unsolicited offers is handled by the <code>makeOffer</code> function</p>
<pre><code class="language-ts">const mint = new PublicKey(&quot;EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&quot;); // USDC mint
const amount = 1 * 1e6; // Amount with decimals, here 1 USDC
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const owner = new PublicKey(&quot;...&quot;); // Owner of the unsolicited offer
const tokenSource = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const tokenSource = new PublicKey(&quot;...&quot;); // Token source used to place the offer. In case of SOL it's the same as `owner`. If another token is used, it's the ATA of the owner for the given mint.

const ix = await makeOffer(
amount,
pubkey,
domainKey,
owner,
mint,
tokenSource,
Expand All @@ -2607,20 +2618,25 @@ <h3 id="unsolicited-offers"><a class="header" href="#unsolicited-offers">Unsolic
</code></pre>
<p>An unsolicited offer can be accepted by the domain owner using the <code>acceptOffer</code> function:</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const offerKey = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const offerOwner = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const domainOwner = new PublicKey(&quot;...&quot;); // Token source used to place the offer
const { pubkey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const domainOwner = new PublicKey(&quot;...&quot;); // Current domain owner
const { pubkey: domainKey } = getDomainKeySync(&quot;something.sol&quot;); // Domain public key
const offerEscrow = new PublicKey(&quot;...&quot;); // PDA used to store the funds of the offer, the address is written in the state
const destination = new PublicKey(&quot;...&quot;); // The token account used to receive the funds from the escrow

// Use a util function from the SDK to get offers by domain name, by domain owner, etc.
const offers = await getOffersForName(connection, &quot;something.sol&quot;);

// This example arbitrarily selects the first offer in the list. Filter offers based on your needs.
const offerKey = offers[0].pubkey;
const offerOwner = offers[0].owner;

const ix = await acceptOffer(
connection,
NAME_OFFERS_ID,
key,
offerKey,
offerOwner,
publicKey,
pubkey,
domainKey,
offerEscrow,
destination
);
Expand Down Expand Up @@ -2648,11 +2664,17 @@ <h3 id="category-offers"><a class="header" href="#category-offers">Category offe
<span class="boring">}</span></code></pre></pre>
<p>Category Offers allow buyers to bid on an entire domain category. Sellers can accept these offers, selling domains within the specified category.</p>
<p>The creation of a category offer is managed by the <code>makeCategoryOffer</code> function, which specifies the number of domains, the SOL price per domain, and the category:</p>
<pre><code class="language-ts">const amount = 10 * LAMPORTS_PER_SOL; // Amount of the offer in lamports here 10 SOL
<pre><code class="language-ts">import { CATEGORIES } from &quot;@bonfida/sns-categories&quot;; // Map of current categories

const amount = 10 * LAMPORTS_PER_SOL; // Amount of the offer in lamports here 10 SOL
const nbDomains = 10; // Number of domains the buyer wants to buy
const categoryKey = new PublicKey(&quot;...&quot;); // Public key of the category
const buyer = new PublicKey(&quot;...&quot;);

// Filter CATEGORIES to find the categoryKey which is the Public key of the category.
const categoryKey = [...CATEGORIES].find(
([, value]) =&gt; value === &quot;999-club&quot;
)?.[0];

const ix = await makeCategoryOffer(
amount,
nbDomains,
Expand All @@ -2663,16 +2685,20 @@ <h3 id="category-offers"><a class="header" href="#category-offers">Category offe
</code></pre>
<p>Taking a category offer is facilitated through the <code>takeCategoryOffer</code> function, allowing sellers to sell domains within the category at the specified price.</p>
<pre><code class="language-ts">const connection = new Connection(&quot;...&quot;);
const categoryOfferKey = new PublicKey(&quot;...&quot;); // Public key of the category offer
const { pubkey } = getDomainKeySync(&quot;999.sol&quot;); // Domain public key
const { pubkey: domainKey } = getDomainKeySync(&quot;999.sol&quot;); // Domain public key
const memberKey = CategoryMember.findKey(&quot;999&quot;, categoryKey); // Membership of the domain to the category
const seller = new PublicKey(&quot;...&quot;); // Seller of the domain here 999.sol

// Use a util function from the SDK to get category offers by category, category offers for a specific owner, etc.
const categoryOffers = await getCategoryOffer(connection, categoryKey);
// This example arbitrarily selects the first category offer in the list. Filter offers based on your needs.
const categoryOfferKey = categoryOffers[0].pubkey;

const ix = await takeCategoryOffer(
connection,
NAME_OFFERS_ID,
categoryOfferKey,
pubkey,
domainKey,
memberKey,
seller
);
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/searchindex.json

Large diffs are not rendered by default.

0 comments on commit 50d6892

Please sign in to comment.