Skip to content

Commit

Permalink
transfer-hook: Move interface and example into subfolders (#5640)
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque authored Oct 24, 2023
1 parent 244c6e2 commit b817b2d
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-token.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test transfer hook example
run: ./ci/cargo-test-sbf.sh token/transfer-hook-example
run: ./ci/cargo-test-sbf.sh token/transfer-hook/example

- name: Upload program
uses: actions/upload-artifact@v2
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ members = [
"token/program",
"token/program-2022",
"token/program-2022-test",
"token/transfer-hook-example",
"token/transfer-hook-interface",
"token/transfer-hook/example",
"token/transfer-hook/interface",
"token/client",
"utils/cgen",
"utils/test-client",
Expand Down
10 changes: 5 additions & 5 deletions docs/src/token-2022/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1346,22 +1346,22 @@ explained in detail in many of the linked `README` files below under
#### Resources

The interface description and structs exist at
[spl-transfer-hook-interface](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface),
[spl-transfer-hook-interface](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface),
along with a sample minimal program implementation. You can find detailed
instructions on how to implement this interface for an on-chain program or
interact with a program that implements transfer-hook in the repository's
[README](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface/README.md).
[README](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface/README.md).

The `spl-transfer-hook-interface` library provides offchain and onchain helpers
for resolving the additional accounts required. See
[invoke.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface/src/invoke.rs)
[invoke.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface/src/invoke.rs)
for usage on-chain, and
[offchain.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface/src/offchain.rs)
[offchain.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface/src/offchain.rs)
for fetching the additional required account metas with any async off-chain client
like `BanksClient` or `RpcClient`.

A usable example program exists at
[spl-transfer-hook-example](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-example).
[spl-transfer-hook-example](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/example).
Token-2022 uses this example program in tests to ensure that it properly uses
the transfer hook interface.

Expand Down
2 changes: 1 addition & 1 deletion token/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spl-memo = { version = "4.0.0", path = "../../memo/program", features = ["no-ent
spl-token = { version = "4.0", path="../program", features = [ "no-entrypoint" ] }
spl-token-2022 = { version = "0.9", path="../program-2022" }
spl-token-metadata-interface = { version = "0.2", path="../../token-metadata/interface" }
spl-transfer-hook-interface = { version = "0.3", path="../transfer-hook-interface" }
spl-transfer-hook-interface = { version = "0.3", path="../transfer-hook/interface" }
thiserror = "1.0"

[features]
Expand Down
4 changes: 2 additions & 2 deletions token/program-2022-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ spl-token-2022 = { version = "0.9", path="../program-2022", features = ["no-entr
spl-instruction-padding = { version = "0.1.0", path="../../instruction-padding/program", features = ["no-entrypoint"] }
spl-token-client = { version = "0.7", path = "../client" }
spl-token-metadata-interface = { version = "0.2", path = "../../token-metadata/interface" }
spl-transfer-hook-example = { version = "0.3", path="../transfer-hook-example", features = ["no-entrypoint"] }
spl-transfer-hook-interface = { version = "0.3", path="../transfer-hook-interface" }
spl-transfer-hook-example = { version = "0.3", path="../transfer-hook/example", features = ["no-entrypoint"] }
spl-transfer-hook-interface = { version = "0.3", path="../transfer-hook/interface" }
test-case = "3.2"
2 changes: 1 addition & 1 deletion token/program-2022/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ solana-zk-token-sdk = "1.17.2"
spl-memo = { version = "4.0.0", path = "../../memo/program", features = [ "no-entrypoint" ] }
spl-token = { version = "4.0", path = "../program", features = ["no-entrypoint"] }
spl-token-metadata-interface = { version = "0.2.0", path = "../../token-metadata/interface" }
spl-transfer-hook-interface = { version = "0.3.0", path = "../transfer-hook-interface" }
spl-transfer-hook-interface = { version = "0.3.0", path = "../transfer-hook/interface" }
spl-type-length-value = { version = "0.3.0", path = "../../libraries/type-length-value" }
spl-pod = { version = "0.1.0", path = "../../libraries/pod" }
thiserror = "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ test-sbf = []
[dependencies]
arrayref = "0.3.7"
solana-program = "1.17.2"
spl-tlv-account-resolution = { version = "0.4" , path = "../../libraries/tlv-account-resolution" }
spl-token-2022 = { version = "0.9", path = "../program-2022", features = ["no-entrypoint"] }
spl-transfer-hook-interface = { version = "0.3" , path = "../transfer-hook-interface" }
spl-type-length-value = { version = "0.3" , path = "../../libraries/type-length-value" }
spl-tlv-account-resolution = { version = "0.4" , path = "../../../libraries/tlv-account-resolution" }
spl-token-2022 = { version = "0.9", path = "../../program-2022", features = ["no-entrypoint"] }
spl-transfer-hook-interface = { version = "0.3" , path = "../interface" }
spl-type-length-value = { version = "0.3" , path = "../../../libraries/type-length-value" }

[dev-dependencies]
solana-program-test = "1.17.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Full example program and tests implementing the `spl-transfer-hook-interface`,
to be used for testing a program that calls into the `spl-transfer-hook-interface`.

See the
[SPL Transfer Hook Interface](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface)
[SPL Transfer Hook Interface](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface)
code for more information.

### Example usage of example
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ edition = "2021"
arrayref = "0.3.7"
bytemuck = { version = "1.14.0", features = ["derive"] }
solana-program = "1.17.2"
spl-discriminator = { version = "0.1" , path = "../../libraries/discriminator" }
spl-program-error = { version = "0.3" , path = "../../libraries/program-error" }
spl-tlv-account-resolution = { version = "0.4" , path = "../../libraries/tlv-account-resolution" }
spl-type-length-value = { version = "0.3" , path = "../../libraries/type-length-value" }
spl-pod = { version = "0.1", path = "../../libraries/pod" }
spl-discriminator = { version = "0.1" , path = "../../../libraries/discriminator" }
spl-program-error = { version = "0.3" , path = "../../../libraries/program-error" }
spl-tlv-account-resolution = { version = "0.4" , path = "../../../libraries/tlv-account-resolution" }
spl-type-length-value = { version = "0.3" , path = "../../../libraries/type-length-value" }
spl-pod = { version = "0.1", path = "../../../libraries/pod" }

[lib]
crate-type = ["cdylib", "lib"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ program:

The `spl-transfer-hook-interface` library provides offchain and onchain helpers
for resolving the additional accounts required. See
[invoke.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface/src/invoke.rs)
[invoke.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface/src/invoke.rs)
for usage on-chain, and
[offchain.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook-interface/src/offchain.rs)
[offchain.rs](https://github.com/solana-labs/solana-program-library/tree/master/token/transfer-hook/interface/src/offchain.rs)
for fetching the additional required account metas with any async off-chain client
like `BanksClient` or `RpcClient`.
File renamed without changes.
File renamed without changes.

0 comments on commit b817b2d

Please sign in to comment.