From 457ceabbfa40c984508c8fe2aaa8c57ab1545016 Mon Sep 17 00:00:00 2001 From: Armani Ferrante Date: Tue, 12 Apr 2022 18:47:53 -0400 Subject: [PATCH] Updates --- 404.html | 6 +- ...les.0eef94d9.css => 0.styles.21b321ec.css} | 2 +- assets/js/{10.99d917b5.js => 10.9b75e9f0.js} | 2 +- assets/js/{11.15bb6a5e.js => 11.0f0c790b.js} | 2 +- assets/js/{12.d30544e0.js => 12.2382ff5e.js} | 2 +- assets/js/{13.7bb3490d.js => 13.c7c68919.js} | 2 +- assets/js/{14.06c054f4.js => 14.b3c5cf32.js} | 2 +- assets/js/{15.5f458f21.js => 15.0c123204.js} | 2 +- assets/js/{16.64b07960.js => 16.1bba98d0.js} | 2 +- assets/js/{17.31820e82.js => 17.29eac49f.js} | 2 +- assets/js/{18.db5dc2ee.js => 18.a3c88079.js} | 2 +- assets/js/{19.b9ce785c.js => 19.8bcaf6fe.js} | 2 +- assets/js/{4.db2affb7.js => 4.f90252b7.js} | 2 +- assets/js/{5.4ce1ab37.js => 5.47891694.js} | 2 +- .../js/{app.61552437.js => app.dfe95c3c.js} | 6 +- cli/commands.html | 6 +- getting-started/installation.html | 8 +- getting-started/introduction.html | 6 +- getting-started/projects.html | 6 +- getting-started/publishing.html | 8 +- getting-started/verification.html | 8 +- index.html | 6 +- ts/assets/highlight.css | 2 +- ts/assets/main.js | 4 +- ts/assets/search.js | 2 +- ts/assets/style.css | 25 ++ ts/classes/AccountClient.html | 26 +- ts/classes/AnchorError.html | 8 +- ts/classes/AnchorProvider.html | 14 +- ts/classes/BN.html | 184 ++++++------ ts/classes/BorshAccountsCoder.html | 4 +- ts/classes/BorshCoder.html | 10 +- ts/classes/BorshEventCoder.html | 2 +- ts/classes/BorshInstructionCoder.html | 10 +- ts/classes/BorshStateCoder.html | 2 +- ts/classes/EventManager.html | 2 +- ts/classes/EventParser.html | 2 +- ts/classes/IdlError.html | 8 +- ts/classes/MethodsBuilderFactory.html | 2 +- ts/classes/Program.html | 34 +-- ts/classes/ProgramError.html | 8 +- ts/classes/ProgramErrorStack.html | 2 +- ts/classes/Spl.html | 2 +- ts/classes/SplTokenCoder.html | 10 +- ts/classes/StateClient.html | 18 +- ts/classes/Wallet.html | 2 +- ts/classes/web3.Account.html | 8 +- ts/classes/web3.Authorized.html | 8 +- ts/classes/web3.BpfLoader.html | 6 +- ts/classes/web3.Connection.html | 168 +++++------ ts/classes/web3.Ed25519Program.html | 6 +- ts/classes/web3.Enum.html | 2 +- ts/classes/web3.EpochSchedule.html | 14 +- ts/classes/web3.Keypair.html | 14 +- ts/classes/web3.Loader.html | 8 +- ts/classes/web3.Lockup.html | 12 +- ts/classes/web3.Message.html | 4 +- ts/classes/web3.NonceAccount.html | 4 +- ts/classes/web3.PublicKey.html | 24 +- ts/classes/web3.Secp256k1Program.html | 10 +- ts/classes/web3.SendTransactionError.html | 8 +- ts/classes/web3.StakeInstruction.html | 20 +- ts/classes/web3.StakeProgram.html | 28 +- ts/classes/web3.Struct.html | 2 +- ts/classes/web3.SystemInstruction.html | 28 +- ts/classes/web3.SystemProgram.html | 24 +- ts/classes/web3.Transaction.html | 38 +-- ts/classes/web3.TransactionInstruction.html | 8 +- ts/classes/web3.ValidatorInfo.html | 10 +- ts/classes/web3.VoteAccount.html | 4 +- ts/classes/web3.VoteInit.html | 4 +- ts/classes/web3.VoteInstruction.html | 10 +- ts/classes/web3.VoteProgram.html | 14 +- ts/index.html | 36 +-- ts/interfaces/AccountsCoder.html | 2 +- ts/interfaces/BN.MPrime.html | 2 +- ts/interfaces/BN.ReductionContext.html | 2 +- ts/interfaces/Coder.html | 10 +- ts/interfaces/EventCoder.html | 2 +- ts/interfaces/InstructionCoder.html | 2 +- ts/interfaces/Provider.html | 2 +- ts/interfaces/StateCoder.html | 2 +- ts/interfaces/web3.Ed25519Keypair.html | 4 +- ts/interfaces/web3.FeeCalculator.html | 4 +- ts/interfaces/web3.Signer.html | 4 +- ts/modules/BN.html | 2 +- ts/modules/utils.bytes.base64.html | 2 +- ts/modules/utils.bytes.bs58.html | 2 +- ts/modules/utils.bytes.hex.html | 2 +- ts/modules/utils.bytes.html | 2 +- ts/modules/utils.bytes.utf8.html | 2 +- ts/modules/utils.features.html | 2 +- ts/modules/utils.html | 2 +- ts/modules/utils.publicKey.html | 2 +- ts/modules/utils.registry.html | 4 +- ts/modules/utils.rpc.html | 4 +- ts/modules/utils.sha256.html | 2 +- ts/modules/utils.token.html | 2 +- ts/modules/web3.html | 276 +++++++++--------- tutorials/tutorial-0.html | 6 +- tutorials/tutorial-1.html | 6 +- tutorials/tutorial-2.html | 6 +- tutorials/tutorial-3.html | 6 +- tutorials/tutorial-4.html | 6 +- 104 files changed, 694 insertions(+), 669 deletions(-) rename assets/css/{0.styles.0eef94d9.css => 0.styles.21b321ec.css} (97%) rename assets/js/{10.99d917b5.js => 10.9b75e9f0.js} (99%) rename assets/js/{11.15bb6a5e.js => 11.0f0c790b.js} (98%) rename assets/js/{12.d30544e0.js => 12.2382ff5e.js} (97%) rename assets/js/{13.7bb3490d.js => 13.c7c68919.js} (97%) rename assets/js/{14.06c054f4.js => 14.b3c5cf32.js} (97%) rename assets/js/{15.5f458f21.js => 15.0c123204.js} (96%) rename assets/js/{16.64b07960.js => 16.1bba98d0.js} (87%) rename assets/js/{17.31820e82.js => 17.29eac49f.js} (99%) rename assets/js/{18.db5dc2ee.js => 18.a3c88079.js} (99%) rename assets/js/{19.b9ce785c.js => 19.8bcaf6fe.js} (99%) rename assets/js/{4.db2affb7.js => 4.f90252b7.js} (64%) rename assets/js/{5.4ce1ab37.js => 5.47891694.js} (87%) rename assets/js/{app.61552437.js => app.dfe95c3c.js} (78%) diff --git a/404.html b/404.html index 2680d6a9..d4f81e1d 100644 --- a/404.html +++ b/404.html @@ -10,11 +10,11 @@ - - + +
- + diff --git a/assets/css/0.styles.0eef94d9.css b/assets/css/0.styles.21b321ec.css similarity index 97% rename from assets/css/0.styles.0eef94d9.css rename to assets/css/0.styles.21b321ec.css index 664d7f34..a5f85c86 100644 --- a/assets/css/0.styles.0eef94d9.css +++ b/assets/css/0.styles.21b321ec.css @@ -1 +1 @@ -.copy-button[data-v-4f47a0ca]{position:absolute;z-index:3;right:.5em;cursor:pointer;opacity:.75}.copy-button.hover[data-v-4f47a0ca]{opacity:0}.copy-button[data-v-4f47a0ca]:hover{opacity:1!important}.copy-ok[data-v-4f47a0ca]{position:absolute;z-index:3;right:.5em}.xiaopanda-code-copy:hover>div>.copy-button{opacity:.75}code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}.theme-default-content code{color:#476582;padding:.25rem .5rem;margin:0;font-size:.85em;background-color:rgba(27,31,35,.05);border-radius:3px}.theme-default-content code .token.deleted{color:#ec5975}.theme-default-content code .token.inserted{color:#3eaf7c}.theme-default-content pre,.theme-default-content pre[class*=language-]{line-height:1.4;padding:1.25rem 1.5rem;margin:.85rem 0;background-color:#282c34;border-radius:6px;overflow:auto}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:#fff;padding:0;background-color:transparent;border-radius:0}div[class*=language-]{position:relative;background-color:#282c34;border-radius:6px}div[class*=language-] .highlight-lines{-webkit-user-select:none;user-select:none;padding-top:1.3rem;position:absolute;top:0;left:0;width:100%;line-height:1.4}div[class*=language-] .highlight-lines .highlighted{background-color:rgba(0,0,0,.66)}div[class*=language-] pre,div[class*=language-] pre[class*=language-]{background:transparent;position:relative;z-index:1}div[class*=language-]:before{position:absolute;z-index:3;top:.8em;right:1em;font-size:.75rem;color:hsla(0,0%,100%,.4)}div[class*=language-]:not(.line-numbers-mode) .line-numbers-wrapper{display:none}div[class*=language-].line-numbers-mode .highlight-lines .highlighted{position:relative}div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{content:" ";position:absolute;z-index:3;left:0;top:0;display:block;width:3.5rem;height:100%;background-color:rgba(0,0,0,.66)}div[class*=language-].line-numbers-mode pre{padding-left:4.5rem;vertical-align:middle}div[class*=language-].line-numbers-mode .line-numbers-wrapper{position:absolute;top:0;width:3.5rem;text-align:center;color:hsla(0,0%,100%,.3);padding:1.25rem 0;line-height:1.4}div[class*=language-].line-numbers-mode .line-numbers-wrapper br{-webkit-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-numbers-wrapper .line-number{position:relative;z-index:4;-webkit-user-select:none;user-select:none;font-size:.85em}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;z-index:2;top:0;left:0;width:3.5rem;height:100%;border-radius:6px 0 0 6px;border-right:1px solid rgba(0,0,0,.66);background-color:#282c34}div[class~=language-js]:before{content:"js"}div[class~=language-ts]:before{content:"ts"}div[class~=language-html]:before{content:"html"}div[class~=language-md]:before{content:"md"}div[class~=language-vue]:before{content:"vue"}div[class~=language-css]:before{content:"css"}div[class~=language-sass]:before{content:"sass"}div[class~=language-scss]:before{content:"scss"}div[class~=language-less]:before{content:"less"}div[class~=language-stylus]:before{content:"stylus"}div[class~=language-go]:before{content:"go"}div[class~=language-java]:before{content:"java"}div[class~=language-c]:before{content:"c"}div[class~=language-sh]:before{content:"sh"}div[class~=language-yaml]:before{content:"yaml"}div[class~=language-py]:before{content:"py"}div[class~=language-docker]:before{content:"docker"}div[class~=language-dockerfile]:before{content:"dockerfile"}div[class~=language-makefile]:before{content:"makefile"}div[class~=language-javascript]:before{content:"js"}div[class~=language-typescript]:before{content:"ts"}div[class~=language-markup]:before{content:"html"}div[class~=language-markdown]:before{content:"md"}div[class~=language-json]:before{content:"json"}div[class~=language-ruby]:before{content:"rb"}div[class~=language-python]:before{content:"py"}div[class~=language-bash]:before{content:"sh"}div[class~=language-php]:before{content:"php"}.custom-block .custom-block-title{font-weight:600;margin-bottom:-.4rem}.custom-block.danger,.custom-block.tip,.custom-block.warning{padding:.1rem 1.5rem;border-left-width:.5rem;border-left-style:solid;margin:1rem 0}.custom-block.tip{background-color:#f3f5f7;border-color:#42b983}.custom-block.warning{background-color:rgba(255,229,100,.3);border-color:#e7c000;color:#6b5900}.custom-block.warning .custom-block-title{color:#b29400}.custom-block.warning a{color:#2c3e50}.custom-block.danger{background-color:#ffe6e6;border-color:#c00;color:#4d0000}.custom-block.danger .custom-block-title{color:#900}.custom-block.danger a{color:#2c3e50}.custom-block.details{display:block;position:relative;border-radius:2px;margin:1.6em 0;padding:1.6em;background-color:#eee}.custom-block.details h4{margin-top:0}.custom-block.details figure:last-child,.custom-block.details p:last-child{margin-bottom:0;padding-bottom:0}.custom-block.details summary{outline:none;cursor:pointer}.arrow{display:inline-block;width:0;height:0}.arrow.up{border-bottom:6px solid #ccc}.arrow.down,.arrow.up{border-left:4px solid transparent;border-right:4px solid transparent}.arrow.down{border-top:6px solid #ccc}.arrow.right{border-left:6px solid #ccc}.arrow.left,.arrow.right{border-top:4px solid transparent;border-bottom:4px solid transparent}.arrow.left{border-right:6px solid #ccc}.theme-default-content:not(.custom){max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.theme-default-content:not(.custom){padding:2rem}}@media (max-width:419px){.theme-default-content:not(.custom){padding:1.5rem}}.table-of-contents .badge{vertical-align:middle}body,html{padding:0;margin:0;background-color:#fff}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px;color:#2c3e50}.page{padding-left:20rem}.navbar{z-index:20;right:0;height:3.6rem;background-color:#fff;box-sizing:border-box;border-bottom:1px solid #eaecef}.navbar,.sidebar-mask{position:fixed;top:0;left:0}.sidebar-mask{z-index:9;width:100vw;height:100vh;display:none}.sidebar{font-size:16px;background-color:#fff;width:20rem;position:fixed;z-index:10;margin:0;top:3.6rem;left:0;bottom:0;box-sizing:border-box;border-right:1px solid #eaecef;overflow-y:auto}.theme-default-content:not(.custom)>:first-child{margin-top:3.6rem}.theme-default-content:not(.custom) a:hover{text-decoration:underline}.theme-default-content:not(.custom) p.demo{padding:1rem 1.5rem;border:1px solid #ddd;border-radius:4px}.theme-default-content:not(.custom) img{max-width:100%}.theme-default-content.custom{padding:0;margin:0}.theme-default-content.custom img{max-width:100%}a{font-weight:500;text-decoration:none}a,p a code{color:#3eaf7c}p a code{font-weight:400}kbd{background:#eee;border:.15rem solid #ddd;border-bottom:.25rem solid #ddd;border-radius:.15rem;padding:0 .15em}blockquote{font-size:1rem;color:#999;border-left:.2rem solid #dfe2e5;margin:1rem 0;padding:.25rem 0 .25rem 1rem}blockquote>p{margin:0}ol,ul{padding-left:1.2em}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:1.25}.theme-default-content:not(.custom)>h1,.theme-default-content:not(.custom)>h2,.theme-default-content:not(.custom)>h3,.theme-default-content:not(.custom)>h4,.theme-default-content:not(.custom)>h5,.theme-default-content:not(.custom)>h6{margin-top:-3.1rem;padding-top:4.6rem;margin-bottom:0}.theme-default-content:not(.custom)>h1:first-child,.theme-default-content:not(.custom)>h2:first-child,.theme-default-content:not(.custom)>h3:first-child,.theme-default-content:not(.custom)>h4:first-child,.theme-default-content:not(.custom)>h5:first-child,.theme-default-content:not(.custom)>h6:first-child{margin-top:-1.5rem;margin-bottom:1rem}.theme-default-content:not(.custom)>h1:first-child+.custom-block,.theme-default-content:not(.custom)>h1:first-child+p,.theme-default-content:not(.custom)>h1:first-child+pre,.theme-default-content:not(.custom)>h2:first-child+.custom-block,.theme-default-content:not(.custom)>h2:first-child+p,.theme-default-content:not(.custom)>h2:first-child+pre,.theme-default-content:not(.custom)>h3:first-child+.custom-block,.theme-default-content:not(.custom)>h3:first-child+p,.theme-default-content:not(.custom)>h3:first-child+pre,.theme-default-content:not(.custom)>h4:first-child+.custom-block,.theme-default-content:not(.custom)>h4:first-child+p,.theme-default-content:not(.custom)>h4:first-child+pre,.theme-default-content:not(.custom)>h5:first-child+.custom-block,.theme-default-content:not(.custom)>h5:first-child+p,.theme-default-content:not(.custom)>h5:first-child+pre,.theme-default-content:not(.custom)>h6:first-child+.custom-block,.theme-default-content:not(.custom)>h6:first-child+p,.theme-default-content:not(.custom)>h6:first-child+pre{margin-top:2rem}h1:focus .header-anchor,h1:hover .header-anchor,h2:focus .header-anchor,h2:hover .header-anchor,h3:focus .header-anchor,h3:hover .header-anchor,h4:focus .header-anchor,h4:hover .header-anchor,h5:focus .header-anchor,h5:hover .header-anchor,h6:focus .header-anchor,h6:hover .header-anchor{opacity:1}h1{font-size:2.2rem}h2{font-size:1.65rem;padding-bottom:.3rem;border-bottom:1px solid #eaecef}h3{font-size:1.35rem}a.header-anchor{font-size:.85em;float:left;margin-left:-.87em;padding-right:.23em;margin-top:.125em;opacity:0}a.header-anchor:focus,a.header-anchor:hover{text-decoration:none}.line-number,code,kbd{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}ol,p,ul{line-height:1.7}hr{border:0;border-top:1px solid #eaecef}table{border-collapse:collapse;margin:1rem 0;display:block;overflow-x:auto}tr{border-top:1px solid #dfe2e5}tr:nth-child(2n){background-color:#f6f8fa}td,th{border:1px solid #dfe2e5;padding:.6em 1em}.theme-container.sidebar-open .sidebar-mask{display:block}.theme-container.no-navbar .theme-default-content:not(.custom)>h1,.theme-container.no-navbar h2,.theme-container.no-navbar h3,.theme-container.no-navbar h4,.theme-container.no-navbar h5,.theme-container.no-navbar h6{margin-top:1.5rem;padding-top:0}.theme-container.no-navbar .sidebar{top:0}@media (min-width:720px){.theme-container.no-sidebar .sidebar{display:none}.theme-container.no-sidebar .page{padding-left:0}}@media (max-width:959px){.sidebar{font-size:15px;width:16.4rem}.page{padding-left:16.4rem}}@media (max-width:719px){.sidebar{top:0;padding-top:3.6rem;transform:translateX(-100%);transition:transform .2s ease}.page{padding-left:0}.theme-container.sidebar-open .sidebar{transform:translateX(0)}.theme-container.no-navbar .sidebar{padding-top:0}}@media (max-width:419px){h1{font-size:1.9rem}.theme-default-content div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}:root{--accentColor:#3eaf7c;--textColor:#2c3e50;--borderColor:#eaecef;--codeBgColor:#282c34;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--bgColor:#fff;--kbdBgColor:#eee;--blockquoteTextColor:#999;--blockquoteBorderColor:#dfe2e5;--tableBorderColor:#dfe2e5;--tableStripeBgColor:#f6f8fa;--preTextColor:#fff;--highlightedBgColor:rgba(0,0,0,0.66);--languageTextColor:hsla(0,0%,100%,0.4);--lineNumbersColor:hsla(0,0%,100%,0.3);--tipColor:#2c3e50;--tipBgColor:#f3f5f7;--warningColor:#e7c000;--warningBgColor:rgba(255,229,100,0.3);--dangerColor:#c00;--dangerBgColor:#ffe6e6;--miniCodeBgColor:rgba(27,31,35,0.05);--searchBorderColor:#999;--lighten10AccentColor:#4abf8a;--lighten10TextColor:#3a5169;--lighten20TextColor:#476582;--lighten25TextColor:#4e6e8e;--lighten35TextColor:#5d82a6;--lighten40TextColor:#6a8bad;--darken10AccentColor:#389d70;--darken10BgColor:#f2f2f2;--darken10BorderColor:#cfd4db}@media (prefers-color-scheme:light){:root{--codeBgColor:#f8f8f8;--preTextColor:#4d4d4d;--highlightedBgColor:hsla(0,0%,87.8%,0.5);--languageTextColor:rgba(0,0,0,0.4);--lineNumbersColor:rgba(0,0,0,0.3)}}@media (prefers-color-scheme:dark){:root{--accentColor:#3eaf7c;--textColor:#e2e2e2;--borderColor:#4e4e4e;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--bgColor:#25272a;--kbdBgColor:#444;--blockquoteTextColor:#eee;--blockquoteBorderColor:#666b6f;--tableBorderColor:#4e4e4e;--tableStripeBgColor:#444;--tipColor:#e2e2e2;--tipBgColor:#3e3b3b;--warningColor:#e7c000;--warningBgColor:rgba(185,174,119,0.3);--dangerColor:#c00;--dangerBgColor:rgba(72,56,57,0.3);--miniCodeBgColor:hsla(0,0%,100%,0.1);--searchBorderColor:#eee;--lighten10AccentColor:#4abf8a;--lighten10TextColor:#e5e5e5;--lighten20TextColor:#e8e8e8;--lighten25TextColor:#e9e9e9;--lighten35TextColor:#ececec;--lighten40TextColor:#eee;--darken10AccentColor:#389d70;--darken10BgColor:#2f3235;--darken10BorderColor:#464646}}html[theme=light]{--textColor:#2c3e50;--borderColor:#eaecef;--codeBgColor:#f8f8f8;--bgColor:#fff;--kbdBgColor:#eee;--blockquoteTextColor:#999;--blockquoteBorderColor:#dfe2e5;--tableBorderColor:#dfe2e5;--tableStripeBgColor:#f6f8fa;--preTextColor:#4d4d4d;--highlightedBgColor:hsla(0,0%,87.8%,0.5);--languageTextColor:rgba(0,0,0,0.4);--lineNumbersColor:rgba(0,0,0,0.3);--tipColor:#2c3e50;--tipBgColor:#f3f5f7;--warningBgColor:rgba(255,229,100,0.3);--dangerBgColor:#ffe6e6;--miniCodeBgColor:rgba(27,31,35,0.05);--searchBorderColor:#999;--lighten10TextColor:#3a5169;--lighten20TextColor:#476582;--lighten25TextColor:#4e6e8e;--lighten35TextColor:#5d82a6;--lighten40TextColor:#6a8bad;--darken10BgColor:#f2f2f2;--darken10BorderColor:#cfd4db}html[theme=dark],html[theme=light]{--accentColor:#3eaf7c;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--warningColor:#e7c000;--dangerColor:#c00;--lighten10AccentColor:#4abf8a;--darken10AccentColor:#389d70}html[theme=dark]{--textColor:#e2e2e2;--borderColor:#4e4e4e;--codeBgColor:#282c34;--bgColor:#25272a;--kbdBgColor:#444;--blockquoteTextColor:#eee;--blockquoteBorderColor:#666b6f;--tableBorderColor:#4e4e4e;--tableStripeBgColor:#444;--preTextColor:#fff;--highlightedBgColor:rgba(0,0,0,0.66);--languageTextColor:hsla(0,0%,100%,0.4);--lineNumbersColor:hsla(0,0%,100%,0.3);--tipColor:#e2e2e2;--tipBgColor:#3e3b3b;--warningBgColor:rgba(185,174,119,0.3);--dangerBgColor:rgba(72,56,57,0.3);--miniCodeBgColor:hsla(0,0%,100%,0.1);--searchBorderColor:#eee;--lighten10TextColor:#e5e5e5;--lighten20TextColor:#e8e8e8;--lighten25TextColor:#e9e9e9;--lighten35TextColor:#ececec;--lighten40TextColor:#eee;--darken10BgColor:#232528;--darken10BorderColor:#464646}.navbar,.sidebar,body,html{background-color:var(--bgColor)}body{color:var(--textColor)}.navbar,h2{border-bottom-color:var(--borderColor)}.sidebar{border-right-color:var(--borderColor)}.theme-default-content:not(.custom) p.demo,kbd{border-color:var(--borderColor)}kbd{background:var(--kbdBgColor)}blockquote{color:var(--blockquoteTextColor);border-left-color:var(--blockquoteBorderColor)}a,p a code{color:var(--accentColor)}hr{border-top-color:var(--borderColor)}tr{border-top-color:var(--tableBorderColor)}tr:nth-child(2n){background-color:var(--tableStripeBgColor)}td,th{border-color:var(--tableBorderColor)}.arrow.up{border-bottom-color:var(--arrowBgColor)}.arrow.down{border-top-color:var(--arrowBgColor)}.arrow.left,.arrow.right,border-left-color var(--arrowBgColor){border-right-color:var(--arrowBgColor)}.theme-default-content code{color:var(--lighten20TextColor);background-color:var(--miniCodeBgColor)}.theme-default-content code .token.inserted{color:var(--accentColor)}.theme-default-content code .token.punctuation{color:var(--preTextColor)}.theme-default-content pre[class*=language-],div[class*=language-],div[class*=language-].line-numbers-mode:after{background-color:var(--codeBgColor)}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:var(--preTextColor)}div[class*=language-] .highlight-lines .highlighted,div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{background-color:var(--highlightedBgColor)}div[class*=language-].line-numbers-mode:after{background-color:var(--codeBgColor);border-right-color:var(--highlightedBgColor)}div[class*=language-]:before{color:var(--languageTextColor)}div[class*=language-].line-numbers-mode .line-numbers-wrapper{color:var(--lineNumbersColor)}.theme-code-block>pre,.theme-code-group .theme-code-group__nav{background-color:var(--codeBgColor)!important}.theme-code-group .theme-code-group__nav .theme-code-group__nav-tab{color:var(--textColor)!important}.theme-code-group .theme-code-group__nav .theme-code-group__nav-tab-active{border-color:var(--accentColor)!important}.custom-block.tip{border-color:var(--badgeTipColor);background-color:var(--tipBgColor)}.custom-block.tip .custom-block-title,.custom-block.tip a{color:var(--tipColor)}.custom-block.warning{border-color:var(--badgeWarningColor);background-color:var(--warningBgColor)}.custom-block.warning .custom-block-title,.custom-block.warning a{color:var(--warningColor)}.custom-block.danger{border-color:var(--badgeErrorColor);background-color:var(--dangerBgColor)}.custom-block.danger .custom-block-title,.custom-block.danger a{color:var(--dangerColor)}.custom-block.danger,.custom-block.warning{color:var(--textColor)}.custom-block.details{background-color:var(--tipBgColor)}.badge,.badge.green,.badge.tip{background-color:var(--badgeTipColor)!important}.badge.error{background-color:var(--badgeErrorColor)!important}.badge.warn,.badge.warning,.badge.yellow{background-color:var(--badgeWarningColor)!important}.global-ui .sw-update-popup{border-color:var(--accentColor)!important;background-color:var(--bgColor)!important;color:var(--textColor)!important}.global-ui .sw-update-popup button{border-color:var(--darken10AccentColor)!important;background-color:var(--accentColor)!important;color:#fff!important}.global-ui .sw-update-popup button:hover{background-color:var(--lighten10AccentColor)!important}@media (min-width:719px){::-webkit-scrollbar{max-width:6px;max-height:12px}::-webkit-scrollbar-thumb{background-color:var(--languageTextColor);border-radius:6px}}.home .hero img{max-width:450px!important}#nprogress{pointer-events:none}#nprogress .bar{background:#3eaf7c;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #3eaf7c,0 0 5px #3eaf7c;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border-color:#3eaf7c transparent transparent #3eaf7c;border-style:solid;border-width:2px;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.icon.outbound{color:#aaa;display:inline-block;vertical-align:middle;position:relative;top:-1px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.home{padding:3.6rem 2rem 0;max-width:960px;margin:0 auto;display:block}.home .hero{text-align:center}.home .hero img{max-width:100%;max-height:280px;display:block;margin:3rem auto 1.5rem}.home .hero h1{font-size:3rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.8rem auto}.home .hero .description{max-width:35rem;font-size:1.6rem;line-height:1.3;color:#6a8bad}.home .hero .action-button{display:inline-block;font-size:1.2rem;color:#fff;background-color:#3eaf7c;padding:.8rem 1.6rem;border-radius:4px;transition:background-color .1s ease;box-sizing:border-box;border-bottom:1px solid #389d70}.home .hero .action-button:hover{background-color:#4abf8a}.home .features{border-top:1px solid #eaecef;padding:1.2rem 0;margin-top:2.5rem;display:flex;flex-wrap:wrap;align-items:flex-start;align-content:stretch;justify-content:space-between}.home .feature{flex-grow:1;flex-basis:30%;max-width:30%}.home .feature h2{font-size:1.4rem;font-weight:500;border-bottom:none;padding-bottom:0;color:#3a5169}.home .feature p{color:#4e6e8e}.home .footer{padding:2.5rem;border-top:1px solid #eaecef;text-align:center;color:#4e6e8e}@media (max-width:719px){.home .features{flex-direction:column}.home .feature{max-width:100%;padding:0 2.5rem}}@media (max-width:419px){.home{padding-left:1.5rem;padding-right:1.5rem}.home .hero img{max-height:210px;margin:2rem auto 1.2rem}.home .hero h1{font-size:2rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.2rem auto}.home .hero .description{font-size:1.2rem}.home .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home .feature h2{font-size:1.25rem}}.search-box{display:inline-block;position:relative;margin-right:1rem}.search-box input{cursor:text;width:10rem;height:2rem;color:#4e6e8e;display:inline-block;border:1px solid #cfd4db;border-radius:2rem;font-size:.9rem;line-height:2rem;padding:0 .5rem 0 2rem;outline:none;transition:all .2s ease;background:#fff url(/anchor/assets/img/search.83621669.svg) .6rem .5rem no-repeat;background-size:1rem}.search-box input:focus{cursor:auto;border-color:#3eaf7c}.search-box .suggestions{background:#fff;width:20rem;position:absolute;top:2rem;border:1px solid #cfd4db;border-radius:6px;padding:.4rem;list-style-type:none}.search-box .suggestions.align-right{right:0}.search-box .suggestion{line-height:1.4;padding:.4rem .6rem;border-radius:4px;cursor:pointer}.search-box .suggestion a{white-space:normal;color:#5d82a6}.search-box .suggestion a .page-title{font-weight:600}.search-box .suggestion a .header{font-size:.9em;margin-left:.25em}.search-box .suggestion.focused{background-color:#f3f4f5}.search-box .suggestion.focused a{color:#3eaf7c}@media (max-width:959px){.search-box input{cursor:pointer;width:0;border-color:transparent;position:relative}.search-box input:focus{cursor:text;left:0;width:10rem}}@media (-ms-high-contrast:none){.search-box input{height:2rem}}@media (max-width:959px) and (min-width:719px){.search-box .suggestions{left:0}}@media (max-width:719px){.search-box{margin-right:0}.search-box input{left:1rem}.search-box .suggestions{right:0}}@media (max-width:419px){.search-box .suggestions{width:calc(100vw - 4rem)}.search-box input:focus{width:8rem}}.sidebar-button{cursor:pointer;display:none;width:1.25rem;height:1.25rem;position:absolute;padding:.6rem;top:.6rem;left:1rem}.sidebar-button .icon{display:block;width:1.25rem;height:1.25rem}@media (max-width:719px){.sidebar-button{display:block}}.dropdown-enter,.dropdown-leave-to{height:0!important}.dropdown-wrapper{cursor:pointer}.dropdown-wrapper .dropdown-title,.dropdown-wrapper .mobile-dropdown-title{display:block;font-size:.9rem;font-family:inherit;cursor:inherit;padding:inherit;line-height:1.4rem;background:transparent;border:none;font-weight:500;color:#2c3e50}.dropdown-wrapper .dropdown-title:hover,.dropdown-wrapper .mobile-dropdown-title:hover{border-color:transparent}.dropdown-wrapper .dropdown-title .arrow,.dropdown-wrapper .mobile-dropdown-title .arrow{vertical-align:middle;margin-top:-1px;margin-left:.4rem}.dropdown-wrapper .mobile-dropdown-title{display:none;font-weight:600}.dropdown-wrapper .mobile-dropdown-title font-size inherit:hover{color:#3eaf7c}.dropdown-wrapper .nav-dropdown .dropdown-item{color:inherit;line-height:1.7rem}.dropdown-wrapper .nav-dropdown .dropdown-item h4{margin:.45rem 0 0;border-top:1px solid #eee;padding:1rem 1.5rem .45rem 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper{padding:0;list-style:none}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper .dropdown-subitem{font-size:.9em}.dropdown-wrapper .nav-dropdown .dropdown-item a{display:block;line-height:1.7rem;position:relative;border-bottom:none;font-weight:400;margin-bottom:0;padding:0 1.5rem 0 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:#3eaf7c}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{content:"";width:0;height:0;border-left:5px solid #3eaf7c;border-top:3px solid transparent;border-bottom:3px solid transparent;position:absolute;top:calc(50% - 2px);left:9px}.dropdown-wrapper .nav-dropdown .dropdown-item:first-child h4{margin-top:0;padding-top:0;border-top:0}@media (max-width:719px){.dropdown-wrapper.open .dropdown-title{margin-bottom:.5rem}.dropdown-wrapper .dropdown-title{display:none}.dropdown-wrapper .mobile-dropdown-title{display:block}.dropdown-wrapper .nav-dropdown{transition:height .1s ease-out;overflow:hidden}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top:0;margin-top:0;padding-top:0}.dropdown-wrapper .nav-dropdown .dropdown-item>a,.dropdown-wrapper .nav-dropdown .dropdown-item h4{font-size:15px;line-height:2rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem{font-size:14px;padding-left:1rem}}@media (min-width:719px){.dropdown-wrapper{height:1.8rem}.dropdown-wrapper.open .nav-dropdown,.dropdown-wrapper:hover .nav-dropdown{display:block!important}.dropdown-wrapper.open:blur{display:none}.dropdown-wrapper .nav-dropdown{display:none;height:auto!important;box-sizing:border-box;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;background-color:#fff;padding:.6rem 0;border:1px solid;border-color:#ddd #ddd #ccc;text-align:left;border-radius:.25rem;white-space:nowrap;margin:0}}.nav-links{display:inline-block}.nav-links a{line-height:1.4rem;color:inherit}.nav-links a.router-link-active,.nav-links a:hover{color:#3eaf7c}.nav-links .nav-item{position:relative;display:inline-block;margin-left:1.5rem;line-height:2rem}.nav-links .nav-item:first-child{margin-left:0}.nav-links .repo-link{margin-left:1.5rem}@media (max-width:719px){.nav-links .nav-item,.nav-links .repo-link{margin-left:0}}@media (min-width:719px){.nav-links a.router-link-active,.nav-links a:hover{color:#2c3e50}.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{margin-bottom:-2px;border-bottom:2px solid #46bd87}}.navbar{padding:.7rem 1.5rem;line-height:2.2rem}.navbar a,.navbar img,.navbar span{display:inline-block}.navbar .logo{height:2.2rem;min-width:2.2rem;margin-right:.8rem;vertical-align:top}.navbar .site-name{font-size:1.3rem;font-weight:600;color:#2c3e50;position:relative}.navbar .links{padding-left:1.5rem;box-sizing:border-box;background-color:#fff;white-space:nowrap;font-size:.9rem;position:absolute;right:1.5rem;top:.7rem;display:flex}.navbar .links .search-box{flex:0 0 auto;vertical-align:top}@media (max-width:719px){.navbar{padding-left:4rem}.navbar .can-hide{display:none}.navbar .links{padding-left:1.5rem}.navbar .site-name{width:calc(100vw - 9.4rem);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}}.page-edit{max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-edit{padding:2rem}}@media (max-width:419px){.page-edit{padding:1.5rem}}.page-edit{padding-top:1rem;padding-bottom:1rem;overflow:auto}.page-edit .edit-link{display:inline-block}.page-edit .edit-link a{color:#4e6e8e;margin-right:.25rem}.page-edit .last-updated{float:right;font-size:.9em}.page-edit .last-updated .prefix{font-weight:500;color:#4e6e8e}.page-edit .last-updated .time{font-weight:400;color:#767676}@media (max-width:719px){.page-edit .edit-link{margin-bottom:.5rem}.page-edit .last-updated{font-size:.8em;float:none;text-align:left}}.page-nav{max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-nav{padding:2rem}}@media (max-width:419px){.page-nav{padding:1.5rem}}.page-nav{padding-top:1rem;padding-bottom:0}.page-nav .inner{min-height:2rem;margin-top:0;border-top:1px solid #eaecef;padding-top:1rem;overflow:auto}.page-nav .next{float:right}.page{padding-bottom:2rem;display:block}.sidebar-group .sidebar-group{padding-left:.5em}.sidebar-group:not(.collapsable) .sidebar-heading:not(.clickable){cursor:auto;color:inherit}.sidebar-group.is-sub-group{padding-left:0}.sidebar-group.is-sub-group>.sidebar-heading{font-size:.95em;line-height:1.4;font-weight:400;padding-left:2rem}.sidebar-group.is-sub-group>.sidebar-heading:not(.clickable){opacity:.5}.sidebar-group.is-sub-group>.sidebar-group-items{padding-left:1rem}.sidebar-group.is-sub-group>.sidebar-group-items>li>.sidebar-link{font-size:.95em;border-left:none}.sidebar-group.depth-2>.sidebar-heading{border-left:none}.sidebar-heading{color:#2c3e50;transition:color .15s ease;cursor:pointer;font-size:1.1em;font-weight:700;padding:.35rem 1.5rem .35rem 1.25rem;width:100%;box-sizing:border-box;margin:0;border-left:.25rem solid transparent}.sidebar-heading.open,.sidebar-heading:hover{color:inherit}.sidebar-heading .arrow{position:relative;top:-.12em;left:.5em}.sidebar-heading.clickable.active{font-weight:600;color:#3eaf7c;border-left-color:#3eaf7c}.sidebar-heading.clickable:hover{color:#3eaf7c}.sidebar-group-items{transition:height .1s ease-out;font-size:.95em;overflow:hidden}.sidebar .sidebar-sub-headers{padding-left:1rem;font-size:.95em}a.sidebar-link{font-size:1em;font-weight:400;display:inline-block;color:#2c3e50;border-left:.25rem solid transparent;padding:.35rem 1rem .35rem 1.25rem;line-height:1.4;width:100%;box-sizing:border-box}a.sidebar-link:hover{color:#3eaf7c}a.sidebar-link.active{font-weight:600;color:#3eaf7c;border-left-color:#3eaf7c}.sidebar-group a.sidebar-link{padding-left:2rem}.sidebar-sub-headers a.sidebar-link{padding-top:.25rem;padding-bottom:.25rem;border-left:none}.sidebar-sub-headers a.sidebar-link.active{font-weight:500}.sidebar ul{padding:0;margin:0;list-style-type:none}.sidebar a{display:inline-block}.sidebar .nav-links{display:none;border-bottom:1px solid #eaecef;padding:.5rem 0 .75rem}.sidebar .nav-links a{font-weight:600}.sidebar .nav-links .nav-item,.sidebar .nav-links .repo-link{display:block;line-height:1.25rem;font-size:1.1em;padding:.5rem 0 .5rem 1.5rem}.sidebar>.sidebar-links{padding:1.5rem 0}.sidebar>.sidebar-links>li>a.sidebar-link{font-size:1.1em;line-height:1.7;font-weight:700}.sidebar>.sidebar-links>li:not(:first-child){margin-top:.75rem}@media (max-width:719px){.sidebar .nav-links{display:block}.sidebar .nav-links .dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{top:calc(1rem - 2px)}.sidebar>.sidebar-links{padding:1rem 0}}.search-box input{color:var(--lighten25TextColor);border-color:var(--darken10BorderColor);background-color:var(--bgColor)}.search-box input:focus{border-color:var(--accentColor)}.search-box .suggestions{background:var(--bgColor);border-color:var(--darken10BorderColor)}.search-box .suggestion a{color:var(--lighten35TextColor)}.search-box .suggestion.focused{background-color:var(--darken10BgColor)}.search-box .suggestion.focused a{color:var(--accentColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu{background:var(--bgColor);border-color:var(--searchBorderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu:before{border-color:var(--searchBorderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestion{border-bottom-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion{border-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header{background:var(--accentColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--title{color:var(--textColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-footer,.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{border-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--content,.dropdown-wrapper .dropdown-title,.dropdown-wrapper .mobile-dropdown-title{color:var(--textColor)}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top-color:var(--kbdBgColor)}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:var(--accentColor)}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{border-left-color:var(--accentColor)}@media (max-width:719px){.dropdown-wrapper .dropdown-title:hover{color:var(--accentColor)}}@media (min-width:719px){.dropdown-wrapper .dropdown-title .arrow{border-top-color:var(--arrowBgColor)}.dropdown-wrapper .nav-dropdown{background-color:var(--bgColor);border-color:var(--borderColor)}}.home .hero .description{color:var(--lighten40TextColor)}.home .hero .action-button{background-color:var(--accentColor);border-bottom-color:var(--darken10AccentColor)}.home .hero .action-button:hover{background-color:var(--lighten10AccentColor)}.home .features{border-top-color:var(--borderColor)}.home .feature h2{color:var(--lighten10TextColor)}.home .feature p,.home .footer{color:var(--lighten25TextColor)}.home .footer{border-top-color:var(--borderColor)}.navbar .site-name{color:var(--textColor);white-space:nowrap}.navbar .links{background:var(--bgColor)}.nav-links a.router-link-active,.nav-links a:hover{color:var(--accentColor)}@media (min-width:719px){.nav-links a.router-link-active,.nav-links a:hover{color:var(--textColor)}}@media (min-width:719px){.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{border-bottom-color:var(--accentColor)}}.page-edit .edit-link a,.page-edit .last-updated .prefix{color:var(--lighten25TextColor)}.page-edit .last-updated .time{color:var(--lighten40TextColor)}.page-nav .inner,.sidebar .nav-links{border-color:var(--borderColor)}.sidebar-heading{color:var(--textColor)}.sidebar-heading.clickable.active{color:var(--accentColor);border-left-color:var(--accentColor)}.sidebar-heading.clickable:hover{color:var(--accentColor)}a.sidebar-link{color:var(--textColor)}a.sidebar-link.active,a.sidebar-link:hover{color:var(--accentColor)}a.sidebar-link.active{border-left-color:var(--accentColor)}.badge[data-v-15b7b770]{display:inline-block;font-size:14px;height:18px;line-height:18px;border-radius:3px;padding:0 6px;color:#fff}.badge.green[data-v-15b7b770],.badge.tip[data-v-15b7b770],.badge[data-v-15b7b770]{background-color:#42b983}.badge.error[data-v-15b7b770]{background-color:#da5961}.badge.warn[data-v-15b7b770],.badge.warning[data-v-15b7b770],.badge.yellow[data-v-15b7b770]{background-color:#e7c000}.badge+.badge[data-v-15b7b770]{margin-left:5px}.theme-code-group__nav[data-v-deefee04]{margin-bottom:-35px;background-color:#282c34;padding-bottom:22px;border-top-left-radius:6px;border-top-right-radius:6px;padding-left:10px;padding-top:10px}.theme-code-group__ul[data-v-deefee04]{margin:auto 0;padding-left:0;display:inline-flex;list-style:none}.theme-code-group__nav-tab[data-v-deefee04]{border:0;padding:5px;cursor:pointer;background-color:transparent;font-size:.85em;line-height:1.4;color:hsla(0,0%,100%,.9);font-weight:600}.theme-code-group__nav-tab-active[data-v-deefee04]{border-bottom:1px solid #42b983}.pre-blank[data-v-deefee04]{color:#42b983}.theme-code-block[data-v-759a7d02]{display:none}.theme-code-block__active[data-v-759a7d02]{display:block}.theme-code-block>pre[data-v-759a7d02]{background-color:orange} \ No newline at end of file +.copy-button[data-v-4f47a0ca]{position:absolute;z-index:3;right:.5em;cursor:pointer;opacity:.75}.copy-button.hover[data-v-4f47a0ca]{opacity:0}.copy-button[data-v-4f47a0ca]:hover{opacity:1!important}.copy-ok[data-v-4f47a0ca]{position:absolute;z-index:3;right:.5em}.xiaopanda-code-copy:hover>div>.copy-button{opacity:.75}code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}.theme-default-content code{color:#476582;padding:.25rem .5rem;margin:0;font-size:.85em;background-color:rgba(27,31,35,.05);border-radius:3px}.theme-default-content code .token.deleted{color:#ec5975}.theme-default-content code .token.inserted{color:#3eaf7c}.theme-default-content pre,.theme-default-content pre[class*=language-]{line-height:1.4;padding:1.25rem 1.5rem;margin:.85rem 0;background-color:#282c34;border-radius:6px;overflow:auto}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:#fff;padding:0;background-color:transparent;border-radius:0}div[class*=language-]{position:relative;background-color:#282c34;border-radius:6px}div[class*=language-] .highlight-lines{-webkit-user-select:none;user-select:none;padding-top:1.3rem;position:absolute;top:0;left:0;width:100%;line-height:1.4}div[class*=language-] .highlight-lines .highlighted{background-color:rgba(0,0,0,.66)}div[class*=language-] pre,div[class*=language-] pre[class*=language-]{background:transparent;position:relative;z-index:1}div[class*=language-]:before{position:absolute;z-index:3;top:.8em;right:1em;font-size:.75rem;color:hsla(0,0%,100%,.4)}div[class*=language-]:not(.line-numbers-mode) .line-numbers-wrapper{display:none}div[class*=language-].line-numbers-mode .highlight-lines .highlighted{position:relative}div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{content:" ";position:absolute;z-index:3;left:0;top:0;display:block;width:3.5rem;height:100%;background-color:rgba(0,0,0,.66)}div[class*=language-].line-numbers-mode pre{padding-left:4.5rem;vertical-align:middle}div[class*=language-].line-numbers-mode .line-numbers-wrapper{position:absolute;top:0;width:3.5rem;text-align:center;color:hsla(0,0%,100%,.3);padding:1.25rem 0;line-height:1.4}div[class*=language-].line-numbers-mode .line-numbers-wrapper br{-webkit-user-select:none;user-select:none}div[class*=language-].line-numbers-mode .line-numbers-wrapper .line-number{position:relative;z-index:4;-webkit-user-select:none;user-select:none;font-size:.85em}div[class*=language-].line-numbers-mode:after{content:"";position:absolute;z-index:2;top:0;left:0;width:3.5rem;height:100%;border-radius:6px 0 0 6px;border-right:1px solid rgba(0,0,0,.66);background-color:#282c34}div[class~=language-js]:before{content:"js"}div[class~=language-ts]:before{content:"ts"}div[class~=language-html]:before{content:"html"}div[class~=language-md]:before{content:"md"}div[class~=language-vue]:before{content:"vue"}div[class~=language-css]:before{content:"css"}div[class~=language-sass]:before{content:"sass"}div[class~=language-scss]:before{content:"scss"}div[class~=language-less]:before{content:"less"}div[class~=language-stylus]:before{content:"stylus"}div[class~=language-go]:before{content:"go"}div[class~=language-java]:before{content:"java"}div[class~=language-c]:before{content:"c"}div[class~=language-sh]:before{content:"sh"}div[class~=language-yaml]:before{content:"yaml"}div[class~=language-py]:before{content:"py"}div[class~=language-docker]:before{content:"docker"}div[class~=language-dockerfile]:before{content:"dockerfile"}div[class~=language-makefile]:before{content:"makefile"}div[class~=language-javascript]:before{content:"js"}div[class~=language-typescript]:before{content:"ts"}div[class~=language-markup]:before{content:"html"}div[class~=language-markdown]:before{content:"md"}div[class~=language-json]:before{content:"json"}div[class~=language-ruby]:before{content:"rb"}div[class~=language-python]:before{content:"py"}div[class~=language-bash]:before{content:"sh"}div[class~=language-php]:before{content:"php"}.custom-block .custom-block-title{font-weight:600;margin-bottom:-.4rem}.custom-block.danger,.custom-block.tip,.custom-block.warning{padding:.1rem 1.5rem;border-left-width:.5rem;border-left-style:solid;margin:1rem 0}.custom-block.tip{background-color:#f3f5f7;border-color:#42b983}.custom-block.warning{background-color:rgba(255,229,100,.3);border-color:#e7c000;color:#6b5900}.custom-block.warning .custom-block-title{color:#b29400}.custom-block.warning a{color:#2c3e50}.custom-block.danger{background-color:#ffe6e6;border-color:#c00;color:#4d0000}.custom-block.danger .custom-block-title{color:#900}.custom-block.danger a{color:#2c3e50}.custom-block.details{display:block;position:relative;border-radius:2px;margin:1.6em 0;padding:1.6em;background-color:#eee}.custom-block.details h4{margin-top:0}.custom-block.details figure:last-child,.custom-block.details p:last-child{margin-bottom:0;padding-bottom:0}.custom-block.details summary{outline:none;cursor:pointer}.arrow{display:inline-block;width:0;height:0}.arrow.up{border-bottom:6px solid #ccc}.arrow.down,.arrow.up{border-left:4px solid transparent;border-right:4px solid transparent}.arrow.down{border-top:6px solid #ccc}.arrow.right{border-left:6px solid #ccc}.arrow.left,.arrow.right{border-top:4px solid transparent;border-bottom:4px solid transparent}.arrow.left{border-right:6px solid #ccc}.theme-default-content:not(.custom){max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.theme-default-content:not(.custom){padding:2rem}}@media (max-width:419px){.theme-default-content:not(.custom){padding:1.5rem}}.table-of-contents .badge{vertical-align:middle}body,html{padding:0;margin:0;background-color:#fff}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:16px;color:#2c3e50}.page{padding-left:20rem}.navbar{z-index:20;right:0;height:3.6rem;background-color:#fff;box-sizing:border-box;border-bottom:1px solid #eaecef}.navbar,.sidebar-mask{position:fixed;top:0;left:0}.sidebar-mask{z-index:9;width:100vw;height:100vh;display:none}.sidebar{font-size:16px;background-color:#fff;width:20rem;position:fixed;z-index:10;margin:0;top:3.6rem;left:0;bottom:0;box-sizing:border-box;border-right:1px solid #eaecef;overflow-y:auto}.theme-default-content:not(.custom)>:first-child{margin-top:3.6rem}.theme-default-content:not(.custom) a:hover{text-decoration:underline}.theme-default-content:not(.custom) p.demo{padding:1rem 1.5rem;border:1px solid #ddd;border-radius:4px}.theme-default-content:not(.custom) img{max-width:100%}.theme-default-content.custom{padding:0;margin:0}.theme-default-content.custom img{max-width:100%}a{font-weight:500;text-decoration:none}a,p a code{color:#3eaf7c}p a code{font-weight:400}kbd{background:#eee;border:.15rem solid #ddd;border-bottom:.25rem solid #ddd;border-radius:.15rem;padding:0 .15em}blockquote{font-size:1rem;color:#999;border-left:.2rem solid #dfe2e5;margin:1rem 0;padding:.25rem 0 .25rem 1rem}blockquote>p{margin:0}ol,ul{padding-left:1.2em}strong{font-weight:600}h1,h2,h3,h4,h5,h6{font-weight:600;line-height:1.25}.theme-default-content:not(.custom)>h1,.theme-default-content:not(.custom)>h2,.theme-default-content:not(.custom)>h3,.theme-default-content:not(.custom)>h4,.theme-default-content:not(.custom)>h5,.theme-default-content:not(.custom)>h6{margin-top:-3.1rem;padding-top:4.6rem;margin-bottom:0}.theme-default-content:not(.custom)>h1:first-child,.theme-default-content:not(.custom)>h2:first-child,.theme-default-content:not(.custom)>h3:first-child,.theme-default-content:not(.custom)>h4:first-child,.theme-default-content:not(.custom)>h5:first-child,.theme-default-content:not(.custom)>h6:first-child{margin-top:-1.5rem;margin-bottom:1rem}.theme-default-content:not(.custom)>h1:first-child+.custom-block,.theme-default-content:not(.custom)>h1:first-child+p,.theme-default-content:not(.custom)>h1:first-child+pre,.theme-default-content:not(.custom)>h2:first-child+.custom-block,.theme-default-content:not(.custom)>h2:first-child+p,.theme-default-content:not(.custom)>h2:first-child+pre,.theme-default-content:not(.custom)>h3:first-child+.custom-block,.theme-default-content:not(.custom)>h3:first-child+p,.theme-default-content:not(.custom)>h3:first-child+pre,.theme-default-content:not(.custom)>h4:first-child+.custom-block,.theme-default-content:not(.custom)>h4:first-child+p,.theme-default-content:not(.custom)>h4:first-child+pre,.theme-default-content:not(.custom)>h5:first-child+.custom-block,.theme-default-content:not(.custom)>h5:first-child+p,.theme-default-content:not(.custom)>h5:first-child+pre,.theme-default-content:not(.custom)>h6:first-child+.custom-block,.theme-default-content:not(.custom)>h6:first-child+p,.theme-default-content:not(.custom)>h6:first-child+pre{margin-top:2rem}h1:focus .header-anchor,h1:hover .header-anchor,h2:focus .header-anchor,h2:hover .header-anchor,h3:focus .header-anchor,h3:hover .header-anchor,h4:focus .header-anchor,h4:hover .header-anchor,h5:focus .header-anchor,h5:hover .header-anchor,h6:focus .header-anchor,h6:hover .header-anchor{opacity:1}h1{font-size:2.2rem}h2{font-size:1.65rem;padding-bottom:.3rem;border-bottom:1px solid #eaecef}h3{font-size:1.35rem}a.header-anchor{font-size:.85em;float:left;margin-left:-.87em;padding-right:.23em;margin-top:.125em;opacity:0}a.header-anchor:focus,a.header-anchor:hover{text-decoration:none}.line-number,code,kbd{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}ol,p,ul{line-height:1.7}hr{border:0;border-top:1px solid #eaecef}table{border-collapse:collapse;margin:1rem 0;display:block;overflow-x:auto}tr{border-top:1px solid #dfe2e5}tr:nth-child(2n){background-color:#f6f8fa}td,th{border:1px solid #dfe2e5;padding:.6em 1em}.theme-container.sidebar-open .sidebar-mask{display:block}.theme-container.no-navbar .theme-default-content:not(.custom)>h1,.theme-container.no-navbar h2,.theme-container.no-navbar h3,.theme-container.no-navbar h4,.theme-container.no-navbar h5,.theme-container.no-navbar h6{margin-top:1.5rem;padding-top:0}.theme-container.no-navbar .sidebar{top:0}@media (min-width:720px){.theme-container.no-sidebar .sidebar{display:none}.theme-container.no-sidebar .page{padding-left:0}}@media (max-width:959px){.sidebar{font-size:15px;width:16.4rem}.page{padding-left:16.4rem}}@media (max-width:719px){.sidebar{top:0;padding-top:3.6rem;transform:translateX(-100%);transition:transform .2s ease}.page{padding-left:0}.theme-container.sidebar-open .sidebar{transform:translateX(0)}.theme-container.no-navbar .sidebar{padding-top:0}}@media (max-width:419px){h1{font-size:1.9rem}.theme-default-content div[class*=language-]{margin:.85rem -1.5rem;border-radius:0}}:root{--accentColor:#3eaf7c;--textColor:#2c3e50;--borderColor:#eaecef;--codeBgColor:#282c34;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--bgColor:#fff;--kbdBgColor:#eee;--blockquoteTextColor:#999;--blockquoteBorderColor:#dfe2e5;--tableBorderColor:#dfe2e5;--tableStripeBgColor:#f6f8fa;--preTextColor:#fff;--highlightedBgColor:rgba(0,0,0,0.66);--languageTextColor:hsla(0,0%,100%,0.4);--lineNumbersColor:hsla(0,0%,100%,0.3);--tipColor:#2c3e50;--tipBgColor:#f3f5f7;--warningColor:#e7c000;--warningBgColor:rgba(255,229,100,0.3);--dangerColor:#c00;--dangerBgColor:#ffe6e6;--miniCodeBgColor:rgba(27,31,35,0.05);--searchBorderColor:#999;--lighten10AccentColor:#4abf8a;--lighten10TextColor:#3a5169;--lighten20TextColor:#476582;--lighten25TextColor:#4e6e8e;--lighten35TextColor:#5d82a6;--lighten40TextColor:#6a8bad;--darken10AccentColor:#389d70;--darken10BgColor:#f2f2f2;--darken10BorderColor:#cfd4db}@media (prefers-color-scheme:light){:root{--codeBgColor:#f8f8f8;--preTextColor:#4d4d4d;--highlightedBgColor:hsla(0,0%,87.8%,0.5);--languageTextColor:rgba(0,0,0,0.4);--lineNumbersColor:rgba(0,0,0,0.3)}}@media (prefers-color-scheme:dark){:root{--accentColor:#3eaf7c;--textColor:#e2e2e2;--borderColor:#4e4e4e;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--bgColor:#25272a;--kbdBgColor:#444;--blockquoteTextColor:#eee;--blockquoteBorderColor:#666b6f;--tableBorderColor:#4e4e4e;--tableStripeBgColor:#444;--tipColor:#e2e2e2;--tipBgColor:#3e3b3b;--warningColor:#e7c000;--warningBgColor:rgba(185,174,119,0.3);--dangerColor:#c00;--dangerBgColor:rgba(72,56,57,0.3);--miniCodeBgColor:hsla(0,0%,100%,0.1);--searchBorderColor:#eee;--lighten10AccentColor:#4abf8a;--lighten10TextColor:#e5e5e5;--lighten20TextColor:#e8e8e8;--lighten25TextColor:#e9e9e9;--lighten35TextColor:#ececec;--lighten40TextColor:#eee;--darken10AccentColor:#389d70;--darken10BgColor:#2f3235;--darken10BorderColor:#464646}}html[theme=light]{--textColor:#2c3e50;--borderColor:#eaecef;--codeBgColor:#f8f8f8;--bgColor:#fff;--kbdBgColor:#eee;--blockquoteTextColor:#999;--blockquoteBorderColor:#dfe2e5;--tableBorderColor:#dfe2e5;--tableStripeBgColor:#f6f8fa;--preTextColor:#4d4d4d;--highlightedBgColor:hsla(0,0%,87.8%,0.5);--languageTextColor:rgba(0,0,0,0.4);--lineNumbersColor:rgba(0,0,0,0.3);--tipColor:#2c3e50;--tipBgColor:#f3f5f7;--warningBgColor:rgba(255,229,100,0.3);--dangerBgColor:#ffe6e6;--miniCodeBgColor:rgba(27,31,35,0.05);--searchBorderColor:#999;--lighten10TextColor:#3a5169;--lighten20TextColor:#476582;--lighten25TextColor:#4e6e8e;--lighten35TextColor:#5d82a6;--lighten40TextColor:#6a8bad;--darken10BgColor:#f2f2f2;--darken10BorderColor:#cfd4db}html[theme=dark],html[theme=light]{--accentColor:#3eaf7c;--arrowBgColor:#ccc;--badgeTipColor:#42b983;--badgeWarningColor:#e7c000;--badgeErrorColor:#da5961;--warningColor:#e7c000;--dangerColor:#c00;--lighten10AccentColor:#4abf8a;--darken10AccentColor:#389d70}html[theme=dark]{--textColor:#e2e2e2;--borderColor:#4e4e4e;--codeBgColor:#282c34;--bgColor:#25272a;--kbdBgColor:#444;--blockquoteTextColor:#eee;--blockquoteBorderColor:#666b6f;--tableBorderColor:#4e4e4e;--tableStripeBgColor:#444;--preTextColor:#fff;--highlightedBgColor:rgba(0,0,0,0.66);--languageTextColor:hsla(0,0%,100%,0.4);--lineNumbersColor:hsla(0,0%,100%,0.3);--tipColor:#e2e2e2;--tipBgColor:#3e3b3b;--warningBgColor:rgba(185,174,119,0.3);--dangerBgColor:rgba(72,56,57,0.3);--miniCodeBgColor:hsla(0,0%,100%,0.1);--searchBorderColor:#eee;--lighten10TextColor:#e5e5e5;--lighten20TextColor:#e8e8e8;--lighten25TextColor:#e9e9e9;--lighten35TextColor:#ececec;--lighten40TextColor:#eee;--darken10BgColor:#232528;--darken10BorderColor:#464646}.navbar,.sidebar,body,html{background-color:var(--bgColor)}body{color:var(--textColor)}.navbar,h2{border-bottom-color:var(--borderColor)}.sidebar{border-right-color:var(--borderColor)}.theme-default-content:not(.custom) p.demo,kbd{border-color:var(--borderColor)}kbd{background:var(--kbdBgColor)}blockquote{color:var(--blockquoteTextColor);border-left-color:var(--blockquoteBorderColor)}a,p a code{color:var(--accentColor)}hr{border-top-color:var(--borderColor)}tr{border-top-color:var(--tableBorderColor)}tr:nth-child(2n){background-color:var(--tableStripeBgColor)}td,th{border-color:var(--tableBorderColor)}.arrow.up{border-bottom-color:var(--arrowBgColor)}.arrow.down{border-top-color:var(--arrowBgColor)}.arrow.left,.arrow.right,border-left-color var(--arrowBgColor){border-right-color:var(--arrowBgColor)}.theme-default-content code{color:var(--lighten20TextColor);background-color:var(--miniCodeBgColor)}.theme-default-content code .token.inserted{color:var(--accentColor)}.theme-default-content code .token.punctuation{color:var(--preTextColor)}.theme-default-content pre[class*=language-],div[class*=language-],div[class*=language-].line-numbers-mode:after{background-color:var(--codeBgColor)}.theme-default-content pre[class*=language-] code,.theme-default-content pre code{color:var(--preTextColor)}div[class*=language-] .highlight-lines .highlighted,div[class*=language-].line-numbers-mode .highlight-lines .highlighted:before{background-color:var(--highlightedBgColor)}div[class*=language-].line-numbers-mode:after{background-color:var(--codeBgColor);border-right-color:var(--highlightedBgColor)}div[class*=language-]:before{color:var(--languageTextColor)}div[class*=language-].line-numbers-mode .line-numbers-wrapper{color:var(--lineNumbersColor)}.theme-code-block>pre,.theme-code-group .theme-code-group__nav{background-color:var(--codeBgColor)!important}.theme-code-group .theme-code-group__nav .theme-code-group__nav-tab{color:var(--textColor)!important}.theme-code-group .theme-code-group__nav .theme-code-group__nav-tab-active{border-color:var(--accentColor)!important}.custom-block.tip{border-color:var(--badgeTipColor);background-color:var(--tipBgColor)}.custom-block.tip .custom-block-title,.custom-block.tip a{color:var(--tipColor)}.custom-block.warning{border-color:var(--badgeWarningColor);background-color:var(--warningBgColor)}.custom-block.warning .custom-block-title,.custom-block.warning a{color:var(--warningColor)}.custom-block.danger{border-color:var(--badgeErrorColor);background-color:var(--dangerBgColor)}.custom-block.danger .custom-block-title,.custom-block.danger a{color:var(--dangerColor)}.custom-block.danger,.custom-block.warning{color:var(--textColor)}.custom-block.details{background-color:var(--tipBgColor)}.badge,.badge.green,.badge.tip{background-color:var(--badgeTipColor)!important}.badge.error{background-color:var(--badgeErrorColor)!important}.badge.warn,.badge.warning,.badge.yellow{background-color:var(--badgeWarningColor)!important}.global-ui .sw-update-popup{border-color:var(--accentColor)!important;background-color:var(--bgColor)!important;color:var(--textColor)!important}.global-ui .sw-update-popup button{border-color:var(--darken10AccentColor)!important;background-color:var(--accentColor)!important;color:#fff!important}.global-ui .sw-update-popup button:hover{background-color:var(--lighten10AccentColor)!important}@media (min-width:719px){::-webkit-scrollbar{max-width:6px;max-height:12px}::-webkit-scrollbar-thumb{background-color:var(--languageTextColor);border-radius:6px}}.home .hero img{max-width:450px!important}#nprogress{pointer-events:none}#nprogress .bar{background:#3eaf7c;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #3eaf7c,0 0 5px #3eaf7c;opacity:1;transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border-color:#3eaf7c transparent transparent #3eaf7c;border-style:solid;border-width:2px;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.icon.outbound{color:#aaa;display:inline-block;vertical-align:middle;position:relative;top:-1px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.home{padding:3.6rem 2rem 0;max-width:960px;margin:0 auto;display:block}.home .hero{text-align:center}.home .hero img{max-width:100%;max-height:280px;display:block;margin:3rem auto 1.5rem}.home .hero h1{font-size:3rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.8rem auto}.home .hero .description{max-width:35rem;font-size:1.6rem;line-height:1.3;color:#6a8bad}.home .hero .action-button{display:inline-block;font-size:1.2rem;color:#fff;background-color:#3eaf7c;padding:.8rem 1.6rem;border-radius:4px;transition:background-color .1s ease;box-sizing:border-box;border-bottom:1px solid #389d70}.home .hero .action-button:hover{background-color:#4abf8a}.home .features{border-top:1px solid #eaecef;padding:1.2rem 0;margin-top:2.5rem;display:flex;flex-wrap:wrap;align-items:flex-start;align-content:stretch;justify-content:space-between}.home .feature{flex-grow:1;flex-basis:30%;max-width:30%}.home .feature h2{font-size:1.4rem;font-weight:500;border-bottom:none;padding-bottom:0;color:#3a5169}.home .feature p{color:#4e6e8e}.home .footer{padding:2.5rem;border-top:1px solid #eaecef;text-align:center;color:#4e6e8e}@media (max-width:719px){.home .features{flex-direction:column}.home .feature{max-width:100%;padding:0 2.5rem}}@media (max-width:419px){.home{padding-left:1.5rem;padding-right:1.5rem}.home .hero img{max-height:210px;margin:2rem auto 1.2rem}.home .hero h1{font-size:2rem}.home .hero .action,.home .hero .description,.home .hero h1{margin:1.2rem auto}.home .hero .description{font-size:1.2rem}.home .hero .action-button{font-size:1rem;padding:.6rem 1.2rem}.home .feature h2{font-size:1.25rem}}.search-box{display:inline-block;position:relative;margin-right:1rem}.search-box input{cursor:text;width:10rem;height:2rem;color:#4e6e8e;display:inline-block;border:1px solid #cfd4db;border-radius:2rem;font-size:.9rem;line-height:2rem;padding:0 .5rem 0 2rem;outline:none;transition:all .2s ease;background:#fff url(/anchor/assets/img/search.83621669.svg) .6rem .5rem no-repeat;background-size:1rem}.search-box input:focus{cursor:auto;border-color:#3eaf7c}.search-box .suggestions{background:#fff;width:20rem;position:absolute;top:2rem;border:1px solid #cfd4db;border-radius:6px;padding:.4rem;list-style-type:none}.search-box .suggestions.align-right{right:0}.search-box .suggestion{line-height:1.4;padding:.4rem .6rem;border-radius:4px;cursor:pointer}.search-box .suggestion a{white-space:normal;color:#5d82a6}.search-box .suggestion a .page-title{font-weight:600}.search-box .suggestion a .header{font-size:.9em;margin-left:.25em}.search-box .suggestion.focused{background-color:#f3f4f5}.search-box .suggestion.focused a{color:#3eaf7c}@media (max-width:959px){.search-box input{cursor:pointer;width:0;border-color:transparent;position:relative}.search-box input:focus{cursor:text;left:0;width:10rem}}@media (-ms-high-contrast:none){.search-box input{height:2rem}}@media (max-width:959px) and (min-width:719px){.search-box .suggestions{left:0}}@media (max-width:719px){.search-box{margin-right:0}.search-box input{left:1rem}.search-box .suggestions{right:0}}@media (max-width:419px){.search-box .suggestions{width:calc(100vw - 4rem)}.search-box input:focus{width:8rem}}.sidebar-button{cursor:pointer;display:none;width:1.25rem;height:1.25rem;position:absolute;padding:.6rem;top:.6rem;left:1rem}.sidebar-button .icon{display:block;width:1.25rem;height:1.25rem}@media (max-width:719px){.sidebar-button{display:block}}.dropdown-enter,.dropdown-leave-to{height:0!important}.dropdown-wrapper{cursor:pointer}.dropdown-wrapper .dropdown-title,.dropdown-wrapper .mobile-dropdown-title{display:block;font-size:.9rem;font-family:inherit;cursor:inherit;padding:inherit;line-height:1.4rem;background:transparent;border:none;font-weight:500;color:#2c3e50}.dropdown-wrapper .dropdown-title:hover,.dropdown-wrapper .mobile-dropdown-title:hover{border-color:transparent}.dropdown-wrapper .dropdown-title .arrow,.dropdown-wrapper .mobile-dropdown-title .arrow{vertical-align:middle;margin-top:-1px;margin-left:.4rem}.dropdown-wrapper .mobile-dropdown-title{display:none;font-weight:600}.dropdown-wrapper .mobile-dropdown-title font-size inherit:hover{color:#3eaf7c}.dropdown-wrapper .nav-dropdown .dropdown-item{color:inherit;line-height:1.7rem}.dropdown-wrapper .nav-dropdown .dropdown-item h4{margin:.45rem 0 0;border-top:1px solid #eee;padding:1rem 1.5rem .45rem 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper{padding:0;list-style:none}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem-wrapper .dropdown-subitem{font-size:.9em}.dropdown-wrapper .nav-dropdown .dropdown-item a{display:block;line-height:1.7rem;position:relative;border-bottom:none;font-weight:400;margin-bottom:0;padding:0 1.5rem 0 1.25rem}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:#3eaf7c}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{content:"";width:0;height:0;border-left:5px solid #3eaf7c;border-top:3px solid transparent;border-bottom:3px solid transparent;position:absolute;top:calc(50% - 2px);left:9px}.dropdown-wrapper .nav-dropdown .dropdown-item:first-child h4{margin-top:0;padding-top:0;border-top:0}@media (max-width:719px){.dropdown-wrapper.open .dropdown-title{margin-bottom:.5rem}.dropdown-wrapper .dropdown-title{display:none}.dropdown-wrapper .mobile-dropdown-title{display:block}.dropdown-wrapper .nav-dropdown{transition:height .1s ease-out;overflow:hidden}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top:0;margin-top:0;padding-top:0}.dropdown-wrapper .nav-dropdown .dropdown-item>a,.dropdown-wrapper .nav-dropdown .dropdown-item h4{font-size:15px;line-height:2rem}.dropdown-wrapper .nav-dropdown .dropdown-item .dropdown-subitem{font-size:14px;padding-left:1rem}}@media (min-width:719px){.dropdown-wrapper{height:1.8rem}.dropdown-wrapper.open .nav-dropdown,.dropdown-wrapper:hover .nav-dropdown{display:block!important}.dropdown-wrapper.open:blur{display:none}.dropdown-wrapper .nav-dropdown{display:none;height:auto!important;box-sizing:border-box;max-height:calc(100vh - 2.7rem);overflow-y:auto;position:absolute;top:100%;right:0;background-color:#fff;padding:.6rem 0;border:1px solid;border-color:#ddd #ddd #ccc;text-align:left;border-radius:.25rem;white-space:nowrap;margin:0}}.nav-links{display:inline-block}.nav-links a{line-height:1.4rem;color:inherit}.nav-links a.router-link-active,.nav-links a:hover{color:#3eaf7c}.nav-links .nav-item{position:relative;display:inline-block;margin-left:1.5rem;line-height:2rem}.nav-links .nav-item:first-child{margin-left:0}.nav-links .repo-link{margin-left:1.5rem}@media (max-width:719px){.nav-links .nav-item,.nav-links .repo-link{margin-left:0}}@media (min-width:719px){.nav-links a.router-link-active,.nav-links a:hover{color:#2c3e50}.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{margin-bottom:-2px;border-bottom:2px solid #46bd87}}.navbar{padding:.7rem 1.5rem;line-height:2.2rem}.navbar a,.navbar img,.navbar span{display:inline-block}.navbar .logo{height:2.2rem;min-width:2.2rem;margin-right:.8rem;vertical-align:top}.navbar .site-name{font-size:1.3rem;font-weight:600;color:#2c3e50;position:relative}.navbar .links{padding-left:1.5rem;box-sizing:border-box;background-color:#fff;white-space:nowrap;font-size:.9rem;position:absolute;right:1.5rem;top:.7rem;display:flex}.navbar .links .search-box{flex:0 0 auto;vertical-align:top}@media (max-width:719px){.navbar{padding-left:4rem}.navbar .can-hide{display:none}.navbar .links{padding-left:1.5rem}.navbar .site-name{width:calc(100vw - 9.4rem);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}}.page-edit{max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-edit{padding:2rem}}@media (max-width:419px){.page-edit{padding:1.5rem}}.page-edit{padding-top:1rem;padding-bottom:1rem;overflow:auto}.page-edit .edit-link{display:inline-block}.page-edit .edit-link a{color:#4e6e8e;margin-right:.25rem}.page-edit .last-updated{float:right;font-size:.9em}.page-edit .last-updated .prefix{font-weight:500;color:#4e6e8e}.page-edit .last-updated .time{font-weight:400;color:#767676}@media (max-width:719px){.page-edit .edit-link{margin-bottom:.5rem}.page-edit .last-updated{font-size:.8em;float:none;text-align:left}}.page-nav{max-width:740px;margin:0 auto;padding:2rem 2.5rem}@media (max-width:959px){.page-nav{padding:2rem}}@media (max-width:419px){.page-nav{padding:1.5rem}}.page-nav{padding-top:1rem;padding-bottom:0}.page-nav .inner{min-height:2rem;margin-top:0;border-top:1px solid #eaecef;padding-top:1rem;overflow:auto}.page-nav .next{float:right}.page{padding-bottom:2rem;display:block}.sidebar-group .sidebar-group{padding-left:.5em}.sidebar-group:not(.collapsable) .sidebar-heading:not(.clickable){cursor:auto;color:inherit}.sidebar-group.is-sub-group{padding-left:0}.sidebar-group.is-sub-group>.sidebar-heading{font-size:.95em;line-height:1.4;font-weight:400;padding-left:2rem}.sidebar-group.is-sub-group>.sidebar-heading:not(.clickable){opacity:.5}.sidebar-group.is-sub-group>.sidebar-group-items{padding-left:1rem}.sidebar-group.is-sub-group>.sidebar-group-items>li>.sidebar-link{font-size:.95em;border-left:none}.sidebar-group.depth-2>.sidebar-heading{border-left:none}.sidebar-heading{color:#2c3e50;transition:color .15s ease;cursor:pointer;font-size:1.1em;font-weight:700;padding:.35rem 1.5rem .35rem 1.25rem;width:100%;box-sizing:border-box;margin:0;border-left:.25rem solid transparent}.sidebar-heading.open,.sidebar-heading:hover{color:inherit}.sidebar-heading .arrow{position:relative;top:-.12em;left:.5em}.sidebar-heading.clickable.active{font-weight:600;color:#3eaf7c;border-left-color:#3eaf7c}.sidebar-heading.clickable:hover{color:#3eaf7c}.sidebar-group-items{transition:height .1s ease-out;font-size:.95em;overflow:hidden}.sidebar .sidebar-sub-headers{padding-left:1rem;font-size:.95em}a.sidebar-link{font-size:1em;font-weight:400;display:inline-block;color:#2c3e50;border-left:.25rem solid transparent;padding:.35rem 1rem .35rem 1.25rem;line-height:1.4;width:100%;box-sizing:border-box}a.sidebar-link:hover{color:#3eaf7c}a.sidebar-link.active{font-weight:600;color:#3eaf7c;border-left-color:#3eaf7c}.sidebar-group a.sidebar-link{padding-left:2rem}.sidebar-sub-headers a.sidebar-link{padding-top:.25rem;padding-bottom:.25rem;border-left:none}.sidebar-sub-headers a.sidebar-link.active{font-weight:500}.sidebar ul{padding:0;margin:0;list-style-type:none}.sidebar a{display:inline-block}.sidebar .nav-links{display:none;border-bottom:1px solid #eaecef;padding:.5rem 0 .75rem}.sidebar .nav-links a{font-weight:600}.sidebar .nav-links .nav-item,.sidebar .nav-links .repo-link{display:block;line-height:1.25rem;font-size:1.1em;padding:.5rem 0 .5rem 1.5rem}.sidebar>.sidebar-links{padding:1.5rem 0}.sidebar>.sidebar-links>li>a.sidebar-link{font-size:1.1em;line-height:1.7;font-weight:700}.sidebar>.sidebar-links>li:not(:first-child){margin-top:.75rem}@media (max-width:719px){.sidebar .nav-links{display:block}.sidebar .nav-links .dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{top:calc(1rem - 2px)}.sidebar>.sidebar-links{padding:1rem 0}}.search-box input{color:var(--lighten25TextColor);border-color:var(--darken10BorderColor);background-color:var(--bgColor)}.search-box input:focus{border-color:var(--accentColor)}.search-box .suggestions{background:var(--bgColor);border-color:var(--darken10BorderColor)}.search-box .suggestion a{color:var(--lighten35TextColor)}.search-box .suggestion.focused{background-color:var(--darken10BgColor)}.search-box .suggestion.focused a{color:var(--accentColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu{background:var(--bgColor);border-color:var(--searchBorderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu:before{border-color:var(--searchBorderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-suggestion{border-bottom-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion{border-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--category-header{background:var(--accentColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--title{color:var(--textColor)}.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-footer,.algolia-search-wrapper .algolia-autocomplete .algolia-docsearch-suggestion .algolia-docsearch-suggestion--subcategory-column{border-color:var(--borderColor)}.algolia-search-wrapper .algolia-autocomplete .ds-cursor .algolia-docsearch-suggestion--content,.dropdown-wrapper .dropdown-title,.dropdown-wrapper .mobile-dropdown-title{color:var(--textColor)}.dropdown-wrapper .nav-dropdown .dropdown-item h4{border-top-color:var(--kbdBgColor)}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active,.dropdown-wrapper .nav-dropdown .dropdown-item a:hover{color:var(--accentColor)}.dropdown-wrapper .nav-dropdown .dropdown-item a.router-link-active:after{border-left-color:var(--accentColor)}@media (max-width:719px){.dropdown-wrapper .dropdown-title:hover{color:var(--accentColor)}}@media (min-width:719px){.dropdown-wrapper .dropdown-title .arrow{border-top-color:var(--arrowBgColor)}.dropdown-wrapper .nav-dropdown{background-color:var(--bgColor);border-color:var(--borderColor)}}.home .hero .description{color:var(--lighten40TextColor)}.home .hero .action-button{background-color:var(--accentColor);border-bottom-color:var(--darken10AccentColor)}.home .hero .action-button:hover{background-color:var(--lighten10AccentColor)}.home .features{border-top-color:var(--borderColor)}.home .feature h2{color:var(--lighten10TextColor)}.home .feature p,.home .footer{color:var(--lighten25TextColor)}.home .footer{border-top-color:var(--borderColor)}.navbar .site-name{color:var(--textColor);white-space:nowrap}.navbar .links{background:var(--bgColor)}.nav-links a.router-link-active,.nav-links a:hover{color:var(--accentColor)}@media (min-width:719px){.nav-links a.router-link-active,.nav-links a:hover{color:var(--textColor)}}@media (min-width:719px){.nav-item>a:not(.external).router-link-active,.nav-item>a:not(.external):hover{border-bottom-color:var(--accentColor)}}.page-edit .edit-link a,.page-edit .last-updated .prefix{color:var(--lighten25TextColor)}.page-edit .last-updated .time{color:var(--lighten40TextColor)}.page-nav .inner,.sidebar .nav-links{border-color:var(--borderColor)}.sidebar-heading{color:var(--textColor)}.sidebar-heading.clickable.active{color:var(--accentColor);border-left-color:var(--accentColor)}.sidebar-heading.clickable:hover{color:var(--accentColor)}a.sidebar-link{color:var(--textColor)}a.sidebar-link.active,a.sidebar-link:hover{color:var(--accentColor)}a.sidebar-link.active{border-left-color:var(--accentColor)}.badge[data-v-15b7b770]{display:inline-block;font-size:14px;height:18px;line-height:18px;border-radius:3px;padding:0 6px;color:#fff}.badge.green[data-v-15b7b770],.badge.tip[data-v-15b7b770],.badge[data-v-15b7b770]{background-color:#42b983}.badge.error[data-v-15b7b770]{background-color:#da5961}.badge.warn[data-v-15b7b770],.badge.warning[data-v-15b7b770],.badge.yellow[data-v-15b7b770]{background-color:#e7c000}.badge+.badge[data-v-15b7b770]{margin-left:5px}.theme-code-block[data-v-759a7d02]{display:none}.theme-code-block__active[data-v-759a7d02]{display:block}.theme-code-block>pre[data-v-759a7d02]{background-color:orange}.theme-code-group__nav[data-v-deefee04]{margin-bottom:-35px;background-color:#282c34;padding-bottom:22px;border-top-left-radius:6px;border-top-right-radius:6px;padding-left:10px;padding-top:10px}.theme-code-group__ul[data-v-deefee04]{margin:auto 0;padding-left:0;display:inline-flex;list-style:none}.theme-code-group__nav-tab[data-v-deefee04]{border:0;padding:5px;cursor:pointer;background-color:transparent;font-size:.85em;line-height:1.4;color:hsla(0,0%,100%,.9);font-weight:600}.theme-code-group__nav-tab-active[data-v-deefee04]{border-bottom:1px solid #42b983}.pre-blank[data-v-deefee04]{color:#42b983} \ No newline at end of file diff --git a/assets/js/10.99d917b5.js b/assets/js/10.9b75e9f0.js similarity index 99% rename from assets/js/10.99d917b5.js rename to assets/js/10.9b75e9f0.js index 352d6bba..a2628d8e 100644 --- a/assets/js/10.99d917b5.js +++ b/assets/js/10.9b75e9f0.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{403:function(t,a,e){"use strict";e.r(a);var s=e(29),r=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"commands"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#commands"}},[t._v("#")]),t._v(" Commands")]),t._v(" "),e("p",[t._v("A CLI is provided to support building and managing an Anchor workspace.\nFor a comprehensive list of commands and options, run "),e("code",[t._v("anchor -h")]),t._v(" on any\nof the following subcommands.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor-cli\n\nUSAGE:\n anchor \n\nFLAGS:\n -h, --help Prints help information\n -V, --version Prints version information\n\nSUBCOMMANDS:\n build Builds the workspace\n cluster Cluster commands\n deploy Deploys each program in the workspace\n expand Expands the macros of a program or the workspace\n help Prints this message or the help of the given subcommand(s)\n idl Commands for interacting with interface definitions\n init Initializes a workspace\n migrate Runs the deploy migration script\n new Creates a new program\n test Runs integration tests against a localnetwork\n upgrade Upgrades a single program. The configured wallet must be the upgrade authority\n verify Verifies the on-chain bytecode matches the locally compiled artifact. Run this\n command inside a program subdirectory, i.e., in the dir containing the program's\n Cargo.toml\n")])])]),e("h2",{attrs:{id:"build"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#build"}},[t._v("#")]),t._v(" Build")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor build\n")])])]),e("p",[t._v("Builds programs in the workspace targeting Solana's BPF runtime and emitting IDLs in the "),e("code",[t._v("target/idl")]),t._v(" directory.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor build --verifiable\n")])])]),e("p",[t._v("Runs the build inside a docker image so that the output binary is deterministic (assuming a Cargo.lock file is used). This command must be run from within a single crate subdirectory within the workspace. For example, "),e("code",[t._v("programs//")]),t._v(".")]),t._v(" "),e("h2",{attrs:{id:"cluster"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#cluster"}},[t._v("#")]),t._v(" Cluster")]),t._v(" "),e("h3",{attrs:{id:"cluster-list"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#cluster-list"}},[t._v("#")]),t._v(" Cluster list")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor cluster list\n")])])]),e("p",[t._v("This lists cluster endpoints:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("Cluster Endpoints:\n\n* Mainnet - https://solana-api.projectserum.com\n* Mainnet - https://api.mainnet-beta.solana.com\n* Devnet - https://api.devnet.solana.com\n* Testnet - https://api.testnet.solana.com\n")])])]),e("h2",{attrs:{id:"deploy"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#deploy"}},[t._v("#")]),t._v(" Deploy")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor deploy\n")])])]),e("p",[t._v("Deploys all programs in the workspace to the configured cluster.")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("This is different from the "),e("code",[t._v("solana program deploy")]),t._v(" command, because everytime it's run\nit will generate a "),e("em",[t._v("new")]),t._v(" program address.")])]),t._v(" "),e("h2",{attrs:{id:"expand"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#expand"}},[t._v("#")]),t._v(" Expand")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor expand\n")])])]),e("p",[t._v("If run inside a program folder, expands the macros of the program.")]),t._v(" "),e("p",[t._v("If run in the workspace but outside a program folder, expands the macros of the workspace.")]),t._v(" "),e("p",[t._v("If run with the "),e("code",[t._v("--program-name")]),t._v(" option, expand only the given program.")]),t._v(" "),e("h2",{attrs:{id:"idl"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl"}},[t._v("#")]),t._v(" Idl")]),t._v(" "),e("p",[t._v("The "),e("code",[t._v("idl")]),t._v(" subcommand provides commands for interacting with interface definition files.\nIt's recommended to use these commands to store an IDL on chain, at a deterministic\naddress, as a function of nothing but the the program's ID. This\nallows us to generate clients for a program using nothing but the program ID.")]),t._v(" "),e("h3",{attrs:{id:"idl-init"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-init"}},[t._v("#")]),t._v(" Idl Init")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl init -f \n")])])]),e("p",[t._v("Creates an idl account, writing the given "),e("code",[t._v("")]),t._v(" file into a program owned account. By default, the size of the account is double the size of the IDL,\nallowing room for growth in case the idl needs to be upgraded in the future.")]),t._v(" "),e("h3",{attrs:{id:"idl-fetch"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-fetch"}},[t._v("#")]),t._v(" Idl Fetch")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl fetch -o \n")])])]),e("p",[t._v("Fetches an IDL from the configured blockchain. For example, make sure\nyour "),e("code",[t._v("Anchor.toml")]),t._v(" is pointing to the "),e("code",[t._v("mainnet")]),t._v(" cluster and run")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl fetch GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94JBy7Y5yv\n")])])]),e("h3",{attrs:{id:"idl-authority"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-authority"}},[t._v("#")]),t._v(" Idl Authority")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl authority \n")])])]),e("p",[t._v("Outputs the IDL account's authority. This is the wallet that has the ability to\nupdate the IDL.")]),t._v(" "),e("h3",{attrs:{id:"idl-erase-authority"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-erase-authority"}},[t._v("#")]),t._v(" Idl Erase Authority")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl erase-authority -p \n")])])]),e("p",[t._v("Erases the IDL account's authority so that upgrades can no longer occur. The\nconfigured wallet must be the current authority.")]),t._v(" "),e("h3",{attrs:{id:"idl-upgrade"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-upgrade"}},[t._v("#")]),t._v(" Idl Upgrade")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl upgrade -f \n")])])]),e("p",[t._v("Upgrades the IDL file on chain to the new "),e("code",[t._v("target/idl/program.json")]),t._v(" idl.\nThe configured wallet must be the current authority.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl set-authority -n -p \n")])])]),e("p",[t._v("Sets a new authority on the IDL account. Both the "),e("code",[t._v("new-authority")]),t._v(" and "),e("code",[t._v("program-id")]),t._v("\nmust be encoded in base 58.")]),t._v(" "),e("h2",{attrs:{id:"init"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#init"}},[t._v("#")]),t._v(" Init")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor init\n")])])]),e("p",[t._v("Initializes a project workspace with the following structure.")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("Anchor.toml")]),t._v(": Anchor configuration file.")]),t._v(" "),e("li",[e("code",[t._v("Cargo.toml")]),t._v(": Rust workspace configuration file.")]),t._v(" "),e("li",[e("code",[t._v("package.json")]),t._v(": JavaScript dependencies file.")]),t._v(" "),e("li",[e("code",[t._v("programs/")]),t._v(": Directory for Solana program crates.")]),t._v(" "),e("li",[e("code",[t._v("app/")]),t._v(": Directory for your application frontend.")]),t._v(" "),e("li",[e("code",[t._v("tests/")]),t._v(": Directory for JavaScript integration tests.")]),t._v(" "),e("li",[e("code",[t._v("migrations/deploy.js")]),t._v(": Deploy script.")])]),t._v(" "),e("h2",{attrs:{id:"migrate"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#migrate"}},[t._v("#")]),t._v(" Migrate")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor migrate\n")])])]),e("p",[t._v("Runs the deploy script located at "),e("code",[t._v("migrations/deploy.js")]),t._v(", injecting a provider configured\nfrom the workspace's "),e("code",[t._v("Anchor.toml")]),t._v(". For example,")]),t._v(" "),e("div",{staticClass:"language-javascript extra-class"},[e("pre",{pre:!0,attrs:{class:"language-javascript"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// File: migrations/deploys.js")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" anchor "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@project-serum/anchor"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nmodule"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("exports")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("provider")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n anchor"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setProvider")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("provider"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Add your deploy script here.")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Migrations are a new feature\nand only support this simple deploy script at the moment.")]),t._v(" "),e("h2",{attrs:{id:"new"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#new"}},[t._v("#")]),t._v(" New")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor new \n")])])]),e("p",[t._v("Creates a new program in the workspace's "),e("code",[t._v("programs/")]),t._v(" directory initialized with boilerplate.")]),t._v(" "),e("h2",{attrs:{id:"test"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#test"}},[t._v("#")]),t._v(" Test")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor test\n")])])]),e("p",[t._v("Run an integration test suit against the configured cluster, deploying new versions\nof all workspace programs before running them.")]),t._v(" "),e("p",[t._v("If the configured network is a localnet, then automatically starts the localnetwork and runs\nthe test.")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("Be sure to shutdown any other local validators, otherwise "),e("code",[t._v("anchor test")]),t._v(" will fail to run.")]),t._v(" "),e("p",[t._v("If you'd prefer to run the program against your local validator use "),e("code",[t._v("anchor test --skip-local-validator")]),t._v(".")])]),t._v(" "),e("p",[t._v("When running tests we stream program logs to "),e("code",[t._v(".anchor/program-logs/
..log")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("The Anchor workflow "),e("a",{attrs:{href:"https://www.parity.io/paritys-checklist-for-secure-smart-contract-development/",target:"_blank",rel:"noopener noreferrer"}},[t._v("recommends"),e("OutboundLink")],1),t._v("\nto test your program using integration tests in a language other\nthan Rust to make sure that bugs related to syntax misunderstandings\nare coverable with tests and not just replicated in tests.")])]),t._v(" "),e("h2",{attrs:{id:"upgrade"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#upgrade"}},[t._v("#")]),t._v(" Upgrade")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor upgrade --program-id \n")])])]),e("p",[t._v("Uses Solana's upgradeable BPF loader to upgrade the on chain program code.")]),t._v(" "),e("h2",{attrs:{id:"verify"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#verify"}},[t._v("#")]),t._v(" Verify")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor verify \n")])])]),e("p",[t._v("Verifies the on-chain bytecode matches the locally compiled artifact.")])])}),[],!1,null,null,null);a.default=r.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{406:function(t,a,e){"use strict";e.r(a);var s=e(29),r=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"commands"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#commands"}},[t._v("#")]),t._v(" Commands")]),t._v(" "),e("p",[t._v("A CLI is provided to support building and managing an Anchor workspace.\nFor a comprehensive list of commands and options, run "),e("code",[t._v("anchor -h")]),t._v(" on any\nof the following subcommands.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor-cli\n\nUSAGE:\n anchor \n\nFLAGS:\n -h, --help Prints help information\n -V, --version Prints version information\n\nSUBCOMMANDS:\n build Builds the workspace\n cluster Cluster commands\n deploy Deploys each program in the workspace\n expand Expands the macros of a program or the workspace\n help Prints this message or the help of the given subcommand(s)\n idl Commands for interacting with interface definitions\n init Initializes a workspace\n migrate Runs the deploy migration script\n new Creates a new program\n test Runs integration tests against a localnetwork\n upgrade Upgrades a single program. The configured wallet must be the upgrade authority\n verify Verifies the on-chain bytecode matches the locally compiled artifact. Run this\n command inside a program subdirectory, i.e., in the dir containing the program's\n Cargo.toml\n")])])]),e("h2",{attrs:{id:"build"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#build"}},[t._v("#")]),t._v(" Build")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor build\n")])])]),e("p",[t._v("Builds programs in the workspace targeting Solana's BPF runtime and emitting IDLs in the "),e("code",[t._v("target/idl")]),t._v(" directory.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor build --verifiable\n")])])]),e("p",[t._v("Runs the build inside a docker image so that the output binary is deterministic (assuming a Cargo.lock file is used). This command must be run from within a single crate subdirectory within the workspace. For example, "),e("code",[t._v("programs//")]),t._v(".")]),t._v(" "),e("h2",{attrs:{id:"cluster"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#cluster"}},[t._v("#")]),t._v(" Cluster")]),t._v(" "),e("h3",{attrs:{id:"cluster-list"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#cluster-list"}},[t._v("#")]),t._v(" Cluster list")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor cluster list\n")])])]),e("p",[t._v("This lists cluster endpoints:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("Cluster Endpoints:\n\n* Mainnet - https://solana-api.projectserum.com\n* Mainnet - https://api.mainnet-beta.solana.com\n* Devnet - https://api.devnet.solana.com\n* Testnet - https://api.testnet.solana.com\n")])])]),e("h2",{attrs:{id:"deploy"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#deploy"}},[t._v("#")]),t._v(" Deploy")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor deploy\n")])])]),e("p",[t._v("Deploys all programs in the workspace to the configured cluster.")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("This is different from the "),e("code",[t._v("solana program deploy")]),t._v(" command, because everytime it's run\nit will generate a "),e("em",[t._v("new")]),t._v(" program address.")])]),t._v(" "),e("h2",{attrs:{id:"expand"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#expand"}},[t._v("#")]),t._v(" Expand")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor expand\n")])])]),e("p",[t._v("If run inside a program folder, expands the macros of the program.")]),t._v(" "),e("p",[t._v("If run in the workspace but outside a program folder, expands the macros of the workspace.")]),t._v(" "),e("p",[t._v("If run with the "),e("code",[t._v("--program-name")]),t._v(" option, expand only the given program.")]),t._v(" "),e("h2",{attrs:{id:"idl"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl"}},[t._v("#")]),t._v(" Idl")]),t._v(" "),e("p",[t._v("The "),e("code",[t._v("idl")]),t._v(" subcommand provides commands for interacting with interface definition files.\nIt's recommended to use these commands to store an IDL on chain, at a deterministic\naddress, as a function of nothing but the the program's ID. This\nallows us to generate clients for a program using nothing but the program ID.")]),t._v(" "),e("h3",{attrs:{id:"idl-init"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-init"}},[t._v("#")]),t._v(" Idl Init")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl init -f \n")])])]),e("p",[t._v("Creates an idl account, writing the given "),e("code",[t._v("")]),t._v(" file into a program owned account. By default, the size of the account is double the size of the IDL,\nallowing room for growth in case the idl needs to be upgraded in the future.")]),t._v(" "),e("h3",{attrs:{id:"idl-fetch"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-fetch"}},[t._v("#")]),t._v(" Idl Fetch")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl fetch -o \n")])])]),e("p",[t._v("Fetches an IDL from the configured blockchain. For example, make sure\nyour "),e("code",[t._v("Anchor.toml")]),t._v(" is pointing to the "),e("code",[t._v("mainnet")]),t._v(" cluster and run")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl fetch GrAkKfEpTKQuVHG2Y97Y2FF4i7y7Q5AHLK94JBy7Y5yv\n")])])]),e("h3",{attrs:{id:"idl-authority"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-authority"}},[t._v("#")]),t._v(" Idl Authority")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl authority \n")])])]),e("p",[t._v("Outputs the IDL account's authority. This is the wallet that has the ability to\nupdate the IDL.")]),t._v(" "),e("h3",{attrs:{id:"idl-erase-authority"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-erase-authority"}},[t._v("#")]),t._v(" Idl Erase Authority")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl erase-authority -p \n")])])]),e("p",[t._v("Erases the IDL account's authority so that upgrades can no longer occur. The\nconfigured wallet must be the current authority.")]),t._v(" "),e("h3",{attrs:{id:"idl-upgrade"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#idl-upgrade"}},[t._v("#")]),t._v(" Idl Upgrade")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl upgrade -f \n")])])]),e("p",[t._v("Upgrades the IDL file on chain to the new "),e("code",[t._v("target/idl/program.json")]),t._v(" idl.\nThe configured wallet must be the current authority.")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor idl set-authority -n -p \n")])])]),e("p",[t._v("Sets a new authority on the IDL account. Both the "),e("code",[t._v("new-authority")]),t._v(" and "),e("code",[t._v("program-id")]),t._v("\nmust be encoded in base 58.")]),t._v(" "),e("h2",{attrs:{id:"init"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#init"}},[t._v("#")]),t._v(" Init")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor init\n")])])]),e("p",[t._v("Initializes a project workspace with the following structure.")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("Anchor.toml")]),t._v(": Anchor configuration file.")]),t._v(" "),e("li",[e("code",[t._v("Cargo.toml")]),t._v(": Rust workspace configuration file.")]),t._v(" "),e("li",[e("code",[t._v("package.json")]),t._v(": JavaScript dependencies file.")]),t._v(" "),e("li",[e("code",[t._v("programs/")]),t._v(": Directory for Solana program crates.")]),t._v(" "),e("li",[e("code",[t._v("app/")]),t._v(": Directory for your application frontend.")]),t._v(" "),e("li",[e("code",[t._v("tests/")]),t._v(": Directory for JavaScript integration tests.")]),t._v(" "),e("li",[e("code",[t._v("migrations/deploy.js")]),t._v(": Deploy script.")])]),t._v(" "),e("h2",{attrs:{id:"migrate"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#migrate"}},[t._v("#")]),t._v(" Migrate")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor migrate\n")])])]),e("p",[t._v("Runs the deploy script located at "),e("code",[t._v("migrations/deploy.js")]),t._v(", injecting a provider configured\nfrom the workspace's "),e("code",[t._v("Anchor.toml")]),t._v(". For example,")]),t._v(" "),e("div",{staticClass:"language-javascript extra-class"},[e("pre",{pre:!0,attrs:{class:"language-javascript"}},[e("code",[e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// File: migrations/deploys.js")]),t._v("\n\n"),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" anchor "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token string"}},[t._v('"@project-serum/anchor"')]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\nmodule"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function-variable function"}},[t._v("exports")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("async")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),e("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("provider")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n anchor"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),e("span",{pre:!0,attrs:{class:"token function"}},[t._v("setProvider")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("provider"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),e("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Add your deploy script here.")]),t._v("\n"),e("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),e("p",[t._v("Migrations are a new feature\nand only support this simple deploy script at the moment.")]),t._v(" "),e("h2",{attrs:{id:"new"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#new"}},[t._v("#")]),t._v(" New")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor new \n")])])]),e("p",[t._v("Creates a new program in the workspace's "),e("code",[t._v("programs/")]),t._v(" directory initialized with boilerplate.")]),t._v(" "),e("h2",{attrs:{id:"test"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#test"}},[t._v("#")]),t._v(" Test")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor test\n")])])]),e("p",[t._v("Run an integration test suit against the configured cluster, deploying new versions\nof all workspace programs before running them.")]),t._v(" "),e("p",[t._v("If the configured network is a localnet, then automatically starts the localnetwork and runs\nthe test.")]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("Be sure to shutdown any other local validators, otherwise "),e("code",[t._v("anchor test")]),t._v(" will fail to run.")]),t._v(" "),e("p",[t._v("If you'd prefer to run the program against your local validator use "),e("code",[t._v("anchor test --skip-local-validator")]),t._v(".")])]),t._v(" "),e("p",[t._v("When running tests we stream program logs to "),e("code",[t._v(".anchor/program-logs/
..log")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("Note")]),t._v(" "),e("p",[t._v("The Anchor workflow "),e("a",{attrs:{href:"https://www.parity.io/paritys-checklist-for-secure-smart-contract-development/",target:"_blank",rel:"noopener noreferrer"}},[t._v("recommends"),e("OutboundLink")],1),t._v("\nto test your program using integration tests in a language other\nthan Rust to make sure that bugs related to syntax misunderstandings\nare coverable with tests and not just replicated in tests.")])]),t._v(" "),e("h2",{attrs:{id:"upgrade"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#upgrade"}},[t._v("#")]),t._v(" Upgrade")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor upgrade --program-id \n")])])]),e("p",[t._v("Uses Solana's upgradeable BPF loader to upgrade the on chain program code.")]),t._v(" "),e("h2",{attrs:{id:"verify"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#verify"}},[t._v("#")]),t._v(" Verify")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("anchor verify \n")])])]),e("p",[t._v("Verifies the on-chain bytecode matches the locally compiled artifact.")])])}),[],!1,null,null,null);a.default=r.exports}}]); \ No newline at end of file diff --git a/assets/js/11.15bb6a5e.js b/assets/js/11.0f0c790b.js similarity index 98% rename from assets/js/11.15bb6a5e.js rename to assets/js/11.0f0c790b.js index c0e8f5e9..5c672af1 100644 --- a/assets/js/11.15bb6a5e.js +++ b/assets/js/11.0f0c790b.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{404:function(a,t,s){"use strict";s.r(t);var e=s(29),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"installing-dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#installing-dependencies"}},[a._v("#")]),a._v(" Installing Dependencies")]),a._v(" "),s("p",[a._v("To get started, make sure to setup all the prerequisite tools on your local machine\n(an installer has not yet been developed).")]),a._v(" "),s("h2",{attrs:{id:"install-rust"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-rust"}},[a._v("#")]),a._v(" Install Rust")]),a._v(" "),s("p",[a._v("For an introduction to Rust, see the excellent Rust "),s("a",{attrs:{href:"https://doc.rust-lang.org/book/",target:"_blank",rel:"noopener noreferrer"}},[a._v("book"),s("OutboundLink")],1),a._v(".")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("curl")]),a._v(" --proto "),s("span",{pre:!0,attrs:{class:"token string"}},[a._v("'=https'")]),a._v(" --tlsv1.2 -sSf https://sh.rustup.rs "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("|")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sh")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[a._v("source")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token environment constant"}},[a._v("$HOME")]),a._v("/.cargo/env\nrustup component "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("add")]),a._v(" rustfmt\n")])])]),s("h2",{attrs:{id:"install-solana"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-solana"}},[a._v("#")]),a._v(" Install Solana")]),a._v(" "),s("p",[a._v("See the solana "),s("a",{attrs:{href:"https://docs.solana.com/cli/install-solana-cli-tools",target:"_blank",rel:"noopener noreferrer"}},[a._v("docs"),s("OutboundLink")],1),a._v(" for installation instructions. On macOS and Linux,")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sh")]),a._v(" -c "),s("span",{pre:!0,attrs:{class:"token string"}},[a._v('"'),s("span",{pre:!0,attrs:{class:"token variable"}},[s("span",{pre:!0,attrs:{class:"token variable"}},[a._v("$(")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("curl")]),a._v(" -sSfL https://release.solana.com/v1.9.1/install"),s("span",{pre:!0,attrs:{class:"token variable"}},[a._v(")")])]),a._v('"')]),a._v("\n")])])]),s("h2",{attrs:{id:"install-yarn"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-yarn"}},[a._v("#")]),a._v(" Install Yarn")]),a._v(" "),s("p",[s("a",{attrs:{href:"https://yarnpkg.com/",target:"_blank",rel:"noopener noreferrer"}},[a._v("Yarn"),s("OutboundLink")],1),a._v(" is recommended for JavaScript package management.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("npm")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" -g "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("yarn")]),a._v("\n")])])]),s("h2",{attrs:{id:"install-anchor"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-anchor"}},[a._v("#")]),a._v(" Install Anchor")]),a._v(" "),s("h3",{attrs:{id:"install-using-pre-build-binary-on-x86-64-linux"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-using-pre-build-binary-on-x86-64-linux"}},[a._v("#")]),a._v(" Install using pre-build binary on x86_64 Linux")]),a._v(" "),s("p",[a._v("Anchor binaries are available via an NPM package "),s("a",{attrs:{href:"https://www.npmjs.com/package/@project-serum/anchor-cli",target:"_blank",rel:"noopener noreferrer"}},[s("code",[a._v("@project-serum/anchor-cli")]),s("OutboundLink")],1),a._v(". Only x86_64 Linux is supported currently, you must build from source for other OS'.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("npm")]),a._v(" i -g @project-serum/anchor-cli\n")])])]),s("h3",{attrs:{id:"build-from-source-for-other-operating-systems"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#build-from-source-for-other-operating-systems"}},[a._v("#")]),a._v(" Build from source for other operating systems")]),a._v(" "),s("p",[a._v("For now, we can use Cargo to install the CLI.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("cargo "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" --git https://github.com/project-serum/anchor --tag v0.24.0 anchor-cli --locked\n")])])]),s("p",[a._v("On Linux systems you may need to install additional dependencies if "),s("code",[a._v("cargo install")]),a._v(" fails. On Ubuntu,")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" update "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("&&")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" upgrade "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("&&")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" -y pkg-config build-essential libudev-dev\n")])])]),s("p",[a._v("Now verify the CLI is installed properly.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("anchor --version\n")])])]),s("h2",{attrs:{id:"start-a-project"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#start-a-project"}},[a._v("#")]),a._v(" Start a Project")]),a._v(" "),s("p",[a._v("To initialize a new project, simply run:")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("anchor init "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("<")]),a._v("new-project-name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(">")]),a._v("\n")])])]),s("h2",{attrs:{id:"minimum-version-requirements"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#minimum-version-requirements"}},[a._v("#")]),a._v(" Minimum version requirements")]),a._v(" "),s("table",[s("thead",[s("tr",[s("th",{staticStyle:{"text-align":"left"}},[a._v("Build tool")]),a._v(" "),s("th",{staticStyle:{"text-align":"left"}},[a._v("Version")])])]),a._v(" "),s("tbody",[s("tr",[s("td",{staticStyle:{"text-align":"left"}},[a._v("Node.js")]),a._v(" "),s("td",{staticStyle:{"text-align":"left"}},[a._v("v11.0.0")])])])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{403:function(a,t,s){"use strict";s.r(t);var e=s(29),n=Object(e.a)({},(function(){var a=this,t=a.$createElement,s=a._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[s("h1",{attrs:{id:"installing-dependencies"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#installing-dependencies"}},[a._v("#")]),a._v(" Installing Dependencies")]),a._v(" "),s("p",[a._v("To get started, make sure to setup all the prerequisite tools on your local machine\n(an installer has not yet been developed).")]),a._v(" "),s("h2",{attrs:{id:"install-rust"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-rust"}},[a._v("#")]),a._v(" Install Rust")]),a._v(" "),s("p",[a._v("For an introduction to Rust, see the excellent Rust "),s("a",{attrs:{href:"https://doc.rust-lang.org/book/",target:"_blank",rel:"noopener noreferrer"}},[a._v("book"),s("OutboundLink")],1),a._v(".")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("curl")]),a._v(" --proto "),s("span",{pre:!0,attrs:{class:"token string"}},[a._v("'=https'")]),a._v(" --tlsv1.2 -sSf https://sh.rustup.rs "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("|")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sh")]),a._v("\n"),s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[a._v("source")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token environment constant"}},[a._v("$HOME")]),a._v("/.cargo/env\nrustup component "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("add")]),a._v(" rustfmt\n")])])]),s("h2",{attrs:{id:"install-solana"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-solana"}},[a._v("#")]),a._v(" Install Solana")]),a._v(" "),s("p",[a._v("See the solana "),s("a",{attrs:{href:"https://docs.solana.com/cli/install-solana-cli-tools",target:"_blank",rel:"noopener noreferrer"}},[a._v("docs"),s("OutboundLink")],1),a._v(" for installation instructions. On macOS and Linux,")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sh")]),a._v(" -c "),s("span",{pre:!0,attrs:{class:"token string"}},[a._v('"'),s("span",{pre:!0,attrs:{class:"token variable"}},[s("span",{pre:!0,attrs:{class:"token variable"}},[a._v("$(")]),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("curl")]),a._v(" -sSfL https://release.solana.com/v1.9.1/install"),s("span",{pre:!0,attrs:{class:"token variable"}},[a._v(")")])]),a._v('"')]),a._v("\n")])])]),s("h2",{attrs:{id:"install-yarn"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-yarn"}},[a._v("#")]),a._v(" Install Yarn")]),a._v(" "),s("p",[s("a",{attrs:{href:"https://yarnpkg.com/",target:"_blank",rel:"noopener noreferrer"}},[a._v("Yarn"),s("OutboundLink")],1),a._v(" is recommended for JavaScript package management.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("npm")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" -g "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("yarn")]),a._v("\n")])])]),s("h2",{attrs:{id:"install-anchor"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-anchor"}},[a._v("#")]),a._v(" Install Anchor")]),a._v(" "),s("h3",{attrs:{id:"install-using-pre-build-binary-on-x86-64-linux"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#install-using-pre-build-binary-on-x86-64-linux"}},[a._v("#")]),a._v(" Install using pre-build binary on x86_64 Linux")]),a._v(" "),s("p",[a._v("Anchor binaries are available via an NPM package "),s("a",{attrs:{href:"https://www.npmjs.com/package/@project-serum/anchor-cli",target:"_blank",rel:"noopener noreferrer"}},[s("code",[a._v("@project-serum/anchor-cli")]),s("OutboundLink")],1),a._v(". Only x86_64 Linux is supported currently, you must build from source for other OS'.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("npm")]),a._v(" i -g @project-serum/anchor-cli\n")])])]),s("h3",{attrs:{id:"build-from-source-for-other-operating-systems"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#build-from-source-for-other-operating-systems"}},[a._v("#")]),a._v(" Build from source for other operating systems")]),a._v(" "),s("p",[a._v("For now, we can use Cargo to install the CLI.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("cargo "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" --git https://github.com/project-serum/anchor --tag v0.24.1 anchor-cli --locked\n")])])]),s("p",[a._v("On Linux systems you may need to install additional dependencies if "),s("code",[a._v("cargo install")]),a._v(" fails. On Ubuntu,")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" update "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("&&")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" upgrade "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("&&")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("sudo")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("apt-get")]),a._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[a._v("install")]),a._v(" -y pkg-config build-essential libudev-dev\n")])])]),s("p",[a._v("Now verify the CLI is installed properly.")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("anchor --version\n")])])]),s("h2",{attrs:{id:"start-a-project"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#start-a-project"}},[a._v("#")]),a._v(" Start a Project")]),a._v(" "),s("p",[a._v("To initialize a new project, simply run:")]),a._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[a._v("anchor init "),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v("<")]),a._v("new-project-name"),s("span",{pre:!0,attrs:{class:"token operator"}},[a._v(">")]),a._v("\n")])])]),s("h2",{attrs:{id:"minimum-version-requirements"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#minimum-version-requirements"}},[a._v("#")]),a._v(" Minimum version requirements")]),a._v(" "),s("table",[s("thead",[s("tr",[s("th",{staticStyle:{"text-align":"left"}},[a._v("Build tool")]),a._v(" "),s("th",{staticStyle:{"text-align":"left"}},[a._v("Version")])])]),a._v(" "),s("tbody",[s("tr",[s("td",{staticStyle:{"text-align":"left"}},[a._v("Node.js")]),a._v(" "),s("td",{staticStyle:{"text-align":"left"}},[a._v("v11.0.0")])])])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/12.d30544e0.js b/assets/js/12.2382ff5e.js similarity index 97% rename from assets/js/12.d30544e0.js rename to assets/js/12.2382ff5e.js index 38bd7adb..fb9a1aee 100644 --- a/assets/js/12.d30544e0.js +++ b/assets/js/12.2382ff5e.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{405:function(e,t,r){"use strict";r.r(t);var o=r(29),n=Object(o.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"introduction"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#introduction"}},[e._v("#")]),e._v(" Introduction")]),e._v(" "),r("div",{staticStyle:{border:"2px solid red","text-align":"center",padding:"10px 10px 10px 10px","box-sizing":"border-box"}},[e._v(" This documentation is being sunset in favor of "),r("a",{attrs:{href:"https://book.anchor-lang.com",rel:"noopener noreferrer",target:"_blank"}},[e._v("The Anchor Book")]),e._v(". At this point in time, either documentation may contain information that the other does not.")]),e._v(" "),r("p",[e._v("Anchor is a framework for Solana's "),r("a",{attrs:{href:"https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192",target:"_blank",rel:"noopener noreferrer"}},[e._v("Sealevel"),r("OutboundLink")],1),e._v(" runtime providing several convenient developer tools.")]),e._v(" "),r("ul",[r("li",[e._v("Rust crates and eDSL for writing Solana programs")]),e._v(" "),r("li",[r("a",{attrs:{href:"https://en.wikipedia.org/wiki/Interface_description_language",target:"_blank",rel:"noopener noreferrer"}},[e._v("IDL"),r("OutboundLink")],1),e._v(" specification")]),e._v(" "),r("li",[e._v("TypeScript package for generating clients from IDL")]),e._v(" "),r("li",[e._v("CLI and workspace management for developing complete applications")])]),e._v(" "),r("p",[e._v("If you're familiar with developing in Ethereum's "),r("a",{attrs:{href:"https://docs.soliditylang.org/en/v0.7.4/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Solidity"),r("OutboundLink")],1),e._v(", "),r("a",{attrs:{href:"https://www.trufflesuite.com/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Truffle"),r("OutboundLink")],1),e._v(", "),r("a",{attrs:{href:"https://github.com/ethereum/web3.js",target:"_blank",rel:"noopener noreferrer"}},[e._v("web3.js"),r("OutboundLink")],1),e._v(" or Parity's "),r("a",{attrs:{href:"https://github.com/paritytech/ink",target:"_blank",rel:"noopener noreferrer"}},[e._v("Ink!"),r("OutboundLink")],1),e._v(", then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same.")]),e._v(" "),r("p",[e._v("Here, we'll walk through several tutorials demonstrating how to use Anchor. To skip the tutorials and jump straight to examples, go "),r("a",{attrs:{href:"https://github.com/project-serum/anchor/blob/master/examples",target:"_blank",rel:"noopener noreferrer"}},[e._v("here"),r("OutboundLink")],1),e._v(". For an introduction to Solana, see the "),r("a",{attrs:{href:"https://docs.solana.com/developing/programming-model/overview",target:"_blank",rel:"noopener noreferrer"}},[e._v("docs"),r("OutboundLink")],1),e._v(".")]),e._v(" "),r("div",{staticClass:"custom-block tip"},[r("p",{staticClass:"custom-block-title"},[e._v("NOTE")]),e._v(" "),r("p",[e._v("Anchor is in active development, so all APIs are subject to change. If you are one of the early developers to try it out and have feedback, please reach out by "),r("a",{attrs:{href:"https://github.com/project-serum/anchor/issues/new",target:"_blank",rel:"noopener noreferrer"}},[e._v("filing an issue"),r("OutboundLink")],1),e._v(". This documentation is a work in progress and is expected to change dramatically as features continue to be built out. If you have any problems, consult the "),r("a",{attrs:{href:"https://github.com/project-serum/anchor",target:"_blank",rel:"noopener noreferrer"}},[e._v("source"),r("OutboundLink")],1),e._v(" or feel free to ask questions on the "),r("a",{attrs:{href:"https://discord.gg/JgVgQ82erk",target:"_blank",rel:"noopener noreferrer"}},[e._v("Discord"),r("OutboundLink")],1),e._v(".")])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{404:function(e,t,r){"use strict";r.r(t);var o=r(29),n=Object(o.a)({},(function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"introduction"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#introduction"}},[e._v("#")]),e._v(" Introduction")]),e._v(" "),r("div",{staticStyle:{border:"2px solid red","text-align":"center",padding:"10px 10px 10px 10px","box-sizing":"border-box"}},[e._v(" This documentation is being sunset in favor of "),r("a",{attrs:{href:"https://book.anchor-lang.com",rel:"noopener noreferrer",target:"_blank"}},[e._v("The Anchor Book")]),e._v(". At this point in time, either documentation may contain information that the other does not.")]),e._v(" "),r("p",[e._v("Anchor is a framework for Solana's "),r("a",{attrs:{href:"https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192",target:"_blank",rel:"noopener noreferrer"}},[e._v("Sealevel"),r("OutboundLink")],1),e._v(" runtime providing several convenient developer tools.")]),e._v(" "),r("ul",[r("li",[e._v("Rust crates and eDSL for writing Solana programs")]),e._v(" "),r("li",[r("a",{attrs:{href:"https://en.wikipedia.org/wiki/Interface_description_language",target:"_blank",rel:"noopener noreferrer"}},[e._v("IDL"),r("OutboundLink")],1),e._v(" specification")]),e._v(" "),r("li",[e._v("TypeScript package for generating clients from IDL")]),e._v(" "),r("li",[e._v("CLI and workspace management for developing complete applications")])]),e._v(" "),r("p",[e._v("If you're familiar with developing in Ethereum's "),r("a",{attrs:{href:"https://docs.soliditylang.org/en/v0.7.4/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Solidity"),r("OutboundLink")],1),e._v(", "),r("a",{attrs:{href:"https://www.trufflesuite.com/",target:"_blank",rel:"noopener noreferrer"}},[e._v("Truffle"),r("OutboundLink")],1),e._v(", "),r("a",{attrs:{href:"https://github.com/ethereum/web3.js",target:"_blank",rel:"noopener noreferrer"}},[e._v("web3.js"),r("OutboundLink")],1),e._v(" or Parity's "),r("a",{attrs:{href:"https://github.com/paritytech/ink",target:"_blank",rel:"noopener noreferrer"}},[e._v("Ink!"),r("OutboundLink")],1),e._v(", then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same.")]),e._v(" "),r("p",[e._v("Here, we'll walk through several tutorials demonstrating how to use Anchor. To skip the tutorials and jump straight to examples, go "),r("a",{attrs:{href:"https://github.com/project-serum/anchor/blob/master/examples",target:"_blank",rel:"noopener noreferrer"}},[e._v("here"),r("OutboundLink")],1),e._v(". For an introduction to Solana, see the "),r("a",{attrs:{href:"https://docs.solana.com/developing/programming-model/overview",target:"_blank",rel:"noopener noreferrer"}},[e._v("docs"),r("OutboundLink")],1),e._v(".")]),e._v(" "),r("div",{staticClass:"custom-block tip"},[r("p",{staticClass:"custom-block-title"},[e._v("NOTE")]),e._v(" "),r("p",[e._v("Anchor is in active development, so all APIs are subject to change. If you are one of the early developers to try it out and have feedback, please reach out by "),r("a",{attrs:{href:"https://github.com/project-serum/anchor/issues/new",target:"_blank",rel:"noopener noreferrer"}},[e._v("filing an issue"),r("OutboundLink")],1),e._v(". This documentation is a work in progress and is expected to change dramatically as features continue to be built out. If you have any problems, consult the "),r("a",{attrs:{href:"https://github.com/project-serum/anchor",target:"_blank",rel:"noopener noreferrer"}},[e._v("source"),r("OutboundLink")],1),e._v(" or feel free to ask questions on the "),r("a",{attrs:{href:"https://discord.gg/JgVgQ82erk",target:"_blank",rel:"noopener noreferrer"}},[e._v("Discord"),r("OutboundLink")],1),e._v(".")])])])}),[],!1,null,null,null);t.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/13.7bb3490d.js b/assets/js/13.c7c68919.js similarity index 97% rename from assets/js/13.7bb3490d.js rename to assets/js/13.c7c68919.js index d3cefe58..842c8f82 100644 --- a/assets/js/13.7bb3490d.js +++ b/assets/js/13.c7c68919.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{406:function(r,e,t){"use strict";t.r(e);var o=t(29),n=Object(o.a)({},(function(){var r=this,e=r.$createElement,t=r._self._c||e;return t("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[t("h1",{attrs:{id:"projects"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#projects"}},[r._v("#")]),r._v(" Projects")]),r._v(" "),t("p",[r._v("Open a pull request to add your project to the "),t("a",{attrs:{href:"https://github.com/project-serum/anchor/blob/master/docs/src/getting-started/projects.md",target:"_blank",rel:"noopener noreferrer"}},[r._v("list"),t("OutboundLink")],1),r._v(".")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/project-serum",target:"_blank",rel:"noopener noreferrer"}},[r._v("Serum"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/Synthetify",target:"_blank",rel:"noopener noreferrer"}},[r._v("Synthetify"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://solfarm.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("SolFarm"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://zeta.markets/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Zeta Markets"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://saber.so",target:"_blank",rel:"noopener noreferrer"}},[r._v("Saber"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://01protocol.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("01"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://parrot.fi/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Parrot Finance"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://marinade.finance/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Marinade Finance"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://dex.aldrin.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Aldrin"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://cyclos.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Cyclos"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://solend.fi",target:"_blank",rel:"noopener noreferrer"}},[r._v("Solend"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://www.drift.trade/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Drift"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://stake.fsynth.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Fabric"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://jetprotocol.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Jet Protocol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://quarry.so/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Quarry"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://psyoptions.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("PsyOptions"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://sosol.app/",target:"_blank",rel:"noopener noreferrer"}},[r._v("sosol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://arrowprotocol.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Arrow Protocol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://hubbleprotocol.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Hubble Protocol"),t("OutboundLink")],1)])])])}),[],!1,null,null,null);e.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{405:function(r,e,t){"use strict";t.r(e);var o=t(29),n=Object(o.a)({},(function(){var r=this,e=r.$createElement,t=r._self._c||e;return t("ContentSlotsDistributor",{attrs:{"slot-key":r.$parent.slotKey}},[t("h1",{attrs:{id:"projects"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#projects"}},[r._v("#")]),r._v(" Projects")]),r._v(" "),t("p",[r._v("Open a pull request to add your project to the "),t("a",{attrs:{href:"https://github.com/project-serum/anchor/blob/master/docs/src/getting-started/projects.md",target:"_blank",rel:"noopener noreferrer"}},[r._v("list"),t("OutboundLink")],1),r._v(".")]),r._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/project-serum",target:"_blank",rel:"noopener noreferrer"}},[r._v("Serum"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/Synthetify",target:"_blank",rel:"noopener noreferrer"}},[r._v("Synthetify"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://solfarm.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("SolFarm"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://zeta.markets/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Zeta Markets"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://saber.so",target:"_blank",rel:"noopener noreferrer"}},[r._v("Saber"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://01protocol.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("01"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://parrot.fi/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Parrot Finance"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://marinade.finance/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Marinade Finance"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://dex.aldrin.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Aldrin"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://cyclos.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Cyclos"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://solend.fi",target:"_blank",rel:"noopener noreferrer"}},[r._v("Solend"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://www.drift.trade/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Drift"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://stake.fsynth.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Fabric"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://jetprotocol.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Jet Protocol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://quarry.so/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Quarry"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://psyoptions.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("PsyOptions"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://sosol.app/",target:"_blank",rel:"noopener noreferrer"}},[r._v("sosol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://arrowprotocol.com/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Arrow Protocol"),t("OutboundLink")],1)]),r._v(" "),t("li",[t("a",{attrs:{href:"https://hubbleprotocol.io/",target:"_blank",rel:"noopener noreferrer"}},[r._v("Hubble Protocol"),t("OutboundLink")],1)])])])}),[],!1,null,null,null);e.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/14.06c054f4.js b/assets/js/14.b3c5cf32.js similarity index 97% rename from assets/js/14.06c054f4.js rename to assets/js/14.b3c5cf32.js index a6446a88..6388a7ad 100644 --- a/assets/js/14.06c054f4.js +++ b/assets/js/14.b3c5cf32.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{408:function(t,e,a){"use strict";a.r(e);var r=a(29),s=Object(r.a)({},(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"publishing-source"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#publishing-source"}},[t._v("#")]),t._v(" Publishing Source")]),t._v(" "),a("p",[t._v("The Anchor Program Registry at "),a("a",{attrs:{href:"https://anchor.projectserum.com",target:"_blank",rel:"noopener noreferrer"}},[t._v("anchor.projectserum.com"),a("OutboundLink")],1),t._v("\nhosts a catalog of verified programs on Solana both written with and without Anchor. It is recommended\nthat authors of smart contracts publish their source to promote best\npractices for security and transparency.")]),t._v(" "),a("div",{staticClass:"custom-block tip"},[a("p",{staticClass:"custom-block-title"},[t._v("note")]),t._v(" "),a("p",[t._v("The Anchor Program Registry is currently in alpha testing. For access to publishing\nplease ask on "),a("a",{attrs:{href:"https://discord.gg/rg5ZZPmmTm",target:"_blank",rel:"noopener noreferrer"}},[t._v("Discord"),a("OutboundLink")],1),t._v(".")])]),t._v(" "),a("h2",{attrs:{id:"getting-started"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[t._v("#")]),t._v(" Getting Started")]),t._v(" "),a("p",[t._v("The process for publishing is mostly identical to "),a("code",[t._v("crates.io")]),t._v(".")]),t._v(" "),a("ul",[a("li",[t._v("Signup for an account "),a("a",{attrs:{href:"https://anchor.projectserum.com/signup",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("li",[t._v("Confirm your email by clicking the link sent to your address.")]),t._v(" "),a("li",[t._v("Navigate to your Username -> Account Settings on the top navbar.")]),t._v(" "),a("li",[t._v('Click "New Token" in the '),a("strong",[t._v("API Access")]),t._v(" section.")]),t._v(" "),a("li",[t._v("Run "),a("code",[t._v("anchor login ")]),t._v(" at the command line.")])]),t._v(" "),a("p",[t._v("And you're ready to interact with the registry.")]),t._v(" "),a("h2",{attrs:{id:"configuring-a-build"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#configuring-a-build"}},[t._v("#")]),t._v(" Configuring a Build")]),t._v(" "),a("p",[t._v("Whether your program is written in Anchor or not, all source being published must\nhave an "),a("code",[t._v("Anchor.toml")]),t._v(" to define the build.")]),t._v(" "),a("p",[t._v("An example "),a("code",[t._v("Anchor.toml")]),t._v(" config looks as follows,")]),t._v(" "),a("div",{staticClass:"language-toml extra-class"},[a("pre",{pre:!0,attrs:{class:"language-toml"}},[a("code",[a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("anchor_version")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.24.0"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("workspace")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("members")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"programs/multisig"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("provider")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("cluster")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"mainnet"')]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("wallet")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"~/.config/solana/id.json"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("programs.mainnet")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("multisig")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("programs.localnet")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("multisig")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u"')]),t._v("\n")])])]),a("p",[t._v("Here there are four sections.")]),t._v(" "),a("ol",[a("li",[a("code",[t._v("anchor_version")]),t._v(" (optional) - sets the anchor docker image to use. By default, the builder will use the latest version of Anchor.")]),t._v(" "),a("li",[a("code",[t._v("[workspace]")]),t._v(" (optional) - sets the paths--relative to the "),a("code",[t._v("Anchor.toml")]),t._v("--\nto all programs in the local\nworkspace, i.e., the path to the "),a("code",[t._v("Cargo.toml")]),t._v(" manifest associated with each\nprogram that can be compiled by the "),a("code",[t._v("anchor")]),t._v(" CLI. For programs using the\nstandard Anchor workflow, this can be ommitted. For programs not written in Anchor\nbut still want to publish, this should be added.")]),t._v(" "),a("li",[a("code",[t._v("[provider]")]),t._v(" - configures the wallet and cluster settings. Here, "),a("code",[t._v("mainnet")]),t._v(" is used because the registry only supports "),a("code",[t._v("mainnet")]),t._v(" binary verification at the moment.")]),t._v(" "),a("li",[a("code",[t._v("[programs.mainnet]")]),t._v(" - configures each program in the workpace, providing\nthe "),a("code",[t._v("address")]),t._v(" of the program to verify.")])]),t._v(" "),a("div",{staticClass:"custom-block tip"},[a("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),a("p",[t._v("When defining program in "),a("code",[t._v("[programs.mainnet]")]),t._v(", make sure the name provided\nmatches the "),a("strong",[t._v("lib")]),t._v(" name for your program, which is defined\nby your program's Cargo.toml.")])]),t._v(" "),a("h3",{attrs:{id:"examples"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[t._v("#")]),t._v(" Examples")]),t._v(" "),a("h4",{attrs:{id:"anchor-program"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#anchor-program"}},[t._v("#")]),t._v(" Anchor Program")]),t._v(" "),a("p",[t._v("An example of a toml file for an Anchor program can be found "),a("a",{attrs:{href:"https://anchor.projectserum.com/build/2",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("h4",{attrs:{id:"non-anchor-program"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#non-anchor-program"}},[t._v("#")]),t._v(" Non Anchor Program")]),t._v(" "),a("p",[t._v("An example of a toml file for a non-anchor program can be found "),a("a",{attrs:{href:"https://anchor.projectserum.com/build/1",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("h2",{attrs:{id:"publishing"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#publishing"}},[t._v("#")]),t._v(" Publishing")]),t._v(" "),a("p",[t._v("To publish to the Anchor Program Registry, change directories to the "),a("code",[t._v("Anchor.toml")]),t._v("\ndefined root and run")]),t._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-bash"}},[a("code",[t._v("anchor publish "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("program-name"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n")])])]),a("p",[t._v("where "),a("code",[t._v("")]),t._v(" is as defined in "),a("code",[t._v("[programs.mainnet]")]),t._v(", i.e., "),a("code",[t._v("multisig")]),t._v("\nin the example above.")])])}),[],!1,null,null,null);e.default=s.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{409:function(t,e,a){"use strict";a.r(e);var r=a(29),s=Object(r.a)({},(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"publishing-source"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#publishing-source"}},[t._v("#")]),t._v(" Publishing Source")]),t._v(" "),a("p",[t._v("The Anchor Program Registry at "),a("a",{attrs:{href:"https://anchor.projectserum.com",target:"_blank",rel:"noopener noreferrer"}},[t._v("anchor.projectserum.com"),a("OutboundLink")],1),t._v("\nhosts a catalog of verified programs on Solana both written with and without Anchor. It is recommended\nthat authors of smart contracts publish their source to promote best\npractices for security and transparency.")]),t._v(" "),a("div",{staticClass:"custom-block tip"},[a("p",{staticClass:"custom-block-title"},[t._v("note")]),t._v(" "),a("p",[t._v("The Anchor Program Registry is currently in alpha testing. For access to publishing\nplease ask on "),a("a",{attrs:{href:"https://discord.gg/rg5ZZPmmTm",target:"_blank",rel:"noopener noreferrer"}},[t._v("Discord"),a("OutboundLink")],1),t._v(".")])]),t._v(" "),a("h2",{attrs:{id:"getting-started"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#getting-started"}},[t._v("#")]),t._v(" Getting Started")]),t._v(" "),a("p",[t._v("The process for publishing is mostly identical to "),a("code",[t._v("crates.io")]),t._v(".")]),t._v(" "),a("ul",[a("li",[t._v("Signup for an account "),a("a",{attrs:{href:"https://anchor.projectserum.com/signup",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("li",[t._v("Confirm your email by clicking the link sent to your address.")]),t._v(" "),a("li",[t._v("Navigate to your Username -> Account Settings on the top navbar.")]),t._v(" "),a("li",[t._v('Click "New Token" in the '),a("strong",[t._v("API Access")]),t._v(" section.")]),t._v(" "),a("li",[t._v("Run "),a("code",[t._v("anchor login ")]),t._v(" at the command line.")])]),t._v(" "),a("p",[t._v("And you're ready to interact with the registry.")]),t._v(" "),a("h2",{attrs:{id:"configuring-a-build"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#configuring-a-build"}},[t._v("#")]),t._v(" Configuring a Build")]),t._v(" "),a("p",[t._v("Whether your program is written in Anchor or not, all source being published must\nhave an "),a("code",[t._v("Anchor.toml")]),t._v(" to define the build.")]),t._v(" "),a("p",[t._v("An example "),a("code",[t._v("Anchor.toml")]),t._v(" config looks as follows,")]),t._v(" "),a("div",{staticClass:"language-toml extra-class"},[a("pre",{pre:!0,attrs:{class:"language-toml"}},[a("code",[a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("anchor_version")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.24.1"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("workspace")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("members")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"programs/multisig"')]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("provider")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("cluster")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"mainnet"')]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("wallet")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"~/.config/solana/id.json"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("programs.mainnet")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("multisig")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u"')]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token table class-name"}},[t._v("programs.localnet")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token key property"}},[t._v("multisig")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v('"A9HAbnCwoD6f2NkZobKFf6buJoN9gUVVvX5PoUnDHS6u"')]),t._v("\n")])])]),a("p",[t._v("Here there are four sections.")]),t._v(" "),a("ol",[a("li",[a("code",[t._v("anchor_version")]),t._v(" (optional) - sets the anchor docker image to use. By default, the builder will use the latest version of Anchor.")]),t._v(" "),a("li",[a("code",[t._v("[workspace]")]),t._v(" (optional) - sets the paths--relative to the "),a("code",[t._v("Anchor.toml")]),t._v("--\nto all programs in the local\nworkspace, i.e., the path to the "),a("code",[t._v("Cargo.toml")]),t._v(" manifest associated with each\nprogram that can be compiled by the "),a("code",[t._v("anchor")]),t._v(" CLI. For programs using the\nstandard Anchor workflow, this can be ommitted. For programs not written in Anchor\nbut still want to publish, this should be added.")]),t._v(" "),a("li",[a("code",[t._v("[provider]")]),t._v(" - configures the wallet and cluster settings. Here, "),a("code",[t._v("mainnet")]),t._v(" is used because the registry only supports "),a("code",[t._v("mainnet")]),t._v(" binary verification at the moment.")]),t._v(" "),a("li",[a("code",[t._v("[programs.mainnet]")]),t._v(" - configures each program in the workpace, providing\nthe "),a("code",[t._v("address")]),t._v(" of the program to verify.")])]),t._v(" "),a("div",{staticClass:"custom-block tip"},[a("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),a("p",[t._v("When defining program in "),a("code",[t._v("[programs.mainnet]")]),t._v(", make sure the name provided\nmatches the "),a("strong",[t._v("lib")]),t._v(" name for your program, which is defined\nby your program's Cargo.toml.")])]),t._v(" "),a("h3",{attrs:{id:"examples"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#examples"}},[t._v("#")]),t._v(" Examples")]),t._v(" "),a("h4",{attrs:{id:"anchor-program"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#anchor-program"}},[t._v("#")]),t._v(" Anchor Program")]),t._v(" "),a("p",[t._v("An example of a toml file for an Anchor program can be found "),a("a",{attrs:{href:"https://anchor.projectserum.com/build/2",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("h4",{attrs:{id:"non-anchor-program"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#non-anchor-program"}},[t._v("#")]),t._v(" Non Anchor Program")]),t._v(" "),a("p",[t._v("An example of a toml file for a non-anchor program can be found "),a("a",{attrs:{href:"https://anchor.projectserum.com/build/1",target:"_blank",rel:"noopener noreferrer"}},[t._v("here"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("h2",{attrs:{id:"publishing"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#publishing"}},[t._v("#")]),t._v(" Publishing")]),t._v(" "),a("p",[t._v("To publish to the Anchor Program Registry, change directories to the "),a("code",[t._v("Anchor.toml")]),t._v("\ndefined root and run")]),t._v(" "),a("div",{staticClass:"language-bash extra-class"},[a("pre",{pre:!0,attrs:{class:"language-bash"}},[a("code",[t._v("anchor publish "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("program-name"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n")])])]),a("p",[t._v("where "),a("code",[t._v("")]),t._v(" is as defined in "),a("code",[t._v("[programs.mainnet]")]),t._v(", i.e., "),a("code",[t._v("multisig")]),t._v("\nin the example above.")])])}),[],!1,null,null,null);e.default=s.exports}}]); \ No newline at end of file diff --git a/assets/js/15.5f458f21.js b/assets/js/15.0c123204.js similarity index 96% rename from assets/js/15.5f458f21.js rename to assets/js/15.0c123204.js index 43b83594..ada8eb60 100644 --- a/assets/js/15.5f458f21.js +++ b/assets/js/15.0c123204.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{407:function(e,a,r){"use strict";r.r(a);var t=r(29),s=Object(t.a)({},(function(){var e=this,a=e.$createElement,r=e._self._c||a;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"verifiable-builds"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifiable-builds"}},[e._v("#")]),e._v(" Verifiable Builds")]),e._v(" "),r("p",[e._v("Building programs with the Solana CLI may embed machine specfic\ncode into the resulting binary. As a result, building the same program\non different machines may produce different executables. To get around this\nproblem, one can build inside a docker image with pinned dependencies to produce\na verifiable build.")]),e._v(" "),r("p",[e._v("Anchor makes this easy by providing CLI commands to build and take care of\ndocker for you. To get started, first make sure you\n"),r("a",{attrs:{href:"https://docs.docker.com/get-docker/",target:"_blank",rel:"noopener noreferrer"}},[e._v("install"),r("OutboundLink")],1),e._v(" docker on your local machine.")]),e._v(" "),r("h2",{attrs:{id:"building"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#building"}},[e._v("#")]),e._v(" Building")]),e._v(" "),r("p",[e._v("To produce a verifiable build, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor build --verifiable\n")])])]),r("h2",{attrs:{id:"verifying"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifying"}},[e._v("#")]),e._v(" Verifying")]),e._v(" "),r("p",[e._v("To verify a build against a program deployed on mainnet, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor verify -p "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("lib-name"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v(" "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("program-id"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v("\n")])])]),r("p",[e._v("where the "),r("code",[e._v("")]),e._v(" is defined by your program's Cargo.toml.")]),e._v(" "),r("p",[e._v("If the program has an IDL, it will also check the IDL deployed on chain matches.")]),e._v(" "),r("h2",{attrs:{id:"images"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#images"}},[e._v("#")]),e._v(" Images")]),e._v(" "),r("p",[e._v("A docker image for each version of Anchor is published on "),r("a",{attrs:{href:"https://hub.docker.com/r/projectserum/build",target:"_blank",rel:"noopener noreferrer"}},[e._v("Docker Hub"),r("OutboundLink")],1),e._v(". They are tagged in the form "),r("code",[e._v("projectserum/build:")]),e._v(". For example, to get the image for Anchor "),r("code",[e._v("v0.24.0")]),e._v(" one can run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker pull projectserum/build:v0.24.0\n")])])]),r("h2",{attrs:{id:"removing-an-image"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#removing-an-image"}},[e._v("#")]),e._v(" Removing an Image")]),e._v(" "),r("p",[e._v("In the event you run a verifiable build from the CLI and exit prematurely,\nit's possible the docker image may still be building in the background.")]),e._v(" "),r("p",[e._v("To remove, run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker rm -f anchor-program\n")])])]),r("p",[e._v("where "),r("code",[e._v("anchor-program")]),e._v(" is the name of the image created by default from within\nthe Anchor CLI.")])])}),[],!1,null,null,null);a.default=s.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{407:function(e,a,r){"use strict";r.r(a);var t=r(29),s=Object(t.a)({},(function(){var e=this,a=e.$createElement,r=e._self._c||a;return r("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[r("h1",{attrs:{id:"verifiable-builds"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifiable-builds"}},[e._v("#")]),e._v(" Verifiable Builds")]),e._v(" "),r("p",[e._v("Building programs with the Solana CLI may embed machine specfic\ncode into the resulting binary. As a result, building the same program\non different machines may produce different executables. To get around this\nproblem, one can build inside a docker image with pinned dependencies to produce\na verifiable build.")]),e._v(" "),r("p",[e._v("Anchor makes this easy by providing CLI commands to build and take care of\ndocker for you. To get started, first make sure you\n"),r("a",{attrs:{href:"https://docs.docker.com/get-docker/",target:"_blank",rel:"noopener noreferrer"}},[e._v("install"),r("OutboundLink")],1),e._v(" docker on your local machine.")]),e._v(" "),r("h2",{attrs:{id:"building"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#building"}},[e._v("#")]),e._v(" Building")]),e._v(" "),r("p",[e._v("To produce a verifiable build, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor build --verifiable\n")])])]),r("h2",{attrs:{id:"verifying"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#verifying"}},[e._v("#")]),e._v(" Verifying")]),e._v(" "),r("p",[e._v("To verify a build against a program deployed on mainnet, run")]),e._v(" "),r("div",{staticClass:"language-bash extra-class"},[r("pre",{pre:!0,attrs:{class:"language-bash"}},[r("code",[e._v("anchor verify -p "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("lib-name"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v(" "),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v("<")]),e._v("program-id"),r("span",{pre:!0,attrs:{class:"token operator"}},[e._v(">")]),e._v("\n")])])]),r("p",[e._v("where the "),r("code",[e._v("")]),e._v(" is defined by your program's Cargo.toml.")]),e._v(" "),r("p",[e._v("If the program has an IDL, it will also check the IDL deployed on chain matches.")]),e._v(" "),r("h2",{attrs:{id:"images"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#images"}},[e._v("#")]),e._v(" Images")]),e._v(" "),r("p",[e._v("A docker image for each version of Anchor is published on "),r("a",{attrs:{href:"https://hub.docker.com/r/projectserum/build",target:"_blank",rel:"noopener noreferrer"}},[e._v("Docker Hub"),r("OutboundLink")],1),e._v(". They are tagged in the form "),r("code",[e._v("projectserum/build:")]),e._v(". For example, to get the image for Anchor "),r("code",[e._v("v0.24.1")]),e._v(" one can run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker pull projectserum/build:v0.24.1\n")])])]),r("h2",{attrs:{id:"removing-an-image"}},[r("a",{staticClass:"header-anchor",attrs:{href:"#removing-an-image"}},[e._v("#")]),e._v(" Removing an Image")]),e._v(" "),r("p",[e._v("In the event you run a verifiable build from the CLI and exit prematurely,\nit's possible the docker image may still be building in the background.")]),e._v(" "),r("p",[e._v("To remove, run")]),e._v(" "),r("div",{staticClass:"language- extra-class"},[r("pre",{pre:!0,attrs:{class:"language-text"}},[r("code",[e._v("docker rm -f anchor-program\n")])])]),r("p",[e._v("where "),r("code",[e._v("anchor-program")]),e._v(" is the name of the image created by default from within\nthe Anchor CLI.")])])}),[],!1,null,null,null);a.default=s.exports}}]); \ No newline at end of file diff --git a/assets/js/16.64b07960.js b/assets/js/16.1bba98d0.js similarity index 87% rename from assets/js/16.64b07960.js rename to assets/js/16.1bba98d0.js index d929c233..b2639e8f 100644 --- a/assets/js/16.64b07960.js +++ b/assets/js/16.1bba98d0.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{410:function(t,e,n){"use strict";n.r(e);var o=n(29),i=Object(o.a)({},(function(){var t=this.$createElement,e=this._self._c||t;return e("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[e("div",{staticStyle:{border:"2px solid red","text-align":"center",padding:"10px 10px 10px 10px","box-sizing":"border-box"}},[this._v(" This documentation is being sunset in favor of "),e("a",{attrs:{href:"https://book.anchor-lang.com",rel:"noopener noreferrer",target:"_blank"}},[this._v("The Anchor Book")]),this._v(". At this point in time, either documentation may contain information that the other does not.")])])}),[],!1,null,null,null);e.default=i.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{408:function(t,e,n){"use strict";n.r(e);var o=n(29),i=Object(o.a)({},(function(){var t=this.$createElement,e=this._self._c||t;return e("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[e("div",{staticStyle:{border:"2px solid red","text-align":"center",padding:"10px 10px 10px 10px","box-sizing":"border-box"}},[this._v(" This documentation is being sunset in favor of "),e("a",{attrs:{href:"https://book.anchor-lang.com",rel:"noopener noreferrer",target:"_blank"}},[this._v("The Anchor Book")]),this._v(". At this point in time, either documentation may contain information that the other does not.")])])}),[],!1,null,null,null);e.default=i.exports}}]); \ No newline at end of file diff --git a/assets/js/17.31820e82.js b/assets/js/17.29eac49f.js similarity index 99% rename from assets/js/17.31820e82.js rename to assets/js/17.29eac49f.js index 955b3aab..dc764d53 100644 --- a/assets/js/17.31820e82.js +++ b/assets/js/17.29eac49f.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{409:function(t,a,s){"use strict";s.r(a);var e=s(29),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"a-minimal-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-minimal-example"}},[t._v("#")]),t._v(" A Minimal Example")]),t._v(" "),s("p",[t._v("Here, we introduce Anchor's core syntax elements and project workflow. This tutorial assumes all\n"),s("RouterLink",{attrs:{to:"/getting-started/installation.html"}},[t._v("prerequisites")]),t._v(" are installed.")],1),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Next, checkout the tagged branch of the same version of the anchor cli you have installed.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" checkout tags/"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("version"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-0\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"starting-a-localnet"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#starting-a-localnet"}},[t._v("#")]),t._v(" Starting a Localnet")]),t._v(" "),s("p",[t._v("In a separate terminal, start a local network. If you're running solana\nfor the first time, generate a wallet.")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("solana-keygen new\n")])])]),s("p",[t._v("Then run")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("solana-test-validator\n")])])]),s("p",[t._v("Then, shut it down.")]),t._v(" "),s("p",[t._v("The test validator will be used when testing Anchor programs. Make sure to turn off the validator before you begin testing Anchor programs.")]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("As you'll see later, starting a localnet manually like this is not necessary when testing with Anchor,\nbut is done for educational purposes in this tutorial.")])]),t._v(" "),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("We define the minimum viable program as follows.")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_0")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Initialize")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("ul",[s("li",[s("p",[s("code",[t._v("#[program]")]),t._v(" First, notice that a program is defined with the "),s("code",[t._v("#[program]")]),t._v(' attribute, where each\ninner method defines an RPC request handler, or, in Solana parlance, an "instruction"\nhandler. These handlers are the entrypoints to your program that clients may invoke, as\nwe will see soon.')])]),t._v(" "),s("li",[s("p",[s("code",[t._v("Context")]),t._v(" The first parameter of "),s("em",[t._v("every")]),t._v(" RPC handler is the "),s("code",[t._v("Context")]),t._v(" struct, which is a simple\ncontainer for the currently executing "),s("code",[t._v("program_id")]),t._v(" generic over\n"),s("code",[t._v("Accounts")]),t._v("--here, the "),s("code",[t._v("Initialize")]),t._v(" struct.")])]),t._v(" "),s("li",[s("p",[s("code",[t._v("#[derive(Accounts)]")]),t._v(" The "),s("code",[t._v("Accounts")]),t._v(" derive macro marks a struct containing all the accounts that must be\nspecified for a given instruction. To understand Accounts on Solana, see the\n"),s("a",{attrs:{href:"https://docs.solana.com/developing/programming-model/accounts",target:"_blank",rel:"noopener noreferrer"}},[t._v("docs"),s("OutboundLink")],1),t._v(".\nIn subsequent tutorials, we'll demonstrate how an "),s("code",[t._v("Accounts")]),t._v(" struct can be used to\nspecify constraints on accounts given to your program. Since this example doesn't touch any\naccounts, we skip this (important) detail.")])])]),t._v(" "),s("h2",{attrs:{id:"building-and-emitting-an-idl"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-and-emitting-an-idl"}},[t._v("#")]),t._v(" Building and Emitting an IDL")]),t._v(" "),s("p",[t._v("After creating a program, you can use the "),s("code",[t._v("anchor")]),t._v(" CLI to build and emit an IDL, from which clients\ncan be generated.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor build\n")])])]),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("The "),s("code",[t._v("build")]),t._v(" command is a convenience combining two steps.")]),t._v(" "),s("ol",[s("li",[s("code",[t._v("cargo build-bpf")])]),t._v(" "),s("li",[s("code",[t._v("anchor idl parse -f program/src/lib.rs -o target/idl/basic_0.json")]),t._v(".")])])]),t._v(" "),s("p",[t._v("Once run, you should see your build artifacts, as usual, in your "),s("code",[t._v("target/")]),t._v(" directory. Additionally,\na "),s("code",[t._v("target/idl/basic_0.json")]),t._v(" file is created. Inspecting its contents you should see")]),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"version"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.1.0"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"basic_0"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"instructions"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"initialize"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"accounts"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"args"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("From this file a client can be generated. Note that this file is created by parsing the "),s("code",[t._v("src/lib.rs")]),t._v("\nfile in your program's crate.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),s("p",[t._v("If you've developed on Ethereum, the IDL is analogous to the "),s("code",[t._v("abi.json")]),t._v(".")])]),t._v(" "),s("h2",{attrs:{id:"deploying"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#deploying"}},[t._v("#")]),t._v(" Deploying")]),t._v(" "),s("p",[t._v("Once built, we can deploy the program by running")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor deploy\n")])])]),s("p",[t._v("Take note of the program's deployed address. We'll use it next.")]),t._v(" "),s("h2",{attrs:{id:"generating-a-client"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#generating-a-client"}},[t._v("#")]),t._v(" Generating a Client")]),t._v(" "),s("p",[t._v("Now that we've built a program, deployed it to a local cluster, and generated an IDL,\nwe can use the IDL to generate a client to speak to our on-chain program. For example,\nsee "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0/client.js",target:"_blank",rel:"noopener noreferrer"}},[t._v("client.js"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Read the generated IDL.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" idl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("parse")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"fs"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("readFileSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./target/idl/basic_0.json"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"utf8"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Address of the deployed program.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" programId "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("web3"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PublicKey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Generate the program client from IDL.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Program")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("idl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" programId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Execute the RPC.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("Notice how we dynamically created the "),s("code",[t._v("initialize")]),t._v(" method under\nthe "),s("code",[t._v("rpc")]),t._v(" namespace.")]),t._v(" "),s("p",[t._v("Now, make sure to plugin your program's address into "),s("code",[t._v("")]),t._v(" (a mild\nannoyance that we'll address next). In order to run the client, you'll also need the path\nto your wallet's keypair you generated when you ran "),s("code",[t._v("solana-keygen new")]),t._v("; you can find it\nby running")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("solana config get keypair\n")])])]),s("p",[t._v("Once you've got it, run the client with the environment variable "),s("code",[t._v("ANCHOR_WALLET")]),t._v(" set to\nthat path, e.g.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token assign-left variable"}},[t._v("ANCHOR_WALLET")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("YOUR-KEYPAIR-"),s("span",{pre:!0,attrs:{class:"token environment constant"}},[t._v("PATH")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" node client.js\n")])])]),s("p",[t._v("You just successfully created a client and executed a transaction on your localnet.")]),t._v(" "),s("h2",{attrs:{id:"workspaces"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#workspaces"}},[t._v("#")]),t._v(" Workspaces")]),t._v(" "),s("p",[t._v("So far we've seen the basics of how to create, deploy, and make RPCs to a program, but\ndeploying a program, copy and pasting the address, and explicitly reading\nan IDL is all a bit tedious, and can easily get out of hand the more tests and the more\nprograms you have. For this reason, we introduce the concept of a workspace.")]),t._v(" "),s("p",[t._v("Inspecting "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0/tests/basic-0.js",target:"_blank",rel:"noopener noreferrer"}},[t._v("tests/basic-0.js"),s("OutboundLink")],1),t._v(", we see the above example can be reduced to")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Read the deployed program from the workspace.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("workspace"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Basic0"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Execute the RPC.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("The "),s("code",[t._v("workspace")]),t._v(" namespace provides access to all programs in the local project and is\nautomatically updated to reflect the latest deployment, making it easy to change\nyour program, update your JavaScript, and run your tests in a fast feedback loop.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("NOTE")]),t._v(" "),s("p",[t._v("For now, the workspace feature is only available when running the "),s("code",[t._v("anchor test")]),t._v(" command,\nwhich will automatically "),s("code",[t._v("build")]),t._v(", "),s("code",[t._v("deploy")]),t._v(", and "),s("code",[t._v("test")]),t._v(" all programs against a localnet\nin one command.")])]),t._v(" "),s("p",[t._v("Finally, we can run the test. Don't forget to kill the local validator started earlier.\nWe won't need to start one manually for any future tutorials.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor "),s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("test")]),t._v("\n")])])]),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've introduced the basic syntax of writing programs in Anchor along with a productive\nworkflow for building and testing. However, programs aren't all that interesting without\ninteracting with persistent state. We'll cover that next.")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{410:function(t,a,s){"use strict";s.r(a);var e=s(29),n=Object(e.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"a-minimal-example"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#a-minimal-example"}},[t._v("#")]),t._v(" A Minimal Example")]),t._v(" "),s("p",[t._v("Here, we introduce Anchor's core syntax elements and project workflow. This tutorial assumes all\n"),s("RouterLink",{attrs:{to:"/getting-started/installation.html"}},[t._v("prerequisites")]),t._v(" are installed.")],1),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Next, checkout the tagged branch of the same version of the anchor cli you have installed.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" checkout tags/"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("version"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v("\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-0\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"starting-a-localnet"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#starting-a-localnet"}},[t._v("#")]),t._v(" Starting a Localnet")]),t._v(" "),s("p",[t._v("In a separate terminal, start a local network. If you're running solana\nfor the first time, generate a wallet.")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("solana-keygen new\n")])])]),s("p",[t._v("Then run")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("solana-test-validator\n")])])]),s("p",[t._v("Then, shut it down.")]),t._v(" "),s("p",[t._v("The test validator will be used when testing Anchor programs. Make sure to turn off the validator before you begin testing Anchor programs.")]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("As you'll see later, starting a localnet manually like this is not necessary when testing with Anchor,\nbut is done for educational purposes in this tutorial.")])]),t._v(" "),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("We define the minimum viable program as follows.")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_0")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("_ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Initialize")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("ul",[s("li",[s("p",[s("code",[t._v("#[program]")]),t._v(" First, notice that a program is defined with the "),s("code",[t._v("#[program]")]),t._v(' attribute, where each\ninner method defines an RPC request handler, or, in Solana parlance, an "instruction"\nhandler. These handlers are the entrypoints to your program that clients may invoke, as\nwe will see soon.')])]),t._v(" "),s("li",[s("p",[s("code",[t._v("Context")]),t._v(" The first parameter of "),s("em",[t._v("every")]),t._v(" RPC handler is the "),s("code",[t._v("Context")]),t._v(" struct, which is a simple\ncontainer for the currently executing "),s("code",[t._v("program_id")]),t._v(" generic over\n"),s("code",[t._v("Accounts")]),t._v("--here, the "),s("code",[t._v("Initialize")]),t._v(" struct.")])]),t._v(" "),s("li",[s("p",[s("code",[t._v("#[derive(Accounts)]")]),t._v(" The "),s("code",[t._v("Accounts")]),t._v(" derive macro marks a struct containing all the accounts that must be\nspecified for a given instruction. To understand Accounts on Solana, see the\n"),s("a",{attrs:{href:"https://docs.solana.com/developing/programming-model/accounts",target:"_blank",rel:"noopener noreferrer"}},[t._v("docs"),s("OutboundLink")],1),t._v(".\nIn subsequent tutorials, we'll demonstrate how an "),s("code",[t._v("Accounts")]),t._v(" struct can be used to\nspecify constraints on accounts given to your program. Since this example doesn't touch any\naccounts, we skip this (important) detail.")])])]),t._v(" "),s("h2",{attrs:{id:"building-and-emitting-an-idl"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#building-and-emitting-an-idl"}},[t._v("#")]),t._v(" Building and Emitting an IDL")]),t._v(" "),s("p",[t._v("After creating a program, you can use the "),s("code",[t._v("anchor")]),t._v(" CLI to build and emit an IDL, from which clients\ncan be generated.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor build\n")])])]),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("The "),s("code",[t._v("build")]),t._v(" command is a convenience combining two steps.")]),t._v(" "),s("ol",[s("li",[s("code",[t._v("cargo build-bpf")])]),t._v(" "),s("li",[s("code",[t._v("anchor idl parse -f program/src/lib.rs -o target/idl/basic_0.json")]),t._v(".")])])]),t._v(" "),s("p",[t._v("Once run, you should see your build artifacts, as usual, in your "),s("code",[t._v("target/")]),t._v(" directory. Additionally,\na "),s("code",[t._v("target/idl/basic_0.json")]),t._v(" file is created. Inspecting its contents you should see")]),t._v(" "),s("div",{staticClass:"language-json extra-class"},[s("pre",{pre:!0,attrs:{class:"language-json"}},[s("code",[s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"version"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"0.1.0"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"basic_0"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"instructions"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"name"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"initialize"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"accounts"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token property"}},[t._v('"args"')]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("From this file a client can be generated. Note that this file is created by parsing the "),s("code",[t._v("src/lib.rs")]),t._v("\nfile in your program's crate.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("TIP")]),t._v(" "),s("p",[t._v("If you've developed on Ethereum, the IDL is analogous to the "),s("code",[t._v("abi.json")]),t._v(".")])]),t._v(" "),s("h2",{attrs:{id:"deploying"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#deploying"}},[t._v("#")]),t._v(" Deploying")]),t._v(" "),s("p",[t._v("Once built, we can deploy the program by running")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor deploy\n")])])]),s("p",[t._v("Take note of the program's deployed address. We'll use it next.")]),t._v(" "),s("h2",{attrs:{id:"generating-a-client"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#generating-a-client"}},[t._v("#")]),t._v(" Generating a Client")]),t._v(" "),s("p",[t._v("Now that we've built a program, deployed it to a local cluster, and generated an IDL,\nwe can use the IDL to generate a client to speak to our on-chain program. For example,\nsee "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0/client.js",target:"_blank",rel:"noopener noreferrer"}},[t._v("client.js"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Read the generated IDL.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" idl "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token constant"}},[t._v("JSON")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("parse")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("require")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"fs"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("readFileSync")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"./target/idl/basic_0.json"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"utf8"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Address of the deployed program.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" programId "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("web3"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("PublicKey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('""')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Generate the program client from IDL.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Program")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("idl"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" programId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Execute the RPC.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("Notice how we dynamically created the "),s("code",[t._v("initialize")]),t._v(" method under\nthe "),s("code",[t._v("rpc")]),t._v(" namespace.")]),t._v(" "),s("p",[t._v("Now, make sure to plugin your program's address into "),s("code",[t._v("")]),t._v(" (a mild\nannoyance that we'll address next). In order to run the client, you'll also need the path\nto your wallet's keypair you generated when you ran "),s("code",[t._v("solana-keygen new")]),t._v("; you can find it\nby running")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("solana config get keypair\n")])])]),s("p",[t._v("Once you've got it, run the client with the environment variable "),s("code",[t._v("ANCHOR_WALLET")]),t._v(" set to\nthat path, e.g.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token assign-left variable"}},[t._v("ANCHOR_WALLET")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("YOUR-KEYPAIR-"),s("span",{pre:!0,attrs:{class:"token environment constant"}},[t._v("PATH")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" node client.js\n")])])]),s("p",[t._v("You just successfully created a client and executed a transaction on your localnet.")]),t._v(" "),s("h2",{attrs:{id:"workspaces"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#workspaces"}},[t._v("#")]),t._v(" Workspaces")]),t._v(" "),s("p",[t._v("So far we've seen the basics of how to create, deploy, and make RPCs to a program, but\ndeploying a program, copy and pasting the address, and explicitly reading\nan IDL is all a bit tedious, and can easily get out of hand the more tests and the more\nprograms you have. For this reason, we introduce the concept of a workspace.")]),t._v(" "),s("p",[t._v("Inspecting "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0/tests/basic-0.js",target:"_blank",rel:"noopener noreferrer"}},[t._v("tests/basic-0.js"),s("OutboundLink")],1),t._v(", we see the above example can be reduced to")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Read the deployed program from the workspace.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("workspace"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Basic0"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Execute the RPC.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("The "),s("code",[t._v("workspace")]),t._v(" namespace provides access to all programs in the local project and is\nautomatically updated to reflect the latest deployment, making it easy to change\nyour program, update your JavaScript, and run your tests in a fast feedback loop.")]),t._v(" "),s("div",{staticClass:"custom-block tip"},[s("p",{staticClass:"custom-block-title"},[t._v("NOTE")]),t._v(" "),s("p",[t._v("For now, the workspace feature is only available when running the "),s("code",[t._v("anchor test")]),t._v(" command,\nwhich will automatically "),s("code",[t._v("build")]),t._v(", "),s("code",[t._v("deploy")]),t._v(", and "),s("code",[t._v("test")]),t._v(" all programs against a localnet\nin one command.")])]),t._v(" "),s("p",[t._v("Finally, we can run the test. Don't forget to kill the local validator started earlier.\nWe won't need to start one manually for any future tutorials.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[t._v("anchor "),s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("test")]),t._v("\n")])])]),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've introduced the basic syntax of writing programs in Anchor along with a productive\nworkflow for building and testing. However, programs aren't all that interesting without\ninteracting with persistent state. We'll cover that next.")])])}),[],!1,null,null,null);a.default=n.exports}}]); \ No newline at end of file diff --git a/assets/js/18.db5dc2ee.js b/assets/js/18.a3c88079.js similarity index 99% rename from assets/js/18.db5dc2ee.js rename to assets/js/18.a3c88079.js index c9b3ae55..2233c91b 100644 --- a/assets/js/18.db5dc2ee.js +++ b/assets/js/18.a3c88079.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{411:function(t,a,s){"use strict";s.r(a);var n=s(29),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"arguments-and-accounts"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments-and-accounts"}},[t._v("#")]),t._v(" Arguments and Accounts")]),t._v(" "),s("p",[t._v("This tutorial covers the basics of creating and mutating accounts using Anchor.\nIt's recommended to read "),s("RouterLink",{attrs:{to:"/tutorials/tutorial-0.html"}},[t._v("Tutorial 0")]),t._v(" first, as this tutorial will\nbuild on top of it.")],1),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-1",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-1\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("We define our program as follows")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_1")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" my_account "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("update")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Update")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" my_account "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(init, payer = user, space = 8 + 8)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("MyAccount")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" system_program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Program")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("System")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Update")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("MyAccount")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("MyAccount")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Some new syntax elements are introduced here.")]),t._v(" "),s("h3",{attrs:{id:"initialize-instruction"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#initialize-instruction"}},[t._v("#")]),t._v(" "),s("code",[t._v("initialize")]),t._v(" instruction")]),t._v(" "),s("p",[t._v("First, let's start with the initialize instruction. Notice the "),s("code",[t._v("data")]),t._v(" argument passed into the program. This argument and any other valid\nRust types can be passed to the instruction to define inputs to the program.")]),t._v(" "),s("p",[t._v("Additionally,\nnotice how we take a mutable reference to "),s("code",[t._v("my_account")]),t._v(" and assign the "),s("code",[t._v("data")]),t._v(" to it. This leads us to\nthe "),s("code",[t._v("Initialize")]),t._v(" struct, deriving "),s("code",[t._v("Accounts")]),t._v(". There are two things to notice about "),s("code",[t._v("Initialize")]),t._v(".")]),t._v(" "),s("ol",[s("li",[t._v("The "),s("code",[t._v("my_account")]),t._v(" field is of type "),s("code",[t._v("Account<'info, MyAccount>")]),t._v(" and the deserialized data structure is "),s("code",[t._v("MyAccount")]),t._v(".")]),t._v(" "),s("li",[t._v("The "),s("code",[t._v("my_account")]),t._v(" field is marked with the "),s("code",[t._v("init")]),t._v(" attribute. This will create a new\naccount owned by the current program, zero initialized. When using "),s("code",[t._v("init")]),t._v(", one must also provide\n"),s("code",[t._v("payer")]),t._v(", which will fund the account creation, "),s("code",[t._v("space")]),t._v(", which defines how large the account should be,\nand the "),s("code",[t._v("system_program")]),t._v(", which is required by the runtime for creating the account.")])]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("All accounts created with Anchor are laid out as follows: "),s("code",[t._v("8-byte-discriminator || borsh serialized data")]),t._v(". The 8-byte-discriminator is created from the first 8 bytes of the\n"),s("code",[t._v("Sha256")]),t._v(" hash of the account's type--using the example above, "),s("code",[t._v('sha256("account:MyAccount")[..8]')]),t._v(".\nThe "),s("code",[t._v("account:")]),t._v(" is a fixed prefix.")]),t._v(" "),s("p",[t._v("Importantly, this allows a program to know for certain an account is indeed of a given type.\nWithout it, a program would be vulnerable to account injection attacks, where a malicious user\nspecifies an account of an unexpected type, causing the program to do unexpected things.")]),t._v(" "),s("p",[t._v("On account creation, this 8-byte discriminator doesn't exist, since the account storage is\nzeroed. The first time an Anchor program mutates an account, this discriminator is prepended\nto the account storage array and all subsequent accesses to the account (not decorated with\n"),s("code",[t._v("#[account(init)]")]),t._v(") will check for this discriminator.")])]),t._v(" "),s("h3",{attrs:{id:"update-instruction"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#update-instruction"}},[t._v("#")]),t._v(" "),s("code",[t._v("update")]),t._v(" instruction")]),t._v(" "),s("p",[t._v("Similarly, the "),s("code",[t._v("Update")]),t._v(" accounts struct is marked with the "),s("code",[t._v("#[account(mut)]")]),t._v(" attribute.\nMarking an account as "),s("code",[t._v("mut")]),t._v(" persists any changes made upon exiting the program.")]),t._v(" "),s("p",[t._v("Here we've covered the basics of how to interact with accounts. In a later tutorial,\nwe'll delve more deeply into deriving "),s("code",[t._v("Accounts")]),t._v(", but for now, just know\nyou must mark an account "),s("code",[t._v("init")]),t._v(" when using it for the first time and "),s("code",[t._v("mut")]),t._v("\nfor persisting changes.")]),t._v(" "),s("h2",{attrs:{id:"creating-and-initializing-accounts"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#creating-and-initializing-accounts"}},[t._v("#")]),t._v(" Creating and Initializing Accounts")]),t._v(" "),s("p",[t._v("We can interact with the program as follows.")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// The program to execute.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("workspace"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Basic1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// The Account to create.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" myAccount "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("web3"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Keypair"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("generate")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Create the new account and initialize it with the program.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("BN")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1234")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n accounts"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n myAccount"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" myAccount"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("publicKey"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" provider"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wallet"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("publicKey"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n systemProgram"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SystemProgram"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("programId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n signers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("myAccount"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("The last element passed into the method is common amongst all dynamically generated\nmethods on the "),s("code",[t._v("rpc")]),t._v(" namespace, containing several options for a transaction. Here,\nwe specify the "),s("code",[t._v("accounts")]),t._v(" field, an object of all the addresses the transaction\nneeds to touch, and the "),s("code",[t._v("signers")]),t._v(" array of all "),s("code",[t._v("Signer")]),t._v(" objects needed to sign the\ntransaction. Because "),s("code",[t._v("myAccount")]),t._v(" is being created, the Solana runtime requires it\nto sign the transaction.")]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("If you've developed on Solana before, you might notice two things 1) the ordering of the accounts doesn't\nmatter and 2) the "),s("code",[t._v("isWritable")]),t._v(" and "),s("code",[t._v("isSigner")]),t._v("\noptions are not specified on the account anywhere. In both cases, the framework takes care\nof these details for you, by reading the IDL.")])]),t._v(" "),s("p",[t._v("As before, we can run the example tests.")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("anchor test\n")])])]),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've covered all the basics of developing applications using Anchor. However, we've\nleft out one important aspect to ensure the security of our programs--validating input\nand access control. We'll cover that next.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{412:function(t,a,s){"use strict";s.r(a);var n=s(29),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"arguments-and-accounts"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#arguments-and-accounts"}},[t._v("#")]),t._v(" Arguments and Accounts")]),t._v(" "),s("p",[t._v("This tutorial covers the basics of creating and mutating accounts using Anchor.\nIt's recommended to read "),s("RouterLink",{attrs:{to:"/tutorials/tutorial-0.html"}},[t._v("Tutorial 0")]),t._v(" first, as this tutorial will\nbuild on top of it.")],1),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-1",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-1\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("We define our program as follows")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_1")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" my_account "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("update")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Update")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" my_account "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Initialize")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(init, payer = user, space = 8 + 8)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("MyAccount")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" system_program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Program")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("System")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Update")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" my_account"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("MyAccount")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("MyAccount")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" data"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Some new syntax elements are introduced here.")]),t._v(" "),s("h3",{attrs:{id:"initialize-instruction"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#initialize-instruction"}},[t._v("#")]),t._v(" "),s("code",[t._v("initialize")]),t._v(" instruction")]),t._v(" "),s("p",[t._v("First, let's start with the initialize instruction. Notice the "),s("code",[t._v("data")]),t._v(" argument passed into the program. This argument and any other valid\nRust types can be passed to the instruction to define inputs to the program.")]),t._v(" "),s("p",[t._v("Additionally,\nnotice how we take a mutable reference to "),s("code",[t._v("my_account")]),t._v(" and assign the "),s("code",[t._v("data")]),t._v(" to it. This leads us to\nthe "),s("code",[t._v("Initialize")]),t._v(" struct, deriving "),s("code",[t._v("Accounts")]),t._v(". There are two things to notice about "),s("code",[t._v("Initialize")]),t._v(".")]),t._v(" "),s("ol",[s("li",[t._v("The "),s("code",[t._v("my_account")]),t._v(" field is of type "),s("code",[t._v("Account<'info, MyAccount>")]),t._v(" and the deserialized data structure is "),s("code",[t._v("MyAccount")]),t._v(".")]),t._v(" "),s("li",[t._v("The "),s("code",[t._v("my_account")]),t._v(" field is marked with the "),s("code",[t._v("init")]),t._v(" attribute. This will create a new\naccount owned by the current program, zero initialized. When using "),s("code",[t._v("init")]),t._v(", one must also provide\n"),s("code",[t._v("payer")]),t._v(", which will fund the account creation, "),s("code",[t._v("space")]),t._v(", which defines how large the account should be,\nand the "),s("code",[t._v("system_program")]),t._v(", which is required by the runtime for creating the account.")])]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("All accounts created with Anchor are laid out as follows: "),s("code",[t._v("8-byte-discriminator || borsh serialized data")]),t._v(". The 8-byte-discriminator is created from the first 8 bytes of the\n"),s("code",[t._v("Sha256")]),t._v(" hash of the account's type--using the example above, "),s("code",[t._v('sha256("account:MyAccount")[..8]')]),t._v(".\nThe "),s("code",[t._v("account:")]),t._v(" is a fixed prefix.")]),t._v(" "),s("p",[t._v("Importantly, this allows a program to know for certain an account is indeed of a given type.\nWithout it, a program would be vulnerable to account injection attacks, where a malicious user\nspecifies an account of an unexpected type, causing the program to do unexpected things.")]),t._v(" "),s("p",[t._v("On account creation, this 8-byte discriminator doesn't exist, since the account storage is\nzeroed. The first time an Anchor program mutates an account, this discriminator is prepended\nto the account storage array and all subsequent accesses to the account (not decorated with\n"),s("code",[t._v("#[account(init)]")]),t._v(") will check for this discriminator.")])]),t._v(" "),s("h3",{attrs:{id:"update-instruction"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#update-instruction"}},[t._v("#")]),t._v(" "),s("code",[t._v("update")]),t._v(" instruction")]),t._v(" "),s("p",[t._v("Similarly, the "),s("code",[t._v("Update")]),t._v(" accounts struct is marked with the "),s("code",[t._v("#[account(mut)]")]),t._v(" attribute.\nMarking an account as "),s("code",[t._v("mut")]),t._v(" persists any changes made upon exiting the program.")]),t._v(" "),s("p",[t._v("Here we've covered the basics of how to interact with accounts. In a later tutorial,\nwe'll delve more deeply into deriving "),s("code",[t._v("Accounts")]),t._v(", but for now, just know\nyou must mark an account "),s("code",[t._v("init")]),t._v(" when using it for the first time and "),s("code",[t._v("mut")]),t._v("\nfor persisting changes.")]),t._v(" "),s("h2",{attrs:{id:"creating-and-initializing-accounts"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#creating-and-initializing-accounts"}},[t._v("#")]),t._v(" Creating and Initializing Accounts")]),t._v(" "),s("p",[t._v("We can interact with the program as follows.")]),t._v(" "),s("div",{staticClass:"language-js extra-class"},[s("pre",{pre:!0,attrs:{class:"language-js"}},[s("code",[s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// The program to execute.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" program "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("workspace"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Basic1"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// The Account to create.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" myAccount "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("web3"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("Keypair"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("generate")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// Create the new account and initialize it with the program.")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("await")]),t._v(" program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("rpc"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("initialize")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("anchor"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("BN")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1234")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n accounts"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n myAccount"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" myAccount"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("publicKey"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n user"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" provider"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("wallet"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("publicKey"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n systemProgram"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" SystemProgram"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("programId"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n signers"),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("myAccount"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")])])])]),s("p",[t._v("The last element passed into the method is common amongst all dynamically generated\nmethods on the "),s("code",[t._v("rpc")]),t._v(" namespace, containing several options for a transaction. Here,\nwe specify the "),s("code",[t._v("accounts")]),t._v(" field, an object of all the addresses the transaction\nneeds to touch, and the "),s("code",[t._v("signers")]),t._v(" array of all "),s("code",[t._v("Signer")]),t._v(" objects needed to sign the\ntransaction. Because "),s("code",[t._v("myAccount")]),t._v(" is being created, the Solana runtime requires it\nto sign the transaction.")]),t._v(" "),s("details",{staticClass:"custom-block details"},[s("summary",[t._v("DETAILS")]),t._v(" "),s("p",[t._v("If you've developed on Solana before, you might notice two things 1) the ordering of the accounts doesn't\nmatter and 2) the "),s("code",[t._v("isWritable")]),t._v(" and "),s("code",[t._v("isSigner")]),t._v("\noptions are not specified on the account anywhere. In both cases, the framework takes care\nof these details for you, by reading the IDL.")])]),t._v(" "),s("p",[t._v("As before, we can run the example tests.")]),t._v(" "),s("div",{staticClass:"language- extra-class"},[s("pre",{pre:!0,attrs:{class:"language-text"}},[s("code",[t._v("anchor test\n")])])]),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've covered all the basics of developing applications using Anchor. However, we've\nleft out one important aspect to ensure the security of our programs--validating input\nand access control. We'll cover that next.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/19.b9ce785c.js b/assets/js/19.8bcaf6fe.js similarity index 99% rename from assets/js/19.b9ce785c.js rename to assets/js/19.8bcaf6fe.js index 435043e4..65267975 100644 --- a/assets/js/19.b9ce785c.js +++ b/assets/js/19.8bcaf6fe.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{412:function(t,a,s){"use strict";s.r(a);var n=s(29),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"account-constraints-and-access-control"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#account-constraints-and-access-control"}},[t._v("#")]),t._v(" Account Constraints and Access Control")]),t._v(" "),s("p",[t._v("This tutorial covers how to specify constraints and access control on accounts, a problem\nsomewhat unique to the parallel nature of Solana.")]),t._v(" "),s("p",[t._v("On Solana, a transaction must specify all accounts required for execution. And because an untrusted client specifies those accounts, a program must responsibly validate all such accounts are what the client claims they are--in addition to any instruction specific access control the program needs to do.")]),t._v(" "),s("p",[t._v("For example, you could imagine easily writing a faulty token program that forgets to check if the "),s("strong",[t._v("signer")]),t._v(" of a transaction claiming to be the "),s("strong",[t._v("owner")]),t._v(" of a Token "),s("code",[t._v("Account")]),t._v(" actually matches the "),s("strong",[t._v("owner")]),t._v(" on that account. Furthermore, imagine what might happen if the program expects a "),s("code",[t._v("Mint")]),t._v(" account but a malicious user gives a token "),s("code",[t._v("Account")]),t._v(".")]),t._v(" "),s("p",[t._v("To address these problems, Anchor provides several types, traits, and macros. It's easiest to understand by seeing how they're used in an example, but a couple include")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Accounts"),s("OutboundLink")],1),t._v(": derive macro implementing the "),s("code",[t._v("Accounts")]),t._v(" "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("trait"),s("OutboundLink")],1),t._v(", allowing a struct to transform\nfrom the untrusted "),s("code",[t._v("&[AccountInfo]")]),t._v(" slice given to a Solana program into a validated struct\nof deserialized account types.")]),t._v(" "),s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/attr.account.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("#[account]"),s("OutboundLink")],1),t._v(": attribute macro implementing "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.AccountSerialize.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("AccountSerialize"),s("OutboundLink")],1),t._v(" and "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.AnchorDeserialize.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("AccountDeserialize"),s("OutboundLink")],1),t._v(", automatically prepending a unique 8 byte discriminator to the account array. The discriminator is defined by the first 8 bytes of the "),s("code",[t._v("Sha256")]),t._v(" hash of the account's Rust identifier--i.e., the struct type name--and ensures no account can be substituted for another.")]),t._v(" "),s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/accounts/account/struct.Account.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Account"),s("OutboundLink")],1),t._v(": a wrapper type for a deserialized account implementing "),s("code",[t._v("AccountDeserialize")]),t._v(". Using this type within an "),s("code",[t._v("Accounts")]),t._v(" struct will ensure the account is "),s("strong",[t._v("owned")]),t._v(" by the address defined by "),s("code",[t._v("declare_id!")]),t._v(" where the inner account was defined.")])]),t._v(" "),s("p",[t._v("With the above, we can define preconditions for any instruction handler expecting a certain set of\naccounts, allowing us to more easily reason about the security of our programs.")]),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-2",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-2\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("Here we have a simple "),s("strong",[t._v("Counter")]),t._v(" program, where anyone can create a counter, but only the assigned\n"),s("strong",[t._v("authority")]),t._v(" can increment it.")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_2")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Create")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Pubkey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" counter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("authority "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("count "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("increment")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" counter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("count "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Create")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(init, payer = user, space = 8 + 40)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" system_program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Program")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("System")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut, has_one = authority)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Counter")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Pubkey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" count"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("If you've gone through the previous tutorials the "),s("code",[t._v("create")]),t._v(" instruction should be straightforward.\nLet's focus on the "),s("code",[t._v("increment")]),t._v(" instruction, specifically the "),s("code",[t._v("Increment")]),t._v(" struct deriving\n"),s("code",[t._v("Accounts")]),t._v(".")]),t._v(" "),s("div",{staticClass:"language-rust extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rust"}},[s("code",[s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut, has_one = authority)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Here, a couple "),s("code",[t._v("#[account(..)]")]),t._v(" attributes are used.")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("mut")]),t._v(": tells the program to persist all changes to the account.")]),t._v(" "),s("li",[s("code",[t._v("has_one")]),t._v(": enforces the constraint that "),s("code",[t._v("Increment.counter.authority == Increment.authority.key")]),t._v(".")])]),t._v(" "),s("p",[t._v("Another new concept here is the "),s("code",[t._v("Signer")]),t._v(" type. This enforces the constraint that the "),s("code",[t._v("authority")]),t._v("\naccount "),s("strong",[t._v("signed")]),t._v(" the transaction. However, anchor doesn't fetch the data on that account.")]),t._v(" "),s("p",[t._v("If any of these constraints do not hold, then the "),s("code",[t._v("increment")]),t._v(" instruction will never be executed.\nThis allows us to completely separate account validation from our program's business logic, allowing us\nto reason about each concern more easily. For more, see the full "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("list"),s("OutboundLink")],1),t._v(" of account constraints.")]),t._v(" "),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've covered the basics for writing a single program using Anchor on Solana. But the power of\nblockchains come not from a single program, but from combining multiple "),s("em",[t._v("composable")]),t._v(" programs\n(buzzword...check). Next, we'll see how to call one program from another.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{411:function(t,a,s){"use strict";s.r(a);var n=s(29),e=Object(n.a)({},(function(){var t=this,a=t.$createElement,s=t._self._c||a;return s("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[s("h1",{attrs:{id:"account-constraints-and-access-control"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#account-constraints-and-access-control"}},[t._v("#")]),t._v(" Account Constraints and Access Control")]),t._v(" "),s("p",[t._v("This tutorial covers how to specify constraints and access control on accounts, a problem\nsomewhat unique to the parallel nature of Solana.")]),t._v(" "),s("p",[t._v("On Solana, a transaction must specify all accounts required for execution. And because an untrusted client specifies those accounts, a program must responsibly validate all such accounts are what the client claims they are--in addition to any instruction specific access control the program needs to do.")]),t._v(" "),s("p",[t._v("For example, you could imagine easily writing a faulty token program that forgets to check if the "),s("strong",[t._v("signer")]),t._v(" of a transaction claiming to be the "),s("strong",[t._v("owner")]),t._v(" of a Token "),s("code",[t._v("Account")]),t._v(" actually matches the "),s("strong",[t._v("owner")]),t._v(" on that account. Furthermore, imagine what might happen if the program expects a "),s("code",[t._v("Mint")]),t._v(" account but a malicious user gives a token "),s("code",[t._v("Account")]),t._v(".")]),t._v(" "),s("p",[t._v("To address these problems, Anchor provides several types, traits, and macros. It's easiest to understand by seeing how they're used in an example, but a couple include")]),t._v(" "),s("ul",[s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Accounts"),s("OutboundLink")],1),t._v(": derive macro implementing the "),s("code",[t._v("Accounts")]),t._v(" "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("trait"),s("OutboundLink")],1),t._v(", allowing a struct to transform\nfrom the untrusted "),s("code",[t._v("&[AccountInfo]")]),t._v(" slice given to a Solana program into a validated struct\nof deserialized account types.")]),t._v(" "),s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/attr.account.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("#[account]"),s("OutboundLink")],1),t._v(": attribute macro implementing "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.AccountSerialize.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("AccountSerialize"),s("OutboundLink")],1),t._v(" and "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/trait.AnchorDeserialize.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("AccountDeserialize"),s("OutboundLink")],1),t._v(", automatically prepending a unique 8 byte discriminator to the account array. The discriminator is defined by the first 8 bytes of the "),s("code",[t._v("Sha256")]),t._v(" hash of the account's Rust identifier--i.e., the struct type name--and ensures no account can be substituted for another.")]),t._v(" "),s("li",[s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/accounts/account/struct.Account.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("Account"),s("OutboundLink")],1),t._v(": a wrapper type for a deserialized account implementing "),s("code",[t._v("AccountDeserialize")]),t._v(". Using this type within an "),s("code",[t._v("Accounts")]),t._v(" struct will ensure the account is "),s("strong",[t._v("owned")]),t._v(" by the address defined by "),s("code",[t._v("declare_id!")]),t._v(" where the inner account was defined.")])]),t._v(" "),s("p",[t._v("With the above, we can define preconditions for any instruction handler expecting a certain set of\naccounts, allowing us to more easily reason about the security of our programs.")]),t._v(" "),s("h2",{attrs:{id:"clone-the-repo"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#clone-the-repo"}},[t._v("#")]),t._v(" Clone the Repo")]),t._v(" "),s("p",[t._v("To get started, clone the repo.")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("git")]),t._v(" clone https://github.com/project-serum/anchor\n")])])]),s("p",[t._v("Change directories to the "),s("a",{attrs:{href:"https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-2",target:"_blank",rel:"noopener noreferrer"}},[t._v("example"),s("OutboundLink")],1),t._v(".")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token builtin class-name"}},[t._v("cd")]),t._v(" anchor/examples/tutorial/basic-2\n")])])]),s("p",[t._v("And install any additional JavaScript dependencies:")]),t._v(" "),s("div",{staticClass:"language-bash extra-class"},[s("pre",{pre:!0,attrs:{class:"language-bash"}},[s("code",[s("span",{pre:!0,attrs:{class:"token function"}},[t._v("yarn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function"}},[t._v("install")]),t._v("\n")])])]),s("h2",{attrs:{id:"defining-a-program"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#defining-a-program"}},[t._v("#")]),t._v(" Defining a Program")]),t._v(" "),s("p",[t._v("Here we have a simple "),s("strong",[t._v("Counter")]),t._v(" program, where anyone can create a counter, but only the assigned\n"),s("strong",[t._v("authority")]),t._v(" can increment it.")]),t._v(" "),s("div",{staticClass:"language-rs extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rs"}},[s("code",[s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token namespace"}},[t._v("anchor_lang"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),t._v("prelude"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")])]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token macro property"}},[t._v("declare_id!")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token string"}},[t._v('"Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"')]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[program]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mod")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token module-declaration namespace"}},[t._v("basic_2")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("use")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("super")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("::")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("*")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("create")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Create")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Pubkey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" counter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("authority "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("count "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("fn")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token function-definition function"}},[t._v("increment")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Context")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("->")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Result")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" counter "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("&")]),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("mut")]),t._v(" ctx"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("accounts"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("count "),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("+=")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Ok")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Create")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(init, payer = user, space = 8 + 40)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" user"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" system_program"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Program")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("System")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut, has_one = authority)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Counter")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Pubkey")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" count"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("u64")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("If you've gone through the previous tutorials the "),s("code",[t._v("create")]),t._v(" instruction should be straightforward.\nLet's focus on the "),s("code",[t._v("increment")]),t._v(" instruction, specifically the "),s("code",[t._v("Increment")]),t._v(" struct deriving\n"),s("code",[t._v("Accounts")]),t._v(".")]),t._v(" "),s("div",{staticClass:"language-rust extra-class"},[s("pre",{pre:!0,attrs:{class:"language-rust"}},[s("code",[s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[derive(Accounts)]")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("struct")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token type-definition class-name"}},[t._v("Increment")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token attribute attr-name"}},[t._v("#[account(mut, has_one = authority)]")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" counter"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Account")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Counter")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),s("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("pub")]),t._v(" authority"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),s("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Signer")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),s("span",{pre:!0,attrs:{class:"token lifetime-annotation symbol"}},[t._v("'info")]),s("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n"),s("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),s("p",[t._v("Here, a couple "),s("code",[t._v("#[account(..)]")]),t._v(" attributes are used.")]),t._v(" "),s("ul",[s("li",[s("code",[t._v("mut")]),t._v(": tells the program to persist all changes to the account.")]),t._v(" "),s("li",[s("code",[t._v("has_one")]),t._v(": enforces the constraint that "),s("code",[t._v("Increment.counter.authority == Increment.authority.key")]),t._v(".")])]),t._v(" "),s("p",[t._v("Another new concept here is the "),s("code",[t._v("Signer")]),t._v(" type. This enforces the constraint that the "),s("code",[t._v("authority")]),t._v("\naccount "),s("strong",[t._v("signed")]),t._v(" the transaction. However, anchor doesn't fetch the data on that account.")]),t._v(" "),s("p",[t._v("If any of these constraints do not hold, then the "),s("code",[t._v("increment")]),t._v(" instruction will never be executed.\nThis allows us to completely separate account validation from our program's business logic, allowing us\nto reason about each concern more easily. For more, see the full "),s("a",{attrs:{href:"https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html",target:"_blank",rel:"noopener noreferrer"}},[t._v("list"),s("OutboundLink")],1),t._v(" of account constraints.")]),t._v(" "),s("h2",{attrs:{id:"next-steps"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#next-steps"}},[t._v("#")]),t._v(" Next Steps")]),t._v(" "),s("p",[t._v("We've covered the basics for writing a single program using Anchor on Solana. But the power of\nblockchains come not from a single program, but from combining multiple "),s("em",[t._v("composable")]),t._v(" programs\n(buzzword...check). Next, we'll see how to call one program from another.")])])}),[],!1,null,null,null);a.default=e.exports}}]); \ No newline at end of file diff --git a/assets/js/4.db2affb7.js b/assets/js/4.f90252b7.js similarity index 64% rename from assets/js/4.db2affb7.js rename to assets/js/4.f90252b7.js index af1e619a..0725e763 100644 --- a/assets/js/4.db2affb7.js +++ b/assets/js/4.f90252b7.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{366:function(t,e,a){},396:function(t,e,a){"use strict";a(366)},402:function(t,e,a){"use strict";a.r(e);var n={name:"CodeBlock",props:{title:{type:String,required:!0},active:{type:Boolean,default:!1}},mounted:function(){this.$parent&&this.$parent.loadTabs&&this.$parent.loadTabs()}},i=(a(396),a(29)),s=Object(i.a)(n,(function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"theme-code-block",class:{"theme-code-block__active":this.active}},[this._t("default")],2)}),[],!1,null,"759a7d02",null);e.default=s.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{365:function(t,e,a){},395:function(t,e,a){"use strict";a(365)},401:function(t,e,a){"use strict";a.r(e);var n={name:"CodeBlock",props:{title:{type:String,required:!0},active:{type:Boolean,default:!1}},mounted:function(){this.$parent&&this.$parent.loadTabs&&this.$parent.loadTabs()}},i=(a(395),a(29)),s=Object(i.a)(n,(function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"theme-code-block",class:{"theme-code-block__active":this.active}},[this._t("default")],2)}),[],!1,null,"759a7d02",null);e.default=s.exports}}]); \ No newline at end of file diff --git a/assets/js/5.4ce1ab37.js b/assets/js/5.47891694.js similarity index 87% rename from assets/js/5.4ce1ab37.js rename to assets/js/5.47891694.js index b527d7e1..943fb650 100644 --- a/assets/js/5.4ce1ab37.js +++ b/assets/js/5.47891694.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{365:function(e,t,a){},395:function(e,t,a){"use strict";a(365)},401:function(e,t,a){"use strict";a.r(t);a(81),a(36),a(6),a(85),a(86);var o={name:"CodeGroup",data:function(){return{codeTabs:[],activeCodeTabIndex:-1}},watch:{activeCodeTabIndex:function(e){this.activateCodeTab(e)}},mounted:function(){this.loadTabs()},methods:{changeCodeTab:function(e){this.activeCodeTabIndex=e},loadTabs:function(){var e=this;this.codeTabs=(this.$slots.default||[]).filter((function(e){return Boolean(e.componentOptions)})).map((function(t,a){return""===t.componentOptions.propsData.active&&(e.activeCodeTabIndex=a),{title:t.componentOptions.propsData.title,elm:t.elm}})),-1===this.activeCodeTabIndex&&this.codeTabs.length>0&&(this.activeCodeTabIndex=0),this.activateCodeTab(0)},activateCodeTab:function(e){this.codeTabs.forEach((function(e){e.elm&&e.elm.classList.remove("theme-code-block__active")})),this.codeTabs[e].elm&&this.codeTabs[e].elm.classList.add("theme-code-block__active")}}},n=(a(395),a(29)),c=Object(n.a)(o,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("ClientOnly",[a("div",{staticClass:"theme-code-group"},[a("div",{staticClass:"theme-code-group__nav"},[a("ul",{staticClass:"theme-code-group__ul"},e._l(e.codeTabs,(function(t,o){return a("li",{key:t.title,staticClass:"theme-code-group__li"},[a("button",{staticClass:"theme-code-group__nav-tab",class:{"theme-code-group__nav-tab-active":o===e.activeCodeTabIndex},on:{click:function(t){return e.changeCodeTab(o)}}},[e._v("\n "+e._s(t.title)+"\n ")])])})),0)]),e._v(" "),e._t("default"),e._v(" "),e.codeTabs.length<1?a("pre",{staticClass:"pre-blank"},[e._v("// Make sure to add code blocks to your code group")]):e._e()],2)])}),[],!1,null,"deefee04",null);t.default=c.exports}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{366:function(e,t,a){},396:function(e,t,a){"use strict";a(366)},402:function(e,t,a){"use strict";a.r(t);a(81),a(36),a(6),a(85),a(86);var o={name:"CodeGroup",data:function(){return{codeTabs:[],activeCodeTabIndex:-1}},watch:{activeCodeTabIndex:function(e){this.activateCodeTab(e)}},mounted:function(){this.loadTabs()},methods:{changeCodeTab:function(e){this.activeCodeTabIndex=e},loadTabs:function(){var e=this;this.codeTabs=(this.$slots.default||[]).filter((function(e){return Boolean(e.componentOptions)})).map((function(t,a){return""===t.componentOptions.propsData.active&&(e.activeCodeTabIndex=a),{title:t.componentOptions.propsData.title,elm:t.elm}})),-1===this.activeCodeTabIndex&&this.codeTabs.length>0&&(this.activeCodeTabIndex=0),this.activateCodeTab(0)},activateCodeTab:function(e){this.codeTabs.forEach((function(e){e.elm&&e.elm.classList.remove("theme-code-block__active")})),this.codeTabs[e].elm&&this.codeTabs[e].elm.classList.add("theme-code-block__active")}}},n=(a(396),a(29)),c=Object(n.a)(o,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("ClientOnly",[a("div",{staticClass:"theme-code-group"},[a("div",{staticClass:"theme-code-group__nav"},[a("ul",{staticClass:"theme-code-group__ul"},e._l(e.codeTabs,(function(t,o){return a("li",{key:t.title,staticClass:"theme-code-group__li"},[a("button",{staticClass:"theme-code-group__nav-tab",class:{"theme-code-group__nav-tab-active":o===e.activeCodeTabIndex},on:{click:function(t){return e.changeCodeTab(o)}}},[e._v("\n "+e._s(t.title)+"\n ")])])})),0)]),e._v(" "),e._t("default"),e._v(" "),e.codeTabs.length<1?a("pre",{staticClass:"pre-blank"},[e._v("// Make sure to add code blocks to your code group")]):e._e()],2)])}),[],!1,null,"deefee04",null);t.default=c.exports}}]); \ No newline at end of file diff --git a/assets/js/app.61552437.js b/assets/js/app.dfe95c3c.js similarity index 78% rename from assets/js/app.61552437.js rename to assets/js/app.dfe95c3c.js index ba219990..435ee918 100644 --- a/assets/js/app.61552437.js +++ b/assets/js/app.dfe95c3c.js @@ -1,8 +1,8 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[]]);!function(t){function e(e){for(var r,a,u=e[0],s=e[1],c=e[2],l=0,p=[];l=n.length?{value:void 0,done:!0}:(t=r(n,o),e.index+=t.length,{value:t,done:!1})}))},function(t,e,n){var r=n(0),o=n(5),i=n(10),a=n(25),u=n(90),s=n(67),c=n(32),f=n(84).CONFIGURABLE,l=c.get,p=c.enforce,h=String(String).split("String");(t.exports=function(t,e,n,s){var c,l=!!s&&!!s.unsafe,d=!!s&&!!s.enumerable,v=!!s&&!!s.noTargetGet,y=s&&void 0!==s.name?s.name:e;o(n)&&("Symbol("===String(y).slice(0,7)&&(y="["+String(y).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!i(n,"name")||f&&n.name!==y)&&a(n,"name",y),(c=p(n)).source||(c.source=h.join("string"==typeof y?y:""))),t!==r?(l?!v&&t[e]&&(d=!0):delete t[e],d?t[e]=n:a(t,e,n)):d?t[e]=n:u(e,n)})(Function.prototype,"toString",(function(){return o(this)&&l(this).source||s(this)}))},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var r=n(0),o=n(142),i=n(143),a=n(120),u=n(25),s=n(4),c=s("iterator"),f=s("toStringTag"),l=a.values,p=function(t,e){if(t){if(t[c]!==l)try{u(t,c,l)}catch(e){t[c]=l}if(t[f]||u(t,f,e),o[e])for(var n in a)if(t[n]!==a[n])try{u(t,n,a[n])}catch(e){t[n]=a[n]}}};for(var h in o)p(r[h]&&r[h].prototype,h);p(i,"DOMTokenList")},function(t,e,n){var r=n(155),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e,n){var r=n(0),o=n(68),i=r.String;t.exports=function(t){if("Symbol"===o(t))throw TypeError("Cannot convert a Symbol value to a string");return i(t)}},function(t,e,n){var r=n(2),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},function(t,e,n){var r=n(83);t.exports=function(t){return r(t.length)}},function(t,e){t.exports=!1},function(t,e,n){var r=n(11),o=n(12),i=n(45);t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r,o=n(8),i=n(203),a=n(95),u=n(43),s=n(124),c=n(61),f=n(66),l=f("IE_PROTO"),p=function(){},h=function(t){return" + diff --git a/getting-started/installation.html b/getting-started/installation.html index bca6b6fb..fd94c29b 100644 --- a/getting-started/installation.html +++ b/getting-started/installation.html @@ -10,8 +10,8 @@ - - + +
- + diff --git a/getting-started/introduction.html b/getting-started/introduction.html index 95516d59..16f80005 100644 --- a/getting-started/introduction.html +++ b/getting-started/introduction.html @@ -10,8 +10,8 @@ - - + +
- + diff --git a/getting-started/projects.html b/getting-started/projects.html index 28d3149b..611436cb 100644 --- a/getting-started/projects.html +++ b/getting-started/projects.html @@ -10,8 +10,8 @@ - - + +
- + diff --git a/getting-started/publishing.html b/getting-started/publishing.html index 5ac070c2..8f90e226 100644 --- a/getting-started/publishing.html +++ b/getting-started/publishing.html @@ -10,8 +10,8 @@ - - + +

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/ts/classes/AnchorProvider.html b/ts/classes/AnchorProvider.html index dc6a270d..26a2d358 100644 --- a/ts/classes/AnchorProvider.html +++ b/ts/classes/AnchorProvider.html @@ -1,15 +1,15 @@ -AnchorProvider | @project-serum/anchor - v0.24.0
Options
All
  • Public
  • Public/Protected
  • All
Menu
+AnchorProvider | @project-serum/anchor - v0.24.1
Options
All
  • Public
  • Public/Protected
  • All
Menu

The network and wallet context used to send transactions paid for and signed by the provider.

-

Hierarchy

  • AnchorProvider

Implements

Index

Constructors

constructor

Hierarchy

  • AnchorProvider

Implements

Index

Constructors

  • Parameters

    • connection: Connection

      The cluster connection where the program is deployed.

    • wallet: Wallet

      The wallet used to pay for and sign all transactions.

    • opts: ConfirmOptions

      Transaction confirmation options to use by default.

      -

    Returns AnchorProvider

Properties

Readonly connection

connection: Connection

Readonly opts

Readonly wallet

wallet: Wallet

Methods

sendAll

Returns AnchorProvider

Properties

connection: Connection
wallet: Wallet

Methods

sendAndConfirm

  • Sends the given transaction, paid for and signed by the provider's wallet.

    Parameters

    • tx: Transaction

      The transaction to send.

      @@ -17,17 +17,17 @@ by the provider.

      The signers of the transaction.

    • Optional opts: ConfirmOptions

      Transaction confirmation options.

      -

    Returns Promise<string>

simulate

Returns Promise<string>

Static defaultOptions

Static env

Returns Promise<SuccessfulTxSimulationResponse>

Static local

  • Returns a Provider with a wallet read from the local filesystem.

    Parameters

    • Optional url: string

      The network cluster url.

      diff --git a/ts/classes/BN.html b/ts/classes/BN.html index 31411624..85c6bdf9 100644 --- a/ts/classes/BN.html +++ b/ts/classes/BN.html @@ -1,94 +1,94 @@ -BN | @project-serum/anchor - v0.24.0
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Hierarchy

      • BN

      Index

      Constructors

      constructor

      • new BN(number: string | number | BN | number[] | Uint8Array | Buffer, base?: number | "hex", endian?: Endianness): BN
      • new BN(number: string | number | BN | number[] | Uint8Array | Buffer, endian?: Endianness): BN
      • Parameters

        • number: string | number | BN | number[] | Uint8Array | Buffer
        • Optional base: number | "hex"
        • Optional endian: Endianness

        Returns BN

      • Parameters

        • number: string | number | BN | number[] | Uint8Array | Buffer
        • Optional endian: Endianness

        Returns BN

      Methods

      abs

      • description

        absolute value

        -

        Returns BN

      add

      • description

        addition

        -

        Parameters

        Returns BN

      addn

      • addn(b: number): BN
      • description

        addition

        -

        Parameters

        • b: number

        Returns BN

      and

      • description

        and

        -

        Parameters

        Returns BN

      andln

      • andln(b: number): BN
      • description

        and (NOTE: andln is going to be replaced with andn in future)

        -

        Parameters

        • b: number

        Returns BN

      bincn

      • bincn(b: number): BN
      • description

        add 1 << b to the number

        -

        Parameters

        • b: number

        Returns BN

      bitLength

      • bitLength(): number
      • description

        get number of bits occupied

        -

        Returns number

      byteLength

      • byteLength(): number
      • description

        return number of bytes occupied

        -

        Returns number

      clone

      • clone(): BN
      • description

        clone number

        -

        Returns BN

      cmp

      • cmp(b: BN): 0 | 1 | -1
      • description

        compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

        -

        Parameters

        Returns 0 | 1 | -1

      cmpn

      • cmpn(b: number): 0 | 1 | -1
      • description

        compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

        -

        Parameters

        • b: number

        Returns 0 | 1 | -1

      div

      • description

        divide

        -

        Parameters

        Returns BN

      divRound

      • description

        rounded division

        -

        Parameters

        Returns BN

      divn

      • divn(b: number): BN
      • description

        divide

        -

        Parameters

        • b: number

        Returns BN

      egcd

      • description

        Extended GCD results ({ a: ..., b: ..., gcd: ... })

        -

        Parameters

        Returns { a: BN; b: BN; gcd: BN }

      eq

      • eq(b: BN): boolean
      • description

        a equals b

        -

        Parameters

        Returns boolean

      eqn

      • eqn(b: number): boolean
      • description

        a equals b

        -

        Parameters

        • b: number

        Returns boolean

      fromTwos

      • fromTwos(width: number): BN
      • description

        convert from two's complement representation, where width is the bit width

        -

        Parameters

        • width: number

        Returns BN

      gcd

      • description

        GCD

        -

        Parameters

        Returns BN

      gt

      • gt(b: BN): boolean
      • description

        a greater than b

        -

        Parameters

        Returns boolean

      gte

      • gte(b: BN): boolean
      • description

        a greater than or equals b

        -

        Parameters

        Returns boolean

      gten

      • gten(b: number): boolean
      • description

        a greater than or equals b

        -

        Parameters

        • b: number

        Returns boolean

      gtn

      • gtn(b: number): boolean
      • description

        a greater than b

        -

        Parameters

        • b: number

        Returns boolean

      iabs

      • iabs(): BN
      • description

        absolute value

        -

        Returns BN

      iadd

      • description

        addition

        -

        Parameters

        Returns BN

      iaddn

      • iaddn(b: number): BN
      • description

        addition

        -

        Parameters

        • b: number

        Returns BN

      iand

      • description

        and

        -

        Parameters

        Returns BN

      idivn

      • idivn(b: number): BN
      • description

        divide

        -

        Parameters

        • b: number

        Returns BN

      imaskn

      • imaskn(b: number): BN
      • description

        clear bits with indexes higher or equal to b

        -

        Parameters

        • b: number

        Returns BN

      imul

      • description

        multiply

        -

        Parameters

        Returns BN

      imuln

      • imuln(b: number): BN
      • description

        multiply

        -

        Parameters

        • b: number

        Returns BN

      ineg

      • ineg(): BN
      • description

        negate sign

        -

        Returns BN

      inotn

      • inotn(w: number): BN
      • description

        not (for the width specified by w)

        -

        Parameters

        • w: number

        Returns BN

      invm

      • description

        inverse a modulo b

        -

        Parameters

        Returns BN

      ior

      • description

        or

        -

        Parameters

        Returns BN

      isEven

      • isEven(): boolean
      • description

        check if value is even

        -

        Returns boolean

      isNeg

      • isNeg(): boolean
      • description

        true if the number is negative

        -

        Returns boolean

      isOdd

      • isOdd(): boolean
      • description

        check if value is odd

        -

        Returns boolean

      isZero

      • isZero(): boolean
      • description

        check if value is zero

        -

        Returns boolean

      ishln

      • ishln(b: number): BN
      • description

        shift left

        -

        Parameters

        • b: number

        Returns BN

      ishrn

      • ishrn(b: number): BN

      isqr

      • isqr(): BN
      • description

        square

        -

        Returns BN

      isub

      • description

        subtraction

        -

        Parameters

        Returns BN

      isubn

      • isubn(b: number): BN
      • description

        subtraction

        -

        Parameters

        • b: number

        Returns BN

      iuand

      • description

        and

        -

        Parameters

        Returns BN

      iuor

      • description

        or

        -

        Parameters

        Returns BN

      iushln

      • iushln(b: number): BN
      • description

        shift left

        -

        Parameters

        • b: number

        Returns BN

      iushrn

      • iushrn(b: number): BN
      • description

        shift right

        -

        Parameters

        • b: number

        Returns BN

      iuxor

      • description

        xor

        -

        Parameters

        Returns BN

      ixor

      • description

        xor

        -

        Parameters

        Returns BN

      lt

      • lt(b: BN): boolean
      • description

        a less than b

        -

        Parameters

        Returns boolean

      lte

      • lte(b: BN): boolean
      • description

        a less than or equals b

        -

        Parameters

        Returns boolean

      lten

      • lten(b: number): boolean
      • description

        a less than or equals b

        -

        Parameters

        • b: number

        Returns boolean

      ltn

      • ltn(b: number): boolean
      • description

        a less than b

        -

        Parameters

        • b: number

        Returns boolean

      maskn

      • maskn(b: number): BN
      • description

        clear bits with indexes higher or equal to b

        -

        Parameters

        • b: number

        Returns BN

      mod

      • description

        reduct

        -

        Parameters

        Returns BN

      modn

      • modn(b: number): number
      • see

        API consistency https://github.com/indutny/bn.js/pull/130

        +BN | @project-serum/anchor - v0.24.1
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu

        Hierarchy

        • BN

        Index

        Constructors

        • new BN(number: string | number | BN | number[] | Uint8Array | Buffer, base?: number | "hex", endian?: Endianness): BN
        • new BN(number: string | number | BN | number[] | Uint8Array | Buffer, endian?: Endianness): BN
        • Parameters

          • number: string | number | BN | number[] | Uint8Array | Buffer
          • Optional base: number | "hex"
          • Optional endian: Endianness

          Returns BN

        • Parameters

          • number: string | number | BN | number[] | Uint8Array | Buffer
          • Optional endian: Endianness

          Returns BN

        Methods

        • description

          absolute value

          +

          Returns BN

        • description

          addition

          +

          Parameters

          Returns BN

        • addn(b: number): BN
        • description

          addition

          +

          Parameters

          • b: number

          Returns BN

        • description

          and

          +

          Parameters

          Returns BN

        • andln(b: number): BN
        • description

          and (NOTE: andln is going to be replaced with andn in future)

          +

          Parameters

          • b: number

          Returns BN

        • bincn(b: number): BN
        • description

          add 1 << b to the number

          +

          Parameters

          • b: number

          Returns BN

        • bitLength(): number
        • description

          get number of bits occupied

          +

          Returns number

        • byteLength(): number
        • description

          return number of bytes occupied

          +

          Returns number

        • clone(): BN
        • description

          clone number

          +

          Returns BN

        • cmp(b: BN): 0 | 1 | -1
        • description

          compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

          +

          Parameters

          Returns 0 | 1 | -1

        • cmpn(b: number): 0 | 1 | -1
        • description

          compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

          +

          Parameters

          • b: number

          Returns 0 | 1 | -1

        • description

          divide

          +

          Parameters

          Returns BN

        • description

          rounded division

          +

          Parameters

          Returns BN

        • divn(b: number): BN
        • description

          divide

          +

          Parameters

          • b: number

          Returns BN

        • description

          Extended GCD results ({ a: ..., b: ..., gcd: ... })

          +

          Parameters

          Returns { a: BN; b: BN; gcd: BN }

        • eq(b: BN): boolean
        • description

          a equals b

          +

          Parameters

          Returns boolean

        • eqn(b: number): boolean
        • description

          a equals b

          +

          Parameters

          • b: number

          Returns boolean

        • fromTwos(width: number): BN
        • description

          convert from two's complement representation, where width is the bit width

          +

          Parameters

          • width: number

          Returns BN

        • description

          GCD

          +

          Parameters

          Returns BN

        • gt(b: BN): boolean
        • description

          a greater than b

          +

          Parameters

          Returns boolean

        • gte(b: BN): boolean
        • description

          a greater than or equals b

          +

          Parameters

          Returns boolean

        • gten(b: number): boolean
        • description

          a greater than or equals b

          +

          Parameters

          • b: number

          Returns boolean

        • gtn(b: number): boolean
        • description

          a greater than b

          +

          Parameters

          • b: number

          Returns boolean

        • iabs(): BN
        • description

          absolute value

          +

          Returns BN

        • description

          addition

          +

          Parameters

          Returns BN

        • iaddn(b: number): BN
        • description

          addition

          +

          Parameters

          • b: number

          Returns BN

        • description

          and

          +

          Parameters

          Returns BN

        • idivn(b: number): BN
        • description

          divide

          +

          Parameters

          • b: number

          Returns BN

        • imaskn(b: number): BN
        • description

          clear bits with indexes higher or equal to b

          +

          Parameters

          • b: number

          Returns BN

        • description

          multiply

          +

          Parameters

          Returns BN

        • imuln(b: number): BN
        • description

          multiply

          +

          Parameters

          • b: number

          Returns BN

        • ineg(): BN
        • description

          negate sign

          +

          Returns BN

        • inotn(w: number): BN
        • description

          not (for the width specified by w)

          +

          Parameters

          • w: number

          Returns BN

        • description

          inverse a modulo b

          +

          Parameters

          Returns BN

        • description

          or

          +

          Parameters

          Returns BN

        • isEven(): boolean
        • description

          check if value is even

          +

          Returns boolean

        • isNeg(): boolean
        • description

          true if the number is negative

          +

          Returns boolean

        • isOdd(): boolean
        • description

          check if value is odd

          +

          Returns boolean

        • isZero(): boolean
        • description

          check if value is zero

          +

          Returns boolean

        • ishln(b: number): BN
        • description

          shift left

          +

          Parameters

          • b: number

          Returns BN

        • ishrn(b: number): BN
        • isqr(): BN
        • description

          square

          +

          Returns BN

        • description

          subtraction

          +

          Parameters

          Returns BN

        • isubn(b: number): BN
        • description

          subtraction

          +

          Parameters

          • b: number

          Returns BN

        • description

          and

          +

          Parameters

          Returns BN

        • description

          or

          +

          Parameters

          Returns BN

        • iushln(b: number): BN
        • description

          shift left

          +

          Parameters

          • b: number

          Returns BN

        • iushrn(b: number): BN
        • description

          shift right

          +

          Parameters

          • b: number

          Returns BN

        • description

          xor

          +

          Parameters

          Returns BN

        • description

          xor

          +

          Parameters

          Returns BN

        • lt(b: BN): boolean
        • description

          a less than b

          +

          Parameters

          Returns boolean

        • lte(b: BN): boolean
        • description

          a less than or equals b

          +

          Parameters

          Returns boolean

        • lten(b: number): boolean
        • description

          a less than or equals b

          +

          Parameters

          • b: number

          Returns boolean

        • ltn(b: number): boolean
        • description

          a less than b

          +

          Parameters

          • b: number

          Returns boolean

        • maskn(b: number): BN
        • description

          clear bits with indexes higher or equal to b

          +

          Parameters

          • b: number

          Returns BN

        • description

          reduct

          +

          Parameters

          Returns BN

        • modn(b: number): number

        mul

        • description

          multiply

          -

          Parameters

          Returns BN

        muln

        • muln(b: number): BN
        • description

          multiply

          -

          Parameters

          • b: number

          Returns BN

        neg

        • description

          negate sign

          -

          Returns BN

        notn

        • notn(w: number): BN
        • description

          not (for the width specified by w)

          -

          Parameters

          • w: number

          Returns BN

        or

        • description

          or

          -

          Parameters

          Returns BN

        pow

        • description

          raise a to the power of b

          -

          Parameters

          Returns BN

        setn

        • setn(b: number): BN
        • description

          set specified bit to 1

          -

          Parameters

          • b: number

          Returns BN

        shln

        • shln(b: number): BN
        • description

          shift left

          -

          Parameters

          • b: number

          Returns BN

        shrn

        • shrn(b: number): BN
        • description

          shift right

          -

          Parameters

          • b: number

          Returns BN

        sqr

        • description

          square

          -

          Returns BN

        sub

        • description

          subtraction

          -

          Parameters

          Returns BN

        subn

        • subn(b: number): BN
        • description

          subtraction

          -

          Parameters

          • b: number

          Returns BN

        testn

        • testn(b: number): boolean
        • description

          test if specified bit is set

          -

          Parameters

          • b: number

          Returns boolean

        toArray

        • toArray(endian?: Endianness, length?: number): number[]
        • description

          convert to byte Array, and optionally zero pad to length, throwing if already exceeding

          -

          Parameters

          • Optional endian: Endianness
          • Optional length: number

          Returns number[]

        toArrayLike

        • toArrayLike(ArrayType: typeof Buffer, endian?: Endianness, length?: number): Buffer
        • toArrayLike(ArrayType: any[], endian?: Endianness, length?: number): any[]
        • description

          convert to an instance of type, which must behave like an Array

          -

          Parameters

          • ArrayType: typeof Buffer
          • Optional endian: Endianness
          • Optional length: number

          Returns Buffer

        • Parameters

          • ArrayType: any[]
          • Optional endian: Endianness
          • Optional length: number

          Returns any[]

        toBuffer

        • toBuffer(endian?: Endianness, length?: number): Buffer
        • description

          convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)

          -

          Parameters

          • Optional endian: Endianness
          • Optional length: number

          Returns Buffer

        toJSON

        • toJSON(): string
        • description

          convert to JSON compatible hex string (alias of toString(16))

          -

          Returns string

        toNumber

        • toNumber(): number
        • description

          convert to Javascript Number (limited to 53 bits)

          -

          Returns number

        toRed

        • description

          Convert number to red

          -

          Parameters

          Returns RedBN

        toString

        • toString(base?: number | "hex", length?: number): string
        • description

          convert to base-string and pad with zeroes

          -

          Parameters

          • Optional base: number | "hex"
          • Optional length: number

          Returns string

        toTwos

        • toTwos(width: number): BN
        • description

          convert to two's complement representation, where width is bit width

          -

          Parameters

          • width: number

          Returns BN

        uand

        • description

          and

          -

          Parameters

          Returns BN

        ucmp

        • ucmp(b: BN): 0 | 1 | -1
        • description

          compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

          -

          Parameters

          Returns 0 | 1 | -1

        umod

        • description

          reduct

          -

          Parameters

          Returns BN

        uor

        • description

          or

          -

          Parameters

          Returns BN

        ushln

        • ushln(b: number): BN
        • description

          shift left

          -

          Parameters

          • b: number

          Returns BN

        ushrn

        • ushrn(b: number): BN
        • description

          shift right

          -

          Parameters

          • b: number

          Returns BN

        uxor

        • description

          xor

          -

          Parameters

          Returns BN

        xor

        • description

          xor

          -

          Parameters

          Returns BN

        zeroBits

        • zeroBits(): number
        • description

          return number of less-significant consequent zero bits (example: 1010000 has 4 zero bits)

          -

          Returns number

        Static isBN

        • isBN(b: any): b is BN
        • description

          returns true if the supplied object is a BN.js instance

          -

          Parameters

          • b: any

          Returns b is BN

        Static max

        • description

          returns the maximum of 2 BN instances.

          -

          Parameters

          Returns BN

        Static min

        • description

          returns the minimum of 2 BN instances.

          -

          Parameters

          Returns BN

        Static mont

        • description

          create a reduction context with the Montgomery trick.

          -

          Parameters

          Returns ReductionContext

        Static red

        • description

          create a reduction context

          +

          Parameters

          • b: number

          Returns number

        • description

          multiply

          +

          Parameters

          Returns BN

        • muln(b: number): BN
        • description

          multiply

          +

          Parameters

          • b: number

          Returns BN

        • description

          negate sign

          +

          Returns BN

        • notn(w: number): BN
        • description

          not (for the width specified by w)

          +

          Parameters

          • w: number

          Returns BN

        • description

          or

          +

          Parameters

          Returns BN

        • description

          raise a to the power of b

          +

          Parameters

          Returns BN

        • setn(b: number): BN
        • description

          set specified bit to 1

          +

          Parameters

          • b: number

          Returns BN

        • shln(b: number): BN
        • description

          shift left

          +

          Parameters

          • b: number

          Returns BN

        • shrn(b: number): BN
        • description

          shift right

          +

          Parameters

          • b: number

          Returns BN

        • description

          square

          +

          Returns BN

        • description

          subtraction

          +

          Parameters

          Returns BN

        • subn(b: number): BN
        • description

          subtraction

          +

          Parameters

          • b: number

          Returns BN

        • testn(b: number): boolean
        • description

          test if specified bit is set

          +

          Parameters

          • b: number

          Returns boolean

        • toArray(endian?: Endianness, length?: number): number[]
        • description

          convert to byte Array, and optionally zero pad to length, throwing if already exceeding

          +

          Parameters

          • Optional endian: Endianness
          • Optional length: number

          Returns number[]

        • toArrayLike(ArrayType: BufferConstructor, endian?: Endianness, length?: number): Buffer
        • toArrayLike(ArrayType: any[], endian?: Endianness, length?: number): any[]
        • description

          convert to an instance of type, which must behave like an Array

          +

          Parameters

          • ArrayType: BufferConstructor
          • Optional endian: Endianness
          • Optional length: number

          Returns Buffer

        • Parameters

          • ArrayType: any[]
          • Optional endian: Endianness
          • Optional length: number

          Returns any[]

        • toBuffer(endian?: Endianness, length?: number): Buffer
        • description

          convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)

          +

          Parameters

          • Optional endian: Endianness
          • Optional length: number

          Returns Buffer

        • toJSON(): string
        • description

          convert to JSON compatible hex string (alias of toString(16))

          +

          Returns string

        • toNumber(): number
        • description

          convert to Javascript Number (limited to 53 bits)

          +

          Returns number

        • description

          Convert number to red

          +

          Parameters

          Returns RedBN

        • toString(base?: number | "hex", length?: number): string
        • description

          convert to base-string and pad with zeroes

          +

          Parameters

          • Optional base: number | "hex"
          • Optional length: number

          Returns string

        • toTwos(width: number): BN
        • description

          convert to two's complement representation, where width is bit width

          +

          Parameters

          • width: number

          Returns BN

        • description

          and

          +

          Parameters

          Returns BN

        • ucmp(b: BN): 0 | 1 | -1
        • description

          compare numbers and return -1 (a < b), 0 (a == b), or 1 (a > b) depending on the comparison result

          +

          Parameters

          Returns 0 | 1 | -1

        • description

          reduct

          +

          Parameters

          Returns BN

        • description

          or

          +

          Parameters

          Returns BN

        • ushln(b: number): BN
        • description

          shift left

          +

          Parameters

          • b: number

          Returns BN

        • ushrn(b: number): BN
        • description

          shift right

          +

          Parameters

          • b: number

          Returns BN

        • description

          xor

          +

          Parameters

          Returns BN

        • description

          xor

          +

          Parameters

          Returns BN

        • zeroBits(): number
        • description

          return number of less-significant consequent zero bits (example: 1010000 has 4 zero bits)

          +

          Returns number

        • isBN(b: any): b is BN
        • description

          returns true if the supplied object is a BN.js instance

          +

          Parameters

          • b: any

          Returns b is BN

        • description

          returns the maximum of 2 BN instances.

          +

          Parameters

          Returns BN

        • description

          returns the minimum of 2 BN instances.

          +

          Parameters

          Returns BN

        • description

          create a reduction context with the Montgomery trick.

          +

          Parameters

          Returns ReductionContext

        • description

          create a reduction context

          Parameters

          Returns ReductionContext

        Legend

        • Constructor
        • Property
        • Method
        • Inherited constructor
        • Inherited property
        • Inherited method
        • Property
        • Method
        • Static method

        Settings

        Theme

        Generated using TypeDoc

        \ No newline at end of file diff --git a/ts/classes/BorshAccountsCoder.html b/ts/classes/BorshAccountsCoder.html index ef458773..f1109db7 100644 --- a/ts/classes/BorshAccountsCoder.html +++ b/ts/classes/BorshAccountsCoder.html @@ -1,6 +1,6 @@ -BorshAccountsCoder | @project-serum/anchor - v0.24.0
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu
        +BorshAccountsCoder | @project-serum/anchor - v0.24.1
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu

        Encodes and decodes account objects.

        -

        Type parameters

        • A: string = string

        Hierarchy

        • BorshAccountsCoder

        Implements

        Index

        Constructors

        constructor

        Methods

        decode

        • decode<T>(accountName: A, data: Buffer): T

        decodeUnchecked

        • decodeUnchecked<T>(accountName: A, ix: Buffer): T

        encode

        • encode<T>(accountName: A, account: T): Promise<Buffer>

        memcmp

        • memcmp(accountName: A, appendData?: Buffer): any

        size

        • size(idlAccount: IdlTypeDef): number

        Static accountDiscriminator

        • accountDiscriminator(name: string): Buffer

        Type parameters

        • A: string = string

        Hierarchy

        • BorshAccountsCoder

        Implements

        Index

        Constructors

        Methods

        • decode<T>(accountName: A, data: Buffer): T
        • decodeUnchecked<T>(accountName: A, ix: Buffer): T
        • encode<T>(accountName: A, account: T): Promise<Buffer>
        • memcmp(accountName: A, appendData?: Buffer): any
        • size(idlAccount: IdlTypeDef): number
        • accountDiscriminator(name: string): Buffer

        Parameters

        • err: Error
        • stackTraces: CallSite[]

        Returns any

stackTraceLimit: number

Methods

  • captureStackTrace(targetObject: object, constructorOpt?: Function): void
  • +

    Create .stack property on a target object

    +

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/ts/classes/MethodsBuilderFactory.html b/ts/classes/MethodsBuilderFactory.html index d7c24f5a..49d7cd94 100644 --- a/ts/classes/MethodsBuilderFactory.html +++ b/ts/classes/MethodsBuilderFactory.html @@ -1 +1 @@ -MethodsBuilderFactory | @project-serum/anchor - v0.24.0
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • MethodsBuilderFactory

Index

Constructors

Methods

Constructors

constructor

Methods

Static build

  • build<IDL, I>(provider: Provider, programId: PublicKey, idlIx: AllInstructions<IDL>, ixFn: InstructionFn<IDL, AllInstructions<IDL>>, txFn: TransactionFn<IDL, AllInstructions<IDL>>, rpcFn: RpcFn<IDL, AllInstructions<IDL>>, simulateFn: SimulateFn<IDL, AllInstructions<IDL>>, viewFn: undefined | ViewFn<IDL, AllInstructions<IDL>>, accountNamespace: AccountNamespace<IDL>): MethodsFn<IDL, I, MethodsBuilder<IDL, I>>

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +MethodsBuilderFactory | @project-serum/anchor - v0.24.1
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • MethodsBuilderFactory

Index

Constructors

Methods

Constructors

Methods

  • build<IDL, I>(provider: Provider, programId: PublicKey, idlIx: AllInstructions<IDL>, ixFn: InstructionFn<IDL, AllInstructions<IDL>>, txFn: TransactionFn<IDL, AllInstructions<IDL>>, rpcFn: RpcFn<IDL, AllInstructions<IDL>>, simulateFn: SimulateFn<IDL, AllInstructions<IDL>>, viewFn: undefined | ViewFn<IDL, AllInstructions<IDL>>, accountNamespace: AccountNamespace<IDL>): MethodsFn<IDL, I, MethodsBuilder<IDL, I>>

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme

Generated using TypeDoc

\ No newline at end of file diff --git a/ts/classes/Program.html b/ts/classes/Program.html index 86123118..603bdd85 100644 --- a/ts/classes/Program.html +++ b/ts/classes/Program.html @@ -1,4 +1,4 @@ -Program | @project-serum/anchor - v0.24.0
Options
All
  • Public
  • Public/Protected
  • All
Menu
+Program | @project-serum/anchor - v0.24.1
Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

  • Program

Index

Constructors

constructor

Type parameters

Hierarchy

  • Program

Index

Constructors

Properties

Readonly account

account: AccountNamespace<IDL>
+
  • Optional coder: Coder
  • Returns Program<IDL>

    Properties

    account: AccountNamespace<IDL>

    The namespace provides handles to an AccountClient object for each account in the program.

    @@ -46,7 +46,7 @@ account in the program.

    const counter = await program.account.counter.fetch(address);
     

    For the full API, see the AccountClient reference.

    -

    Readonly instruction

    instruction: InstructionNamespace<IDL, IDL["instructions"][number]>
    +
    instruction: InstructionNamespace<IDL, IDL["instructions"][number]>

    The namespace provides functions to build TransactionInstruction objects for each method of a program.

    @@ -72,10 +72,10 @@ Always the last parameter in the method call.

    To create an instruction for the increment method above,

    const tx = await program.instruction.increment({
    accounts: {
    counter,
    },
    });
    -
    deprecated

    Readonly methods

    methods: MethodsNamespace<IDL, AllInstructions<IDL>>
    +
    deprecated
    methods: MethodsNamespace<IDL, AllInstructions<IDL>>

    The namespace provides a builder API for all APIs on the program. This is an alternative to using namespace the other namespaces..

    -

    Readonly rpc

    rpc: RpcNamespace<IDL, AllInstructions<IDL>>
    +
    rpc: RpcNamespace<IDL, AllInstructions<IDL>>

    Async methods to send signed transactions to non-state methods on the program, returning a TransactionSignature.

    @@ -101,7 +101,7 @@ Always the last parameter in the method call.

    To send a transaction invoking the increment method above,

    const txSignature = await program.rpc.increment({
    accounts: {
    counter,
    authority,
    },
    });
    -
    deprecated

    Readonly simulate

    simulate: SimulateNamespace<IDL, AllInstructions<IDL>>
    +
    deprecated
    simulate: SimulateNamespace<IDL, AllInstructions<IDL>>

    The namespace provides functions to simulate transactions for each method of a program, returning a list of deserialized events and raw program logs.

    @@ -131,11 +131,11 @@ Always the last parameter in the method call.

    To simulate the increment method above,

    const events = await program.simulate.increment({
    accounts: {
    counter,
    },
    });
    -
    deprecated

    Optional Readonly state

    state?: StateClient<IDL>
    +
    deprecated
    state?: StateClient<IDL>

    A client for the program state. Similar to the base Program client, one can use this to send transactions and read accounts for the state abstraction.

    -

    Readonly transaction

    transaction: TransactionNamespace<IDL, AllInstructions<IDL>>
    +
    transaction: TransactionNamespace<IDL, AllInstructions<IDL>>

    The namespace provides functions to build Transaction objects for each method of a program.

    @@ -161,30 +161,30 @@ Always the last parameter in the method call.

    To create an instruction for the increment method above,

    const tx = await program.transaction.increment({
    accounts: {
    counter,
    },
    });
    -
    deprecated

    Optional Readonly views

    views?: ViewNamespace<IDL, AllInstructions<IDL>>

    Accessors

    coder

    views?: ViewNamespace<IDL, AllInstructions<IDL>>

    Accessors

    idl

    • get idl(): IDL
    • get idl(): IDL

    programId

    provider

    Methods

    addEventListener

    • addEventListener(eventName: string, callback: (event: any, slot: number) => void): number

    Methods

    • addEventListener(eventName: string, callback: (event: any, slot: number) => void): number
    • Invokes the given callback every time the given event is emitted.

      Parameters

      • eventName: string

        The PascalCase name of the event, provided by the IDL.

      • callback: (event: any, slot: number) => void

        The function to invoke whenever the event is emitted from program logs.

        -
          • (event: any, slot: number): void
          • Parameters

            • event: any
            • slot: number

            Returns void

      Returns number

    removeEventListener

    • removeEventListener(listener: number): Promise<void>

    Returns number

    • removeEventListener(listener: number): Promise<void>
    • Unsubscribes from the given eventName.

      -

      Parameters

      • listener: number

      Returns Promise<void>

    Static at

    • Generates a Program client by fetching the IDL from the network.

      In order to use this method, an IDL must have been previously initialized via the anchor CLI's anchor idl init command.

      Type parameters

      Parameters

      • address: Address
      • Optional provider: Provider

        The network and wallet context.

        -

      Returns Promise<Program<IDL>>

    Static fetchIdl

    Returns Promise<Program<IDL>>

    • Fetches an idl from the blockchain.

      In order to use this method, an IDL must have been previously initialized via the anchor CLI's anchor idl init command.

      diff --git a/ts/classes/ProgramError.html b/ts/classes/ProgramError.html index 762f5c3f..316cfe26 100644 --- a/ts/classes/ProgramError.html +++ b/ts/classes/ProgramError.html @@ -1,6 +1,6 @@ -ProgramError | @project-serum/anchor - v0.24.0
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Hierarchy

      • Error
        • ProgramError

      Index

      Constructors

      constructor

      • new ProgramError(code: number, msg: string, logs?: string[]): ProgramError

      Properties

      Readonly code

      code: number

      Optional Readonly logs

      logs?: string[]

      message

      message: string

      Readonly msg

      msg: string

      name

      name: string

      Optional stack

      stack?: string

      Static stackTraceLimit

      stackTraceLimit: number

      Accessors

      program

      programErrorStack

      • get programErrorStack(): undefined | PublicKey[]

      Methods

      toString

      • toString(): string

      Static captureStackTrace

      • captureStackTrace(targetObject: object, constructorOpt?: Function): void
      • -

        Create .stack property on a target object

        -

        Parameters

        • targetObject: object
        • Optional constructorOpt: Function

        Returns void

      Static parse

      • parse(err: any, idlErrors: Map<number, string>): null | ProgramError

      Static Optional prepareStackTrace

      • prepareStackTrace(err: Error, stackTraces: CallSite[]): any
    stackTraceLimit: number

    Accessors

    • get programErrorStack(): undefined | PublicKey[]

    Methods

    • toString(): string
    • captureStackTrace(targetObject: object, constructorOpt?: Function): void
    • +

      Create .stack property on a target object

      +

      Parameters

      • targetObject: object
      • Optional constructorOpt: Function

      Returns void

    • parse(err: any, idlErrors: Map<number, string>): null | ProgramError

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/ProgramErrorStack.html b/ts/classes/ProgramErrorStack.html index 19007a59..8d817ecb 100644 --- a/ts/classes/ProgramErrorStack.html +++ b/ts/classes/ProgramErrorStack.html @@ -1 +1 @@ -ProgramErrorStack | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • ProgramErrorStack

    Index

    Constructors

    Properties

    Methods

    Constructors

    constructor

    Properties

    Readonly stack

    stack: PublicKey[]

    Methods

    Static parse

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +ProgramErrorStack | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • ProgramErrorStack

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    stack: PublicKey[]

    Methods

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/Spl.html b/ts/classes/Spl.html index 7d3264c6..858acc7f 100644 --- a/ts/classes/Spl.html +++ b/ts/classes/Spl.html @@ -1 +1 @@ -Spl | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Spl

    Index

    Constructors

    Methods

    Constructors

    constructor

    Methods

    Static token

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +Spl | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Spl

    Index

    Constructors

    Methods

    Constructors

    Methods

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/SplTokenCoder.html b/ts/classes/SplTokenCoder.html index a6505a27..62c17746 100644 --- a/ts/classes/SplTokenCoder.html +++ b/ts/classes/SplTokenCoder.html @@ -1,11 +1,11 @@ -SplTokenCoder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +SplTokenCoder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Coder for the SPL token program.

    -

    Hierarchy

    • SplTokenCoder

    Implements

    Index

    Constructors

    constructor

    Properties

    Readonly accounts

    accounts: SplTokenAccountsCoder<string>
    +

    Hierarchy

    • SplTokenCoder

    Implements

    Index

    Constructors

    Properties

    accounts: SplTokenAccountsCoder<string>

    Account coder.

    -

    Readonly events

    events: SplTokenEventsCoder
    +
    events: SplTokenEventsCoder

    Coder for events.

    -

    Readonly instruction

    instruction: SplTokenInstructionCoder
    +
    instruction: SplTokenInstructionCoder

    Instruction coder.

    -

    Readonly state

    state: SplTokenStateCoder
    +
    state: SplTokenStateCoder

    Coder for state structs.

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/StateClient.html b/ts/classes/StateClient.html index b21da0a3..9211fb06 100644 --- a/ts/classes/StateClient.html +++ b/ts/classes/StateClient.html @@ -1,22 +1,22 @@ -StateClient | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +StateClient | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    A client for the program state. Similar to the base Program client, one can use this to send transactions and read accounts for the state abstraction.

    -

    Type parameters

    Hierarchy

    • StateClient

    Index

    Constructors

    constructor

    Properties

    Readonly coder

    coder: Coder = ...

    Readonly instruction

    instruction: InstructionNamespace<IDL, NullableMethods<IDL>[number]>
    +

    Type parameters

    Hierarchy

    • StateClient

    Index

    Constructors

    Properties

    coder: Coder = ...
    instruction: InstructionNamespace<IDL, NullableMethods<IDL>[number]>

    InstructionNamespace for all state methods.

    -

    Readonly provider

    provider: Provider = ...

    Readonly rpc

    rpc: RpcNamespace<IDL, NullableMethods<IDL>[number]>
    +
    provider: Provider = ...
    rpc: RpcNamespace<IDL, NullableMethods<IDL>[number]>

    RpcNamespace for all state methods.

    -

    Readonly transaction

    transaction: TransactionNamespace<IDL, NullableMethods<IDL>[number]>
    +
    transaction: TransactionNamespace<IDL, NullableMethods<IDL>[number]>

    TransactionNamespace for all state methods.

    -

    Accessors

    programId

    Accessors

    Methods

    address

    Methods

    fetch

    • fetch(): Promise<TypeDef<IDL["state"] extends undefined ? IdlTypeDef : NonNullable<IDL["state"]>["struct"], IdlTypes<IDL>>>
    • fetch(): Promise<TypeDef<IDL["state"] extends undefined ? IdlTypeDef : NonNullable<IDL["state"]>["struct"], IdlTypes<IDL>>>

    subscribe

    • subscribe(commitment?: Commitment): EventEmitter<string | symbol, any>
    • subscribe(commitment?: Commitment): EventEmitter<string | symbol, any>
    • Returns an EventEmitter with a "change" event that's fired whenever the state account cahnges.

      -

      Parameters

      Returns EventEmitter<string | symbol, any>

    unsubscribe

    • unsubscribe(): void
    • unsubscribe(): void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/Wallet.html b/ts/classes/Wallet.html index 1fd33ed2..d633909c 100644 --- a/ts/classes/Wallet.html +++ b/ts/classes/Wallet.html @@ -1 +1 @@ -Wallet | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • NodeWallet
      • Wallet

    Index

    Constructors

    constructor

    Properties

    Readonly payer

    payer: Keypair

    Accessors

    publicKey

    Methods

    signAllTransactions

    signTransaction

    Static local

    • local(): default

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +Wallet | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • default
      • Wallet

    Index

    Constructors

    Properties

    payer: Keypair

    Accessors

    Methods

    • local(): default

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Account.html b/ts/classes/web3.Account.html index a0113852..96febf7b 100644 --- a/ts/classes/web3.Account.html +++ b/ts/classes/web3.Account.html @@ -1,14 +1,14 @@ -Account | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Account | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    An account key pair (public and secret keys).

    deprecated

    since v1.10.0, please use Keypair instead.

    -

    Hierarchy

    • Account

    Index

    Constructors

    Accessors

    Constructors

    constructor

    • new Account(secretKey?: number[] | Uint8Array | Buffer): Account
    • +

    Hierarchy

    • Account

    Index

    Constructors

    Accessors

    Constructors

    • new Account(secretKey?: number[] | Uint8Array | Buffer): Account
    • Create a new Account object

      If the secretKey parameter is not provided a new key pair is randomly created for the account

      Parameters

      • Optional secretKey: number[] | Uint8Array | Buffer

        Secret key for the account

        -

      Returns Account

    Accessors

    publicKey

    • +

    Returns Account

    Accessors

    • The public key for this account

      -

      Returns PublicKey

    secretKey

    • get secretKey(): Buffer
    • +

      Returns PublicKey

    • get secretKey(): Buffer
    • The unencrypted secret key for this account

      Returns Buffer

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Authorized.html b/ts/classes/web3.Authorized.html index ffdc8434..d3893b73 100644 --- a/ts/classes/web3.Authorized.html +++ b/ts/classes/web3.Authorized.html @@ -1,13 +1,13 @@ -Authorized | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Authorized | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Stake account authority info

    -

    Hierarchy

    • Authorized

    Index

    Constructors

    Properties

    Constructors

    constructor

    • +

    Hierarchy

    • Authorized

    Index

    Constructors

    Properties

    Constructors

    • Create a new Authorized object

      Parameters

      Returns Authorized

    Properties

    staker

    staker: PublicKey
    +

    Returns Authorized

    Properties

    staker: PublicKey

    stake authority

    -

    withdrawer

    withdrawer: PublicKey
    +
    withdrawer: PublicKey

    withdraw authority

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.BpfLoader.html b/ts/classes/web3.BpfLoader.html index 7ca66d9f..2112a21c 100644 --- a/ts/classes/web3.BpfLoader.html +++ b/ts/classes/web3.BpfLoader.html @@ -1,10 +1,10 @@ -BpfLoader | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +BpfLoader | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Factory class for transactions to interact with a program loader

    -

    Hierarchy

    • BpfLoader

    Index

    Constructors

    constructor

    Methods

    Static getMinNumSignatures

    • getMinNumSignatures(dataLength: number): number
    • +

    Hierarchy

    • BpfLoader

    Index

    Constructors

    Methods

    • getMinNumSignatures(dataLength: number): number
    • Minimum number of signatures required to load a program not including retries

      Can be used to calculate transaction fees

      -

      Parameters

      • dataLength: number

      Returns number

    Static load

    • +

      Parameters

      • dataLength: number

      Returns number

    Accessors

    • The default commitment used for requests

      -

      Returns undefined | Commitment

    Methods

    _buildArgs

    • _buildArgs(args: any[], override?: Commitment, encoding?: "jsonParsed" | "base64", extra?: any): any[]
    • Parameters

      • args: any[]
      • Optional override: Commitment
      • Optional encoding: "jsonParsed" | "base64"
      • Optional extra: any

      Returns any[]

    confirmTransaction

    • +

      Returns undefined | Commitment

    Methods

    • _buildArgs(args: any[], override?: Commitment, encoding?: "jsonParsed" | "base64", extra?: any): any[]
    • Parameters

      • args: any[]
      • Optional override: Commitment
      • Optional encoding: "jsonParsed" | "base64"
      • Optional extra: any

      Returns any[]

    • Confirm the transaction identified by the specified signature.

      -

      Parameters

      Returns Promise<RpcResponseAndContext<SignatureResult>>

    getAccountInfo

    • Fetch all the account info for the specified public key

      -

      Parameters

      Returns Promise<null | AccountInfo<Buffer>>

    getAccountInfoAndContext

    • +

      Parameters

      Returns Promise<null | AccountInfo<Buffer>>

    • Fetch all the account info for the specified public key, return with context

      -

      Parameters

      Returns Promise<RpcResponseAndContext<null | AccountInfo<Buffer>>>

    getBalance

    • Fetch the balance for the specified public key

      -

      Parameters

      Returns Promise<number>

    getBalanceAndContext

    • +

      Parameters

      Returns Promise<number>

    • Fetch the balance for the specified public key, return with context

      -

      Parameters

      Returns Promise<RpcResponseAndContext<number>>

    getBlock

    • Fetch a processed block from the cluster.

      -

      Parameters

      • slot: number
      • Optional opts: { commitment?: Finality }

      Returns Promise<null | BlockResponse>

    getBlockSignatures

    • +

      Parameters

      • slot: number
      • Optional opts: { commitment?: Finality }

      Returns Promise<null | BlockResponse>

    • Fetch a list of Signatures from the cluster for a block, excluding rewards

      -

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<BlockSignatures>

    getBlockTime

    • getBlockTime(slot: number): Promise<null | number>
    • +

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<BlockSignatures>

    • getBlockTime(slot: number): Promise<null | number>
    • Fetch the estimated production time of a block

      -

      Parameters

      • slot: number

      Returns Promise<null | number>

    getBlocks

    • getBlocks(startSlot: number, endSlot?: number, commitment?: Finality): Promise<number[]>
    • +

      Parameters

      • slot: number

      Returns Promise<null | number>

    • getBlocks(startSlot: number, endSlot?: number, commitment?: Finality): Promise<number[]>
    • Fetch confirmed blocks between two slots

      -

      Parameters

      • startSlot: number
      • Optional endSlot: number
      • Optional commitment: Finality

      Returns Promise<number[]>

    getClusterNodes

    • +

      Parameters

      • startSlot: number
      • Optional endSlot: number
      • Optional commitment: Finality

      Returns Promise<number[]>

    • Return the list of nodes that are currently participating in the cluster

      -

      Returns Promise<ContactInfo[]>

    getConfirmedBlock

    • +

      Returns Promise<ContactInfo[]>

    • Fetch a list of Transactions and transaction statuses from the cluster for a confirmed block.

      deprecated

      Deprecated since v1.13.0. Please use getBlock instead.

      -

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<ConfirmedBlock>

    getConfirmedBlockSignatures

    • +

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<ConfirmedBlock>

    • Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards

      deprecated

      Deprecated since Solana v1.8.0. Please use getBlockSignatures instead.

      -

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<BlockSignatures>

    getConfirmedSignaturesForAddress

    • getConfirmedSignaturesForAddress(address: PublicKey, startSlot: number, endSlot: number): Promise<string[]>
    • +

      Parameters

      • slot: number
      • Optional commitment: Finality

      Returns Promise<BlockSignatures>

    • getConfirmedSignaturesForAddress(address: PublicKey, startSlot: number, endSlot: number): Promise<string[]>
    • Fetch a list of all the confirmed signatures for transactions involving an address within a specified slot range. Max range allowed is 10,000 slots.

      deprecated

      Deprecated since v1.3. Please use getConfirmedSignaturesForAddress2 instead.

      @@ -45,76 +45,76 @@ within a specified slot range. Max range allowed is 10,000 slots.

      start slot, inclusive

  • endSlot: number

    end slot, inclusive

    -
  • Returns Promise<string[]>

    getConfirmedSignaturesForAddress2

    • +

    Returns Promise<string[]>

    getConfirmedTransaction

    • +
    • Optional commitment: Finality

    Returns Promise<ConfirmedSignatureInfo[]>

    • Fetch a transaction details for a confirmed transaction

      deprecated

      Deprecated since Solana v1.8.0. Please use getTransaction instead.

      -

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ConfirmedTransaction>

    getEpochInfo

    • +

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ConfirmedTransaction>

    • Fetch the Epoch Info parameters

      -

      Parameters

      Returns Promise<EpochInfo>

    getEpochSchedule

    • +

      Parameters

      Returns Promise<EpochInfo>

    • Fetch the Epoch Schedule parameters

      -

      Returns Promise<EpochSchedule>

    getFeeCalculatorForBlockhash

    • +

      Returns Promise<EpochSchedule>

    • Fetch the fee calculator for a recent blockhash from the cluster, return with context

      deprecated

      Deprecated since Solana v1.8.0. Please use getFeeForMessage instead.

      -

      Parameters

      Returns Promise<RpcResponseAndContext<null | FeeCalculator>>

    getFeeForMessage

    • Fetch the fee for a message from the cluster, return with context

      -

      Parameters

      Returns Promise<RpcResponseAndContext<number>>

    getFirstAvailableBlock

    • getFirstAvailableBlock(): Promise<number>
    • getFirstAvailableBlock(): Promise<number>
    • Fetch the slot of the lowest confirmed block that has not been purged from the ledger

      -

      Returns Promise<number>

    getGenesisHash

    • getGenesisHash(): Promise<string>
    • +

      Returns Promise<number>

    • getGenesisHash(): Promise<string>
    • Fetch the genesis hash

      -

      Returns Promise<string>

    getInflationGovernor

    • +

      Returns Promise<string>

    • Fetch the cluster InflationGovernor parameters

      -

      Parameters

      Returns Promise<InflationGovernor>

    getInflationReward

    • +

      Parameters

      Returns Promise<InflationGovernor>

    • Fetch the inflation reward for a list of addresses for an epoch

      -

      Parameters

      Returns Promise<(null | InflationReward)[]>

    getLargestAccounts

    • +

      Parameters

      Returns Promise<(null | InflationReward)[]>

    getLatestBlockhash

    • getLatestBlockhash(commitment?: Commitment): Promise<{ blockhash: string; lastValidBlockHeight: number }>
    • getLatestBlockhash(commitment?: Commitment): Promise<{ blockhash: string; lastValidBlockHeight: number }>
    • Fetch the latest blockhash from the cluster

      Parameters

      Returns Promise<{ blockhash: string; lastValidBlockHeight: number }>

      }

      -

    getLatestBlockhashAndContext

    • +
    • Fetch the latest blockhash from the cluster

      Parameters

      Returns Promise<RpcResponseAndContext<{ blockhash: string; lastValidBlockHeight: number }>>

      }

      -

    getLeaderSchedule

    • +
    • Fetch the leader schedule for the current epoch

      -

      Returns Promise<LeaderSchedule>

    getMinimumBalanceForRentExemption

    • getMinimumBalanceForRentExemption(dataLength: number, commitment?: Commitment): Promise<number>
    • +

      Returns Promise<LeaderSchedule>

    • getMinimumBalanceForRentExemption(dataLength: number, commitment?: Commitment): Promise<number>
    • Fetch the minimum balance needed to exempt an account of dataLength size from rent

      -

      Parameters

      Returns Promise<number>

    getMinimumLedgerSlot

    • getMinimumLedgerSlot(): Promise<number>
    • +

      Parameters

      Returns Promise<number>

    • getMinimumLedgerSlot(): Promise<number>
    • Fetch the lowest slot that the node has information about in its ledger. This value may increase over time if the node is configured to purge older ledger data

      -

      Returns Promise<number>

    getMultipleAccountsInfo

    • +

      Returns Promise<number>

    • Fetch all the account info for multiple accounts specified by an array of public keys

      -

      Parameters

      Returns Promise<(null | AccountInfo<Buffer>)[]>

    getMultipleAccountsInfoAndContext

    • +

      Parameters

      Returns Promise<(null | AccountInfo<Buffer>)[]>

    • Fetch all the account info for multiple accounts specified by an array of public keys, return with context

      -

      Parameters

      Returns Promise<RpcResponseAndContext<(null | AccountInfo<Buffer>)[]>>

    getNonce

    • Fetch the contents of a Nonce account from the cluster

      -

      Parameters

      Returns Promise<null | NonceAccount>

    getNonceAndContext

    • +

      Parameters

      Returns Promise<null | NonceAccount>

    • Fetch the contents of a Nonce account from the cluster, return with context

      -

      Parameters

      Returns Promise<RpcResponseAndContext<null | NonceAccount>>

    getParsedAccountInfo

    getParsedConfirmedTransaction

    • Fetch parsed transaction details for a confirmed transaction

      deprecated

      Deprecated since Solana v1.8.0. Please use getParsedTransaction instead.

      -

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ParsedTransactionWithMeta>

    getParsedConfirmedTransactions

    • +

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ParsedTransactionWithMeta>

    • Fetch parsed transaction details for a batch of confirmed transactions

      deprecated

      Deprecated since Solana v1.8.0. Please use getParsedTransactions instead.

      -

      Parameters

      • signatures: string[]
      • Optional commitment: Finality

      Returns Promise<(null | ParsedTransactionWithMeta)[]>

    getParsedProgramAccounts

    • +

      Parameters

      • signatures: string[]
      • Optional commitment: Finality

      Returns Promise<(null | ParsedTransactionWithMeta)[]>

    getParsedTokenAccountsByOwner

    • +

    getParsedTransaction

    • +
    • Fetch parsed transaction details for a confirmed or finalized transaction

      -

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ParsedTransactionWithMeta>

    getParsedTransactions

    • +

      Parameters

      • signature: string
      • Optional commitment: Finality

      Returns Promise<null | ParsedTransactionWithMeta>

    • Fetch parsed transaction details for a batch of confirmed transactions

      -

      Parameters

      • signatures: string[]
      • Optional commitment: Finality

      Returns Promise<(null | ParsedTransactionWithMeta)[]>

    getProgramAccounts

    • +

      Parameters

      • signatures: string[]
      • Optional commitment: Finality

      Returns Promise<(null | ParsedTransactionWithMeta)[]>

    getRecentBlockhash

    • +
    • Fetch a recent blockhash from the cluster

      deprecated

      Deprecated since Solana v1.8.0. Please use getLatestBlockhash instead.

      Parameters

      Returns Promise<{ blockhash: string; feeCalculator: FeeCalculator }>

      }

      -

    getRecentBlockhashAndContext

    • +
    • Fetch a recent blockhash from the cluster, return with context

      deprecated

      Deprecated since Solana v1.8.0. Please use getLatestBlockhash instead.

      Parameters

      Returns Promise<RpcResponseAndContext<{ blockhash: string; feeCalculator: FeeCalculator }>>

      @@ -148,35 +148,35 @@ This value may increase over time if the node is configured to purge older ledge

      }

      -

    getRecentPerformanceSamples

    • getRecentPerformanceSamples(limit?: number): Promise<PerfSample[]>
    • +
    • getRecentPerformanceSamples(limit?: number): Promise<PerfSample[]>
    • Fetch recent performance samples

      -

      Parameters

      • Optional limit: number

      Returns Promise<PerfSample[]>

    getSignatureStatus

    • +

      Parameters

      • Optional limit: number

      Returns Promise<PerfSample[]>

    getSignatureStatuses

    getSignaturesForAddress

    • Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block

      Parameters

      Returns Promise<ConfirmedSignatureInfo[]>

    getSlot

    • +
    • Optional commitment: Finality

    Returns Promise<ConfirmedSignatureInfo[]>

    • Fetch the current slot that the node is processing

      -

      Parameters

      Returns Promise<number>

    getSlotLeader

    • getSlotLeader(commitment?: Commitment): Promise<string>
    • +

      Parameters

      Returns Promise<number>

    • getSlotLeader(commitment?: Commitment): Promise<string>
    • Fetch the current slot leader of the cluster

      -

      Parameters

      Returns Promise<string>

    getSlotLeaders

    • getSlotLeaders(startSlot: number, limit: number): Promise<PublicKey[]>
    • +

      Parameters

      Returns Promise<string>

    • getSlotLeaders(startSlot: number, limit: number): Promise<PublicKey[]>
    • Fetch limit number of slot leaders starting from startSlot

      Parameters

      • startSlot: number

        fetch slot leaders starting from this slot

      • limit: number

        number of slot leaders to return

        -

      Returns Promise<PublicKey[]>

    getStakeActivation

    • +

    Returns Promise<PublicKey[]>

    • Returns epoch activation information for a stake account that has been delegated

      -

      Parameters

      Returns Promise<StakeActivationData>

    getSupply

    getTokenAccountBalance

    getTokenAccountsByOwner

    • Fetch all the token accounts owned by the specified account

      Parameters

      Returns Promise<RpcResponseAndContext<{ account: AccountInfo<Buffer>; pubkey: PublicKey }[]>>

      @@ -185,23 +185,23 @@ address backwards in time from the provided signature or most recent confirmed b
      -

    getTokenLargestAccounts

    • +

    getTokenSupply

    getTotalSupply

    • getTotalSupply(commitment?: Commitment): Promise<number>
    • getTotalSupply(commitment?: Commitment): Promise<number>
    • Fetch the current total currency supply of the cluster in lamports

      deprecated

      Deprecated since v1.2.8. Please use getSupply instead.

      -

      Parameters

      Returns Promise<number>

    getTransaction

    • +

      Parameters

      Returns Promise<number>

    • Fetch a confirmed or finalized transaction from the cluster.

      -

      Parameters

      • signature: string
      • Optional opts: { commitment?: Finality }

      Returns Promise<null | TransactionResponse>

    getTransactionCount

    • getTransactionCount(commitment?: Commitment): Promise<number>
    • +

      Parameters

      • signature: string
      • Optional opts: { commitment?: Finality }

      Returns Promise<null | TransactionResponse>

    • getTransactionCount(commitment?: Commitment): Promise<number>
    • Fetch the current transaction count of the cluster

      -

      Parameters

      Returns Promise<number>

    getVersion

    • +

      Parameters

      Returns Promise<number>

    • Fetch the node version

      -

      Returns Promise<Version>

    getVoteAccounts

    • +

      Returns Promise<Version>

    • Return the list of nodes that are currently participating in the cluster

      -

      Parameters

      Returns Promise<VoteAccountStatus>

    onAccountChange

    • +

      Parameters

      Returns Promise<VoteAccountStatus>

    • Register a callback to be invoked whenever the specified account changes

      Parameters

      • publicKey: PublicKey

        Public key of the account to monitor

        @@ -210,9 +210,9 @@ for a given mint.

      • Optional commitment: Commitment

        Specify the commitment level account changes must reach before notification

      Returns number

      subscription id

      -

    onLogs

    • +
    • Registers a callback to be invoked whenever logs are emitted.

      -

      Parameters

      Returns number

    onProgramAccountChange

    • Register a callback to be invoked whenever accounts owned by the specified program change

      Parameters

      • programId: PublicKey
        @@ -224,12 +224,12 @@ specified program change

      • Optional filters: GetProgramAccountsFilter[]

        The program account filters to pass into the RPC method

      Returns number

      subscription id

      -

    onRootChange

    • +
    • Register a callback to be invoked upon root changes

      Parameters

      Returns number

      subscription id

      -

    onSignature

    • +
    • Register a callback to be invoked upon signature updates

      Parameters

      • signature: string

        Transaction signature string in base 58

        @@ -238,7 +238,7 @@ specified program change

      • Optional commitment: Commitment

        Specify the commitment level signature must reach before notification

      Returns number

      subscription id

      -

    onSignatureWithOptions

    • +
    • Register a callback to be invoked when a transaction is received and/or processed.

      Parameters

      • signature: string
        @@ -249,57 +249,57 @@ received and/or processed.

        Enable received notifications and set the commitment level that signature must reach before notification

      Returns number

      subscription id

      -

    onSlotChange

    • +
    • Register a callback to be invoked upon slot changes

      Parameters

      Returns number

      subscription id

      -

    onSlotUpdate

    • +
    • Register a callback to be invoked upon slot updates. SlotUpdate's may be useful to track live progress of a cluster.

      Parameters

      Returns number

      subscription id

      -

    removeAccountChangeListener

    • removeAccountChangeListener(id: number): Promise<void>
    • +
    • removeAccountChangeListener(id: number): Promise<void>
    • Deregister an account notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    removeOnLogsListener

    • removeOnLogsListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeOnLogsListener(id: number): Promise<void>
    • Deregister a logs callback.

      Parameters

      • id: number

        subscription id to deregister.

        -

      Returns Promise<void>

    removeProgramAccountChangeListener

    • removeProgramAccountChangeListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeProgramAccountChangeListener(id: number): Promise<void>
    • Deregister an account notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    removeRootChangeListener

    • removeRootChangeListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeRootChangeListener(id: number): Promise<void>
    • Deregister a root notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    removeSignatureListener

    • removeSignatureListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeSignatureListener(id: number): Promise<void>
    • Deregister a signature notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    removeSlotChangeListener

    • removeSlotChangeListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeSlotChangeListener(id: number): Promise<void>
    • Deregister a slot notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    removeSlotUpdateListener

    • removeSlotUpdateListener(id: number): Promise<void>
    • +

    Returns Promise<void>

    • removeSlotUpdateListener(id: number): Promise<void>
    • Deregister a slot update notification callback

      Parameters

      • id: number

        subscription id to deregister

        -

      Returns Promise<void>

    requestAirdrop

    • requestAirdrop(to: PublicKey, lamports: number): Promise<string>
    • +

    Returns Promise<void>

    • requestAirdrop(to: PublicKey, lamports: number): Promise<string>
    • Request an allocation of lamports to the specified address

      import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";

      (async () => {
      const connection = new Connection("https://api.testnet.solana.com", "confirmed");
      const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
      const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
      await connection.confirmTransaction(signature);
      })();
      -

      Parameters

      Returns Promise<string>

    sendEncodedTransaction

    • sendEncodedTransaction(encodedTransaction: string, options?: SendOptions): Promise<string>
    • +

      Parameters

      Returns Promise<string>

    • sendEncodedTransaction(encodedTransaction: string, options?: SendOptions): Promise<string>
    • Send a transaction that has already been signed, serialized into the wire format, and encoded as a base64 string

      -

      Parameters

      • encodedTransaction: string
      • Optional options: SendOptions

      Returns Promise<string>

    sendRawTransaction

    • sendRawTransaction(rawTransaction: number[] | Uint8Array | Buffer, options?: SendOptions): Promise<string>
    • +

      Parameters

      • encodedTransaction: string
      • Optional options: SendOptions

      Returns Promise<string>

    • sendRawTransaction(rawTransaction: number[] | Uint8Array | Buffer, options?: SendOptions): Promise<string>
    • Send a transaction that has already been signed and serialized into the wire format

      -

      Parameters

      • rawTransaction: number[] | Uint8Array | Buffer
      • Optional options: SendOptions

      Returns Promise<string>

    sendTransaction

    • +

      Parameters

      • rawTransaction: number[] | Uint8Array | Buffer
      • Optional options: SendOptions

      Returns Promise<string>

    • Sign and send a transaction

      -

      Parameters

      Returns Promise<string>

    simulateTransaction

    • +

      Parameters

      Returns Promise<string>

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Ed25519Program.html b/ts/classes/web3.Ed25519Program.html index 5e93b5b9..ebd07516 100644 --- a/ts/classes/web3.Ed25519Program.html +++ b/ts/classes/web3.Ed25519Program.html @@ -1,9 +1,9 @@ -Ed25519Program | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Ed25519Program

    Index

    Constructors

    constructor

    Properties

    Static programId

    programId: PublicKey
    +Ed25519Program | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Ed25519Program

    Index

    Constructors

    Properties

    programId: PublicKey

    Public key that identifies the ed25519 program

    -

    Methods

    Static createInstructionWithPrivateKey

    • +

    Methods

    Static createInstructionWithPublicKey

    • Create an ed25519 instruction with a public key and signature. The public key must be a buffer that is 32 bytes long, and the signature must be a buffer of 64 bytes.

      diff --git a/ts/classes/web3.Enum.html b/ts/classes/web3.Enum.html index 4b851d87..9050faa8 100644 --- a/ts/classes/web3.Enum.html +++ b/ts/classes/web3.Enum.html @@ -1 +1 @@ -Enum | @project-serum/anchor - v0.24.0
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Hierarchy

      Index

      Constructors

      Properties

      Methods

      Constructors

      constructor

      • new Enum(properties: any): Enum
      • Parameters

        • properties: any

        Returns Enum

      Properties

      enum

      enum: string

      Methods

      encode

      • encode(): Buffer
      • Returns Buffer

      Static decode

      • decode(data: Buffer): any
      • Parameters

        • data: Buffer

        Returns any

      Static decodeUnchecked

      • decodeUnchecked(data: Buffer): any
      • Parameters

        • data: Buffer

        Returns any

      Legend

      • Constructor
      • Property
      • Method
      • Inherited constructor
      • Inherited property
      • Inherited method
      • Property
      • Method
      • Static method

      Settings

      Theme

      Generated using TypeDoc

      \ No newline at end of file +Enum | @project-serum/anchor - v0.24.1
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Hierarchy

      Index

      Constructors

      Properties

      Methods

      Constructors

      • new Enum(properties: any): Enum
      • Parameters

        • properties: any

        Returns Enum

      Properties

      enum: string

      Methods

      • encode(): Buffer
      • Returns Buffer

      • decode(data: Buffer): any
      • Parameters

        • data: Buffer

        Returns any

      • decodeUnchecked(data: Buffer): any
      • Parameters

        • data: Buffer

        Returns any

      Legend

      • Constructor
      • Property
      • Method
      • Inherited constructor
      • Inherited property
      • Inherited method
      • Property
      • Method
      • Static method

      Settings

      Theme

      Generated using TypeDoc

      \ No newline at end of file diff --git a/ts/classes/web3.EpochSchedule.html b/ts/classes/web3.EpochSchedule.html index a8cc328c..20b44811 100644 --- a/ts/classes/web3.EpochSchedule.html +++ b/ts/classes/web3.EpochSchedule.html @@ -1,15 +1,15 @@ -EpochSchedule | @project-serum/anchor - v0.24.0
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu
      +EpochSchedule | @project-serum/anchor - v0.24.1
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      Epoch schedule (see https://docs.solana.com/terminology#epoch) Can be retrieved with the {@link connection.getEpochSchedule} method

      -

      Hierarchy

      • EpochSchedule

      Index

      Constructors

      constructor

      • new EpochSchedule(slotsPerEpoch: number, leaderScheduleSlotOffset: number, warmup: boolean, firstNormalEpoch: number, firstNormalSlot: number): EpochSchedule
      • Parameters

        • slotsPerEpoch: number
        • leaderScheduleSlotOffset: number
        • warmup: boolean
        • firstNormalEpoch: number
        • firstNormalSlot: number

        Returns EpochSchedule

      Properties

      firstNormalEpoch

      firstNormalEpoch: number
      +

      Hierarchy

      • EpochSchedule

      Index

      Constructors

      • new EpochSchedule(slotsPerEpoch: number, leaderScheduleSlotOffset: number, warmup: boolean, firstNormalEpoch: number, firstNormalSlot: number): EpochSchedule
      • Parameters

        • slotsPerEpoch: number
        • leaderScheduleSlotOffset: number
        • warmup: boolean
        • firstNormalEpoch: number
        • firstNormalSlot: number

        Returns EpochSchedule

      Properties

      firstNormalEpoch: number

      The first epoch with slotsPerEpoch slots

      -

      firstNormalSlot

      firstNormalSlot: number
      +
      firstNormalSlot: number

      The first slot of firstNormalEpoch

      -

      leaderScheduleSlotOffset

      leaderScheduleSlotOffset: number
      +
      leaderScheduleSlotOffset: number

      The number of slots before beginning of an epoch to calculate a leader schedule for that epoch

      -

      slotsPerEpoch

      slotsPerEpoch: number
      +
      slotsPerEpoch: number

      The maximum number of slots in each epoch

      -

      warmup

      warmup: boolean
      +
      warmup: boolean

      Indicates whether epochs start short and grow

      -

      Methods

      getEpoch

      • getEpoch(slot: number): number
      • Parameters

        • slot: number

        Returns number

      getEpochAndSlotIndex

      • getEpochAndSlotIndex(slot: number): [number, number]
      • Parameters

        • slot: number

        Returns [number, number]

      getFirstSlotInEpoch

      • getFirstSlotInEpoch(epoch: number): number
      • Parameters

        • epoch: number

        Returns number

      getLastSlotInEpoch

      • getLastSlotInEpoch(epoch: number): number
      • Parameters

        • epoch: number

        Returns number

      getSlotsInEpoch

      • getSlotsInEpoch(epoch: number): number
      • Parameters

        • epoch: number

        Returns number

      Legend

      • Constructor
      • Property
      • Method
      • Inherited constructor
      • Inherited property
      • Inherited method
      • Property
      • Method
      • Static method

      Settings

      Theme

      Generated using TypeDoc

      \ No newline at end of file +

    Methods

    • getEpoch(slot: number): number
    • Parameters

      • slot: number

      Returns number

    • getEpochAndSlotIndex(slot: number): [number, number]
    • Parameters

      • slot: number

      Returns [number, number]

    • getFirstSlotInEpoch(epoch: number): number
    • Parameters

      • epoch: number

      Returns number

    • getLastSlotInEpoch(epoch: number): number
    • Parameters

      • epoch: number

      Returns number

    • getSlotsInEpoch(epoch: number): number
    • Parameters

      • epoch: number

      Returns number

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Keypair.html b/ts/classes/web3.Keypair.html index a99e9186..4f5d062a 100644 --- a/ts/classes/web3.Keypair.html +++ b/ts/classes/web3.Keypair.html @@ -1,15 +1,15 @@ -Keypair | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Keypair | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    An account keypair used for signing transactions.

    -

    Hierarchy

    • Keypair

    Index

    Constructors

    constructor

    • +

    Hierarchy

    • Keypair

    Index

    Constructors

    • Create a new keypair instance. Generate random keypair if no Ed25519Keypair is provided.

      Parameters

      Returns Keypair

    Accessors

    publicKey

    • +

    Returns Keypair

    Accessors

    • The public key for this keypair

      -

      Returns PublicKey

    secretKey

    • get secretKey(): Uint8Array
    • +

      Returns PublicKey

    • get secretKey(): Uint8Array
    • The raw secret key for this keypair

      -

      Returns Uint8Array

    Methods

    Static fromSecretKey

    • fromSecretKey(secretKey: Uint8Array, options?: { skipValidation?: boolean }): Keypair
    • +

      Returns Uint8Array

    Methods

    • fromSecretKey(secretKey: Uint8Array, options?: { skipValidation?: boolean }): Keypair
    • Create a keypair from a raw secret key byte array.

      This method should only be used to recreate a keypair from a previously generated secret key. Generating keypairs from a random seed should be done @@ -17,10 +17,10 @@ with the Keypair.fromSeed method.

      throws

      error if the provided secret key is invalid and validation is not skipped.

      Parameters

      • secretKey: Uint8Array

        secret key byte array

        -
      • Optional options: { skipValidation?: boolean }
        • Optional skipValidation?: boolean

      Returns Keypair

    Static fromSeed

    • fromSeed(seed: Uint8Array): Keypair
    • +
    • Optional options: { skipValidation?: boolean }
      • Optional skipValidation?: boolean

    Returns Keypair

    • fromSeed(seed: Uint8Array): Keypair
    • Generate a keypair from a 32 byte seed.

      Parameters

      • seed: Uint8Array

        seed byte array

        -

      Returns Keypair

    Static generate

    • +

    Returns Keypair

    • Generate a new random keypair

      Returns Keypair

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Loader.html b/ts/classes/web3.Loader.html index 6424840b..5176d72c 100644 --- a/ts/classes/web3.Loader.html +++ b/ts/classes/web3.Loader.html @@ -1,12 +1,12 @@ -Loader | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Loader | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Program loader interface

    -

    Hierarchy

    • Loader

    Index

    Constructors

    Properties

    Methods

    Constructors

    constructor

    Properties

    Static chunkSize

    chunkSize: number
    +

    Hierarchy

    • Loader

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    chunkSize: number

    Amount of program data placed in each load Transaction

    -

    Methods

    Static getMinNumSignatures

    • getMinNumSignatures(dataLength: number): number
    • +

    Methods

    • getMinNumSignatures(dataLength: number): number
    • Minimum number of signatures required to load a program not including retries

      Can be used to calculate transaction fees

      -

      Parameters

      • dataLength: number

      Returns number

    Static load

    • +

      Parameters

      • dataLength: number

      Returns number

    • Loads a generic program

      Parameters

      • connection: Connection

        The connection to use

        diff --git a/ts/classes/web3.Lockup.html b/ts/classes/web3.Lockup.html index d043bd59..80e1a4ce 100644 --- a/ts/classes/web3.Lockup.html +++ b/ts/classes/web3.Lockup.html @@ -1,13 +1,13 @@ -Lockup | @project-serum/anchor - v0.24.0
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu
        +Lockup | @project-serum/anchor - v0.24.1
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu

        Stake account lockup info

        -

        Hierarchy

        • Lockup

        Index

        Constructors

        constructor

        • new Lockup(unixTimestamp: number, epoch: number, custodian: PublicKey): Lockup
        • +

        Hierarchy

        • Lockup

        Index

        Constructors

        • new Lockup(unixTimestamp: number, epoch: number, custodian: PublicKey): Lockup
        • Create a new Lockup object

          -

          Parameters

          • unixTimestamp: number
          • epoch: number
          • custodian: PublicKey

          Returns Lockup

        Properties

        custodian

        custodian: PublicKey
        +

        Parameters

        • unixTimestamp: number
        • epoch: number
        • custodian: PublicKey

        Returns Lockup

    Properties

    custodian: PublicKey

    Lockup custodian authority

    -

    epoch

    epoch: number
    +
    epoch: number

    Epoch of lockup expiration

    -

    unixTimestamp

    unixTimestamp: number
    +
    unixTimestamp: number

    Unix timestamp of lockup expiration

    -

    Static default

    default: Lockup
    +
    default: Lockup

    Default, inactive Lockup value

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Message.html b/ts/classes/web3.Message.html index d21e3cbf..b0738e0d 100644 --- a/ts/classes/web3.Message.html +++ b/ts/classes/web3.Message.html @@ -1,5 +1,5 @@ -Message | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Message | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    List of instructions to be processed atomically

    -

    Hierarchy

    • Message

    Index

    Constructors

    constructor

    • Parameters

      Returns Message

    Properties

    accountKeys

    accountKeys: PublicKey[]

    header

    instructions

    instructions: CompiledInstruction[]

    recentBlockhash

    recentBlockhash: string

    Methods

    isAccountSigner

    • isAccountSigner(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    isAccountWritable

    • isAccountWritable(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    isProgramId

    • isProgramId(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    nonProgramIds

    • Returns PublicKey[]

    programIds

    • Returns PublicKey[]

    serialize

    • serialize(): Buffer
    • Returns Buffer

    Static from

    • from(buffer: number[] | Uint8Array | Buffer): Message
    • +

    Hierarchy

    • Message

    Index

    Constructors

    • Parameters

      Returns Message

    Properties

    accountKeys: PublicKey[]
    instructions: CompiledInstruction[]
    recentBlockhash: string

    Methods

    • isAccountSigner(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    • isAccountWritable(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    • isProgramId(index: number): boolean
    • Parameters

      • index: number

      Returns boolean

    • Returns PublicKey[]

    • Returns PublicKey[]

    • serialize(): Buffer
    • Returns Buffer

    • from(buffer: number[] | Uint8Array | Buffer): Message
    • Decode a compiled message into a Message object.

      Parameters

      • buffer: number[] | Uint8Array | Buffer

      Returns Message

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.NonceAccount.html b/ts/classes/web3.NonceAccount.html index bafae022..528d9545 100644 --- a/ts/classes/web3.NonceAccount.html +++ b/ts/classes/web3.NonceAccount.html @@ -1,6 +1,6 @@ -NonceAccount | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +NonceAccount | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    NonceAccount class

    -

    Hierarchy

    • NonceAccount

    Index

    Constructors

    constructor

    Properties

    authorizedPubkey

    authorizedPubkey: PublicKey

    feeCalculator

    feeCalculator: FeeCalculator

    nonce

    nonce: string

    Methods

    Static fromAccountData

    • fromAccountData(buffer: number[] | Uint8Array | Buffer): NonceAccount
    • +

    Hierarchy

    • NonceAccount

    Index

    Constructors

    Properties

    authorizedPubkey: PublicKey
    feeCalculator: FeeCalculator
    nonce: string

    Methods

    • fromAccountData(buffer: number[] | Uint8Array | Buffer): NonceAccount

    Properties

    default: PublicKey

    Default public key value. (All zeros)

    -

    Methods

    encode

    • encode(): Buffer
    • Returns Buffer

    equals

    • +

    Methods

    • encode(): Buffer
    • Returns Buffer

    • Checks if two publicKeys are equal

      -

      Parameters

      Returns boolean

    toBase58

    • toBase58(): string
    • +

      Parameters

      Returns boolean

    • toBase58(): string
    • Return the base-58 representation of the public key

      -

      Returns string

    toBuffer

    • toBuffer(): Buffer
    • +

      Returns string

    • toBuffer(): Buffer
    • Return the Buffer representation of the public key

      -

      Returns Buffer

    toBytes

    • toBytes(): Uint8Array
    • +

      Returns Buffer

    • toBytes(): Uint8Array
    • Return the byte array representation of the public key

      -

      Returns Uint8Array

    toJSON

    • toJSON(): string
    • Returns string

    toString

    • toString(): string
    • +

      Returns Uint8Array

    • toJSON(): string
    • Returns string

    • toString(): string
    • Return the base-58 representation of the public key

      -

      Returns string

    Static createProgramAddress

    • createProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<PublicKey>
    • +

      Returns string

    • createProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<PublicKey>
    • Derive a program address from seeds and a program ID.

      -

      Parameters

      • seeds: (Uint8Array | Buffer)[]
      • programId: PublicKey

      Returns Promise<PublicKey>

    Static createWithSeed

    • +

      Parameters

      • seeds: (Uint8Array | Buffer)[]
      • programId: PublicKey

      Returns Promise<PublicKey>

    • Derive a public key from another key, a seed, and a program ID. The program ID will also serve as the owner of the public key, giving it permission to write data to the account.

      -

      Parameters

      Returns Promise<PublicKey>

    Static decode

    • decode(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    Static decodeUnchecked

    • decodeUnchecked(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    Static findProgramAddress

    • findProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<[PublicKey, number]>
    • +

      Parameters

      Returns Promise<PublicKey>

    • decode(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    • decodeUnchecked(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    • findProgramAddress(seeds: (Uint8Array | Buffer)[], programId: PublicKey): Promise<[PublicKey, number]>
    • Find a valid program address

      Valid program addresses must fall off the ed25519 curve. This function iterates a nonce until it finds one that when combined with the seeds results in a valid program address.

      -

      Parameters

      • seeds: (Uint8Array | Buffer)[]
      • programId: PublicKey

      Returns Promise<[PublicKey, number]>

    Static isOnCurve

    • isOnCurve(pubkey: Uint8Array): boolean
    • +

      Parameters

      • seeds: (Uint8Array | Buffer)[]
      • programId: PublicKey

      Returns Promise<[PublicKey, number]>

    • isOnCurve(pubkey: Uint8Array): boolean
    • Check that a pubkey is on the ed25519 curve.

      Parameters

      • pubkey: Uint8Array

      Returns boolean

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Secp256k1Program.html b/ts/classes/web3.Secp256k1Program.html index f26b143d..0527be47 100644 --- a/ts/classes/web3.Secp256k1Program.html +++ b/ts/classes/web3.Secp256k1Program.html @@ -1,15 +1,15 @@ -Secp256k1Program | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Secp256k1Program

    Index

    Constructors

    constructor

    Properties

    Static programId

    programId: PublicKey
    +Secp256k1Program | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Secp256k1Program

    Index

    Constructors

    Properties

    programId: PublicKey

    Public key that identifies the secp256k1 program

    -

    Methods

    Static createInstructionWithEthAddress

    • +

    Methods

    Static createInstructionWithPrivateKey

    Static createInstructionWithPublicKey

    Static publicKeyToEthAddress

    • publicKeyToEthAddress(publicKey: number[] | Uint8Array | Buffer): Buffer
    • publicKeyToEthAddress(publicKey: number[] | Uint8Array | Buffer): Buffer
    • Construct an Ethereum address from a secp256k1 public key buffer.

      Parameters

      • publicKey: number[] | Uint8Array | Buffer

        a 64 byte secp256k1 public key buffer

        diff --git a/ts/classes/web3.SendTransactionError.html b/ts/classes/web3.SendTransactionError.html index 7fc17fb5..4dce1527 100644 --- a/ts/classes/web3.SendTransactionError.html +++ b/ts/classes/web3.SendTransactionError.html @@ -1,6 +1,6 @@ -SendTransactionError | @project-serum/anchor - v0.24.0
        Options
        All
        • Public
        • Public/Protected
        • All
        Menu

        Hierarchy

        • Error
          • SendTransactionError

        Index

        Constructors

        constructor

        • Parameters

          • message: string
          • Optional logs: string[]

          Returns SendTransactionError

        Properties

        logs

        logs: undefined | string[]

        message

        message: string

        name

        name: string

        Optional stack

        stack?: string

        Static stackTraceLimit

        stackTraceLimit: number

        Methods

        Static captureStackTrace

        • captureStackTrace(targetObject: object, constructorOpt?: Function): void
        • -

          Create .stack property on a target object

          -

          Parameters

          • targetObject: object
          • Optional constructorOpt: Function

          Returns void

        Static Optional prepareStackTrace

        • prepareStackTrace(err: Error, stackTraces: CallSite[]): any
        • +SendTransactionError | @project-serum/anchor - v0.24.1
          Options
          All
          • Public
          • Public/Protected
          • All
          Menu

          Hierarchy

          • Error
            • SendTransactionError

          Index

          Constructors

          • Parameters

            • message: string
            • Optional logs: string[]

            Returns SendTransactionError

          Properties

          logs: undefined | string[]
          message: string
          name: string
          stack?: string
          prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any

          Type declaration

          Legend

          • Constructor
          • Property
          • Method
          • Inherited constructor
          • Inherited property
          • Inherited method
          • Property
          • Method
          • Static method

          Settings

          Theme

          Generated using TypeDoc

          \ No newline at end of file +

          Parameters

          • err: Error
          • stackTraces: CallSite[]

          Returns any

    stackTraceLimit: number

    Methods

    • captureStackTrace(targetObject: object, constructorOpt?: Function): void
    • +

      Create .stack property on a target object

      +

      Parameters

      • targetObject: object
      • Optional constructorOpt: Function

      Returns void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.StakeInstruction.html b/ts/classes/web3.StakeInstruction.html index 43e62263..97aee566 100644 --- a/ts/classes/web3.StakeInstruction.html +++ b/ts/classes/web3.StakeInstruction.html @@ -1,21 +1,21 @@ -StakeInstruction | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +StakeInstruction | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Stake Instruction class

    -

    Hierarchy

    • StakeInstruction

    Index

    Constructors

    constructor

    Methods

    Static decodeAuthorize

    • +

    Hierarchy

    • StakeInstruction

    Index

    Constructors

    Methods

    Static decodeAuthorizeWithSeed

    Static decodeDeactivate

    Static decodeDelegate

    • Decode a delegate stake instruction and retrieve the instruction params.

      -

      Parameters

      Returns DelegateStakeParams

    Static decodeInitialize

    Static decodeInstructionType

    Static decodeMerge

    • Decode a merge stake instruction and retrieve the instruction params.

      -

      Parameters

      Returns MergeStakeParams

    Static decodeSplit

    • Decode a split stake instruction and retrieve the instruction params.

      -

      Parameters

      Returns SplitStakeParams

    Static decodeWithdraw

    • Decode a withdraw stake instruction and retrieve the instruction params.

      Parameters

      Returns WithdrawStakeParams

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.StakeProgram.html b/ts/classes/web3.StakeProgram.html index 63cdf032..45dcf652 100644 --- a/ts/classes/web3.StakeProgram.html +++ b/ts/classes/web3.StakeProgram.html @@ -1,38 +1,38 @@ -StakeProgram | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +StakeProgram | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Factory class for transactions to interact with the Stake program

    -

    Hierarchy

    • StakeProgram

    Index

    Constructors

    constructor

    Properties

    Static programId

    programId: PublicKey
    +

    Hierarchy

    • StakeProgram

    Index

    Constructors

    Properties

    programId: PublicKey

    Public key that identifies the Stake program

    -

    Static space

    space: number
    +
    space: number

    Max space of a Stake account

    This is generated from the solana-stake-program StakeState struct as std::mem::size_of::<StakeState>(): https://docs.rs/solana-stake-program/1.4.4/solana_stake_program/stake_state/enum.StakeState.html

    -

    Methods

    Static authorize

    • +

    Methods

    • Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

      -

      Parameters

      Returns Transaction

    Static authorizeWithSeed

    • Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

      -

      Parameters

      Returns Transaction

    Static createAccount

    • Generate a Transaction that creates a new Stake account

      -

      Parameters

      Returns Transaction

    Static createAccountWithSeed

    • Generate a Transaction that creates a new Stake account at an address generated with from, a seed, and the Stake programId

      -

      Parameters

      Returns Transaction

    Static deactivate

    • Generate a Transaction that deactivates Stake tokens.

      -

      Parameters

      Returns Transaction

    Static delegate

    • Generate a Transaction that delegates Stake tokens to a validator Vote PublicKey. This transaction can also be used to redelegate Stake to a new validator Vote PublicKey.

      -

      Parameters

      Returns Transaction

    Static initialize

    Static merge

    • Generate a Transaction that merges Stake accounts.

      -

      Parameters

      Returns Transaction

    Static split

    • Generate a Transaction that splits Stake tokens into another stake account

      -

      Parameters

      Returns Transaction

    Static splitWithSeed

    • Generate a Transaction that splits Stake tokens into another account derived from a base public key and seed

      -

      Parameters

      Returns Transaction

    Static withdraw

    • Generate a Transaction that withdraws deactivated Stake tokens.

      Parameters

      Returns Transaction

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Struct.html b/ts/classes/web3.Struct.html index fef9a8c6..d86f4896 100644 --- a/ts/classes/web3.Struct.html +++ b/ts/classes/web3.Struct.html @@ -1 +1 @@ -Struct | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    Index

    Constructors

    constructor

    • new Struct(properties: any): Struct
    • Parameters

      • properties: any

      Returns Struct

    Methods

    encode

    • encode(): Buffer
    • Returns Buffer

    Static decode

    • decode(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    Static decodeUnchecked

    • decodeUnchecked(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +Struct | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    Index

    Constructors

    • new Struct(properties: any): Struct
    • Parameters

      • properties: any

      Returns Struct

    Methods

    • encode(): Buffer
    • Returns Buffer

    • decode(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    • decodeUnchecked(data: Buffer): any
    • Parameters

      • data: Buffer

      Returns any

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.SystemInstruction.html b/ts/classes/web3.SystemInstruction.html index 94a75945..67a5a219 100644 --- a/ts/classes/web3.SystemInstruction.html +++ b/ts/classes/web3.SystemInstruction.html @@ -1,29 +1,29 @@ -SystemInstruction | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +SystemInstruction | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    System Instruction class

    -

    Hierarchy

    • SystemInstruction

    Index

    Constructors

    constructor

    Methods

    Static decodeAllocate

    • +

    Hierarchy

    • SystemInstruction

    Index

    Constructors

    Methods

    • Decode an allocate system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AllocateParams

    Static decodeAllocateWithSeed

    • Decode an allocate with seed system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AllocateWithSeedParams

    Static decodeAssign

    • Decode an assign system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AssignParams

    Static decodeAssignWithSeed

    • Decode an assign with seed system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AssignWithSeedParams

    Static decodeCreateAccount

    • Decode a create account system instruction and retrieve the instruction params.

      -

      Parameters

      Returns CreateAccountParams

    Static decodeCreateWithSeed

    Static decodeInstructionType

    Static decodeNonceAdvance

    • Decode a nonce advance system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AdvanceNonceParams

    Static decodeNonceAuthorize

    • Decode a nonce authorize system instruction and retrieve the instruction params.

      -

      Parameters

      Returns AuthorizeNonceParams

    Static decodeNonceInitialize

    • Decode a nonce initialize system instruction and retrieve the instruction params.

      -

      Parameters

      Returns InitializeNonceParams

    Static decodeNonceWithdraw

    • Decode a nonce withdraw system instruction and retrieve the instruction params.

      -

      Parameters

      Returns WithdrawNonceParams

    Static decodeTransfer

    • Decode a transfer system instruction and retrieve the instruction params.

      -

      Parameters

      Returns TransferParams

    Static decodeTransferWithSeed

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.SystemProgram.html b/ts/classes/web3.SystemProgram.html index 29234332..f0095e27 100644 --- a/ts/classes/web3.SystemProgram.html +++ b/ts/classes/web3.SystemProgram.html @@ -1,27 +1,27 @@ -SystemProgram | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +SystemProgram | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Factory class for transactions to interact with the System program

    -

    Hierarchy

    • SystemProgram

    Index

    Constructors

    constructor

    Properties

    Static programId

    programId: PublicKey
    +

    Hierarchy

    • SystemProgram

    Index

    Constructors

    Properties

    programId: PublicKey

    Public key that identifies the System program

    -

    Methods

    Static allocate

    • +

    Methods

    Static assign

    Static createAccount

    Static createAccountWithSeed

    • Generate a transaction instruction that creates a new account at an address generated with from, a seed, and programId

      -

      Parameters

      Returns TransactionInstruction

    Static createNonceAccount

    Static nonceAdvance

    Static nonceAuthorize

    • Generate a transaction instruction that authorizes a new PublicKey as the authority on a Nonce account.

      -

      Parameters

      Returns TransactionInstruction

    Static nonceInitialize

    Static nonceWithdraw

    • Generate a transaction instruction that withdraws lamports from a Nonce account

      -

      Parameters

      Returns TransactionInstruction

    Static transfer

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.Transaction.html b/ts/classes/web3.Transaction.html index 81ccb93e..d749b217 100644 --- a/ts/classes/web3.Transaction.html +++ b/ts/classes/web3.Transaction.html @@ -1,46 +1,46 @@ -Transaction | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Transaction | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Transaction class

    -

    Hierarchy

    • Transaction

    Index

    Constructors

    constructor

    • +

    Hierarchy

    • Transaction

    Index

    Constructors

    Properties

    Optional feePayer

    feePayer?: PublicKey
    +

    Parameters

    Returns Transaction

    Properties

    feePayer?: PublicKey

    The transaction fee payer

    -

    instructions

    instructions: TransactionInstruction[]
    +
    instructions: TransactionInstruction[]

    The instructions to atomically execute

    -

    Optional nonceInfo

    nonceInfo?: NonceInformation
    +
    nonceInfo?: NonceInformation

    Optional Nonce information. If populated, transaction will use a durable Nonce hash instead of a recentBlockhash. Must be populated by the caller

    -

    Optional recentBlockhash

    recentBlockhash?: string
    +
    recentBlockhash?: string

    A recent transaction id. Must be populated by the caller

    -

    signatures

    signatures: SignaturePubkeyPair[]
    +
    signatures: SignaturePubkeyPair[]

    Signatures for the transaction. Typically created by invoking the sign() method

    -

    Accessors

    signature

    • get signature(): null | Buffer
    • +

    Accessors

    • get signature(): null | Buffer
    • The first (payer) Transaction signature

      -

      Returns null | Buffer

    Methods

    add

    • +

      Returns null | Buffer

    Methods

    addSignature

    • addSignature(pubkey: PublicKey, signature: Buffer): void
    • addSignature(pubkey: PublicKey, signature: Buffer): void
    • Add an externally created signature to a transaction. The public key must correspond to either the fee payer or a signer account in the transaction instructions.

      -

      Parameters

      Returns void

    compileMessage

    • +

      Parameters

      Returns void

    • Compile transaction data

      -

      Returns Message

    partialSign

    • partialSign(...signers: Signer[]): void
    • +

      Returns Message

    • partialSign(...signers: Signer[]): void
    • Partially sign a transaction with the specified accounts. All accounts must correspond to either the fee payer or a signer account in the transaction instructions.

      All the caveats from the sign method apply to partialSign

      -

      Parameters

      Returns void

    serialize

    • +

      Parameters

      Returns void

    • Serialize the Transaction in the wire format.

      -

      Parameters

      Returns Buffer

    serializeMessage

    • serializeMessage(): Buffer
    • +

      Parameters

      Returns Buffer

    • serializeMessage(): Buffer
    • Get a buffer of the Transaction data that need to be covered by signatures

      -

      Returns Buffer

    setSigners

    • +

      Returns Buffer

    • Specify the public keys which will be used to sign the Transaction. The first signer will be used as the transaction fee payer account.

      Signatures can be added with either partialSign or addSignature

      deprecated

      Deprecated since v0.84.0. Only the fee payer needs to be specified and it can be set in the Transaction constructor or with the feePayer property.

      -

      Parameters

      Returns void

    sign

    • sign(...signers: Signer[]): void
    • +

      Parameters

      Returns void

    • sign(...signers: Signer[]): void
    • Sign the Transaction with the specified signers. Multiple signatures may be applied to a Transaction. The first signature is considered "primary" and is used identify and confirm transactions.

      @@ -50,10 +50,10 @@ as the transaction fee payer account.

      as doing so may invalidate the signature and cause the Transaction to be rejected.

      The Transaction must be assigned a valid recentBlockhash before invoking this method

      -

      Parameters

      Returns void

    verifySignatures

    • verifySignatures(): boolean
    • +

      Parameters

      Returns void

    • verifySignatures(): boolean
    • Verify signatures of a complete, signed Transaction

      -

      Returns boolean

    Static from

    • from(buffer: number[] | Uint8Array | Buffer): Transaction
    • +

      Returns boolean

    • from(buffer: number[] | Uint8Array | Buffer): Transaction
    • Parse a wire transaction into a Transaction object.

      -

      Parameters

      • buffer: number[] | Uint8Array | Buffer

      Returns Transaction

    Static populate

    • +

      Parameters

      • buffer: number[] | Uint8Array | Buffer

      Returns Transaction

    • Populate Transaction object from message and signatures

      Parameters

      • message: Message
      • Optional signatures: string[]

      Returns Transaction

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.TransactionInstruction.html b/ts/classes/web3.TransactionInstruction.html index 44a36630..e33bd235 100644 --- a/ts/classes/web3.TransactionInstruction.html +++ b/ts/classes/web3.TransactionInstruction.html @@ -1,10 +1,10 @@ -TransactionInstruction | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +TransactionInstruction | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Transaction Instruction class

    -

    Hierarchy

    • TransactionInstruction

    Index

    Constructors

    Properties

    Constructors

    constructor

    Properties

    data

    data: Buffer
    +

    Hierarchy

    • TransactionInstruction

    Index

    Constructors

    Properties

    Constructors

    Properties

    data: Buffer

    Program input

    -

    keys

    keys: AccountMeta[]
    +
    keys: AccountMeta[]

    Public keys to include in this transaction Boolean represents whether this pubkey needs to sign the transaction

    -

    programId

    programId: PublicKey
    +
    programId: PublicKey

    Program Id to execute

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/classes/web3.ValidatorInfo.html b/ts/classes/web3.ValidatorInfo.html index 4a43c080..55fa87ae 100644 --- a/ts/classes/web3.ValidatorInfo.html +++ b/ts/classes/web3.ValidatorInfo.html @@ -1,16 +1,16 @@ -ValidatorInfo | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +ValidatorInfo | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    ValidatorInfo class

    -

    Hierarchy

    • ValidatorInfo

    Index

    Constructors

    Properties

    Methods

    Constructors

    constructor

    • +

    Hierarchy

    • ValidatorInfo

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Construct a valid ValidatorInfo

      Parameters

      • key: PublicKey

        validator public key

      • info: Info

        validator information

        -

      Returns ValidatorInfo

    Properties

    info

    info: Info
    +

    Returns ValidatorInfo

    Properties

    info: Info

    validator information

    -

    key

    +

    validator public key

    -

    Methods

    Static fromConfigData

    • fromConfigData(buffer: number[] | Uint8Array | Buffer): null | ValidatorInfo
    • +

    Methods

    • fromConfigData(buffer: number[] | Uint8Array | Buffer): null | ValidatorInfo

    Type parameters

    • IDL: Idl = Idl

    • I: IdlInstruction = IDL["instructions"][number]

    MethodsNamespace

    MethodsNamespace<IDL, I>: MakeMethodsNamespace<IDL, I>

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    RpcFn

    RpcFn<IDL, I>: InstructionContextFn<IDL, I, Promise<TransactionSignature>>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: IdlInstruction = IDL["instructions"][number]

    MethodsNamespace<IDL, I>: MakeMethodsNamespace<IDL, I>

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    RpcFn<IDL, I>: InstructionContextFn<IDL, I, Promise<TransactionSignature>>

    RpcFn is a single RPC method generated from an IDL, sending a transaction paid for and signed by the configured provider.

    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    RpcNamespace

    RpcNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<TransactionSignature>>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    RpcNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<TransactionSignature>>

    The namespace provides async methods to send signed transactions for each non-state method on Anchor program.

    Keys are method names, values are RPC functions returning a @@ -106,12 +106,12 @@ Always the last parameter in the method call.

    To send a transaction invoking the increment method above,

    const txSignature = await program.rpc.increment({
    accounts: {
    counter,
    authority,
    },
    });
    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SimulateFn

    SimulateFn<IDL, I>: InstructionContextFn<IDL, I, Promise<SimulateResponse<NullableEvents<IDL>, IdlTypes<IDL>>>>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SimulateFn<IDL, I>: InstructionContextFn<IDL, I, Promise<SimulateResponse<NullableEvents<IDL>, IdlTypes<IDL>>>>

    SimulateFn is a single method generated from an IDL. It simulates a method against a cluster configured by the provider, returning a list of all the events and raw logs that were emitted during the execution of the method.

    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SimulateNamespace

    SimulateNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<SimulateResponse<NullableEvents<IDL>, IdlTypes<IDL>>>>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SimulateNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<SimulateResponse<NullableEvents<IDL>, IdlTypes<IDL>>>>

    The namespace provides functions to simulate transactions for each method of a program, returning a list of deserialized events and raw program logs.

    @@ -141,11 +141,11 @@ Always the last parameter in the method call.

    To simulate the increment method above,

    const events = await program.simulate.increment({
    accounts: {
    counter,
    },
    });
    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SplToken

    SplToken: { accounts: [{ name: "mint"; type: { fields: [{ name: "mintAuthority"; type: { coption: "publicKey" } }, { name: "supply"; type: "u64" }, { name: "decimals"; type: "u8" }, { name: "isInitialized"; type: "bool" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }, { name: "token"; type: { fields: [{ name: "mint"; type: "publicKey" }, { name: "authority"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "delegate"; type: { coption: "publicKey" } }, { name: "state"; type: "u8" }, { name: "isNative"; type: { coption: "u64" } }, { name: "delegatedAmount"; type: "u64" }, { name: "closeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }]; instructions: [{ accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "authority" }, { isMut: false; isSigner: false; name: "rent" }]; args: []; name: "initializeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "transfer" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "approve" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "revoke" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "authorityType"; type: "u8" }, { name: "newAuthority"; type: { coption: "publicKey" } }]; name: "setAuthority" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "mintTo" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "burn" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: false; name: "authority" }]; args: []; name: "closeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "freezeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "thawAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "transferChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "approveChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "mintToChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "burnChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount2" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: []; name: "syncNative" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount3" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig2" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint2" }]; name: "spl_token"; version: "0.1.0" }
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    SplToken: { accounts: [{ name: "mint"; type: { fields: [{ name: "mintAuthority"; type: { coption: "publicKey" } }, { name: "supply"; type: "u64" }, { name: "decimals"; type: "u8" }, { name: "isInitialized"; type: "bool" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }, { name: "token"; type: { fields: [{ name: "mint"; type: "publicKey" }, { name: "authority"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "delegate"; type: { coption: "publicKey" } }, { name: "state"; type: "u8" }, { name: "isNative"; type: { coption: "u64" } }, { name: "delegatedAmount"; type: "u64" }, { name: "closeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }]; instructions: [{ accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "authority" }, { isMut: false; isSigner: false; name: "rent" }]; args: []; name: "initializeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "transfer" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "approve" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "revoke" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "authorityType"; type: "u8" }, { name: "newAuthority"; type: { coption: "publicKey" } }]; name: "setAuthority" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "mintTo" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "burn" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: false; name: "authority" }]; args: []; name: "closeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "freezeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "thawAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "transferChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "approveChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "mintToChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "burnChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount2" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: []; name: "syncNative" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount3" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig2" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint2" }]; name: "spl_token"; version: "0.1.0" }

    SplToken IDL.

    -

    Type declaration

    • accounts: [{ name: "mint"; type: { fields: [{ name: "mintAuthority"; type: { coption: "publicKey" } }, { name: "supply"; type: "u64" }, { name: "decimals"; type: "u8" }, { name: "isInitialized"; type: "bool" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }, { name: "token"; type: { fields: [{ name: "mint"; type: "publicKey" }, { name: "authority"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "delegate"; type: { coption: "publicKey" } }, { name: "state"; type: "u8" }, { name: "isNative"; type: { coption: "u64" } }, { name: "delegatedAmount"; type: "u64" }, { name: "closeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }]
    • instructions: [{ accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "authority" }, { isMut: false; isSigner: false; name: "rent" }]; args: []; name: "initializeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "transfer" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "approve" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "revoke" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "authorityType"; type: "u8" }, { name: "newAuthority"; type: { coption: "publicKey" } }]; name: "setAuthority" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "mintTo" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "burn" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: false; name: "authority" }]; args: []; name: "closeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "freezeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "thawAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "transferChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "approveChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "mintToChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "burnChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount2" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: []; name: "syncNative" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount3" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig2" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint2" }]
    • name: "spl_token"
    • version: "0.1.0"

    Subscription

    Subscription: { ee: EventEmitter; listener: number }

    Type declaration

    • ee: EventEmitter
    • listener: number

    TransactionFn

    TransactionFn<IDL, I>: InstructionContextFn<IDL, I, Transaction>
    +

    Type declaration

    • accounts: [{ name: "mint"; type: { fields: [{ name: "mintAuthority"; type: { coption: "publicKey" } }, { name: "supply"; type: "u64" }, { name: "decimals"; type: "u8" }, { name: "isInitialized"; type: "bool" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }, { name: "token"; type: { fields: [{ name: "mint"; type: "publicKey" }, { name: "authority"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "delegate"; type: { coption: "publicKey" } }, { name: "state"; type: "u8" }, { name: "isNative"; type: { coption: "u64" } }, { name: "delegatedAmount"; type: "u64" }, { name: "closeAuthority"; type: { coption: "publicKey" } }]; kind: "struct" } }]
    • instructions: [{ accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "authority" }, { isMut: false; isSigner: false; name: "rent" }]; args: []; name: "initializeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "transfer" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "approve" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "revoke" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "authorityType"; type: "u8" }, { name: "newAuthority"; type: { coption: "publicKey" } }]; name: "setAuthority" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "mintTo" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }]; name: "burn" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: false; name: "authority" }]; args: []; name: "closeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "freezeAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: []; name: "thawAccount" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "destination" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "transferChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "delegate" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "approveChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }, { isMut: true; isSigner: false; name: "to" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "mintToChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "source" }, { isMut: true; isSigner: false; name: "mint" }, { isMut: false; isSigner: true; name: "authority" }]; args: [{ name: "amount"; type: "u64" }, { name: "decimals"; type: "u8" }]; name: "burnChecked" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }, { isMut: false; isSigner: false; name: "rent" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount2" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: []; name: "syncNative" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }, { isMut: false; isSigner: false; name: "mint" }]; args: [{ name: "authority"; type: "publicKey" }]; name: "initializeAccount3" }, { accounts: [{ isMut: true; isSigner: false; name: "account" }]; args: [{ name: "m"; type: "u8" }]; name: "initializeMultisig2" }, { accounts: [{ isMut: true; isSigner: false; name: "mint" }]; args: [{ name: "decimals"; type: "u8" }, { name: "mintAuthority"; type: "publicKey" }, { name: "freezeAuthority"; type: { coption: "publicKey" } }]; name: "initializeMint2" }]
    • name: "spl_token"
    • version: "0.1.0"
    Subscription: { ee: EventEmitter; listener: number }

    Type declaration

    • ee: EventEmitter
    • listener: number
    TransactionFn<IDL, I>: InstructionContextFn<IDL, I, Transaction>

    Tx is a function to create a Transaction for a given program instruction.

    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    TransactionNamespace

    TransactionNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Transaction>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    TransactionNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Transaction>

    The namespace provides functions to build Transaction objects for each method of a program.

    @@ -171,14 +171,14 @@ Always the last parameter in the method call.

    To create an instruction for the increment method above,

    const tx = await program.transaction.increment({
    accounts: {
    counter,
    },
    });
    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    ViewFn

    ViewFn<IDL, I>: InstructionContextFn<IDL, I, Promise<any>>
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    ViewFn<IDL, I>: InstructionContextFn<IDL, I, Promise<any>>

    ViewFn is a single method generated from an IDL. It simulates a method against a cluster configured by the provider, and then parses the events and extracts return data from the raw logs emitted during the simulation.

    -

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    ViewNamespace

    ViewNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<any>>

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    Variables

    ACCOUNT_DISCRIMINATOR_SIZE

    ACCOUNT_DISCRIMINATOR_SIZE: 8 = 8
    +

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    ViewNamespace<IDL, I>: MakeInstructionsNamespace<IDL, I, Promise<any>>

    Type parameters

    • IDL: Idl = Idl

    • I: AllInstructions<IDL> = AllInstructions<IDL>

    Variables

    ACCOUNT_DISCRIMINATOR_SIZE: 8 = 8

    Number of bytes of the account discriminator.

    -

    LangErrorCode

    LangErrorCode: { AccountDidNotDeserialize: number; AccountDidNotSerialize: number; AccountDiscriminatorAlreadySet: number; AccountDiscriminatorMismatch: number; AccountDiscriminatorNotFound: number; AccountNotAssociatedTokenAccount: number; AccountNotEnoughKeys: number; AccountNotInitialized: number; AccountNotMutable: number; AccountNotProgramData: number; AccountNotSigner: number; AccountNotSystemOwned: number; AccountOwnedByWrongProgram: number; AccountSysvarMismatch: number; ConstraintAddress: number; ConstraintAssociated: number; ConstraintAssociatedInit: number; ConstraintClose: number; ConstraintExecutable: number; ConstraintHasOne: number; ConstraintMintDecimals: number; ConstraintMintFreezeAuthority: number; ConstraintMintMintAuthority: number; ConstraintMut: number; ConstraintOwner: number; ConstraintRaw: number; ConstraintRentExempt: number; ConstraintSeeds: number; ConstraintSigner: number; ConstraintSpace: number; ConstraintState: number; ConstraintTokenMint: number; ConstraintTokenOwner: number; ConstraintZero: number; DeclaredProgramIdMismatch: number; Deprecated: number; IdlInstructionInvalidProgram: number; IdlInstructionStub: number; InstructionDidNotDeserialize: number; InstructionDidNotSerialize: number; InstructionFallbackNotFound: number; InstructionMissing: number; InvalidProgramExecutable: number; InvalidProgramId: number; RequireEqViolated: number; RequireGtViolated: number; RequireGteViolated: number; RequireKeysEqViolated: number; RequireKeysNeqViolated: number; RequireNeqViolated: number; RequireViolated: number; StateInvalidAddress: number } = ...

    Type declaration

    • AccountDidNotDeserialize: number
    • AccountDidNotSerialize: number
    • AccountDiscriminatorAlreadySet: number
    • AccountDiscriminatorMismatch: number
    • AccountDiscriminatorNotFound: number
    • AccountNotAssociatedTokenAccount: number
    • AccountNotEnoughKeys: number
    • AccountNotInitialized: number
    • AccountNotMutable: number
    • AccountNotProgramData: number
    • AccountNotSigner: number
    • AccountNotSystemOwned: number
    • AccountOwnedByWrongProgram: number
    • AccountSysvarMismatch: number
    • ConstraintAddress: number
    • ConstraintAssociated: number
    • ConstraintAssociatedInit: number
    • ConstraintClose: number
    • ConstraintExecutable: number
    • ConstraintHasOne: number
    • ConstraintMintDecimals: number
    • ConstraintMintFreezeAuthority: number
    • ConstraintMintMintAuthority: number
    • ConstraintMut: number
    • ConstraintOwner: number
    • ConstraintRaw: number
    • ConstraintRentExempt: number
    • ConstraintSeeds: number
    • ConstraintSigner: number
    • ConstraintSpace: number
    • ConstraintState: number
    • ConstraintTokenMint: number
    • ConstraintTokenOwner: number
    • ConstraintZero: number
    • DeclaredProgramIdMismatch: number
    • Deprecated: number
    • IdlInstructionInvalidProgram: number
    • IdlInstructionStub: number
    • InstructionDidNotDeserialize: number
    • InstructionDidNotSerialize: number
    • InstructionFallbackNotFound: number
    • InstructionMissing: number
    • InvalidProgramExecutable: number
    • InvalidProgramId: number
    • RequireEqViolated: number
    • RequireGtViolated: number
    • RequireGteViolated: number
    • RequireKeysEqViolated: number
    • RequireKeysNeqViolated: number
    • RequireNeqViolated: number
    • RequireViolated: number
    • StateInvalidAddress: number

    LangErrorMessage

    LangErrorMessage: Map<number, string> = ...

    workspace

    workspace: any

    Functions

    eventDiscriminator

    • eventDiscriminator(name: string): Buffer

    getProvider

    LangErrorCode: { AccountDidNotDeserialize: number; AccountDidNotSerialize: number; AccountDiscriminatorAlreadySet: number; AccountDiscriminatorMismatch: number; AccountDiscriminatorNotFound: number; AccountNotAssociatedTokenAccount: number; AccountNotEnoughKeys: number; AccountNotInitialized: number; AccountNotMutable: number; AccountNotProgramData: number; AccountNotSigner: number; AccountNotSystemOwned: number; AccountOwnedByWrongProgram: number; AccountSysvarMismatch: number; ConstraintAddress: number; ConstraintAssociated: number; ConstraintAssociatedInit: number; ConstraintClose: number; ConstraintExecutable: number; ConstraintHasOne: number; ConstraintMintDecimals: number; ConstraintMintFreezeAuthority: number; ConstraintMintMintAuthority: number; ConstraintMut: number; ConstraintOwner: number; ConstraintRaw: number; ConstraintRentExempt: number; ConstraintSeeds: number; ConstraintSigner: number; ConstraintSpace: number; ConstraintState: number; ConstraintTokenMint: number; ConstraintTokenOwner: number; ConstraintZero: number; DeclaredProgramIdMismatch: number; Deprecated: number; IdlInstructionInvalidProgram: number; IdlInstructionStub: number; InstructionDidNotDeserialize: number; InstructionDidNotSerialize: number; InstructionFallbackNotFound: number; InstructionMissing: number; InvalidProgramExecutable: number; InvalidProgramId: number; RequireEqViolated: number; RequireGtViolated: number; RequireGteViolated: number; RequireKeysEqViolated: number; RequireKeysNeqViolated: number; RequireNeqViolated: number; RequireViolated: number; StateInvalidAddress: number } = ...

    Type declaration

    • AccountDidNotDeserialize: number
    • AccountDidNotSerialize: number
    • AccountDiscriminatorAlreadySet: number
    • AccountDiscriminatorMismatch: number
    • AccountDiscriminatorNotFound: number
    • AccountNotAssociatedTokenAccount: number
    • AccountNotEnoughKeys: number
    • AccountNotInitialized: number
    • AccountNotMutable: number
    • AccountNotProgramData: number
    • AccountNotSigner: number
    • AccountNotSystemOwned: number
    • AccountOwnedByWrongProgram: number
    • AccountSysvarMismatch: number
    • ConstraintAddress: number
    • ConstraintAssociated: number
    • ConstraintAssociatedInit: number
    • ConstraintClose: number
    • ConstraintExecutable: number
    • ConstraintHasOne: number
    • ConstraintMintDecimals: number
    • ConstraintMintFreezeAuthority: number
    • ConstraintMintMintAuthority: number
    • ConstraintMut: number
    • ConstraintOwner: number
    • ConstraintRaw: number
    • ConstraintRentExempt: number
    • ConstraintSeeds: number
    • ConstraintSigner: number
    • ConstraintSpace: number
    • ConstraintState: number
    • ConstraintTokenMint: number
    • ConstraintTokenOwner: number
    • ConstraintZero: number
    • DeclaredProgramIdMismatch: number
    • Deprecated: number
    • IdlInstructionInvalidProgram: number
    • IdlInstructionStub: number
    • InstructionDidNotDeserialize: number
    • InstructionDidNotSerialize: number
    • InstructionFallbackNotFound: number
    • InstructionMissing: number
    • InvalidProgramExecutable: number
    • InvalidProgramId: number
    • RequireEqViolated: number
    • RequireGtViolated: number
    • RequireGteViolated: number
    • RequireKeysEqViolated: number
    • RequireKeysNeqViolated: number
    • RequireNeqViolated: number
    • RequireViolated: number
    • StateInvalidAddress: number
    LangErrorMessage: Map<number, string> = ...
    workspace: any

    Functions

    • eventDiscriminator(name: string): Buffer

    parseIdlErrors

    • parseIdlErrors(idl: Idl): Map<number, string>

    setProvider

    • parseIdlErrors(idl: Idl): Map<number, string>

    splitArgsAndCtx

    • splitArgsAndCtx(idlIx: IdlInstruction, args: any[]): [any[], Context]

    stateDiscriminator

    • stateDiscriminator(name: string): Promise<Buffer>

    toInstruction

    • toInstruction(idlIx: IdlInstruction, ...args: any[]): {}

    translateAddress

    translateError

    • translateError(err: any, idlErrors: Map<number, string>): any
    • Parameters

      • err: any
      • idlErrors: Map<number, string>

      Returns any

    validateAccounts

    • validateAccounts(ixAccounts: IdlAccountItem[], accounts?: Accounts<IdlAccountItem>): void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    Parameters

    Returns void

    • splitArgsAndCtx(idlIx: IdlInstruction, args: any[]): [any[], Context]
    • stateDiscriminator(name: string): Promise<Buffer>
    • toInstruction(idlIx: IdlInstruction, ...args: any[]): {}
    • translateError(err: any, idlErrors: Map<number, string>): any
    • Parameters

      • err: any
      • idlErrors: Map<number, string>

      Returns any

    • validateAccounts(ixAccounts: IdlAccountItem[], accounts?: Accounts<IdlAccountItem>): void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/AccountsCoder.html b/ts/interfaces/AccountsCoder.html index 2eb59a92..62738a8a 100644 --- a/ts/interfaces/AccountsCoder.html +++ b/ts/interfaces/AccountsCoder.html @@ -1 +1 @@ -AccountsCoder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Type parameters

    • A: string = string

    Hierarchy

    • AccountsCoder

    Implemented by

    Index

    Methods

    decode

    • decode<T>(accountName: A, ix: Buffer): T

    decodeUnchecked

    • decodeUnchecked<T>(accountName: A, ix: Buffer): T

    encode

    • encode<T>(accountName: A, account: T): Promise<Buffer>
    • Type parameters

      • T = any

      Parameters

      • accountName: A
      • account: T

      Returns Promise<Buffer>

    memcmp

    • memcmp(accountName: A, appendData?: Buffer): any

    size

    • size(idlAccount: IdlTypeDef): number

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +AccountsCoder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Type parameters

    • A: string = string

    Hierarchy

    • AccountsCoder

    Implemented by

    Index

    Methods

    • decode<T>(accountName: A, ix: Buffer): T
    • decodeUnchecked<T>(accountName: A, ix: Buffer): T
    • encode<T>(accountName: A, account: T): Promise<Buffer>
    • Type parameters

      • T = any

      Parameters

      • accountName: A
      • account: T

      Returns Promise<Buffer>

    • memcmp(accountName: A, appendData?: Buffer): any
    • size(idlAccount: IdlTypeDef): number

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/BN.MPrime.html b/ts/interfaces/BN.MPrime.html index e13302c7..f9cc1f7a 100644 --- a/ts/interfaces/BN.MPrime.html +++ b/ts/interfaces/BN.MPrime.html @@ -1 +1 @@ -MPrime | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • MPrime

    Index

    Properties

    Properties

    k

    k: BN

    n

    n: number

    name

    name: string

    p

    p: BN

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +MPrime | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • MPrime

    Index

    Properties

    Properties

    k: BN
    n: number
    name: string
    p: BN

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/BN.ReductionContext.html b/ts/interfaces/BN.ReductionContext.html index 162e3e39..b4882113 100644 --- a/ts/interfaces/BN.ReductionContext.html +++ b/ts/interfaces/BN.ReductionContext.html @@ -1 +1 @@ -ReductionContext | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • ReductionContext

    Indexable

    [key: string]: any

    Index

    Properties

    Properties

    m

    m: number

    prime

    prime: MPrime

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +ReductionContext | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • ReductionContext

    Indexable

    [key: string]: any

    Index

    Properties

    Properties

    m: number
    prime: MPrime

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/Coder.html b/ts/interfaces/Coder.html index d0003864..dceb0fc7 100644 --- a/ts/interfaces/Coder.html +++ b/ts/interfaces/Coder.html @@ -1,11 +1,11 @@ -Coder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Coder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Coder provides a facade for encoding and decoding all IDL related objects.

    -

    Hierarchy

    • Coder

    Implemented by

    Index

    Properties

    Readonly accounts

    accounts: AccountsCoder<string>
    +

    Hierarchy

    • Coder

    Implemented by

    Index

    Properties

    accounts: AccountsCoder<string>

    Account coder.

    -

    Readonly events

    events: EventCoder
    +
    events: EventCoder

    Coder for events.

    -

    Readonly instruction

    instruction: InstructionCoder
    +
    instruction: InstructionCoder

    Instruction coder.

    -

    Readonly state

    state: StateCoder
    +
    state: StateCoder

    Coder for state structs.

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/EventCoder.html b/ts/interfaces/EventCoder.html index b339692e..2e381381 100644 --- a/ts/interfaces/EventCoder.html +++ b/ts/interfaces/EventCoder.html @@ -1 +1 @@ -EventCoder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • EventCoder

    Implemented by

    Index

    Methods

    Methods

    decode

    • decode<E, T>(log: string): null | Event<E, T>
    • Type parameters

      • E: IdlEvent = IdlEvent

      • T = Record<string, string>

      Parameters

      • log: string

      Returns null | Event<E, T>

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +EventCoder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • EventCoder

    Implemented by

    Index

    Methods

    Methods

    • decode<E, T>(log: string): null | Event<E, T>
    • Type parameters

      • E: IdlEvent = IdlEvent

      • T = Record<string, string>

      Parameters

      • log: string

      Returns null | Event<E, T>

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/InstructionCoder.html b/ts/interfaces/InstructionCoder.html index f275cb9e..df34da82 100644 --- a/ts/interfaces/InstructionCoder.html +++ b/ts/interfaces/InstructionCoder.html @@ -1 +1 @@ -InstructionCoder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • InstructionCoder

    Implemented by

    Index

    Methods

    encode

    • encode(ixName: string, ix: any): Buffer

    encodeState

    • encodeState(ixName: string, ix: any): Buffer

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +InstructionCoder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • InstructionCoder

    Implemented by

    Index

    Methods

    • encode(ixName: string, ix: any): Buffer
    • encodeState(ixName: string, ix: any): Buffer

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/Provider.html b/ts/interfaces/Provider.html index 5e4fe770..4ecb1870 100644 --- a/ts/interfaces/Provider.html +++ b/ts/interfaces/Provider.html @@ -1 +1 @@ -Provider | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Provider

    Implemented by

    Index

    Properties

    Readonly connection

    connection: Connection

    Methods

    Optional send

    Optional sendAll

    Optional sendAndConfirm

    Optional simulate

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +Provider | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • Provider

    Implemented by

    Index

    Properties

    connection: Connection

    Methods

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/StateCoder.html b/ts/interfaces/StateCoder.html index c389f8d8..c437de89 100644 --- a/ts/interfaces/StateCoder.html +++ b/ts/interfaces/StateCoder.html @@ -1 +1 @@ -StateCoder | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • StateCoder

    Index

    Methods

    decode

    • decode<T>(ix: Buffer): T

    encode

    • encode<T>(name: string, account: T): Promise<Buffer>
    • Type parameters

      • T = any

      Parameters

      • name: string
      • account: T

      Returns Promise<Buffer>

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +StateCoder | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Hierarchy

    • StateCoder

    Index

    Methods

    • decode<T>(ix: Buffer): T
    • encode<T>(name: string, account: T): Promise<Buffer>
    • Type parameters

      • T = any

      Parameters

      • name: string
      • account: T

      Returns Promise<Buffer>

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/web3.Ed25519Keypair.html b/ts/interfaces/web3.Ed25519Keypair.html index d7159b13..b5703fa7 100644 --- a/ts/interfaces/web3.Ed25519Keypair.html +++ b/ts/interfaces/web3.Ed25519Keypair.html @@ -1,3 +1,3 @@ -Ed25519Keypair | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Ed25519Keypair | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Ed25519 Keypair

    -

    Hierarchy

    • Ed25519Keypair

    Index

    Properties

    publicKey

    publicKey: Uint8Array

    secretKey

    secretKey: Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    Hierarchy

    • Ed25519Keypair

    Index

    Properties

    publicKey: Uint8Array
    secretKey: Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/web3.FeeCalculator.html b/ts/interfaces/web3.FeeCalculator.html index 4b631468..9f741f25 100644 --- a/ts/interfaces/web3.FeeCalculator.html +++ b/ts/interfaces/web3.FeeCalculator.html @@ -1,5 +1,5 @@ -FeeCalculator | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +FeeCalculator | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Calculator for transaction fees.

    -

    Hierarchy

    • FeeCalculator

    Index

    Properties

    lamportsPerSignature

    lamportsPerSignature: number
    +

    Hierarchy

    • FeeCalculator

    Index

    Properties

    lamportsPerSignature: number

    Cost in lamports to validate a signature.

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/interfaces/web3.Signer.html b/ts/interfaces/web3.Signer.html index 14bf7d8f..46ebcf86 100644 --- a/ts/interfaces/web3.Signer.html +++ b/ts/interfaces/web3.Signer.html @@ -1,3 +1,3 @@ -Signer | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu
    +Signer | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Keypair signer interface

    -

    Hierarchy

    • Signer

    Index

    Properties

    publicKey

    publicKey: PublicKey

    secretKey

    secretKey: Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    Hierarchy

    • Signer

    Index

    Properties

    publicKey: PublicKey
    secretKey: Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/BN.html b/ts/modules/BN.html index 4a993d1e..bb0afbbf 100644 --- a/ts/modules/BN.html +++ b/ts/modules/BN.html @@ -1 +1 @@ -BN | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Type aliases

    Endianness

    Endianness: "le" | "be"

    IPrimeName

    IPrimeName: "k256" | "p224" | "p192" | "p25519"

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +BN | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Type aliases

    Endianness: "le" | "be"
    IPrimeName: "k256" | "p224" | "p192" | "p25519"

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.bytes.base64.html b/ts/modules/utils.bytes.base64.html index 19f15755..fe6cf7a4 100644 --- a/ts/modules/utils.bytes.base64.html +++ b/ts/modules/utils.bytes.base64.html @@ -1 +1 @@ -base64 | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    decode

    • decode(data: string): Buffer

    encode

    • encode(data: Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +base64 | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    • decode(data: string): Buffer
    • encode(data: Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.bytes.bs58.html b/ts/modules/utils.bytes.bs58.html index 521f5503..c80d8837 100644 --- a/ts/modules/utils.bytes.bs58.html +++ b/ts/modules/utils.bytes.bs58.html @@ -1 +1 @@ -bs58 | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    decode

    • decode(data: string): Buffer

    encode

    • encode(data: number[] | Uint8Array | Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +bs58 | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    • decode(data: string): Buffer
    • encode(data: number[] | Uint8Array | Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.bytes.hex.html b/ts/modules/utils.bytes.hex.html index 66510560..7012fec2 100644 --- a/ts/modules/utils.bytes.hex.html +++ b/ts/modules/utils.bytes.hex.html @@ -1 +1 @@ -hex | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    decode

    • decode(data: string): Buffer

    encode

    • encode(data: Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +hex | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    • decode(data: string): Buffer
    • encode(data: Buffer): string

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.bytes.html b/ts/modules/utils.bytes.html index 01fdb08f..6c0a8afa 100644 --- a/ts/modules/utils.bytes.html +++ b/ts/modules/utils.bytes.html @@ -1 +1 @@ -bytes | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +bytes | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.bytes.utf8.html b/ts/modules/utils.bytes.utf8.html index 08ce585c..664dd8ef 100644 --- a/ts/modules/utils.bytes.utf8.html +++ b/ts/modules/utils.bytes.utf8.html @@ -1 +1 @@ -utf8 | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    decode

    • decode(array: Uint8Array): string

    encode

    • encode(input: string): Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +utf8 | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    • decode(array: Uint8Array): string
    • encode(input: string): Uint8Array

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.features.html b/ts/modules/utils.features.html index 7f4caca7..6c6f153a 100644 --- a/ts/modules/utils.features.html +++ b/ts/modules/utils.features.html @@ -1 +1 @@ -features | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    isSet

    • isSet(key: string): boolean

    set

    • set(key: string): void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +features | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    Functions

    • isSet(key: string): boolean
    • set(key: string): void

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.html b/ts/modules/utils.html index bf208c78..523e5e29 100644 --- a/ts/modules/utils.html +++ b/ts/modules/utils.html @@ -1 +1 @@ -utils | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +utils | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.publicKey.html b/ts/modules/utils.publicKey.html index cebaf28b..90eb20cf 100644 --- a/ts/modules/utils.publicKey.html +++ b/ts/modules/utils.publicKey.html @@ -1 +1 @@ -publicKey | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    associated

    createProgramAddressSync

    createWithSeedSync

    findProgramAddressSync

    • findProgramAddressSync(seeds: (Uint8Array | Buffer)[], programId: PublicKey): [PublicKey, number]

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +publicKey | @project-serum/anchor - v0.24.1
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Functions

    • findProgramAddressSync(seeds: (Uint8Array | Buffer)[], programId: PublicKey): [PublicKey, number]

    Legend

    • Constructor
    • Property
    • Method
    • Inherited constructor
    • Inherited property
    • Inherited method
    • Property
    • Method
    • Static method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/ts/modules/utils.registry.html b/ts/modules/utils.registry.html index 3a045b7f..5a5dd96e 100644 --- a/ts/modules/utils.registry.html +++ b/ts/modules/utils.registry.html @@ -1,7 +1,7 @@ -registry | @project-serum/anchor - v0.24.0
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Index

    Type aliases

    Build

    Build: { aborted: boolean; address: string; created_at: string; descriptor: string[]; docker: string; id: number; name: string; sha256: string; state: string; updated_at: string; upgrade_authority: string; verified: string; verified_slot: number }

    Type declaration

    • aborted: boolean
    • address: string
    • created_at: string
    • descriptor: string[]
    • docker: string
    • id: number
    • name: string
    • sha256: string
    • state: string
    • updated_at: string
    • upgrade_authority: string
    • verified: string
    • verified_slot: number

    ProgramData

    ProgramData: { slot: BN; upgradeAuthorityAddress: PublicKey | null }

    Type declaration

    Functions

    decodeUpgradeableLoaderState

    • decodeUpgradeableLoaderState(data: Buffer): any

    fetchData

    AccountInfo<T>: { data: T; executable: boolean; lamports: number; owner: PublicKey; rentEpoch?: number }

    Information describing an account

    Type parameters

    • T

    Type declaration

    • data: T

      Optional data assigned to the account

      @@ -14,7 +14,7 @@

      Identifier of the program that owns the account

    • Optional rentEpoch?: number

      Optional rent epoch info for account

      -

    AccountMeta

    AccountMeta: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }
    +
    AccountMeta: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }

    Account metadata used to define instructions

    Type declaration

    • isSigner: boolean

      True if an instruction requires a transaction signature matching pubkey

      @@ -22,19 +22,19 @@

      True if the pubkey can be loaded as a read-write account.

    • pubkey: PublicKey

      An account's public key

      -

    AdvanceNonceParams

    AdvanceNonceParams: { authorizedPubkey: PublicKey; noncePubkey: PublicKey }
    +
    AdvanceNonceParams: { authorizedPubkey: PublicKey; noncePubkey: PublicKey }

    Advance nonce account system instruction params

    Type declaration

    • authorizedPubkey: PublicKey

      Public key of the nonce authority

    • noncePubkey: PublicKey

      Nonce account

      -

    AllocateParams

    AllocateParams: { accountPubkey: PublicKey; space: number }
    +
    AllocateParams: { accountPubkey: PublicKey; space: number }

    Allocate account system transaction params

    Type declaration

    • accountPubkey: PublicKey

      Account to allocate

    • space: number

      Amount of space in bytes to allocate

      -

    AllocateWithSeedParams

    AllocateWithSeedParams: { accountPubkey: PublicKey; basePubkey: PublicKey; programId: PublicKey; seed: string; space: number }
    +
    AllocateWithSeedParams: { accountPubkey: PublicKey; basePubkey: PublicKey; programId: PublicKey; seed: string; space: number }

    Allocate account with seed system transaction params

    Type declaration

    • accountPubkey: PublicKey

      Account to allocate

      @@ -46,13 +46,13 @@

      Seed to use to derive the address of the allocated account

    • space: number

      Amount of space in bytes to allocate

      -

    AssignParams

    AssignParams: { accountPubkey: PublicKey; programId: PublicKey }
    +
    AssignParams: { accountPubkey: PublicKey; programId: PublicKey }

    Assign system transaction params

    Type declaration

    • accountPubkey: PublicKey

      Public key of the account which will be assigned a new owner

    • programId: PublicKey

      Public key of the program to assign as the owner

      -

    AssignWithSeedParams

    AssignWithSeedParams: { accountPubkey: PublicKey; basePubkey: PublicKey; programId: PublicKey; seed: string }
    +
    AssignWithSeedParams: { accountPubkey: PublicKey; basePubkey: PublicKey; programId: PublicKey; seed: string }

    Assign account with seed system transaction params

    Type declaration

    • accountPubkey: PublicKey

      Public key of the account which will be assigned a new owner

      @@ -62,7 +62,7 @@

      Public key of the program to assign as the owner

    • seed: string

      Seed to use to derive the address of the assigned account

      -

    AuthorizeNonceParams

    AuthorizeNonceParams: { authorizedPubkey: PublicKey; newAuthorizedPubkey: PublicKey; noncePubkey: PublicKey }
    +
    AuthorizeNonceParams: { authorizedPubkey: PublicKey; newAuthorizedPubkey: PublicKey; noncePubkey: PublicKey }

    Authorize nonce account system transaction params

    Type declaration

    • authorizedPubkey: PublicKey

      Public key of the current nonce authority

      @@ -70,15 +70,15 @@

      Public key to set as the new nonce authority

    • noncePubkey: PublicKey

      Nonce account

      -

    AuthorizeStakeParams

    AuthorizeStakeParams: { authorizedPubkey: PublicKey; custodianPubkey?: PublicKey; newAuthorizedPubkey: PublicKey; stakeAuthorizationType: StakeAuthorizationType; stakePubkey: PublicKey }
    +
    AuthorizeStakeParams: { authorizedPubkey: PublicKey; custodianPubkey?: PublicKey; newAuthorizedPubkey: PublicKey; stakeAuthorizationType: StakeAuthorizationType; stakePubkey: PublicKey }

    Authorize stake instruction params

    -

    Type declaration

    AuthorizeVoteParams

    AuthorizeVoteParams: { authorizedPubkey: PublicKey; newAuthorizedPubkey: PublicKey; voteAuthorizationType: VoteAuthorizationType; votePubkey: PublicKey }
    +

    Type declaration

    AuthorizeVoteParams: { authorizedPubkey: PublicKey; newAuthorizedPubkey: PublicKey; voteAuthorizationType: VoteAuthorizationType; votePubkey: PublicKey }

    Authorize instruction params

    Type declaration

    AuthorizeWithSeedStakeParams

    AuthorizeWithSeedStakeParams: { authorityBase: PublicKey; authorityOwner: PublicKey; authoritySeed: string; custodianPubkey?: PublicKey; newAuthorizedPubkey: PublicKey; stakeAuthorizationType: StakeAuthorizationType; stakePubkey: PublicKey }
    +
  • newAuthorizedPubkey: PublicKey
  • voteAuthorizationType: VoteAuthorizationType
  • votePubkey: PublicKey
  • AuthorizeWithSeedStakeParams: { authorityBase: PublicKey; authorityOwner: PublicKey; authoritySeed: string; custodianPubkey?: PublicKey; newAuthorizedPubkey: PublicKey; stakeAuthorizationType: StakeAuthorizationType; stakePubkey: PublicKey }

    Authorize stake instruction params using a derived key

    -

    Type declaration

    AuthorizedVoter

    AuthorizedVoter: { authorizedVoter: PublicKey; epoch: number }

    Type declaration

    BlockResponse

    BlockResponse: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; rewards?: { lamports: number; postBalance: number | null; pubkey: string; rewardType: string | null }[]; transactions: { meta: ConfirmedTransactionMeta | null; transaction: { message: Message; signatures: string[] } }[] }
    +

    Type declaration

    AuthorizedVoter: { authorizedVoter: PublicKey; epoch: number }

    Type declaration

    BlockResponse: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; rewards?: { lamports: number; postBalance: number | null; pubkey: string; rewardType: string | null }[]; transactions: { meta: ConfirmedTransactionMeta | null; transaction: { message: Message; signatures: string[] } }[] }

    A processed block fetched from the RPC API

    Type declaration

    • blockTime: number | null

      The unix timestamp of when the block was processed

      @@ -92,7 +92,7 @@

      Vector of block rewards

    • transactions: { meta: ConfirmedTransactionMeta | null; transaction: { message: Message; signatures: string[] } }[]

      Vector of transactions with status meta and original message

      -

    BlockSignatures

    BlockSignatures: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; signatures: string[] }
    +
    BlockSignatures: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; signatures: string[] }

    A Block on the ledger with signatures only

    Type declaration

    • blockTime: number | null

      The unix timestamp of when the block was processed

      @@ -104,15 +104,15 @@

      Blockhash of this block's parent

    • signatures: string[]

      Vector of signatures

      -

    BlockTimestamp

    BlockTimestamp: { slot: number; timetamp: number }

    Type declaration

    • slot: number
    • timetamp: number

    Blockhash

    Blockhash: string
    +
    BlockTimestamp: { slot: number; timetamp: number }

    Type declaration

    • slot: number
    • timetamp: number
    Blockhash: string

    Blockhash as Base58 string.

    -

    Cluster

    Cluster: "devnet" | "testnet" | "mainnet-beta"

    Commitment

    Commitment: "processed" | "confirmed" | "finalized" | "recent" | "single" | "singleGossip" | "root" | "max"
    +
    Cluster: "devnet" | "testnet" | "mainnet-beta"
    Commitment: "processed" | "confirmed" | "finalized" | "recent" | "single" | "singleGossip" | "root" | "max"

    The level of commitment desired when querying state

       'processed': Query the most recent block which has reached 1 confirmation by the connected node
       'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
       'finalized': Query the most recent block which has been finalized by the cluster
    -

    CompiledInnerInstruction

    CompiledInnerInstruction: { index: number; instructions: CompiledInstruction[] }

    Type declaration

    CompiledInstruction

    CompiledInstruction: { accounts: number[]; data: string; programIdIndex: number }
    +
    CompiledInnerInstruction: { index: number; instructions: CompiledInstruction[] }

    Type declaration

    CompiledInstruction: { accounts: number[]; data: string; programIdIndex: number }

    An instruction to execute by a program

    property

    {number} programIdIndex

    property

    {number[]} accounts

    @@ -123,7 +123,7 @@

    The program input data encoded as base 58

  • programIdIndex: number

    Index into the transaction keys array indicating the program account that executes this instruction

    -
  • ConfirmOptions

    ConfirmOptions: { commitment?: Commitment; maxRetries?: number; preflightCommitment?: Commitment; skipPreflight?: boolean }
    +
    ConfirmOptions: { commitment?: Commitment; maxRetries?: number; preflightCommitment?: Commitment; skipPreflight?: boolean }

    Options for confirming transactions

    Type declaration

    • Optional commitment?: Commitment

      desired commitment level

      @@ -133,7 +133,7 @@

      preflight commitment level

    • Optional skipPreflight?: boolean

      disable transaction verification step

      -

    ConfirmedBlock

    ConfirmedBlock: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; rewards?: { lamports: number; postBalance: number | null; pubkey: string; rewardType: string | null }[]; transactions: { meta: ConfirmedTransactionMeta | null; transaction: Transaction }[] }
    +
    ConfirmedBlock: { blockTime: number | null; blockhash: Blockhash; parentSlot: number; previousBlockhash: Blockhash; rewards?: { lamports: number; postBalance: number | null; pubkey: string; rewardType: string | null }[]; transactions: { meta: ConfirmedTransactionMeta | null; transaction: Transaction }[] }

    A ConfirmedBlock on the ledger

    Type declaration

    • blockTime: number | null

      The unix timestamp of when the block was processed

      @@ -147,7 +147,7 @@

      Vector of block rewards

    • transactions: { meta: ConfirmedTransactionMeta | null; transaction: Transaction }[]

      Vector of transactions and status metas

      -

    ConfirmedSignatureInfo

    ConfirmedSignatureInfo: { blockTime?: number | null; err: TransactionError | null; memo: string | null; signature: string; slot: number }
    +
    ConfirmedSignatureInfo: { blockTime?: number | null; err: TransactionError | null; memo: string | null; signature: string; slot: number }

    A confirmed signature with its status

    Type declaration

    • Optional blockTime?: number | null

      The unix timestamp of when the transaction was processed

      @@ -159,7 +159,7 @@

      the transaction signature

    • slot: number

      when the transaction was processed

      -

    ConfirmedSignaturesForAddress2Options

    ConfirmedSignaturesForAddress2Options: { before?: TransactionSignature; limit?: number; until?: TransactionSignature }
    +
    ConfirmedSignaturesForAddress2Options: { before?: TransactionSignature; limit?: number; until?: TransactionSignature }

    Options for getConfirmedSignaturesForAddress2

    Type declaration

    • Optional before?: TransactionSignature

      Start searching backwards from this transaction signature.

      @@ -168,7 +168,7 @@

      Maximum transaction signatures to return (between 1 and 1,000, default: 1,000).

    • Optional until?: TransactionSignature

      Search until this transaction signature is reached, if found before limit.

      -

    ConfirmedTransaction

    ConfirmedTransaction: { blockTime?: number | null; meta: ConfirmedTransactionMeta | null; slot: number; transaction: Transaction }
    +
    ConfirmedTransaction: { blockTime?: number | null; meta: ConfirmedTransactionMeta | null; slot: number; transaction: Transaction }

    A confirmed transaction on the ledger

    Type declaration

    • Optional blockTime?: number | null

      The unix timestamp of when the transaction was processed

      @@ -178,7 +178,7 @@

      The slot during which the transaction was processed

    • transaction: Transaction

      The details of the transaction

      -

    ConfirmedTransactionMeta

    ConfirmedTransactionMeta: { err: TransactionError | null; fee: number; innerInstructions?: CompiledInnerInstruction[] | null; logMessages?: string[] | null; postBalances: number[]; postTokenBalances?: TokenBalance[] | null; preBalances: number[]; preTokenBalances?: TokenBalance[] | null }
    +
    ConfirmedTransactionMeta: { err: TransactionError | null; fee: number; innerInstructions?: CompiledInnerInstruction[] | null; logMessages?: string[] | null; postBalances: number[]; postTokenBalances?: TokenBalance[] | null; preBalances: number[]; preTokenBalances?: TokenBalance[] | null }

    Metadata for a confirmed transaction on the ledger

    Type declaration

    • err: TransactionError | null

      The error result of transaction processing

      @@ -196,7 +196,7 @@

      The balances of the transaction accounts before processing

    • Optional preTokenBalances?: TokenBalance[] | null

      The token balances of the transaction accounts before processing

      -

    ConnectionConfig

    ConnectionConfig: { commitment?: Commitment; confirmTransactionInitialTimeout?: number; disableRetryOnRateLimit?: boolean; fetchMiddleware?: FetchMiddleware; httpHeaders?: HttpHeaders; wsEndpoint?: string }
    +
    ConnectionConfig: { commitment?: Commitment; confirmTransactionInitialTimeout?: number; disableRetryOnRateLimit?: boolean; fetchMiddleware?: FetchMiddleware; httpHeaders?: HttpHeaders; wsEndpoint?: string }

    Configuration for instantiating a Connection

    Type declaration

    • Optional commitment?: Commitment

      Optional commitment level

      @@ -210,7 +210,7 @@

      Optional HTTP headers object

    • Optional wsEndpoint?: string

      Optional endpoint URL to the fullnode JSON RPC PubSub WebSocket Endpoint

      -

    ContactInfo

    ContactInfo: { gossip: string | null; pubkey: string; rpc: string | null; tpu: string | null; version: string | null }
    +
    ContactInfo: { gossip: string | null; pubkey: string; rpc: string | null; tpu: string | null; version: string | null }

    Information describing a cluster node

    Type declaration

    • gossip: string | null

      Gossip network address for the node

      @@ -222,9 +222,9 @@

      TPU network address for the node (null if not available)

    • version: string | null

      Software version of the node (null if not available)

      -

    Context

    Context: { slot: number }
    +
    Context: { slot: number }

    Extra contextual information for RPC responses

    -

    Type declaration

    • slot: number

    CreateAccountParams

    CreateAccountParams: { fromPubkey: PublicKey; lamports: number; newAccountPubkey: PublicKey; programId: PublicKey; space: number }
    +

    Type declaration

    • slot: number
    CreateAccountParams: { fromPubkey: PublicKey; lamports: number; newAccountPubkey: PublicKey; programId: PublicKey; space: number }

    Create account system transaction params

    Type declaration

    • fromPubkey: PublicKey

      The account that will transfer lamports to the created account

      @@ -236,7 +236,7 @@

      Public key of the program to assign as the owner of the created account

    • space: number

      Amount of space in bytes to allocate to the created account

      -

    CreateAccountWithSeedParams

    CreateAccountWithSeedParams: { basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; newAccountPubkey: PublicKey; programId: PublicKey; seed: string; space: number }
    +
    CreateAccountWithSeedParams: { basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; newAccountPubkey: PublicKey; programId: PublicKey; seed: string; space: number }

    Create account with seed system transaction params

    Type declaration

    • basePubkey: PublicKey

      Base public key to use to derive the address of the created account. Must be the same as the base key used to create newAccountPubkey

      @@ -252,11 +252,11 @@

      Seed to use to derive the address of the created account. Must be the same as the seed used to create newAccountPubkey

    • space: number

      Amount of space in bytes to allocate to the created account

      -

    CreateEd25519InstructionWithPrivateKeyParams

    CreateEd25519InstructionWithPrivateKeyParams: { instructionIndex?: number; message: Uint8Array; privateKey: Uint8Array }
    +
    CreateEd25519InstructionWithPrivateKeyParams: { instructionIndex?: number; message: Uint8Array; privateKey: Uint8Array }

    Params for creating an ed25519 instruction using a private key

    -

    Type declaration

    • Optional instructionIndex?: number
    • message: Uint8Array
    • privateKey: Uint8Array

    CreateEd25519InstructionWithPublicKeyParams

    CreateEd25519InstructionWithPublicKeyParams: { instructionIndex?: number; message: Uint8Array; publicKey: Uint8Array; signature: Uint8Array }
    +

    Type declaration

    • Optional instructionIndex?: number
    • message: Uint8Array
    • privateKey: Uint8Array
    CreateEd25519InstructionWithPublicKeyParams: { instructionIndex?: number; message: Uint8Array; publicKey: Uint8Array; signature: Uint8Array }

    Params for creating an ed25519 instruction using a public key

    -

    Type declaration

    • Optional instructionIndex?: number
    • message: Uint8Array
    • publicKey: Uint8Array
    • signature: Uint8Array

    CreateNonceAccountParams

    CreateNonceAccountParams: { authorizedPubkey: PublicKey; fromPubkey: PublicKey; lamports: number; noncePubkey: PublicKey }
    +

    Type declaration

    • Optional instructionIndex?: number
    • message: Uint8Array
    • publicKey: Uint8Array
    • signature: Uint8Array
    CreateNonceAccountParams: { authorizedPubkey: PublicKey; fromPubkey: PublicKey; lamports: number; noncePubkey: PublicKey }

    Create nonce account system transaction params

    Type declaration

    • authorizedPubkey: PublicKey

      Public key to set as authority of the created nonce account

      @@ -266,7 +266,7 @@

      Amount of lamports to transfer to the created nonce account

    • noncePubkey: PublicKey

      Public key of the created nonce account

      -

    CreateNonceAccountWithSeedParams

    CreateNonceAccountWithSeedParams: { authorizedPubkey: PublicKey; basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; noncePubkey: PublicKey; seed: string }
    +
    CreateNonceAccountWithSeedParams: { authorizedPubkey: PublicKey; basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; noncePubkey: PublicKey; seed: string }

    Create nonce account with seed system transaction params

    Type declaration

    • authorizedPubkey: PublicKey

      Public key to set as authority of the created nonce account

      @@ -280,13 +280,13 @@

      Public key of the created nonce account

    • seed: string

      Seed to use to derive the address of the nonce account

      -

    CreateSecp256k1InstructionWithEthAddressParams

    CreateSecp256k1InstructionWithEthAddressParams: { ethAddress: Buffer | Uint8Array | number[] | string; instructionIndex?: number; message: Buffer | Uint8Array | number[]; recoveryId: number; signature: Buffer | Uint8Array | number[] }
    +
    CreateSecp256k1InstructionWithEthAddressParams: { ethAddress: Buffer | Uint8Array | number[] | string; instructionIndex?: number; message: Buffer | Uint8Array | number[]; recoveryId: number; signature: Buffer | Uint8Array | number[] }

    Params for creating an secp256k1 instruction using an Ethereum address

    -

    Type declaration

    • ethAddress: Buffer | Uint8Array | number[] | string
    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • recoveryId: number
    • signature: Buffer | Uint8Array | number[]

    CreateSecp256k1InstructionWithPrivateKeyParams

    CreateSecp256k1InstructionWithPrivateKeyParams: { instructionIndex?: number; message: Buffer | Uint8Array | number[]; privateKey: Buffer | Uint8Array | number[] }
    +

    Type declaration

    • ethAddress: Buffer | Uint8Array | number[] | string
    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • recoveryId: number
    • signature: Buffer | Uint8Array | number[]
    CreateSecp256k1InstructionWithPrivateKeyParams: { instructionIndex?: number; message: Buffer | Uint8Array | number[]; privateKey: Buffer | Uint8Array | number[] }

    Params for creating an secp256k1 instruction using a private key

    -

    Type declaration

    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • privateKey: Buffer | Uint8Array | number[]

    CreateSecp256k1InstructionWithPublicKeyParams

    CreateSecp256k1InstructionWithPublicKeyParams: { instructionIndex?: number; message: Buffer | Uint8Array | number[]; publicKey: Buffer | Uint8Array | number[]; recoveryId: number; signature: Buffer | Uint8Array | number[] }
    +

    Type declaration

    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • privateKey: Buffer | Uint8Array | number[]
    CreateSecp256k1InstructionWithPublicKeyParams: { instructionIndex?: number; message: Buffer | Uint8Array | number[]; publicKey: Buffer | Uint8Array | number[]; recoveryId: number; signature: Buffer | Uint8Array | number[] }

    Params for creating an secp256k1 instruction using a public key

    -

    Type declaration

    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • publicKey: Buffer | Uint8Array | number[]
    • recoveryId: number
    • signature: Buffer | Uint8Array | number[]

    CreateStakeAccountParams

    CreateStakeAccountParams: { authorized: Authorized; fromPubkey: PublicKey; lamports: number; lockup?: Lockup; stakePubkey: PublicKey }
    +

    Type declaration

    • Optional instructionIndex?: number
    • message: Buffer | Uint8Array | number[]
    • publicKey: Buffer | Uint8Array | number[]
    • recoveryId: number
    • signature: Buffer | Uint8Array | number[]
    CreateStakeAccountParams: { authorized: Authorized; fromPubkey: PublicKey; lamports: number; lockup?: Lockup; stakePubkey: PublicKey }

    Create stake account transaction params

    Type declaration

    • authorized: Authorized

      Authorities of the new stake account

      @@ -298,54 +298,54 @@

      Lockup of the new stake account

    • stakePubkey: PublicKey

      Address of the new stake account

      -

    CreateStakeAccountWithSeedParams

    CreateStakeAccountWithSeedParams: { authorized: Authorized; basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; lockup?: Lockup; seed: string; stakePubkey: PublicKey }
    +
    CreateStakeAccountWithSeedParams: { authorized: Authorized; basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; lockup?: Lockup; seed: string; stakePubkey: PublicKey }

    Create stake account with seed transaction params

    -

    Type declaration

    CreateVoteAccountParams

    CreateVoteAccountParams: { fromPubkey: PublicKey; lamports: number; voteInit: VoteInit; votePubkey: PublicKey }
    +

    Type declaration

    CreateVoteAccountParams: { fromPubkey: PublicKey; lamports: number; voteInit: VoteInit; votePubkey: PublicKey }

    Create vote account transaction params

    -

    Type declaration

    DataSizeFilter

    DataSizeFilter: { dataSize: number }
    +

    Type declaration

    DataSizeFilter: { dataSize: number }

    Data size comparison filter for getProgramAccounts

    Type declaration

    • dataSize: number

      Size of data for program account data length comparison

      -

    DataSlice

    DataSlice: { length: number; offset: number }
    +
    DataSlice: { length: number; offset: number }

    Data slice argument for getProgramAccounts

    Type declaration

    • length: number

      length of data slice

    • offset: number

      offset of data slice

      -

    DeactivateStakeParams

    DeactivateStakeParams: { authorizedPubkey: PublicKey; stakePubkey: PublicKey }
    +
    DeactivateStakeParams: { authorizedPubkey: PublicKey; stakePubkey: PublicKey }

    Deactivate stake instruction params

    -

    Type declaration

    DelegateStakeParams

    DelegateStakeParams: { authorizedPubkey: PublicKey; stakePubkey: PublicKey; votePubkey: PublicKey }
    +

    Type declaration

    DelegateStakeParams: { authorizedPubkey: PublicKey; stakePubkey: PublicKey; votePubkey: PublicKey }

    Delegate stake instruction params

    -

    Type declaration

    EpochCredits

    EpochCredits: { credits: number; epoch: number; prevCredits: number }
    +

    Type declaration

    EpochCredits: { credits: number; epoch: number; prevCredits: number }

    History of how many credits earned by the end of each epoch

    -

    Type declaration

    • credits: number
    • epoch: number
    • prevCredits: number

    EpochInfo

    EpochInfo: { absoluteSlot: number; blockHeight?: number; epoch: number; slotIndex: number; slotsInEpoch: number; transactionCount?: number }
    +

    Type declaration

    • credits: number
    • epoch: number
    • prevCredits: number
    EpochInfo: { absoluteSlot: number; blockHeight?: number; epoch: number; slotIndex: number; slotsInEpoch: number; transactionCount?: number }

    Information about the current epoch

    -

    Type declaration

    • absoluteSlot: number
    • Optional blockHeight?: number
    • epoch: number
    • slotIndex: number
    • slotsInEpoch: number
    • Optional transactionCount?: number

    FetchMiddleware

    FetchMiddleware: (url: string, options: any, fetch: (modifiedUrl: string, modifiedOptions: any) => void) => void

    Type declaration

      • (url: string, options: any, fetch: (modifiedUrl: string, modifiedOptions: any) => void): void
      • +

        Type declaration

        • absoluteSlot: number
        • Optional blockHeight?: number
        • epoch: number
        • slotIndex: number
        • slotsInEpoch: number
        • Optional transactionCount?: number
    FetchMiddleware: (url: string, options: any, fetch: (modifiedUrl: string, modifiedOptions: any) => void) => void

    Type declaration

      • (url: string, options: any, fetch: (modifiedUrl: string, modifiedOptions: any) => void): void
      • A callback used to augment the outgoing HTTP request

        -

        Parameters

        • url: string
        • options: any
        • fetch: (modifiedUrl: string, modifiedOptions: any) => void
            • (modifiedUrl: string, modifiedOptions: any): void
            • Parameters

              • modifiedUrl: string
              • modifiedOptions: any

              Returns void

        Returns void

    Finality

    Finality: "confirmed" | "finalized"
    +

    Parameters

    • url: string
    • options: any
    • fetch: (modifiedUrl: string, modifiedOptions: any) => void
        • (modifiedUrl: string, modifiedOptions: any): void
        • Parameters

          • modifiedUrl: string
          • modifiedOptions: any

          Returns void

    Returns void

    Finality: "confirmed" | "finalized"

    A subset of Commitment levels, which are at least optimistically confirmed

       'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
       'finalized': Query the most recent block which has been finalized by the cluster
    -

    GetLargestAccountsConfig

    GetLargestAccountsConfig: { commitment?: Commitment; filter?: LargestAccountsFilter }
    +
    GetLargestAccountsConfig: { commitment?: Commitment; filter?: LargestAccountsFilter }

    Configuration object for changing getLargestAccounts query behavior

    Type declaration

    • Optional commitment?: Commitment

      The level of commitment desired

    • Optional filter?: LargestAccountsFilter

      Filter largest accounts by whether they are part of the circulating supply

      -

    GetMultipleAccountsConfig

    GetMultipleAccountsConfig: { commitment?: Commitment; encoding?: "base64" | "jsonParsed" }
    +
    GetMultipleAccountsConfig: { commitment?: Commitment; encoding?: "base64" | "jsonParsed" }

    Configuration object for getMultipleAccounts

    Type declaration

    • Optional commitment?: Commitment

      Optional commitment level

    • Optional encoding?: "base64" | "jsonParsed"

      Optional encoding for account data (default base64)

      -

    GetParsedProgramAccountsConfig

    GetParsedProgramAccountsConfig: { commitment?: Commitment; filters?: GetProgramAccountsFilter[] }
    +
    GetParsedProgramAccountsConfig: { commitment?: Commitment; filters?: GetProgramAccountsFilter[] }

    Configuration object for getParsedProgramAccounts

    Type declaration

    GetProgramAccountsConfig

    GetProgramAccountsConfig: { commitment?: Commitment; dataSlice?: DataSlice; encoding?: "base64"; filters?: GetProgramAccountsFilter[] }
    +
    GetProgramAccountsConfig: { commitment?: Commitment; dataSlice?: DataSlice; encoding?: "base64"; filters?: GetProgramAccountsFilter[] }

    Configuration object for getProgramAccounts requests

    Type declaration

    • Optional commitment?: Commitment

      Optional commitment level

      @@ -356,20 +356,20 @@ To use "jsonParsed" encoding, please refer to getParsedProgramAccounts in connection.ts

    • Optional filters?: GetProgramAccountsFilter[]

      Optional array of filters to apply to accounts

      -

    GetProgramAccountsFilter

    GetProgramAccountsFilter: MemcmpFilter | DataSizeFilter
    +
    GetProgramAccountsFilter: MemcmpFilter | DataSizeFilter

    A filter object for getProgramAccounts

    -

    GetSupplyConfig

    GetSupplyConfig: { commitment?: Commitment; excludeNonCirculatingAccountsList?: boolean }
    +
    GetSupplyConfig: { commitment?: Commitment; excludeNonCirculatingAccountsList?: boolean }

    Configuration object for changing getSupply request behavior

    Type declaration

    • Optional commitment?: Commitment

      The level of commitment desired

    • Optional excludeNonCirculatingAccountsList?: boolean

      Exclude non circulating accounts list from response

      -

    HttpHeaders

    HttpHeaders: {}
    +
    HttpHeaders: {}

    An object defining headers to be passed to the RPC server

    -

    Type declaration

    • [header: string]: string

    InflationGovernor

    InflationGovernor: { foundation: number; foundationTerm: number; initial: number; taper: number; terminal: number }
    +

    Type declaration

    • [header: string]: string
    InflationGovernor: { foundation: number; foundationTerm: number; initial: number; taper: number; terminal: number }

    Type declaration

    • foundation: number
    • foundationTerm: number
    • initial: number
    • taper: number
    • terminal: number

    InflationReward

    InflationReward: { amount: number; effectiveSlot: number; epoch: number; postBalance: number }
    +

    Type declaration

    • foundation: number
    • foundationTerm: number
    • initial: number
    • taper: number
    • terminal: number
    InflationReward: { amount: number; effectiveSlot: number; epoch: number; postBalance: number }

    The inflation reward for an epoch

    Type declaration

    • amount: number

      reward amount in lamports

      @@ -379,7 +379,7 @@ To use "jsonParsed" encoding, please refer to getParsedProgramAc

      epoch for which the reward occurs

    • postBalance: number

      post balance of the account in lamports

      -

    Info

    Info: { details?: string; keybaseUsername?: string; name: string; website?: string }
    +
    Info: { details?: string; keybaseUsername?: string; name: string; website?: string }

    Info used to identity validators.

    Type declaration

    • Optional details?: string

      optional, extra information the validator chose to share

      @@ -389,41 +389,41 @@ To use "jsonParsed" encoding, please refer to getParsedProgramAc

      validator name

    • Optional website?: string

      optional, validator website

      -

    InitializeAccountParams

    InitializeAccountParams: { nodePubkey: PublicKey; voteInit: VoteInit; votePubkey: PublicKey }
    +
    InitializeAccountParams: { nodePubkey: PublicKey; voteInit: VoteInit; votePubkey: PublicKey }

    InitializeAccount instruction params

    -

    Type declaration

    InitializeNonceParams

    InitializeNonceParams: { authorizedPubkey: PublicKey; noncePubkey: PublicKey }
    +

    Type declaration

    InitializeNonceParams: { authorizedPubkey: PublicKey; noncePubkey: PublicKey }

    Initialize nonce account system instruction params

    Type declaration

    • authorizedPubkey: PublicKey

      Public key to set as authority of the initialized nonce account

    • noncePubkey: PublicKey

      Nonce account which will be initialized

      -

    InitializeStakeParams

    InitializeStakeParams: { authorized: Authorized; lockup?: Lockup; stakePubkey: PublicKey }
    +
    InitializeStakeParams: { authorized: Authorized; lockup?: Lockup; stakePubkey: PublicKey }

    Initialize stake instruction params

    -

    Type declaration

    KeyedAccountInfo

    KeyedAccountInfo: { accountId: PublicKey; accountInfo: AccountInfo<Buffer> }
    +

    Type declaration

    KeyedAccountInfo: { accountId: PublicKey; accountInfo: AccountInfo<Buffer> }

    Account information identified by pubkey

    -

    Type declaration

    LargestAccountsFilter

    LargestAccountsFilter: "circulating" | "nonCirculating"
    +

    Type declaration

    LargestAccountsFilter: "circulating" | "nonCirculating"

    Filter for largest accounts query

       'circulating':    Return the largest accounts that are part of the circulating supply
       'nonCirculating': Return the largest accounts that are not part of the circulating supply
    -

    LeaderSchedule

    LeaderSchedule: {}
    +
    LeaderSchedule: {}

    Type declaration

    • [address: string]: number[]

    Lockout

    Lockout: { confirmationCount: number; slot: number }

    Type declaration

    • confirmationCount: number
    • slot: number

    Logs

    Logs: { err: TransactionError | null; logs: string[]; signature: string }
    +

    Type declaration

    • [address: string]: number[]
    Lockout: { confirmationCount: number; slot: number }

    Type declaration

    • confirmationCount: number
    • slot: number
    Logs: { err: TransactionError | null; logs: string[]; signature: string }

    Logs result.

    -

    Type declaration

    LogsCallback

    LogsCallback: (logs: Logs, ctx: web3.Context) => void

    Type declaration

    LogsCallback: (logs: Logs, ctx: web3.Context) => void

    Type declaration

    LogsFilter

    LogsFilter: PublicKey | "all" | "allWithVotes"
    +

    Parameters

    Returns void

    LogsFilter: PublicKey | "all" | "allWithVotes"

    Filter for log subscriptions.

    -

    MemcmpFilter

    MemcmpFilter: { memcmp: { bytes: string; offset: number } }
    +
    MemcmpFilter: { memcmp: { bytes: string; offset: number } }

    Memory comparison filter for getProgramAccounts

    Type declaration

    • memcmp: { bytes: string; offset: number }
      • bytes: string

        data to match, as base-58 encoded string and limited to less than 129 bytes

      • offset: number

        offset into program account data to start comparison

        -

    MergeStakeParams

    MergeStakeParams: { authorizedPubkey: PublicKey; sourceStakePubKey: PublicKey; stakePubkey: PublicKey }
    +
    MergeStakeParams: { authorizedPubkey: PublicKey; sourceStakePubKey: PublicKey; stakePubkey: PublicKey }

    Merge stake instruction params

    -

    Type declaration

    MessageArgs

    MessageArgs: { accountKeys: string[]; header: MessageHeader; instructions: CompiledInstruction[]; recentBlockhash: Blockhash }
    +

    Type declaration

    MessageArgs: { accountKeys: string[]; header: MessageHeader; instructions: CompiledInstruction[]; recentBlockhash: Blockhash }

    Message constructor arguments

    Type declaration

    • accountKeys: string[]

      All the account keys used by this transaction

      @@ -433,7 +433,7 @@ To use "jsonParsed" encoding, please refer to getParsedProgramAc

      Instructions that will be executed in sequence and committed in one atomic transaction if all succeed.

    • recentBlockhash: Blockhash

      The hash of a recent ledger block

      -

    MessageHeader

    MessageHeader: { numReadonlySignedAccounts: number; numReadonlyUnsignedAccounts: number; numRequiredSignatures: number }
    +
    MessageHeader: { numReadonlySignedAccounts: number; numReadonlyUnsignedAccounts: number; numRequiredSignatures: number }

    The message header, identifying signed and read-only account

    Type declaration

    • numReadonlySignedAccounts: number

      The last numReadonlySignedAccounts of the signed keys are read-only accounts

      @@ -442,13 +442,13 @@ To use "jsonParsed" encoding, please refer to getParsedProgramAc
    • numRequiredSignatures: number

      The number of signatures required for this message to be considered valid. The signatures must match the first numRequiredSignatures of accountKeys.

      -

    NonceInformation

    NonceInformation: { nonce: Blockhash; nonceInstruction: TransactionInstruction }
    +
    NonceInformation: { nonce: Blockhash; nonceInstruction: TransactionInstruction }

    Nonce information to be used to build an offline Transaction.

    Type declaration

    ParsedAccountData

    ParsedAccountData: { parsed: any; program: string; space: number }
    +
    ParsedAccountData: { parsed: any; program: string; space: number }

    Parsed account data

    Type declaration

    • parsed: any

      Parsed account data

      @@ -456,13 +456,13 @@ signatures must match the first numRequiredSignatures of acco

      Name of the program that owns this account

    • space: number

      Space used by account data

      -

    ParsedConfirmedTransaction

    ParsedConfirmedTransaction: ParsedTransactionWithMeta
    +
    ParsedConfirmedTransaction: ParsedTransactionWithMeta

    A parsed and confirmed transaction on the ledger

    deprecated

    Deprecated since Solana v1.8.0. Please use ParsedTransactionWithMeta instead.

    -

    ParsedConfirmedTransactionMeta

    ParsedConfirmedTransactionMeta: ParsedTransactionMeta
    +
    ParsedConfirmedTransactionMeta: ParsedTransactionMeta

    Metadata for a parsed confirmed transaction on the ledger

    deprecated

    Deprecated since Solana v1.8.0. Please use ParsedTransactionMeta instead.

    -

    ParsedInnerInstruction

    ParsedInnerInstruction: { index: number; instructions: (ParsedInstruction | PartiallyDecodedInstruction)[] }

    Type declaration

    ParsedInstruction

    ParsedInstruction: { parsed: any; program: string; programId: PublicKey }
    +
    ParsedInnerInstruction: { index: number; instructions: (ParsedInstruction | PartiallyDecodedInstruction)[] }

    Type declaration

    ParsedInstruction: { parsed: any; program: string; programId: PublicKey }

    A parsed transaction instruction

    Type declaration

    • parsed: any

      Parsed instruction info

      @@ -470,7 +470,7 @@ signatures must match the first numRequiredSignatures of acco

      Name of the program for this instruction

    • programId: PublicKey

      ID of the program for this instruction

      -

    ParsedMessage

    ParsedMessage: { accountKeys: ParsedMessageAccount[]; instructions: (ParsedInstruction | PartiallyDecodedInstruction)[]; recentBlockhash: string }
    +
    ParsedMessage: { accountKeys: ParsedMessageAccount[]; instructions: (ParsedInstruction | PartiallyDecodedInstruction)[]; recentBlockhash: string }

    A parsed transaction message

    Type declaration

    • accountKeys: ParsedMessageAccount[]

      Accounts used in the instructions

      @@ -478,7 +478,7 @@ signatures must match the first numRequiredSignatures of acco

      The atomically executed instructions for the transaction

    • recentBlockhash: string

      Recent blockhash

      -

    ParsedMessageAccount

    ParsedMessageAccount: { pubkey: PublicKey; signer: boolean; writable: boolean }
    +
    ParsedMessageAccount: { pubkey: PublicKey; signer: boolean; writable: boolean }

    A parsed transaction message account

    Type declaration

    • pubkey: PublicKey

      Public key of the account

      @@ -486,13 +486,13 @@ signatures must match the first numRequiredSignatures of acco

      Indicates if the account signed the transaction

    • writable: boolean

      Indicates if the account is writable for this transaction

      -

    ParsedTransaction

    ParsedTransaction: { message: ParsedMessage; signatures: string[] }
    +
    ParsedTransaction: { message: ParsedMessage; signatures: string[] }

    A parsed transaction

    Type declaration

    • message: ParsedMessage

      Message of the transaction

    • signatures: string[]

      Signatures for the transaction

      -

    ParsedTransactionMeta

    ParsedTransactionMeta: { err: TransactionError | null; fee: number; innerInstructions?: ParsedInnerInstruction[] | null; logMessages?: string[] | null; postBalances: number[]; postTokenBalances?: TokenBalance[] | null; preBalances: number[]; preTokenBalances?: TokenBalance[] | null }
    +
    ParsedTransactionMeta: { err: TransactionError | null; fee: number; innerInstructions?: ParsedInnerInstruction[] | null; logMessages?: string[] | null; postBalances: number[]; postTokenBalances?: TokenBalance[] | null; preBalances: number[]; preTokenBalances?: TokenBalance[] | null }

    Metadata for a parsed transaction on the ledger

    Type declaration

    • err: TransactionError | null

      The error result of transaction processing

      @@ -510,7 +510,7 @@ signatures must match the first numRequiredSignatures of acco

      The balances of the transaction accounts before processing

    • Optional preTokenBalances?: TokenBalance[] | null

      The token balances of the transaction accounts before processing

      -

    ParsedTransactionWithMeta

    ParsedTransactionWithMeta: { blockTime?: number | null; meta: ParsedTransactionMeta | null; slot: number; transaction: ParsedTransaction }
    +
    ParsedTransactionWithMeta: { blockTime?: number | null; meta: ParsedTransactionMeta | null; slot: number; transaction: ParsedTransaction }

    A parsed transaction on the ledger with meta

    Type declaration

    • Optional blockTime?: number | null

      The unix timestamp of when the transaction was processed

      @@ -520,7 +520,7 @@ signatures must match the first numRequiredSignatures of acco

      The slot during which the transaction was processed

    • transaction: ParsedTransaction

      The details of the transaction

      -

    PartiallyDecodedInstruction

    PartiallyDecodedInstruction: { accounts: PublicKey[]; data: string; programId: PublicKey }
    +
    PartiallyDecodedInstruction: { accounts: PublicKey[]; data: string; programId: PublicKey }

    A partially decoded transaction instruction

    Type declaration

    • accounts: PublicKey[]

      Public keys of accounts passed to this instruction

      @@ -528,7 +528,7 @@ signatures must match the first numRequiredSignatures of acco

      Raw base-58 instruction data

    • programId: PublicKey

      Program id called by this instruction

      -

    PerfSample

    PerfSample: { numSlots: number; numTransactions: number; samplePeriodSecs: number; slot: number }
    +
    PerfSample: { numSlots: number; numTransactions: number; samplePeriodSecs: number; slot: number }

    A performance sample

    Type declaration

    • numSlots: number

      Number of slots in a sample window

      @@ -538,21 +538,21 @@ signatures must match the first numRequiredSignatures of acco

      Sample window in seconds

    • slot: number

      Slot number of sample

      -

    PriorVoter

    PriorVoter: { authorizedPubkey: PublicKey; epochOfLastAuthorizedSwitch: number; targetEpoch: number }

    Type declaration

    • authorizedPubkey: PublicKey
    • epochOfLastAuthorizedSwitch: number
    • targetEpoch: number

    ProgramAccountChangeCallback

    ProgramAccountChangeCallback: (keyedAccountInfo: KeyedAccountInfo, context: web3.Context) => void

    Type declaration

    PriorVoter: { authorizedPubkey: PublicKey; epochOfLastAuthorizedSwitch: number; targetEpoch: number }

    Type declaration

    • authorizedPubkey: PublicKey
    • epochOfLastAuthorizedSwitch: number
    • targetEpoch: number
    ProgramAccountChangeCallback: (keyedAccountInfo: KeyedAccountInfo, context: web3.Context) => void

    Type declaration

    PublicKeyData

    PublicKeyData: {}
    +

    Parameters

    Returns void

    PublicKeyData: {}

    JSON object representation of PublicKey class

    -

    Type declaration

      PublicKeyInitData

      PublicKeyInitData: number | string | Buffer | Uint8Array | number[] | PublicKeyData
      +

      Type declaration

        PublicKeyInitData: number | string | Buffer | Uint8Array | number[] | PublicKeyData

        Value to be converted into public key

        -

        RootChangeCallback

        RootChangeCallback: (root: number) => void

        Type declaration

          • (root: number): void
          • +
        RootChangeCallback: (root: number) => void

        Type declaration

          • (root: number): void
          • Callback function for root change notifications

            -

            Parameters

            • root: number

            Returns void

        RpcResponseAndContext

        RpcResponseAndContext<T>: { context: web3.Context; value: T }
        +

        Parameters

        • root: number

        Returns void

        RpcResponseAndContext<T>: { context: web3.Context; value: T }

        RPC Response with extra contextual information

        Type parameters

        • T

        Type declaration

        • context: web3.Context

          response context

        • value: T

          response value

          -

        SendOptions

        SendOptions: { maxRetries?: number; preflightCommitment?: Commitment; skipPreflight?: boolean }
        +
        SendOptions: { maxRetries?: number; preflightCommitment?: Commitment; skipPreflight?: boolean }

        Options for sending transactions

        Type declaration

        • Optional maxRetries?: number

          Maximum number of times for the RPC node to retry sending the transaction to the leader.

          @@ -560,21 +560,21 @@ signatures must match the first numRequiredSignatures of acco

          preflight commitment level

        • Optional skipPreflight?: boolean

          disable transaction verification step

          -

        SerializeConfig

        SerializeConfig: { requireAllSignatures?: boolean; verifySignatures?: boolean }
        +
        SerializeConfig: { requireAllSignatures?: boolean; verifySignatures?: boolean }

        Configuration object for Transaction.serialize()

        Type declaration

        • Optional requireAllSignatures?: boolean

          Require all transaction signatures be present (default: true)

        • Optional verifySignatures?: boolean

          Verify provided signatures (default: true)

          -

        SignaturePubkeyPair

        SignaturePubkeyPair: { publicKey: PublicKey; signature: Buffer | null }
        +
        SignaturePubkeyPair: { publicKey: PublicKey; signature: Buffer | null }

        Pair of signature and corresponding public key

        -

        Type declaration

        SignatureReceivedNotification

        SignatureReceivedNotification: { type: "received" }
        +

        Type declaration

        SignatureReceivedNotification: { type: "received" }

        Signature received notification

        -

        Type declaration

        • type: "received"

        SignatureResult

        SignatureResult: { err: TransactionError | null }
        +

        Type declaration

        • type: "received"
        SignatureResult: { err: TransactionError | null }

        Signature result

        -

        Type declaration

        SignatureResultCallback

        SignatureResultCallback: (signatureResult: SignatureResult, context: web3.Context) => void

        Type declaration

        SignatureResultCallback: (signatureResult: SignatureResult, context: web3.Context) => void

        Type declaration

        SignatureStatus

        SignatureStatus: { confirmationStatus?: TransactionConfirmationStatus; confirmations: number | null; err: TransactionError | null; slot: number }
        +

        Parameters

        Returns void

        SignatureStatus: { confirmationStatus?: TransactionConfirmationStatus; confirmations: number | null; err: TransactionError | null; slot: number }

        Signature status

        Type declaration

        • Optional confirmationStatus?: TransactionConfirmationStatus

          cluster confirmation status, if data available. Possible responses: processed, confirmed, finalized

          @@ -584,17 +584,17 @@ signatures must match the first numRequiredSignatures of acco

          transaction error, if any

        • slot: number

          when the transaction was processed

          -

        SignatureStatusConfig

        SignatureStatusConfig: { searchTransactionHistory: boolean }
        +
        SignatureStatusConfig: { searchTransactionHistory: boolean }

        Configuration object for changing query behavior

        Type declaration

        • searchTransactionHistory: boolean

          enable searching status history, not needed for recent transactions

          -

        SignatureStatusNotification

        SignatureStatusNotification: { result: SignatureResult; type: "status" }
        +
        SignatureStatusNotification: { result: SignatureResult; type: "status" }

        Signature status notification with transaction result

        -

        Type declaration

        SignatureSubscriptionCallback

        SignatureSubscriptionCallback: (notification: SignatureStatusNotification | SignatureReceivedNotification, context: web3.Context) => void

        Type declaration

        SignatureSubscriptionCallback: (notification: SignatureStatusNotification | SignatureReceivedNotification, context: web3.Context) => void

        Type declaration

        SignatureSubscriptionOptions

        SignatureSubscriptionOptions: { commitment?: Commitment; enableReceivedNotification?: boolean }
        +

        Parameters

        Returns void

        SignatureSubscriptionOptions: { commitment?: Commitment; enableReceivedNotification?: boolean }

        Signature subscription options

        -

        Type declaration

        • Optional commitment?: Commitment
        • Optional enableReceivedNotification?: boolean

        SignaturesForAddressOptions

        SignaturesForAddressOptions: { before?: TransactionSignature; limit?: number; until?: TransactionSignature }
        +

        Type declaration

        • Optional commitment?: Commitment
        • Optional enableReceivedNotification?: boolean
        SignaturesForAddressOptions: { before?: TransactionSignature; limit?: number; until?: TransactionSignature }

        Options for getSignaturesForAddress

        Type declaration

        • Optional before?: TransactionSignature

          Start searching backwards from this transaction signature.

          @@ -603,7 +603,7 @@ signatures must match the first numRequiredSignatures of acco

          Maximum transaction signatures to return (between 1 and 1,000, default: 1,000).

        • Optional until?: TransactionSignature

          Search until this transaction signature is reached, if found before limit.

          -

        SimulatedTransactionAccountInfo

        SimulatedTransactionAccountInfo: { data: string[]; executable: boolean; lamports: number; owner: string; rentEpoch?: number }

        Type declaration

        • data: string[]
          +
        SimulatedTransactionAccountInfo: { data: string[]; executable: boolean; lamports: number; owner: string; rentEpoch?: number }

        Type declaration

        • data: string[]

          Optional data assigned to the account

        • executable: boolean

          true if this account's data contains a loaded program

          @@ -613,9 +613,9 @@ signatures must match the first numRequiredSignatures of acco

          Identifier of the program that owns the account

        • Optional rentEpoch?: number

          Optional rent epoch info for account

          -

        SimulatedTransactionResponse

        SimulatedTransactionResponse: { accounts?: (SimulatedTransactionAccountInfo | null)[] | null; err: TransactionError | string | null; logs: string[] | null; unitsConsumed?: number }

        Type declaration

        SlotChangeCallback

        SlotChangeCallback: (slotInfo: SlotInfo) => void

        Type declaration

        SimulatedTransactionResponse: { accounts?: (SimulatedTransactionAccountInfo | null)[] | null; err: TransactionError | string | null; logs: string[] | null; unitsConsumed?: number }

        Type declaration

        SlotChangeCallback: (slotInfo: SlotInfo) => void

        Type declaration

          • Callback function for slot change notifications

            -

            Parameters

            Returns void

        SlotInfo

        SlotInfo: { parent: number; root: number; slot: number }
        +

        Parameters

        Returns void

        SlotInfo: { parent: number; root: number; slot: number }

        Information about the latest slot being processed by a node

        Type declaration

        • parent: number

          Parent of the current slot

          @@ -623,7 +623,7 @@ signatures must match the first numRequiredSignatures of acco

          The root block of the current slot's fork

        • slot: number

          Currently processing slot

          -

        SlotUpdate

        SlotUpdate: { slot: number; timestamp: number; type: "firstShredReceived" } | { slot: number; timestamp: number; type: "completed" } | { parent: number; slot: number; timestamp: number; type: "createdBank" } | { slot: number; stats: { maxTransactionsPerEntry: number; numFailedTransactions: number; numSuccessfulTransactions: number; numTransactionEntries: number }; timestamp: number; type: "frozen" } | { err: string; slot: number; timestamp: number; type: "dead" } | { slot: number; timestamp: number; type: "optimisticConfirmation" } | { slot: number; timestamp: number; type: "root" }
        +
        SlotUpdate: { slot: number; timestamp: number; type: "firstShredReceived" } | { slot: number; timestamp: number; type: "completed" } | { parent: number; slot: number; timestamp: number; type: "createdBank" } | { slot: number; stats: { maxTransactionsPerEntry: number; numFailedTransactions: number; numSuccessfulTransactions: number; numTransactionEntries: number }; timestamp: number; type: "frozen" } | { err: string; slot: number; timestamp: number; type: "dead" } | { slot: number; timestamp: number; type: "optimisticConfirmation" } | { slot: number; timestamp: number; type: "root" }

        Slot updates which can be used for tracking the live progress of a cluster.

        • "firstShredReceived": connected node received the first shred of a block. @@ -638,13 +638,13 @@ will be sent for every finalized blocks.
        • "frozen": the connected node has validated this block.
        • "dead": the connected node failed to validate this block.
        -

        SlotUpdateCallback

        SlotUpdateCallback: (slotUpdate: SlotUpdate) => void

        Type declaration

        SlotUpdateCallback: (slotUpdate: SlotUpdate) => void

        Type declaration

          • Callback function for slot update notifications

            -

            Parameters

            Returns void

        SplitStakeParams

        SplitStakeParams: { authorizedPubkey: PublicKey; lamports: number; splitStakePubkey: PublicKey; stakePubkey: PublicKey }
        +

        Parameters

        Returns void

        SplitStakeParams: { authorizedPubkey: PublicKey; lamports: number; splitStakePubkey: PublicKey; stakePubkey: PublicKey }

        Split stake instruction params

        -

        Type declaration

        SplitStakeWithSeedParams

        SplitStakeWithSeedParams: { authorizedPubkey: PublicKey; basePubkey: PublicKey; lamports: number; seed: string; splitStakePubkey: PublicKey; stakePubkey: PublicKey }
        +

        Type declaration

        SplitStakeWithSeedParams: { authorizedPubkey: PublicKey; basePubkey: PublicKey; lamports: number; seed: string; splitStakePubkey: PublicKey; stakePubkey: PublicKey }

        Split with seed transaction params

        -

        Type declaration

        StakeActivationData

        StakeActivationData: { active: number; inactive: number; state: "active" | "inactive" | "activating" | "deactivating" }
        +

        Type declaration

        StakeActivationData: { active: number; inactive: number; state: "active" | "inactive" | "activating" | "deactivating" }

        Stake Activation data

        Type declaration

        • active: number

          stake active during the epoch

          @@ -652,13 +652,13 @@ will be sent for every finalized blocks.
        • stake inactive during the epoch

      • state: "active" | "inactive" | "activating" | "deactivating"

        the stake account's activation state

        -
      • StakeAuthorizationType

        StakeAuthorizationType: { index: number }
        +
        StakeAuthorizationType: { index: number }

        Stake authorization type

        Type declaration

        • index: number

          The Stake Authorization index (from solana-stake-program)

          -

        StakeInstructionType

        StakeInstructionType: "AuthorizeWithSeed" | "Authorize" | "Deactivate" | "Delegate" | "Initialize" | "Split" | "Withdraw" | "Merge"
        +
        StakeInstructionType: "AuthorizeWithSeed" | "Authorize" | "Deactivate" | "Delegate" | "Initialize" | "Split" | "Withdraw" | "Merge"

        An enumeration of valid StakeInstructionType's

        -

        Supply

        Supply: { circulating: number; nonCirculating: number; nonCirculatingAccounts: PublicKey[]; total: number }
        +
        Supply: { circulating: number; nonCirculating: number; nonCirculatingAccounts: PublicKey[]; total: number }

        Supply

        Type declaration

        • circulating: number

          Circulating supply in lamports

          @@ -668,9 +668,9 @@ will be sent for every finalized blocks.
        • List of non-circulating account addresses

      • total: number

        Total supply in lamports

        -
      • SystemInstructionType

        SystemInstructionType: "AdvanceNonceAccount" | "Allocate" | "AllocateWithSeed" | "Assign" | "AssignWithSeed" | "AuthorizeNonceAccount" | "Create" | "CreateWithSeed" | "InitializeNonceAccount" | "Transfer" | "TransferWithSeed" | "WithdrawNonceAccount"
        +
        SystemInstructionType: "AdvanceNonceAccount" | "Allocate" | "AllocateWithSeed" | "Assign" | "AssignWithSeed" | "AuthorizeNonceAccount" | "Create" | "CreateWithSeed" | "InitializeNonceAccount" | "Transfer" | "TransferWithSeed" | "WithdrawNonceAccount"

        An enumeration of valid SystemInstructionType's

        -

        TokenAccountBalancePair

        TokenAccountBalancePair: { address: PublicKey; amount: string; decimals: number; uiAmount: number | null; uiAmountString?: string }
        +
        TokenAccountBalancePair: { address: PublicKey; amount: string; decimals: number; uiAmount: number | null; uiAmountString?: string }

        Token address and balance.

        Type declaration

        • address: PublicKey

          Address of the token account

          @@ -682,7 +682,7 @@ will be sent for every finalized blocks.
        • Token amount as float, accounts for decimals

      • Optional uiAmountString?: string

        Token amount as string, accounts for decimals

        -
      • TokenAccountsFilter

        TokenAccountsFilter: { mint: PublicKey } | { programId: PublicKey }

        TokenAmount

        TokenAmount: { amount: string; decimals: number; uiAmount: number | null; uiAmountString?: string }
        +
        TokenAccountsFilter: { mint: PublicKey } | { programId: PublicKey }
        TokenAmount: { amount: string; decimals: number; uiAmount: number | null; uiAmountString?: string }

        Token amount object which returns a token amount in different formats for various client use cases.

        Type declaration

        • amount: string
          @@ -693,13 +693,13 @@ for various client use cases.

          Token amount as float, accounts for decimals

        • Optional uiAmountString?: string

          Token amount as string, accounts for decimals

          -

        TokenBalance

        TokenBalance: { accountIndex: number; mint: string; owner?: string; uiTokenAmount: TokenAmount }

        Type declaration

        • accountIndex: number
        • mint: string
        • Optional owner?: string
        • uiTokenAmount: TokenAmount

        TransactionConfirmationStatus

        TransactionConfirmationStatus: "processed" | "confirmed" | "finalized"
        +
        TokenBalance: { accountIndex: number; mint: string; owner?: string; uiTokenAmount: TokenAmount }

        Type declaration

        • accountIndex: number
        • mint: string
        • Optional owner?: string
        • uiTokenAmount: TokenAmount
        TransactionConfirmationStatus: "processed" | "confirmed" | "finalized"

        Transaction confirmation status

           'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
           'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
           'finalized': Transaction landed in a block which has been finalized by the cluster
        -

        TransactionCtorFields

        TransactionCtorFields: { feePayer?: PublicKey | null; nonceInfo?: NonceInformation | null; recentBlockhash?: Blockhash | null; signatures?: SignaturePubkeyPair[] }
        +
        TransactionCtorFields: { feePayer?: PublicKey | null; nonceInfo?: NonceInformation | null; recentBlockhash?: Blockhash | null; signatures?: SignaturePubkeyPair[] }

        List of Transaction object fields that may be initialized at construction

        Type declaration

        • Optional feePayer?: PublicKey | null

          The transaction fee payer

          @@ -709,11 +709,11 @@ for various client use cases.

          A recent blockhash

        • Optional signatures?: SignaturePubkeyPair[]

          One or more signatures

          -

        TransactionError

        TransactionError: {} | string
        +
        TransactionError: {} | string

        Transaction error

        -

        TransactionInstructionCtorFields

        TransactionInstructionCtorFields: { data?: Buffer; keys: AccountMeta[]; programId: PublicKey }
        +
        TransactionInstructionCtorFields: { data?: Buffer; keys: AccountMeta[]; programId: PublicKey }

        List of TransactionInstruction object fields that may be initialized at construction

        -

        Type declaration

        TransactionResponse

        TransactionResponse: { blockTime?: number | null; meta: ConfirmedTransactionMeta | null; slot: number; transaction: { message: Message; signatures: string[] } }
        +

        Type declaration

        TransactionResponse: { blockTime?: number | null; meta: ConfirmedTransactionMeta | null; slot: number; transaction: { message: Message; signatures: string[] } }

        A processed transaction from the RPC API

        Type declaration

        • Optional blockTime?: number | null

          The unix timestamp of when the transaction was processed

          @@ -727,9 +727,9 @@ for various client use cases.

          The transaction message

        • signatures: string[]

          The transaction signatures

          -

        TransactionSignature

        TransactionSignature: string
        +
        TransactionSignature: string

        Transaction signature as base-58 encoded string

        -

        TransferParams

        TransferParams: { fromPubkey: PublicKey; lamports: number; toPubkey: PublicKey }
        +
        TransferParams: { fromPubkey: PublicKey; lamports: number; toPubkey: PublicKey }

        Transfer system transaction params

        Type declaration

        • fromPubkey: PublicKey

          Account that will transfer lamports

          @@ -737,7 +737,7 @@ for various client use cases.

          Amount of lamports to transfer

        • toPubkey: PublicKey

          Account that will receive transferred lamports

          -

        TransferWithSeedParams

        TransferWithSeedParams: { basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; programId: PublicKey; seed: string; toPubkey: PublicKey }
        +
        TransferWithSeedParams: { basePubkey: PublicKey; fromPubkey: PublicKey; lamports: number; programId: PublicKey; seed: string; toPubkey: PublicKey }

        Transfer with seed system transaction params

        Type declaration

        • basePubkey: PublicKey

          Base public key to use to derive the funding account address

          @@ -751,11 +751,11 @@ for various client use cases.

          Seed to use to derive the funding account address

        • toPubkey: PublicKey

          Account that will receive transferred lamports

          -

        Version

        Version: { feature-set?: number; solana-core: string }
        +
        Version: { feature-set?: number; solana-core: string }

        Version info for a node

        Type declaration

        • Optional feature-set?: number
        • solana-core: string

          Version of solana-core

          -

        VoteAccountInfo

        VoteAccountInfo: { activatedStake: number; commission: number; epochCredits: [number, number, number][]; epochVoteAccount: boolean; lastVote: number; nodePubkey: string; votePubkey: string }
        +
        VoteAccountInfo: { activatedStake: number; commission: number; epochCredits: [number, number, number][]; epochVoteAccount: boolean; lastVote: number; nodePubkey: string; votePubkey: string }

        Information describing a vote account

        Type declaration

        • activatedStake: number

          The stake, in lamports, delegated to this vote account and activated

          @@ -771,21 +771,21 @@ for various client use cases.

          Identity public key of the node voting with this account

        • votePubkey: string

          Public key of the vote account

          -

        VoteAccountStatus

        VoteAccountStatus: { current: VoteAccountInfo[]; delinquent: VoteAccountInfo[] }
        +
        VoteAccountStatus: { current: VoteAccountInfo[]; delinquent: VoteAccountInfo[] }

        A collection of cluster vote accounts

        Type declaration

        VoteAuthorizationType

        VoteAuthorizationType: { index: number }
        +
        VoteAuthorizationType: { index: number }

        VoteAuthorize type

        Type declaration

        • index: number

          The VoteAuthorize index (from solana-vote-program)

          -

        VoteInstructionType

        VoteInstructionType: "Authorize" | "InitializeAccount" | "Withdraw"
        +
        VoteInstructionType: "Authorize" | "InitializeAccount" | "Withdraw"

        An enumeration of valid VoteInstructionType's

        -

        WithdrawFromVoteAccountParams

        WithdrawFromVoteAccountParams: { authorizedWithdrawerPubkey: PublicKey; lamports: number; toPubkey: PublicKey; votePubkey: PublicKey }
        +
        WithdrawFromVoteAccountParams: { authorizedWithdrawerPubkey: PublicKey; lamports: number; toPubkey: PublicKey; votePubkey: PublicKey }

        Withdraw from vote account transaction params

        -

        Type declaration

        WithdrawNonceParams

        WithdrawNonceParams: { authorizedPubkey: PublicKey; lamports: number; noncePubkey: PublicKey; toPubkey: PublicKey }
        +

        Type declaration

        WithdrawNonceParams: { authorizedPubkey: PublicKey; lamports: number; noncePubkey: PublicKey; toPubkey: PublicKey }

        Withdraw nonce account system transaction params

        Type declaration

        • authorizedPubkey: PublicKey

          Public key of the nonce authority

          @@ -795,30 +795,30 @@ for various client use cases.

          Nonce account

        • toPubkey: PublicKey

          Public key of the account which will receive the withdrawn nonce account balance

          -

        WithdrawStakeParams

        WithdrawStakeParams: { authorizedPubkey: PublicKey; custodianPubkey?: PublicKey; lamports: number; stakePubkey: PublicKey; toPubkey: PublicKey }
        +
        WithdrawStakeParams: { authorizedPubkey: PublicKey; custodianPubkey?: PublicKey; lamports: number; stakePubkey: PublicKey; toPubkey: PublicKey }

        Withdraw stake instruction params

        -

        Type declaration

        Variables

        BPF_LOADER_DEPRECATED_PROGRAM_ID

        BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey

        BPF_LOADER_PROGRAM_ID

        BPF_LOADER_PROGRAM_ID: PublicKey

        LAMPORTS_PER_SOL

        LAMPORTS_PER_SOL: 1000000000 = 1000000000
        +

        Type declaration

        Variables

        BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey
        BPF_LOADER_PROGRAM_ID: PublicKey
        LAMPORTS_PER_SOL: 1000000000 = 1000000000

        There are 1-billion lamports in one SOL

        -

        MAX_SEED_LENGTH

        MAX_SEED_LENGTH: 32 = 32
        +
        MAX_SEED_LENGTH: 32 = 32

        Maximum length of derived pubkey seed

        -

        NONCE_ACCOUNT_LENGTH

        NONCE_ACCOUNT_LENGTH: number

        PACKET_DATA_SIZE

        PACKET_DATA_SIZE: number
        +
        NONCE_ACCOUNT_LENGTH: number
        PACKET_DATA_SIZE: number

        Maximum over-the-wire size of a Transaction

        1280 is IPv6 minimum MTU 40 bytes is the size of the IPv6 header 8 bytes is the size of the fragment header

        -

        SOLANA_SCHEMA

        SOLANA_SCHEMA: Map<Function, any>

        STAKE_CONFIG_ID

        STAKE_CONFIG_ID: PublicKey
        +
        SOLANA_SCHEMA: Map<Function, any>
        STAKE_CONFIG_ID: PublicKey

        Address of the stake config account which configures the rate of stake warmup and cooldown as well as the slashing penalty.

        -

        SYSVAR_CLOCK_PUBKEY

        SYSVAR_CLOCK_PUBKEY: PublicKey

        SYSVAR_EPOCH_SCHEDULE_PUBKEY

        SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey

        SYSVAR_INSTRUCTIONS_PUBKEY

        SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey

        SYSVAR_RECENT_BLOCKHASHES_PUBKEY

        SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey

        SYSVAR_RENT_PUBKEY

        SYSVAR_RENT_PUBKEY: PublicKey

        SYSVAR_REWARDS_PUBKEY

        SYSVAR_REWARDS_PUBKEY: PublicKey

        SYSVAR_SLOT_HASHES_PUBKEY

        SYSVAR_SLOT_HASHES_PUBKEY: PublicKey

        SYSVAR_SLOT_HISTORY_PUBKEY

        SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey

        SYSVAR_STAKE_HISTORY_PUBKEY

        SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey

        StakeAuthorizationLayout

        StakeAuthorizationLayout: Readonly<{ Staker: { index: number }; Withdrawer: { index: number } }>
        +
        SYSVAR_CLOCK_PUBKEY: PublicKey
        SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey
        SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey
        SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey
        SYSVAR_RENT_PUBKEY: PublicKey
        SYSVAR_REWARDS_PUBKEY: PublicKey
        SYSVAR_SLOT_HASHES_PUBKEY: PublicKey
        SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey
        SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey
        StakeAuthorizationLayout: Readonly<{ Staker: { index: number }; Withdrawer: { index: number } }>

        An enumeration of valid StakeAuthorizationLayout's

        -

        VALIDATOR_INFO_KEY

        VALIDATOR_INFO_KEY: PublicKey

        VOTE_PROGRAM_ID

        VOTE_PROGRAM_ID: PublicKey

        VoteAuthorizationLayout

        VoteAuthorizationLayout: Readonly<{ Voter: { index: number }; Withdrawer: { index: number } }>
        +
        VALIDATOR_INFO_KEY: PublicKey
        VOTE_PROGRAM_ID: PublicKey
        VoteAuthorizationLayout: Readonly<{ Voter: { index: number }; Withdrawer: { index: number } }>

        An enumeration of valid VoteAuthorization layouts.

        -

        Functions

        clusterApiUrl

        • clusterApiUrl(cluster?: Cluster, tls?: boolean): string
        • +

        Functions

        • clusterApiUrl(cluster?: Cluster, tls?: boolean): string
        • Retrieves the RPC API URL for the specified cluster

          -

          Parameters

          • Optional cluster: Cluster
          • Optional tls: boolean

          Returns string

        sendAndConfirmRawTransaction

        • +

          Parameters

          • Optional cluster: Cluster
          • Optional tls: boolean

          Returns string

        • Send and confirm a raw transaction

          If commitment option is not specified, defaults to 'max' commitment.

          -

          Parameters

          Returns Promise<TransactionSignature>

        sendAndConfirmTransaction

        • Sign, send and confirm a transaction.

          If commitment option is not specified, defaults to 'max' commitment.

          Parameters

          Returns Promise<TransactionSignature>

        Legend

        • Constructor
        • Property
        • Method
        • Inherited constructor
        • Inherited property
        • Inherited method
        • Property
        • Method
        • Static method

        Settings

        Theme

        Generated using TypeDoc

        \ No newline at end of file diff --git a/tutorials/tutorial-0.html b/tutorials/tutorial-0.html index cdc9d8c7..8325ab71 100644 --- a/tutorials/tutorial-0.html +++ b/tutorials/tutorial-0.html @@ -10,8 +10,8 @@ - - + + - + diff --git a/tutorials/tutorial-1.html b/tutorials/tutorial-1.html index 94871a10..ee2f3f85 100644 --- a/tutorials/tutorial-1.html +++ b/tutorials/tutorial-1.html @@ -10,8 +10,8 @@ - - + + - + diff --git a/tutorials/tutorial-2.html b/tutorials/tutorial-2.html index 5513ebed..104053ef 100644 --- a/tutorials/tutorial-2.html +++ b/tutorials/tutorial-2.html @@ -10,8 +10,8 @@ - - + +
        - + diff --git a/tutorials/tutorial-3.html b/tutorials/tutorial-3.html index 8aaea2a6..034090b7 100644 --- a/tutorials/tutorial-3.html +++ b/tutorials/tutorial-3.html @@ -10,8 +10,8 @@ - - + +
        - + diff --git a/tutorials/tutorial-4.html b/tutorials/tutorial-4.html index 9c21697b..0588ef3b 100644 --- a/tutorials/tutorial-4.html +++ b/tutorials/tutorial-4.html @@ -10,8 +10,8 @@ - - + +