diff --git a/.github/workflows/pull-request-js.yml b/.github/workflows/pull-request-js.yml index 32f7d156675..f75ef69e438 100644 --- a/.github/workflows/pull-request-js.yml +++ b/.github/workflows/pull-request-js.yml @@ -5,7 +5,6 @@ on: paths: - 'account-compression/sdk/**' - 'libraries/type-length-value/js/**' - - 'memo/js/**' - 'name-service/js/**' - 'single-pool/js/**' - 'stake-pool/js/**' @@ -21,7 +20,6 @@ on: paths: - 'account-compression/sdk/**' - 'libraries/type-length-value/js/**' - - 'memo/js/**' - 'single-pool/js/**' - 'stake-pool/js/**' - 'token/js/**' @@ -43,7 +41,6 @@ jobs: node-version: [16.x, 18.x, 20.x] package: [ - memo, name-service, stake-pool, token, diff --git a/.github/workflows/pull-request-memo.yml b/.github/workflows/pull-request-memo.yml deleted file mode 100644 index 0c97a20b8bc..00000000000 --- a/.github/workflows/pull-request-memo.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Memo Pull Request - -on: - pull_request: - paths: - - 'memo/**' - - 'ci/*-version.sh' - - '!memo/js/**' - push: - branches: [master] - paths: - - 'memo/**' - - 'ci/*-version.sh' - - '!memo/js/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - cargo-test-sbf: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set env vars - run: | - source ci/rust-version.sh - echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV - source ci/solana-version.sh - echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV - - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_STABLE }} - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}} - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/rustfilt - key: cargo-sbf-bins-${{ runner.os }} - - - uses: actions/cache@v4 - with: - path: ~/.cache/solana - key: solana-${{ env.SOLANA_VERSION }} - - - name: Install dependencies - run: | - ./ci/install-build-deps.sh - ./ci/install-program-deps.sh - echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH - - - name: Build and test - run: ./ci/cargo-test-sbf.sh memo - - js-test: - runs-on: ubuntu-latest - env: - NODE_VERSION: 16.x - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - uses: pnpm/action-setup@v4 - - uses: actions/cache@v4 - with: - path: ~/.npm - key: node-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - node- - - run: ./ci/js-test-memo.sh diff --git a/Anchor.toml b/Anchor.toml index a7999972431..e8bd9dfc048 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -6,7 +6,6 @@ solana_version = "2.1.0" members = [ "governance/program", "governance/chat/program", - "memo/program", "stake-pool/program", "token/program", "token/program-2022", diff --git a/Cargo.lock b/Cargo.lock index 4ab18134531..7333341ad13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8168,15 +8168,15 @@ dependencies = [ [[package]] name = "spl-memo" version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" dependencies = [ "solana-account-info", "solana-instruction", "solana-msg", "solana-program-entrypoint", "solana-program-error", - "solana-program-test", "solana-pubkey", - "solana-sdk", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index df80da2c754..5b93b9a2544 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,6 @@ members = [ "libraries/tlv-account-resolution", "libraries/type-length-value", "libraries/type-length-value-derive-test", - "memo/program", "name-service/program", "managed-token/program", "record/program", diff --git a/README.md b/README.md index d98f488f3d6..2a88a26c616 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ the Solana Mainnet Beta. Currently, this includes: | [shared-memory](https://github.com/solana-labs/solana-program-library/tree/master/shared-memory/program) | [1.0.0](https://github.com/solana-labs/solana-program-library/commit/b40e0dd3fd6c0e509dc1e8dd3da0a6d609035bbd) | | [feature-proposal](https://github.com/solana-labs/solana-program-library/tree/master/feature-proposal/program) | [1.0.0](https://github.com/solana-labs/solana-program-library/releases/tag/feature-proposal-v1.0.0) | | [name-service](https://github.com/solana-labs/solana-program-library/tree/master/name-service/program) | [0.3.0](https://github.com/solana-labs/solana-program-library/releases/tag/name-service-v0.3.0) | -| [memo](https://github.com/solana-labs/solana-program-library/tree/master/memo/program) | [3.0.0](https://github.com/solana-labs/solana-program-library/releases/tag/memo-v3.0.0) | +| [memo](https://github.com/solana-program/memo/tree/master/program) | [3.0.0](https://github.com/solana-labs/solana-program-library/releases/tag/memo-v3.0.0) | In addition, one program is planned for deployment to Solana Mainnet Beta: @@ -57,7 +57,6 @@ unaudited programs: * [feature-proposal](https://github.com/solana-labs/solana-program-library/tree/master/feature-proposal/program) * [instruction-padding](https://github.com/solana-labs/solana-program-library/tree/master/instruction-padding/program) * [managed-token](https://github.com/solana-labs/solana-program-library/tree/master/managed-token/program) -* [memo](https://github.com/solana-labs/solana-program-library/tree/master/memo/program) * [name-service](https://github.com/solana-labs/solana-program-library/tree/master/name-service/program) * [record](https://github.com/solana-labs/solana-program-library/tree/master/record/program) * [stateless-asks](https://github.com/solana-labs/solana-program-library/tree/master/stateless-asks/program) @@ -71,6 +70,13 @@ More information about the repository's security policy at The [security-audits repo](https://github.com/solana-labs/security-audits) contains all past and present program audits. +## Migrated Packages + +The Solana Program Library repository is being broken up into separate repos for +each program and set of clients. The following programs have been moved: + +* [Memo](https://github.com/solana-program/memo) + ## Program Packages | Package | Description | Version | Docs | @@ -82,7 +88,6 @@ all past and present program audits. | `spl-account-compression` | Program for managing compressed accounts stored in an off-chain merkle tree | [![Crates.io](https://img.shields.io/crates/v/spl-account-compression)](https://crates.io/crates/spl-account-compression) | [![Docs.rs](https://docs.rs/spl-account-compression/badge.svg)](https://docs.rs/spl-account-compression) | | `spl-feature-proposal` | Program using tokens to vote on enabling Solana network features | [![Crates.io](https://img.shields.io/crates/v/spl-feature-proposal)](https://crates.io/crates/spl-feature-proposal) | [![Docs.rs](https://docs.rs/spl-feature-proposal/badge.svg)](https://docs.rs/spl-feature-proposal) | | `spl-noop` | Program that does nothing, used for logging instruction data | [![Crates.io](https://img.shields.io/crates/v/spl-noop)](https://crates.io/crates/spl-noop) | [![Docs.rs](https://docs.rs/spl-noop/badge.svg)](https://docs.rs/spl-noop) | -| `spl-memo` | Program for logging signed memos on-chain | [![Crates.io](https://img.shields.io/crates/v/spl-memo)](https://crates.io/crates/spl-memo) | [![Docs.rs](https://docs.rs/spl-memo/badge.svg)](https://docs.rs/spl-memo) | | `spl-name-service` | Program for managing ownership of data on-chain | [![Crates.io](https://img.shields.io/crates/v/spl-name-service)](https://crates.io/crates/spl-name-service) | [![Docs.rs](https://docs.rs/spl-name-service/badge.svg)](https://docs.rs/spl-name-service) | | `spl-shared-memory` | Program for sharing data between programs | [![Crates.io](https://img.shields.io/crates/v/spl-shared-memory)](https://crates.io/crates/spl-shared-memory) | [![Docs.rs](https://docs.rs/spl-shared-memory/badge.svg)](https://docs.rs/spl-shared-memory) | | `spl-stake-pool` | Program for pooling stake accounts, managed by another entity | [![Crates.io](https://img.shields.io/crates/v/spl-stake-pool)](https://crates.io/crates/spl-stake-pool) | [![Docs.rs](https://docs.rs/spl-stake-pool/badge.svg)](https://docs.rs/spl-stake-pool) | @@ -110,7 +115,6 @@ all past and present program audits. | `@solana/spl-token` | Bindings for the token, token-2022, and associated-token-account programs | [![npm](https://img.shields.io/npm/v/@solana/spl-token.svg)](https://www.npmjs.com/package/@solana/spl-token) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://solana-labs.github.io/solana-program-library/token/js) | | `@solana/spl-governance` | Bindings for the governance program | [![npm](https://img.shields.io/npm/v/@solana/spl-governance.svg)](https://www.npmjs.com/package/@solana/spl-governance) | N/A | | `@solana/spl-account-compression` | Bindings for the account-compression program | [![npm](https://img.shields.io/npm/v/@solana/spl-account-compression.svg)](https://www.npmjs.com/package/@solana/spl-account-compression) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://solana-labs.github.io/solana-program-library/account-compression/sdk/docs) | -| `@solana/spl-memo` | Bindings for the memo program | [![npm](https://img.shields.io/npm/v/@solana/spl-memo.svg)](https://www.npmjs.com/package/@solana/spl-memo) | N/A | | `@solana/spl-name-service` | Bindings for the name-service program | [![npm](https://img.shields.io/npm/v/@solana/spl-name-service.svg)](https://www.npmjs.com/package/@solana/spl-name-service) | N/A | | `@solana/spl-stake-pool` | Bindings for the stake-pool program | [![npm](https://img.shields.io/npm/v/@solana/spl-stake-pool.svg)](https://www.npmjs.com/package/@solana/spl-stake-pool) | N/A | | `@solana/spl-token-lending` | Bindings for the token-lending program | [![npm](https://img.shields.io/npm/v/@solana/spl-token-lending.svg)](https://www.npmjs.com/package/@solana/spl-token-lending) | N/A | diff --git a/SECURITY.md b/SECURITY.md index d08589f9d82..91e69bcda73 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -47,7 +47,7 @@ the Solana Mainnet Beta. Currently, this includes: * [associated-token-account](https://github.com/solana-labs/solana-program-library/tree/master/associated-token-account/program) * [feature-proposal](https://github.com/solana-labs/solana-program-library/tree/master/feature-proposal/program) * [governance](https://github.com/solana-labs/solana-program-library/tree/master/governance/program) -* [memo](https://github.com/solana-labs/solana-program-library/tree/master/memo/program) +* [memo](https://github.com/solana-program/memo) * [name-service](https://github.com/solana-labs/solana-program-library/tree/master/name-service/program) * [stake-pool](https://github.com/solana-labs/solana-program-library/tree/master/stake-pool/program) * [token](https://github.com/solana-labs/solana-program-library/tree/master/token/program) diff --git a/ci/js-test-memo.sh b/ci/js-test-memo.sh deleted file mode 100755 index 3496f8d3f65..00000000000 --- a/ci/js-test-memo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -e -cd "$(dirname "$0")/.." -source ./ci/solana-version.sh install - -set -x -pnpm install -pnpm format - -cd memo/js -pnpm lint -pnpm build -pnpm test diff --git a/coverage.sh b/coverage.sh index e2923813d81..cb12b4b493a 100755 --- a/coverage.sh +++ b/coverage.sh @@ -22,7 +22,6 @@ reportName="lcov-${CI_COMMIT:0:9}" if [[ -z $1 ]]; then programs=( libraries/math - memo/program token/program token-lending/program token-swap/program diff --git a/docs/src/memo.md b/docs/src/memo.md index 00748522573..95bbd49d881 100644 --- a/docs/src/memo.md +++ b/docs/src/memo.md @@ -20,7 +20,7 @@ document are available at: ## Source The Memo Program's source is available on -[GitHub](https://github.com/solana-labs/solana-program-library) +[GitHub](https://github.com/solana-program/memo) ## Interface diff --git a/memo/README.md b/memo/README.md index e195553d405..71ece75d71f 100644 --- a/memo/README.md +++ b/memo/README.md @@ -1,3 +1,6 @@ +NOTE: The memo program and clients are now maintained at +[solana-program/memo](https://github.com/solana-program/memo). + # Memo Program A simple program that validates a string of UTF-8 encoded characters and logs it diff --git a/memo/js/.editorconfig b/memo/js/.editorconfig deleted file mode 100644 index 3e10c03d05b..00000000000 --- a/memo/js/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 4 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true \ No newline at end of file diff --git a/memo/js/.eslintignore b/memo/js/.eslintignore deleted file mode 100644 index 6da325effab..00000000000 --- a/memo/js/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -docs -lib -test-ledger - -package-lock.json diff --git a/memo/js/.eslintrc b/memo/js/.eslintrc deleted file mode 100644 index 0a82d0c7b1a..00000000000 --- a/memo/js/.eslintrc +++ /dev/null @@ -1,32 +0,0 @@ -{ - "root": true, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "plugin:require-extensions/recommended" - ], - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint", - "prettier", - "require-extensions" - ], - "rules": { - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/consistent-type-imports": "error" - }, - "overrides": [ - { - "files": [ - "test/**/*" - ], - "rules": { - "require-extensions/require-extensions": "off" - } - } - ] -} diff --git a/memo/js/.gitignore b/memo/js/.gitignore deleted file mode 100644 index 21f33db819c..00000000000 --- a/memo/js/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -.idea -.vscode -.DS_Store - -node_modules - -pnpm-lock.yaml -yarn.lock - -docs -lib -test-ledger -*.tsbuildinfo diff --git a/memo/js/.nojekyll b/memo/js/.nojekyll deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/memo/js/LICENSE b/memo/js/LICENSE deleted file mode 100644 index 6b0b1270ff0..00000000000 --- a/memo/js/LICENSE +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/memo/js/README.md b/memo/js/README.md deleted file mode 100644 index 2dc078f3ce6..00000000000 --- a/memo/js/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# `@solana/spl-memo` - -A TypeScript library for interacting with the SPL Memo program. - -## Links - -- [TypeScript Docs](https://solana-labs.github.io/solana-program-library/memo/js/) -- [Install](#install) -- [Build from Source](#build-from-source) - -## Install - -```shell -npm install --save @solana/spl-memo @solana/web3.js@1 -``` -_OR_ -```shell -yarn add @solana/spl-memo @solana/web3.js@1 -``` - -## Build from Source - -0. Prerequisites - -* Node 16+ -* NPM 8+ - -1. Clone the project: -```shell -git clone https://github.com/solana-labs/solana-program-library.git -``` - -2. Navigate to the library: -```shell -cd solana-program-library/memo/js -``` - -3. Install the dependencies: -```shell -npm install -``` - -4. Build the library: -```shell -npm run build -``` - -5. Run the tests: -```shell -npm run test -``` diff --git a/memo/js/jest.config.ts b/memo/js/jest.config.ts deleted file mode 100644 index 586fb9fe3d1..00000000000 --- a/memo/js/jest.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { JestConfigWithTsJest } from 'ts-jest'; - -const jestConfig: JestConfigWithTsJest = { - preset: 'ts-jest/presets/default-esm', -}; - -export default jestConfig; diff --git a/memo/js/package.json b/memo/js/package.json deleted file mode 100644 index adf78becc0d..00000000000 --- a/memo/js/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@solana/spl-memo", - "description": "SPL Memo Program JS API", - "version": "0.2.4", - "author": "Solana Labs Maintainers ", - "repository": "https://github.com/solana-labs/solana-program-library", - "license": "Apache-2.0", - "type": "module", - "sideEffects": false, - "engines": { - "node": ">=16" - }, - "files": [ - "lib", - "src", - "LICENSE", - "README.md" - ], - "publishConfig": { - "access": "public" - }, - "main": "./lib/cjs/index.js", - "module": "./lib/esm/index.js", - "types": "./lib/types/index.d.ts", - "exports": { - "types": "./lib/types/index.d.ts", - "require": "./lib/cjs/index.js", - "import": "./lib/esm/index.js" - }, - "scripts": { - "nuke": "shx rm -rf node_modules package-lock.json || true", - "reinstall": "npm run nuke && npm install", - "clean": "shx rm -rf lib **/*.tsbuildinfo || true", - "build": "tsc --build --verbose tsconfig.all.json", - "postbuild": "shx echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "watch": "tsc --build --verbose --watch tsconfig.all.json", - "release": "npm run clean && npm run build", - "lint": "eslint --max-warnings 0 .", - "lint:fix": "eslint --fix .", - "test": "npm run test:unit && npm run test:e2e", - "test:unit": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest test/unit", - "test:e2e": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" start-server-and-test 'solana-test-validator -r -q' http://127.0.0.1:8899/health 'jest test/e2e'", - "deploy": "npm run deploy:docs", - "docs": "shx rm -rf docs && typedoc && shx cp .nojekyll docs/", - "deploy:docs": "npm run docs && gh-pages --dest memo/js --dist docs --dotfiles" - }, - "peerDependencies": { - "@solana/web3.js": "^1.95.5" - }, - "dependencies": { - "buffer": "^6.0.3" - }, - "devDependencies": { - "@solana/web3.js": "^1.95.5", - "@types/chai": "^5.0.1", - "@types/jest": "^29.5.14", - "@types/node": "^22.10.1", - "@types/node-fetch": "^2.6.12", - "@typescript-eslint/eslint-plugin": "^8.4.0", - "@typescript-eslint/parser": "^8.4.0", - "chai": "^5.1.2", - "eslint": "^8.57.0", - "eslint-plugin-require-extensions": "^0.1.1", - "gh-pages": "^6.2.0", - "jest": "^29.0.0", - "process": "^0.11.10", - "shx": "^0.3.4", - "start-server-and-test": "^2.0.8", - "ts-jest": "^29.2.5", - "ts-node": "^10.9.2", - "typedoc": "^0.27.2", - "typescript": "^5.7.2" - } -} diff --git a/memo/js/src/index.ts b/memo/js/src/index.ts deleted file mode 100644 index 67f2c12aa43..00000000000 --- a/memo/js/src/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Buffer } from 'buffer'; -import { PublicKey, TransactionInstruction } from '@solana/web3.js'; - -export const MEMO_PROGRAM_ID: PublicKey = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'); - -/** - * Creates and returns an instruction which validates a string of UTF-8 - * encoded characters and verifies that any accounts provided are signers of - * the transaction. The program also logs the memo, as well as any verified - * signer addresses, to the transaction log, so that anyone can easily observe - * memos and know they were approved by zero or more addresses by inspecting - * the transaction log from a trusted provider. - * - * Public keys passed in via the signerPubkeys will identify Signers which - * must subsequently sign the Transaction including the returned - * TransactionInstruction in order for the transaction to be valid. - * - * @param memo The UTF-8 encoded memo string to validate - * @param signerPubkeys An array of public keys which must sign the - * Transaction including the returned TransactionInstruction in order - * for the transaction to be valid and the memo verification to - * succeed. null is allowed if there are no signers for the memo - * verification. - **/ -export function createMemoInstruction(memo: string, signerPubkeys?: Array): TransactionInstruction { - const keys = - signerPubkeys == null - ? [] - : signerPubkeys.map(function (key) { - return { pubkey: key, isSigner: true, isWritable: false }; - }); - - return new TransactionInstruction({ - keys: keys, - programId: MEMO_PROGRAM_ID, - data: Buffer.from(memo, 'utf8'), - }); -} diff --git a/memo/js/test/e2e/transaction.test.ts b/memo/js/test/e2e/transaction.test.ts deleted file mode 100644 index 0d7cd62871c..00000000000 --- a/memo/js/test/e2e/transaction.test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoInstruction } from '../../src/index'; -import { Connection, Keypair, Transaction, LAMPORTS_PER_SOL, sendAndConfirmTransaction } from '@solana/web3.js'; - -test('transaction: live', async () => { - const url = 'http://127.0.0.1:8899'; - const connection = new Connection(url, 'confirmed'); - await connection.getVersion(); - const signer = new Keypair(); // also fee-payer - - const airdropSignature = await connection.requestAirdrop(signer.publicKey, LAMPORTS_PER_SOL / 10); - await connection.confirmTransaction(airdropSignature, 'confirmed'); - - const memoTx = new Transaction().add(createMemoInstruction('this is a test memo', [signer.publicKey])); - await sendAndConfirmTransaction(connection, memoTx, [signer], { - preflightCommitment: 'confirmed', - }); -}); diff --git a/memo/js/test/unit/index.test.ts b/memo/js/test/unit/index.test.ts deleted file mode 100644 index 94f3309056a..00000000000 --- a/memo/js/test/unit/index.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { createMemoInstruction, MEMO_PROGRAM_ID } from '../../src/index'; -import { expect } from 'chai'; -import { Keypair } from '@solana/web3.js'; - -test('instruction: no signers', () => { - const ix = createMemoInstruction('this is a test memo', []); - expect(ix.programId).to.eql(MEMO_PROGRAM_ID); - expect(ix.keys).to.have.length(0); - expect(ix.data).to.have.length(19); - - const ix2 = createMemoInstruction('this is a test'); - expect(ix2.programId).to.eql(MEMO_PROGRAM_ID); - expect(ix2.keys).to.have.length(0); - expect(ix2.data).to.have.length(14); -}); - -test('instruction: one signer', () => { - const signer = new Keypair(); - const ix = createMemoInstruction('this is a test memo', [signer.publicKey]); - expect(ix.programId).to.eql(MEMO_PROGRAM_ID); - expect(ix.keys).to.have.length(1); - expect(ix.data).to.have.length(19); -}); - -test('instruction: many signers', () => { - const signer0 = new Keypair(); - const signer1 = new Keypair(); - const signer2 = new Keypair(); - const signer3 = new Keypair(); - const signer4 = new Keypair(); - const ix = createMemoInstruction('this is a test memo', [ - signer0.publicKey, - signer1.publicKey, - signer2.publicKey, - signer3.publicKey, - signer4.publicKey, - ]); - expect(ix.programId).to.eql(MEMO_PROGRAM_ID); - expect(ix.keys).to.have.length(5); - expect(ix.data).to.have.length(19); -}); diff --git a/memo/js/tsconfig.all.json b/memo/js/tsconfig.all.json deleted file mode 100644 index 985513259e2..00000000000 --- a/memo/js/tsconfig.all.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.root.json", - "references": [ - { - "path": "./tsconfig.cjs.json" - }, - { - "path": "./tsconfig.esm.json" - } - ] -} diff --git a/memo/js/tsconfig.base.json b/memo/js/tsconfig.base.json deleted file mode 100644 index 90620c4e485..00000000000 --- a/memo/js/tsconfig.base.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "include": [], - "compilerOptions": { - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "Node", - "esModuleInterop": true, - "isolatedModules": true, - "noEmitOnError": true, - "resolveJsonModule": true, - "strict": true, - "stripInternal": true - } -} diff --git a/memo/js/tsconfig.cjs.json b/memo/js/tsconfig.cjs.json deleted file mode 100644 index 2db9b71569e..00000000000 --- a/memo/js/tsconfig.cjs.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib/cjs", - "target": "ES2016", - "module": "CommonJS", - "sourceMap": true - } -} diff --git a/memo/js/tsconfig.esm.json b/memo/js/tsconfig.esm.json deleted file mode 100644 index 25e7e25e751..00000000000 --- a/memo/js/tsconfig.esm.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib/esm", - "declarationDir": "lib/types", - "target": "ES2020", - "module": "ES2020", - "sourceMap": true, - "declaration": true, - "declarationMap": true - } -} diff --git a/memo/js/tsconfig.json b/memo/js/tsconfig.json deleted file mode 100644 index 2f9b239bfca..00000000000 --- a/memo/js/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.all.json", - "include": ["src", "test"], - "compilerOptions": { - "noEmit": true, - "skipLibCheck": true - } -} diff --git a/memo/js/tsconfig.root.json b/memo/js/tsconfig.root.json deleted file mode 100644 index fadf294ab43..00000000000 --- a/memo/js/tsconfig.root.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "composite": true - } -} diff --git a/memo/js/typedoc.json b/memo/js/typedoc.json deleted file mode 100644 index c39fc53aee1..00000000000 --- a/memo/js/typedoc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "entryPoints": ["src/index.ts"], - "out": "docs", - "readme": "README.md" -} diff --git a/memo/program/Cargo.toml b/memo/program/Cargo.toml deleted file mode 100644 index 7631d51b9a1..00000000000 --- a/memo/program/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "spl-memo" -version = "6.0.0" -description = "Solana Program Library Memo" -authors = ["Solana Labs Maintainers "] -repository = "https://github.com/solana-labs/solana-program-library" -license = "Apache-2.0" -edition = "2021" - -[features] -no-entrypoint = [] -test-sbf = [] - -[dependencies] -solana-account-info = "2.1.0" -solana-instruction = "2.1.0" -solana-msg = "2.1.0" -solana-program-entrypoint = "2.1.0" -solana-program-error = "2.1.0" -solana-pubkey = "2.1.0" - -[dev-dependencies] -solana-program-test = "2.1.0" -solana-sdk = "2.1.0" - -[lib] -crate-type = ["cdylib", "lib"] - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] diff --git a/memo/program/Xargo.toml b/memo/program/Xargo.toml deleted file mode 100644 index 1744f098ae1..00000000000 --- a/memo/program/Xargo.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.bpfel-unknown-unknown.dependencies.std] -features = [] \ No newline at end of file diff --git a/memo/program/program-id.md b/memo/program/program-id.md deleted file mode 100644 index 284ff6d8137..00000000000 --- a/memo/program/program-id.md +++ /dev/null @@ -1 +0,0 @@ -MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr diff --git a/memo/program/src/entrypoint.rs b/memo/program/src/entrypoint.rs deleted file mode 100644 index 09ae9409615..00000000000 --- a/memo/program/src/entrypoint.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! Program entrypoint - -#![cfg(not(feature = "no-entrypoint"))] - -use { - solana_account_info::AccountInfo, solana_program_entrypoint::ProgramResult, - solana_pubkey::Pubkey, -}; - -solana_program_entrypoint::entrypoint!(process_instruction); -fn process_instruction( - program_id: &Pubkey, - accounts: &[AccountInfo], - instruction_data: &[u8], -) -> ProgramResult { - crate::processor::process_instruction(program_id, accounts, instruction_data) -} diff --git a/memo/program/src/lib.rs b/memo/program/src/lib.rs deleted file mode 100644 index 898167a75e9..00000000000 --- a/memo/program/src/lib.rs +++ /dev/null @@ -1,58 +0,0 @@ -#![deny(missing_docs)] - -//! A program that accepts a string of encoded characters and verifies that it -//! parses, while verifying and logging signers. Currently handles UTF-8 -//! characters. - -mod entrypoint; -pub mod processor; - -// Export current sdk types for downstream users building with a different sdk -// version -pub use { - solana_account_info, solana_instruction, solana_msg, solana_program_entrypoint, - solana_program_error, solana_pubkey, -}; -use { - solana_instruction::{AccountMeta, Instruction}, - solana_pubkey::Pubkey, -}; - -/// Legacy symbols from Memo v1 -pub mod v1 { - solana_pubkey::declare_id!("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"); -} - -solana_pubkey::declare_id!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"); - -/// Build a memo instruction, possibly signed -/// -/// Accounts expected by this instruction: -/// -/// 0. ..0+N. `[signer]` Expected signers; if zero provided, instruction will -/// be processed as a normal, unsigned spl-memo -pub fn build_memo(memo: &[u8], signer_pubkeys: &[&Pubkey]) -> Instruction { - Instruction { - program_id: id(), - accounts: signer_pubkeys - .iter() - .map(|&pubkey| AccountMeta::new_readonly(*pubkey, true)) - .collect(), - data: memo.to_vec(), - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_build_memo() { - let signer_pubkey = Pubkey::new_unique(); - let memo = "🐆".as_bytes(); - let instruction = build_memo(memo, &[&signer_pubkey]); - assert_eq!(memo, instruction.data); - assert_eq!(instruction.accounts.len(), 1); - assert_eq!(instruction.accounts[0].pubkey, signer_pubkey); - } -} diff --git a/memo/program/src/processor.rs b/memo/program/src/processor.rs deleted file mode 100644 index 618290ad9e6..00000000000 --- a/memo/program/src/processor.rs +++ /dev/null @@ -1,107 +0,0 @@ -//! Program state processor - -use { - solana_account_info::AccountInfo, solana_msg::msg, solana_program_entrypoint::ProgramResult, - solana_program_error::ProgramError, solana_pubkey::Pubkey, std::str::from_utf8, -}; - -/// Instruction processor -pub fn process_instruction( - _program_id: &Pubkey, - accounts: &[AccountInfo], - input: &[u8], -) -> ProgramResult { - let account_info_iter = &mut accounts.iter(); - let mut missing_required_signature = false; - for account_info in account_info_iter { - if let Some(address) = account_info.signer_key() { - msg!("Signed by {:?}", address); - } else { - missing_required_signature = true; - } - } - if missing_required_signature { - return Err(ProgramError::MissingRequiredSignature); - } - - let memo = from_utf8(input).map_err(|err| { - msg!("Invalid UTF-8, from byte {}", err.valid_up_to()); - ProgramError::InvalidInstructionData - })?; - msg!("Memo (len {}): {:?}", memo.len(), memo); - - Ok(()) -} - -#[cfg(test)] -mod tests { - use { - super::*, solana_account_info::IntoAccountInfo, solana_program_error::ProgramError, - solana_pubkey::Pubkey, solana_sdk::account::Account, - }; - - #[test] - fn test_utf8_memo() { - let program_id = Pubkey::new_from_array([0; 32]); - - let string = b"letters and such"; - assert_eq!(Ok(()), process_instruction(&program_id, &[], string)); - - let emoji = "🐆".as_bytes(); - let bytes = [0xF0, 0x9F, 0x90, 0x86]; - assert_eq!(emoji, bytes); - assert_eq!(Ok(()), process_instruction(&program_id, &[], emoji)); - - let mut bad_utf8 = bytes; - bad_utf8[3] = 0xFF; // Invalid UTF-8 byte - assert_eq!( - Err(ProgramError::InvalidInstructionData), - process_instruction(&program_id, &[], &bad_utf8) - ); - } - - #[test] - fn test_signers() { - let program_id = Pubkey::new_from_array([0; 32]); - let memo = "🐆".as_bytes(); - - let pubkey0 = Pubkey::new_unique(); - let pubkey1 = Pubkey::new_unique(); - let pubkey2 = Pubkey::new_unique(); - let mut account0 = Account::default(); - let mut account1 = Account::default(); - let mut account2 = Account::default(); - - let signed_account_infos = vec![ - (&pubkey0, true, &mut account0).into_account_info(), - (&pubkey1, true, &mut account1).into_account_info(), - (&pubkey2, true, &mut account2).into_account_info(), - ]; - assert_eq!( - Ok(()), - process_instruction(&program_id, &signed_account_infos, memo) - ); - - assert_eq!(Ok(()), process_instruction(&program_id, &[], memo)); - - let unsigned_account_infos = vec![ - (&pubkey0, false, &mut account0).into_account_info(), - (&pubkey1, false, &mut account1).into_account_info(), - (&pubkey2, false, &mut account2).into_account_info(), - ]; - assert_eq!( - Err(ProgramError::MissingRequiredSignature), - process_instruction(&program_id, &unsigned_account_infos, memo) - ); - - let partially_signed_account_infos = vec![ - (&pubkey0, true, &mut account0).into_account_info(), - (&pubkey1, false, &mut account1).into_account_info(), - (&pubkey2, true, &mut account2).into_account_info(), - ]; - assert_eq!( - Err(ProgramError::MissingRequiredSignature), - process_instruction(&program_id, &partially_signed_account_infos, memo) - ); - } -} diff --git a/memo/program/tests/functional.rs b/memo/program/tests/functional.rs deleted file mode 100644 index c8a05e1b1ed..00000000000 --- a/memo/program/tests/functional.rs +++ /dev/null @@ -1,207 +0,0 @@ -#![cfg(feature = "test-sbf")] - -use { - solana_instruction::{error::InstructionError, AccountMeta, Instruction}, - solana_program_test::*, - solana_pubkey::Pubkey, - solana_sdk::{ - signature::{Keypair, Signer}, - transaction::{Transaction, TransactionError}, - }, - spl_memo::*, -}; - -fn program_test() -> ProgramTest { - ProgramTest::new("spl_memo", id(), processor!(processor::process_instruction)) -} - -#[tokio::test] -async fn test_memo_signing() { - let memo = "🐆".as_bytes(); - let (banks_client, payer, recent_blockhash) = program_test().start().await; - - let keypairs = vec![Keypair::new(), Keypair::new(), Keypair::new()]; - let pubkeys: Vec = keypairs.iter().map(|keypair| keypair.pubkey()).collect(); - - // Test complete signing - let signer_key_refs: Vec<&Pubkey> = pubkeys.iter().collect(); - let mut transaction = - Transaction::new_with_payer(&[build_memo(memo, &signer_key_refs)], Some(&payer.pubkey())); - let mut signers = vec![&payer]; - for keypair in keypairs.iter() { - signers.push(keypair); - } - transaction.sign(&signers, recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - // Test unsigned memo - let mut transaction = - Transaction::new_with_payer(&[build_memo(memo, &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - // Demonstrate success on signature provided, regardless of specific memo - // AccountMeta - let mut transaction = Transaction::new_with_payer( - &[Instruction { - program_id: id(), - accounts: vec![ - AccountMeta::new_readonly(keypairs[0].pubkey(), true), - AccountMeta::new_readonly(keypairs[1].pubkey(), true), - AccountMeta::new_readonly(payer.pubkey(), false), - ], - data: memo.to_vec(), - }], - Some(&payer.pubkey()), - ); - transaction.sign(&[&payer, &keypairs[0], &keypairs[1]], recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - // Test missing signer(s) - let mut transaction = Transaction::new_with_payer( - &[Instruction { - program_id: id(), - accounts: vec![ - AccountMeta::new_readonly(keypairs[0].pubkey(), true), - AccountMeta::new_readonly(keypairs[1].pubkey(), false), - AccountMeta::new_readonly(keypairs[2].pubkey(), true), - ], - data: memo.to_vec(), - }], - Some(&payer.pubkey()), - ); - transaction.sign(&[&payer, &keypairs[0], &keypairs[2]], recent_blockhash); - assert_eq!( - banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(), - TransactionError::InstructionError(0, InstructionError::MissingRequiredSignature) - ); - - let mut transaction = Transaction::new_with_payer( - &[Instruction { - program_id: id(), - accounts: vec![ - AccountMeta::new_readonly(keypairs[0].pubkey(), false), - AccountMeta::new_readonly(keypairs[1].pubkey(), false), - AccountMeta::new_readonly(keypairs[2].pubkey(), false), - ], - data: memo.to_vec(), - }], - Some(&payer.pubkey()), - ); - transaction.sign(&[&payer], recent_blockhash); - assert_eq!( - banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(), - TransactionError::InstructionError(0, InstructionError::MissingRequiredSignature) - ); - - // Test invalid utf-8; demonstrate log - let invalid_utf8 = [0xF0, 0x9F, 0x90, 0x86, 0xF0, 0x9F, 0xFF, 0x86]; - let mut transaction = - Transaction::new_with_payer(&[build_memo(&invalid_utf8, &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - assert_eq!( - banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(), - TransactionError::InstructionError(0, InstructionError::InvalidInstructionData) - ); -} - -#[tokio::test] -#[ignore] -async fn test_memo_compute_limits() { - let (banks_client, payer, recent_blockhash) = program_test().start().await; - - // Test memo length - let mut memo = vec![]; - for _ in 0..1000 { - let mut vec = vec![0x53, 0x4F, 0x4C]; - memo.append(&mut vec); - } - - let mut transaction = - Transaction::new_with_payer(&[build_memo(&memo[..450], &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - let mut transaction = - Transaction::new_with_payer(&[build_memo(&memo[..600], &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - let err = banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(); - let failed_to_complete = - TransactionError::InstructionError(0, InstructionError::ProgramFailedToComplete); - let computational_budget_exceeded = - TransactionError::InstructionError(0, InstructionError::ComputationalBudgetExceeded); - assert!(err == failed_to_complete || err == computational_budget_exceeded); - - let mut memo = vec![]; - for _ in 0..100 { - let mut vec = vec![0xE2, 0x97, 0x8E]; - memo.append(&mut vec); - } - - let mut transaction = - Transaction::new_with_payer(&[build_memo(&memo[..60], &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - let mut transaction = - Transaction::new_with_payer(&[build_memo(&memo[..63], &[])], Some(&payer.pubkey())); - transaction.sign(&[&payer], recent_blockhash); - let err = banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(); - assert!(err == failed_to_complete || err == computational_budget_exceeded); - - // Test num signers with 32-byte memo - let memo = Pubkey::new_unique().to_bytes(); - let mut keypairs = vec![]; - for _ in 0..20 { - keypairs.push(Keypair::new()); - } - let pubkeys: Vec = keypairs.iter().map(|keypair| keypair.pubkey()).collect(); - let signer_key_refs: Vec<&Pubkey> = pubkeys.iter().collect(); - - let mut signers = vec![&payer]; - for keypair in keypairs[..12].iter() { - signers.push(keypair); - } - let mut transaction = Transaction::new_with_payer( - &[build_memo(&memo, &signer_key_refs[..12])], - Some(&payer.pubkey()), - ); - transaction.sign(&signers, recent_blockhash); - banks_client.process_transaction(transaction).await.unwrap(); - - let mut signers = vec![&payer]; - for keypair in keypairs[..15].iter() { - signers.push(keypair); - } - let mut transaction = Transaction::new_with_payer( - &[build_memo(&memo, &signer_key_refs[..15])], - Some(&payer.pubkey()), - ); - transaction.sign(&signers, recent_blockhash); - let err = banks_client - .process_transaction(transaction) - .await - .unwrap_err() - .unwrap(); - assert!(err == failed_to_complete || err == computational_budget_exceeded); -} diff --git a/package.json b/package.json index f6bade3eca5..b59273af3bb 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "workspaces": [ "account-compression/sdk", "libraries/type-length-value/js", - "memo/js", "single-pool/js", "stake-pool/js", "token/js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a645921d36d..e5c86974341 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -182,70 +182,6 @@ importers: specifier: ^5.7.2 version: 5.7.2 - memo/js: - dependencies: - buffer: - specifier: ^6.0.3 - version: 6.0.3 - devDependencies: - '@solana/web3.js': - specifier: ^1.95.5 - version: 1.95.5 - '@types/chai': - specifier: ^5.0.1 - version: 5.0.1 - '@types/jest': - specifier: ^29.5.14 - version: 29.5.14 - '@types/node': - specifier: ^22.10.1 - version: 22.10.1 - '@types/node-fetch': - specifier: ^2.6.12 - version: 2.6.12 - '@typescript-eslint/eslint-plugin': - specifier: ^8.4.0 - version: 8.4.0(@typescript-eslint/parser@8.4.0)(eslint@8.57.0)(typescript@5.7.2) - '@typescript-eslint/parser': - specifier: ^8.4.0 - version: 8.4.0(eslint@8.57.0)(typescript@5.7.2) - chai: - specifier: ^5.1.2 - version: 5.1.2 - eslint: - specifier: ^8.57.0 - version: 8.57.0 - eslint-plugin-require-extensions: - specifier: ^0.1.1 - version: 0.1.3(eslint@8.57.0) - gh-pages: - specifier: ^6.2.0 - version: 6.2.0 - jest: - specifier: ^29.0.0 - version: 29.7.0(@types/node@22.10.1)(ts-node@10.9.2) - process: - specifier: ^0.11.10 - version: 0.11.10 - shx: - specifier: ^0.3.4 - version: 0.3.4 - start-server-and-test: - specifier: ^2.0.8 - version: 2.0.8 - ts-jest: - specifier: ^29.2.5 - version: 29.2.5(@babel/core@7.26.0)(jest@29.7.0)(typescript@5.7.2) - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@22.10.1)(typescript@5.7.2) - typedoc: - specifier: ^0.27.2 - version: 0.27.2(typescript@5.7.2) - typescript: - specifier: ^5.7.2 - version: 5.7.2 - name-service/js: dependencies: '@solana/web3.js': @@ -715,7 +651,7 @@ importers: version: 2.0.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) '@solana/spl-memo': specifier: 0.2.4 - version: link:../../memo/js + version: 0.2.4(@solana/web3.js@1.95.5) '@solana/web3.js': specifier: ^1.95.5 version: 1.95.5 @@ -2778,6 +2714,17 @@ packages: - fastestsmallesttextencoderdecoder dev: false + /@solana/spl-memo@0.2.4(@solana/web3.js@1.95.5): + resolution: {integrity: sha512-x6MpxcUXpzRkBaqPHda/nWHqv3JOh+BsvptX4CUk5lcAB6ksr2VXLuxaAzWlLtIzU6VSU7cg2N7xGlkt28B+UQ==} + engines: {node: '>=16'} + deprecated: CommonJS exports were broken in this release + peerDependencies: + '@solana/web3.js': ^1.91.6 + dependencies: + '@solana/web3.js': 1.95.5 + buffer: 6.0.3 + dev: true + /@solana/transaction-messages@2.0.0(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2): resolution: {integrity: sha512-Uc6Fw1EJLBrmgS1lH2ZfLAAKFvprWPQQzOVwZS78Pv8Whsk7tweYTK6S0Upv0nHr50rGpnORJfmdBrXE6OfNGg==} engines: {node: '>=20.18.0'} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e1424560139..3e3548b6355 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,7 +1,6 @@ packages: - "account-compression/sdk" - "libraries/type-length-value/js" - - "memo/js" - "name-service/js" - "single-pool/js/packages/*" - "stake-pool/js" diff --git a/token/cli/Cargo.toml b/token/cli/Cargo.toml index 1893630d004..8ab362ee423 100644 --- a/token/cli/Cargo.toml +++ b/token/cli/Cargo.toml @@ -39,9 +39,7 @@ spl-token-client = { version = "0.13.0", path = "../client" } spl-token-confidential-transfer-proof-generation = { version = "0.2.0", path = "../confidential-transfer/proof-generation" } spl-token-metadata-interface = { version = "0.6.0", path = "../../token-metadata/interface" } spl-token-group-interface = { version = "0.5.0", path = "../../token-group/interface" } -spl-memo = { version = "6.0", path = "../../memo/program", features = [ - "no-entrypoint", -] } +spl-memo = { version = "6.0", features = ["no-entrypoint"] } strum = "0.26" strum_macros = "0.26" tokio = "1.41" diff --git a/token/client/Cargo.toml b/token/client/Cargo.toml index 4622d6b5d39..c7d3d94a2b5 100644 --- a/token/client/Cargo.toml +++ b/token/client/Cargo.toml @@ -21,9 +21,7 @@ solana-rpc-client-api = "2.1.0" solana-sdk = "2.1.0" spl-associated-token-account-client = { version = "2.0.0", path = "../../associated-token-account/client" } spl-elgamal-registry = { version = "0.1.0", path = "../confidential-transfer/elgamal-registry"} -spl-memo = { version = "6.0", path = "../../memo/program", features = [ - "no-entrypoint", -] } +spl-memo = { version = "6.0", features = ["no-entrypoint"] } spl-record = { version = "0.3.0", path = "../../record/program", features = ["no-entrypoint"] } spl-token = { version = "7.0", path = "../program", features = [ "no-entrypoint", diff --git a/token/program-2022-test/Cargo.toml b/token/program-2022-test/Cargo.toml index 3edc32f8c41..99c4e1842d6 100644 --- a/token/program-2022-test/Cargo.toml +++ b/token/program-2022-test/Cargo.toml @@ -25,9 +25,7 @@ solana-program-test = "2.1.0" solana-sdk = "2.1.0" spl-associated-token-account = { version = "6.0.0", path = "../../associated-token-account/program" } spl-elgamal-registry = { version = "0.1.0", path = "../confidential-transfer/elgamal-registry" } -spl-memo = { version = "6.0.0", path = "../../memo/program", features = [ - "no-entrypoint", -] } +spl-memo = { version = "6.0.0", features = ["no-entrypoint"] } spl-pod = { version = "0.5.0", path = "../../libraries/pod" } spl-record = { version = "0.3.0", path = "../../record/program", features = [ "no-entrypoint", diff --git a/token/program-2022/Cargo.toml b/token/program-2022/Cargo.toml index b71dca2df25..3b29dbcb7fd 100644 --- a/token/program-2022/Cargo.toml +++ b/token/program-2022/Cargo.toml @@ -26,7 +26,7 @@ solana-program = "2.1.0" solana-security-txt = "1.1.1" solana-zk-sdk = "2.1.0" spl-elgamal-registry = { version = "0.1.0", path = "../confidential-transfer/elgamal-registry", features = ["no-entrypoint"] } -spl-memo = { version = "6.0", path = "../../memo/program", features = [ "no-entrypoint" ] } +spl-memo = { version = "6.0", features = ["no-entrypoint"] } spl-token = { version = "7.0", path = "../program", features = ["no-entrypoint"] } spl-token-confidential-transfer-ciphertext-arithmetic = { version = "0.2.0", path = "../confidential-transfer/ciphertext-arithmetic" } spl-token-confidential-transfer-proof-extraction = { version = "0.2.0", path = "../confidential-transfer/proof-extraction" } diff --git a/utils/test-client/Cargo.toml b/utils/test-client/Cargo.toml index ff57a85ffa4..ffc54b1163c 100644 --- a/utils/test-client/Cargo.toml +++ b/utils/test-client/Cargo.toml @@ -9,6 +9,6 @@ edition = "2021" [dependencies] solana-sdk = "2.1.0" -spl-memo = { path = "../../memo/program", features = [ "no-entrypoint" ] } +spl-memo = { version = "6.0.0", features = [ "no-entrypoint" ] } spl-token = { path = "../../token/program", features = [ "no-entrypoint" ] } spl-token-swap = { path = "../../token-swap/program", features = [ "no-entrypoint" ] }