spl: Fix compilation error and warnings (#2647)
This commit is contained in:
parent
5602244e1a
commit
51578bcbc5
|
@ -379,6 +379,8 @@ jobs:
|
|||
path: tests/composite
|
||||
- cmd: cd tests/errors && anchor test --skip-lint && npx tsc --noEmit
|
||||
path: tests/errors
|
||||
- cmd: cd tests/spl/metadata && anchor test --skip-lint
|
||||
path: spl/metadata
|
||||
- cmd: cd tests/spl/token-proxy && anchor test --skip-lint
|
||||
path: spl/token-proxy
|
||||
- cmd: cd tests/spl/token-wrapper && anchor test --skip-lint
|
||||
|
|
|
@ -106,18 +106,8 @@ pub fn create_metadata_accounts_v3<'info>(
|
|||
ctx: CpiContext<'_, '_, '_, 'info, CreateMetadataAccountsV3<'info>>,
|
||||
data: mpl_token_metadata::types::DataV2,
|
||||
is_mutable: bool,
|
||||
update_authority_is_signer: bool,
|
||||
details: Option<mpl_token_metadata::types::CollectionDetails>,
|
||||
collection_details: Option<mpl_token_metadata::types::CollectionDetails>,
|
||||
) -> Result<()> {
|
||||
let mpl_token_metadata::types::DataV2 {
|
||||
name,
|
||||
symbol,
|
||||
uri,
|
||||
creators,
|
||||
seller_fee_basis_points,
|
||||
collection,
|
||||
uses,
|
||||
} = data;
|
||||
let ix = mpl_token_metadata::instructions::CreateMetadataAccountV3 {
|
||||
metadata: *ctx.accounts.metadata.key,
|
||||
mint: *ctx.accounts.mint.key,
|
||||
|
@ -129,7 +119,7 @@ pub fn create_metadata_accounts_v3<'info>(
|
|||
}
|
||||
.instruction(
|
||||
mpl_token_metadata::instructions::CreateMetadataAccountV3InstructionArgs {
|
||||
collection_details: details,
|
||||
collection_details,
|
||||
data,
|
||||
is_mutable,
|
||||
},
|
||||
|
@ -468,7 +458,7 @@ pub fn remove_creator_verification<'info>(
|
|||
|
||||
pub fn utilize<'info>(
|
||||
ctx: CpiContext<'_, '_, '_, 'info, Utilize<'info>>,
|
||||
use_authority_record_pda: Option<Pubkey>,
|
||||
use_authority_record: Option<Pubkey>,
|
||||
burner: Option<Pubkey>,
|
||||
number_of_uses: u64,
|
||||
) -> Result<()> {
|
||||
|
@ -483,7 +473,7 @@ pub fn utilize<'info>(
|
|||
token_account: *ctx.accounts.token_account.key,
|
||||
token_program: spl_token::ID,
|
||||
use_authority: *ctx.accounts.use_authority.key,
|
||||
use_authority_record: None,
|
||||
use_authority_record,
|
||||
}
|
||||
.instruction(mpl_token_metadata::instructions::UtilizeInstructionArgs { number_of_uses });
|
||||
solana_program::program::invoke_signed(
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"relations-derivation",
|
||||
"pyth",
|
||||
"realloc",
|
||||
"spl/metadata",
|
||||
"spl/token-proxy",
|
||||
"spl/token-wrapper",
|
||||
"swap",
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
[programs.localnet]
|
||||
metadata = "Metadata11111111111111111111111111111111111"
|
||||
|
||||
[provider]
|
||||
cluster = "localnet"
|
||||
wallet = "~/.config/solana/id.json"
|
||||
|
||||
[scripts]
|
||||
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
|
|
@ -0,0 +1,13 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"programs/*"
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
overflow-checks = true
|
||||
lto = "fat"
|
||||
codegen-units = 1
|
||||
[profile.release.build-override]
|
||||
opt-level = 3
|
||||
incremental = false
|
||||
codegen-units = 1
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "metadata",
|
||||
"version": "0.28.0",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"homepage": "https://github.com/coral-xyz/anchor#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/coral-xyz/anchor/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/coral-xyz/anchor.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=17"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
[package]
|
||||
name = "metadata"
|
||||
version = "0.1.0"
|
||||
description = "Created with Anchor"
|
||||
rust-version = "1.60"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
name = "metadata"
|
||||
|
||||
[features]
|
||||
no-entrypoint = []
|
||||
no-idl = []
|
||||
cpi = ["no-entrypoint"]
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
anchor-lang = { path = "../../../../../lang" }
|
||||
anchor-spl = { path = "../../../../../spl", features = ["metadata"] }
|
|
@ -0,0 +1,2 @@
|
|||
[target.bpfel-unknown-unknown.dependencies.std]
|
||||
features = []
|
|
@ -0,0 +1,8 @@
|
|||
//! Only tests whether `anchor-spl` builds with `metadata` feature enabled.
|
||||
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
declare_id!("Metadata11111111111111111111111111111111111");
|
||||
|
||||
#[program]
|
||||
pub mod metadata {}
|
|
@ -0,0 +1,12 @@
|
|||
import * as anchor from "@coral-xyz/anchor";
|
||||
|
||||
import { Metadata } from "../target/types/metadata";
|
||||
|
||||
describe("Client interactions", () => {
|
||||
anchor.setProvider(anchor.AnchorProvider.env());
|
||||
const program = anchor.workspace.metadata as anchor.Program<Metadata>;
|
||||
|
||||
it("Builds and deploys", () => {
|
||||
console.log("Program ID:", program.programId.toBase58());
|
||||
});
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"types": ["mocha", "chai"],
|
||||
"lib": ["es2015"],
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue