adds program library logo and link back to docs (#191)
* adds program library logo and link back to docs * adds logo and link to docs * formatting fixes Co-authored-by: Raj Gokal <rajgokal@macbook-pro.lan>
This commit is contained in:
parent
b006741718
commit
ef94e22067
|
@ -28,6 +28,7 @@ $ docs/build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### CI Build Flow
|
### CI Build Flow
|
||||||
|
|
||||||
The docs are built and published in Travis CI with the `docs/build.sh` script.
|
The docs are built and published in Travis CI with the `docs/build.sh` script.
|
||||||
On each PR, the docs are built, but not published.
|
On each PR, the docs are built, but not published.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ module.exports = {
|
||||||
title: "Solana Program Library Docs",
|
title: "Solana Program Library Docs",
|
||||||
tagline:
|
tagline:
|
||||||
"Solana is an open source project implementing a new, high-performance, permissionless blockchain.",
|
"Solana is an open source project implementing a new, high-performance, permissionless blockchain.",
|
||||||
url: "https://spl.docs.solana.com",
|
url: "https://spl.solana.com",
|
||||||
baseUrl: "/",
|
baseUrl: "/",
|
||||||
favicon: "img/favicon.ico",
|
favicon: "img/favicon.ico",
|
||||||
organizationName: "solana-labs", // Usually your GitHub org/user name.
|
organizationName: "solana-labs", // Usually your GitHub org/user name.
|
||||||
|
@ -14,6 +14,24 @@ module.exports = {
|
||||||
src: "img/logo-horizontal.svg",
|
src: "img/logo-horizontal.svg",
|
||||||
srcDark: "img/logo-horizontal-dark.svg",
|
srcDark: "img/logo-horizontal-dark.svg",
|
||||||
},
|
},
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
href: "https://docs.solana.com/",
|
||||||
|
label: "Docs »",
|
||||||
|
position: "left",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: "https://discordapp.com/invite/pquxPsq",
|
||||||
|
label: "Chat",
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
href: "https://github.com/solana-labs/solana",
|
||||||
|
label: "GitHub",
|
||||||
|
position: "right",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
style: "dark",
|
style: "dark",
|
||||||
|
@ -55,7 +73,7 @@ module.exports = {
|
||||||
docs: {
|
docs: {
|
||||||
path: "src",
|
path: "src",
|
||||||
routeBasePath: "/",
|
routeBasePath: "/",
|
||||||
homePageId: 'introduction',
|
homePageId: "introduction",
|
||||||
sidebarPath: require.resolve("./sidebars.js"),
|
sidebarPath: require.resolve("./sidebars.js"),
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
docs: {
|
docs: {
|
||||||
"Introduction": ["introduction"],
|
"Other Thing": [],
|
||||||
"Programs": [
|
"Solana Program Library (SPL)": [
|
||||||
|
"introduction",
|
||||||
"token",
|
"token",
|
||||||
"token-swap",
|
"token-swap",
|
||||||
"memo",
|
"memo",
|
||||||
|
|
|
@ -3,4 +3,4 @@ scripts: [
|
||||||
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
||||||
'/js/code-block-buttons.js',
|
'/js/code-block-buttons.js',
|
||||||
],
|
],
|
||||||
stylesheets: ['/css/code-block-buttons.css']
|
stylesheets: ['/css/code-block-buttons.css']
|
|
@ -1,10 +1,10 @@
|
||||||
---
|
---
|
||||||
title: Solana Program Library
|
title: Introduction
|
||||||
---
|
---
|
||||||
|
|
||||||
The Solana Program Library (SPL) is a collection of on-chain programs targeting
|
The Solana Program Library (SPL) is a collection of on-chain programs targeting
|
||||||
the [Sealevel parallel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192).
|
the [Sealevel parallel runtime](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192).
|
||||||
These programs are tested against Solana's implementation
|
These programs are tested against Solana's implementation
|
||||||
of Sealevel, solana-runtime, and deployed to its mainnet. As others implement
|
of Sealevel, solana-runtime, and deployed to its mainnet. As others implement
|
||||||
Sealevel, we will graciously accept patches to ensure the programs here are
|
Sealevel, we will graciously accept patches to ensure the programs here are
|
||||||
portable across all implementations.
|
portable across all implementations.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
title: Memo Program
|
title: Memo Program
|
||||||
---
|
---
|
||||||
|
|
||||||
A simple program that validates a string of UTF-8 encoded characters. It can be
|
A simple program that validates a string of UTF-8 encoded characters. It can be
|
||||||
used to record a string on-chain, stored in the instruction data of a successful
|
used to record a string on-chain, stored in the instruction data of a successful
|
||||||
transaction.
|
transaction.
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ transaction.
|
||||||
|
|
||||||
Solana's programming model and the definitions of the Solana terms used in this
|
Solana's programming model and the definitions of the Solana terms used in this
|
||||||
document are available at:
|
document are available at:
|
||||||
|
|
||||||
- https://docs.solana.com/apps
|
- https://docs.solana.com/apps
|
||||||
- https://docs.solana.com/terminology
|
- https://docs.solana.com/terminology
|
||||||
|
|
||||||
|
@ -26,4 +27,4 @@ The on-chain Memo Program is written in Rust and available on crates.io as
|
||||||
## Operational overview
|
## Operational overview
|
||||||
|
|
||||||
The Memo program attempts to UTF-8 decode the instruction data; if successfully
|
The Memo program attempts to UTF-8 decode the instruction data; if successfully
|
||||||
decoded, the instruction is successful.
|
decoded, the instruction is successful.
|
||||||
|
|
|
@ -11,6 +11,7 @@ utilize to create and use their tokens.
|
||||||
|
|
||||||
Solana's programming model and the definitions of the Solana terms used in this
|
Solana's programming model and the definitions of the Solana terms used in this
|
||||||
document are available at:
|
document are available at:
|
||||||
|
|
||||||
- https://docs.solana.com/apps
|
- https://docs.solana.com/apps
|
||||||
- https://docs.solana.com/terminology
|
- https://docs.solana.com/terminology
|
||||||
|
|
||||||
|
@ -40,20 +41,20 @@ instructions.
|
||||||
### Creating a new token type
|
### Creating a new token type
|
||||||
|
|
||||||
A new token type can be created by initializing a new Mint with the
|
A new token type can be created by initializing a new Mint with the
|
||||||
`InitializeMint` instruction. The Mint is used to create or "Mint" new tokens,
|
`InitializeMint` instruction. The Mint is used to create or "Mint" new tokens,
|
||||||
and these tokens are stored in Accounts. A Mint is associated with each
|
and these tokens are stored in Accounts. A Mint is associated with each
|
||||||
Account, which means that the total supply of a particular token type is equal
|
Account, which means that the total supply of a particular token type is equal
|
||||||
to the balances of all the associated Accounts.
|
to the balances of all the associated Accounts.
|
||||||
|
|
||||||
A Mint can either be configured with a fixed-supply or non-fixed supply. The
|
A Mint can either be configured with a fixed-supply or non-fixed supply. The
|
||||||
total supply of a fixed-supply Mint is determined during initialization and
|
total supply of a fixed-supply Mint is determined during initialization and
|
||||||
deposited into a provided destination account. A non-fixed-supply Mint also has
|
deposited into a provided destination account. A non-fixed-supply Mint also has
|
||||||
an owner associated with it who has the authority to create new tokens in the
|
an owner associated with it who has the authority to create new tokens in the
|
||||||
future with the `MintTo` instruction. Both types of Mints can `Burn` tokens to
|
future with the `MintTo` instruction. Both types of Mints can `Burn` tokens to
|
||||||
decrease supply.ß
|
decrease supply.ß
|
||||||
|
|
||||||
It's important to note that the `InitializeMint` instruction does not require
|
It's important to note that the `InitializeMint` instruction does not require
|
||||||
the Solana account being initialized also be a signer. The `InitializeMint`
|
the Solana account being initialized also be a signer. The `InitializeMint`
|
||||||
instruction should be atomically processed with the system instruction that
|
instruction should be atomically processed with the system instruction that
|
||||||
creates the Solana account by including both instructions in the same
|
creates the Solana account by including both instructions in the same
|
||||||
transaction.
|
transaction.
|
||||||
|
@ -61,7 +62,7 @@ transaction.
|
||||||
### Creating accounts
|
### Creating accounts
|
||||||
|
|
||||||
Accounts hold token balances and are created using the `InitializeAccount`
|
Accounts hold token balances and are created using the `InitializeAccount`
|
||||||
instruction. Each Account has an owner who must be present as a signer in some
|
instruction. Each Account has an owner who must be present as a signer in some
|
||||||
instructions.
|
instructions.
|
||||||
|
|
||||||
Balances can be transferred between Accounts using the `Transfer` instruction.
|
Balances can be transferred between Accounts using the `Transfer` instruction.
|
||||||
|
@ -72,7 +73,7 @@ An Account's owner may transfer ownership of an account to another using the
|
||||||
`SetOwner` instruction.
|
`SetOwner` instruction.
|
||||||
|
|
||||||
It's important to note that the `InitializeAccount` instruction does not require
|
It's important to note that the `InitializeAccount` instruction does not require
|
||||||
the Solana account being initialized also be a signer. The `InitializeAccount`
|
the Solana account being initialized also be a signer. The `InitializeAccount`
|
||||||
instruction should be atomically processed with the system instruction that
|
instruction should be atomically processed with the system instruction that
|
||||||
creates the Solana account by including both instructions in the same
|
creates the Solana account by including both instructions in the same
|
||||||
transaction.
|
transaction.
|
||||||
|
@ -85,35 +86,36 @@ to another Account, effectively removing the token from circulation permanently.
|
||||||
### Authority delegation
|
### Authority delegation
|
||||||
|
|
||||||
Account owners may delegate authority over some or all of their token balance
|
Account owners may delegate authority over some or all of their token balance
|
||||||
using the `Approve` instruction. Delegated authorities may transfer or burn up
|
using the `Approve` instruction. Delegated authorities may transfer or burn up
|
||||||
to the amount they've been delegated. Authority delegation may be revoked by
|
to the amount they've been delegated. Authority delegation may be revoked by
|
||||||
the Account's owner via the `Revoke` instruction.
|
the Account's owner via the `Revoke` instruction.
|
||||||
|
|
||||||
### Multisignatures
|
### Multisignatures
|
||||||
|
|
||||||
M of N multisignatures are supported and can be used in place of Mint owners, or
|
M of N multisignatures are supported and can be used in place of Mint owners, or
|
||||||
Account owners or delegates. Multisignature owners or delegates must be
|
Account owners or delegates. Multisignature owners or delegates must be
|
||||||
initialized with the `InitializeMultisig` instruction. Initialization specifies
|
initialized with the `InitializeMultisig` instruction. Initialization specifies
|
||||||
the set of N public keys that are valid and the number M of those N that must be
|
the set of N public keys that are valid and the number M of those N that must be
|
||||||
present as instruction signers for the authority to be legitimate.
|
present as instruction signers for the authority to be legitimate.
|
||||||
|
|
||||||
It's important to note that the `InitializeMultisig` instruction does not
|
It's important to note that the `InitializeMultisig` instruction does not
|
||||||
require the Solana account being initialized also be a signer. The
|
require the Solana account being initialized also be a signer. The
|
||||||
`InitializeMultisig` instruction should be atomically processed with the system
|
`InitializeMultisig` instruction should be atomically processed with the system
|
||||||
instruction that creates the Solana account by including both instructions in
|
instruction that creates the Solana account by including both instructions in
|
||||||
the same transaction.
|
the same transaction.
|
||||||
|
|
||||||
### Wrapping SOL
|
### Wrapping SOL
|
||||||
|
|
||||||
The Token Program can be used to wrap native SOL. Doing so allows native SOL to
|
The Token Program can be used to wrap native SOL. Doing so allows native SOL to
|
||||||
be treated like any other Token program token type and can be useful when being
|
be treated like any other Token program token type and can be useful when being
|
||||||
called from other programs that interact with the Token Program's interface.
|
called from other programs that interact with the Token Program's interface.
|
||||||
|
|
||||||
Accounts containing wrapped SOL are associated with a specific Mint called the
|
Accounts containing wrapped SOL are associated with a specific Mint called the
|
||||||
"Native Mint" using the public key
|
"Native Mint" using the public key
|
||||||
`So11111111111111111111111111111111111111111`.
|
`So11111111111111111111111111111111111111111`.
|
||||||
|
|
||||||
These accounts have a few unique behaviors
|
These accounts have a few unique behaviors
|
||||||
|
|
||||||
- `InitializeAccount` sets the balance of the initialized Account to the SOL
|
- `InitializeAccount` sets the balance of the initialized Account to the SOL
|
||||||
balance of the Solana account being initialized, resulting in a token balance
|
balance of the Solana account being initialized, resulting in a token balance
|
||||||
equal to the SOL balance.
|
equal to the SOL balance.
|
||||||
|
@ -124,7 +126,7 @@ These accounts have a few unique behaviors
|
||||||
|
|
||||||
### Closing accounts
|
### Closing accounts
|
||||||
|
|
||||||
An account may be closed using the `CloseAccount` instruction. When closing an
|
An account may be closed using the `CloseAccount` instruction. When closing an
|
||||||
Account, all remaining SOL will be transferred to another Solana account
|
Account, all remaining SOL will be transferred to another Solana account
|
||||||
(doesn't have to be associated with the Token Program). Non-native accounts
|
(doesn't have to be associated with the Token Program). Non-native accounts
|
||||||
must have a balance of zero to be closed.
|
must have a balance of zero to be closed.
|
||||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
|
@ -1,48 +1,47 @@
|
||||||
// Turn off ESLint for this file because it's sent down to users as-is.
|
// Turn off ESLint for this file because it's sent down to users as-is.
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener("load", function () {
|
||||||
function button(label, ariaLabel, icon, className) {
|
function button(label, ariaLabel, icon, className) {
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement("button");
|
||||||
btn.classList.add('btnIcon', className);
|
btn.classList.add("btnIcon", className);
|
||||||
btn.setAttribute('type', 'button');
|
btn.setAttribute("type", "button");
|
||||||
btn.setAttribute('aria-label', ariaLabel);
|
btn.setAttribute("aria-label", ariaLabel);
|
||||||
btn.innerHTML =
|
btn.innerHTML =
|
||||||
'<div class="btnIcon__body">' +
|
'<div class="btnIcon__body">' +
|
||||||
icon +
|
icon +
|
||||||
'<strong class="btnIcon__label">' +
|
'<strong class="btnIcon__label">' +
|
||||||
label +
|
label +
|
||||||
'</strong>' +
|
"</strong>" +
|
||||||
'</div>';
|
"</div>";
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addButtons(codeBlockSelector, btn) {
|
function addButtons(codeBlockSelector, btn) {
|
||||||
document.querySelectorAll(codeBlockSelector).forEach(function(code) {
|
document.querySelectorAll(codeBlockSelector).forEach(function (code) {
|
||||||
code.parentNode.appendChild(btn.cloneNode(true));
|
code.parentNode.appendChild(btn.cloneNode(true));
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const copyIcon =
|
|
||||||
'<svg width="12" height="12" viewBox="340 364 14 15" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M342 375.974h4v.998h-4v-.998zm5-5.987h-5v.998h5v-.998zm2 2.994v-1.995l-3 2.993 3 2.994v-1.996h5v-1.995h-5zm-4.5-.997H342v.998h2.5v-.997zm-2.5 2.993h2.5v-.998H342v.998zm9 .998h1v1.996c-.016.28-.11.514-.297.702-.187.187-.422.28-.703.296h-10c-.547 0-1-.452-1-.998v-10.976c0-.546.453-.998 1-.998h3c0-1.107.89-1.996 2-1.996 1.11 0 2 .89 2 1.996h3c.547 0 1 .452 1 .998v4.99h-1v-2.995h-10v8.98h10v-1.996zm-9-7.983h8c0-.544-.453-.996-1-.996h-1c-.547 0-1-.453-1-.998 0-.546-.453-.998-1-.998-.547 0-1 .452-1 .998 0 .545-.453.998-1 .998h-1c-.547 0-1 .452-1 .997z" fill-rule="evenodd"/></svg>';
|
|
||||||
|
|
||||||
addButtons(
|
|
||||||
'.hljs',
|
|
||||||
button('Copy', 'Copy code to clipboard', copyIcon, 'btnClipboard'),
|
|
||||||
);
|
|
||||||
|
|
||||||
const clipboard = new ClipboardJS('.btnClipboard', {
|
|
||||||
target: function(trigger) {
|
|
||||||
return trigger.parentNode.querySelector('code');
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
clipboard.on('success', function(event) {
|
|
||||||
event.clearSelection();
|
|
||||||
const textEl = event.trigger.querySelector('.btnIcon__label');
|
|
||||||
textEl.textContent = 'Copied';
|
|
||||||
setTimeout(function() {
|
|
||||||
textEl.textContent = 'Copy';
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const copyIcon =
|
||||||
|
'<svg width="12" height="12" viewBox="340 364 14 15" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M342 375.974h4v.998h-4v-.998zm5-5.987h-5v.998h5v-.998zm2 2.994v-1.995l-3 2.993 3 2.994v-1.996h5v-1.995h-5zm-4.5-.997H342v.998h2.5v-.997zm-2.5 2.993h2.5v-.998H342v.998zm9 .998h1v1.996c-.016.28-.11.514-.297.702-.187.187-.422.28-.703.296h-10c-.547 0-1-.452-1-.998v-10.976c0-.546.453-.998 1-.998h3c0-1.107.89-1.996 2-1.996 1.11 0 2 .89 2 1.996h3c.547 0 1 .452 1 .998v4.99h-1v-2.995h-10v8.98h10v-1.996zm-9-7.983h8c0-.544-.453-.996-1-.996h-1c-.547 0-1-.453-1-.998 0-.546-.453-.998-1-.998-.547 0-1 .452-1 .998 0 .545-.453.998-1 .998h-1c-.547 0-1 .452-1 .997z" fill-rule="evenodd"/></svg>';
|
||||||
|
|
||||||
|
addButtons(
|
||||||
|
".hljs",
|
||||||
|
button("Copy", "Copy code to clipboard", copyIcon, "btnClipboard")
|
||||||
|
);
|
||||||
|
|
||||||
|
const clipboard = new ClipboardJS(".btnClipboard", {
|
||||||
|
target: function (trigger) {
|
||||||
|
return trigger.parentNode.querySelector("code");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clipboard.on("success", function (event) {
|
||||||
|
event.clearSelection();
|
||||||
|
const textEl = event.trigger.querySelector(".btnIcon__label");
|
||||||
|
textEl.textContent = "Copied";
|
||||||
|
setTimeout(function () {
|
||||||
|
textEl.textContent = "Copy";
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue