CargoIDL: {
accounts: [{
docs: ["A pod that can store any number of resources and tracks stats given a definition."];
name: "cargoPod";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The definition of tracked stats."];
name: "statsDefinition";
type: "publicKey";
}, {
docs: ["The authority for this pod."];
name: "authority";
type: "publicKey";
}, {
docs: ["The number of open token accounts in this pod."];
name: "openTokenAccounts";
type: "u8";
}, {
docs: ["The seeds of the signer for this pod."];
name: "podSeeds";
type: {
array: ["u8", 32];
};
}, {
docs: ["The bump of the signer for this pod."];
name: "podBump";
type: "u8";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}, {
docs: ["The number of unupdated token accounts in this pod. If this is greater than zero means the pod is frozen and only can withdraw cargo but not deposit."];
name: "unupdatedTokenAccounts";
type: "u8";
}];
kind: "struct";
};
}, {
docs: ["A definition of cargo stats.", "Remaining data is the stats."];
name: "cargoStatsDefinition";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The authority for this definition."];
name: "authority";
type: "publicKey";
}, {
docs: ["The default cargo type. System program (all 0s) if none."];
name: "defaultCargoType";
type: "publicKey";
}, {
docs: ["The number of stats in this definition."];
name: "statsCount";
type: "u16";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}];
kind: "struct";
};
}, {
docs: ["The stats for a given cargo type (token mint)."];
name: "cargoType";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The definition this follows"];
name: "statsDefinition";
type: "publicKey";
}, {
docs: ["The mint the cargo type is for"];
name: "mint";
type: "publicKey";
}, {
docs: ["The bump for this account"];
name: "bump";
type: "u8";
}, {
docs: ["The number of stats in this definition."];
name: "statsCount";
type: "u16";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}];
kind: "struct";
};
}];
docs: ["The `cargo` program"];
errors: [{
code: 6000;
msg: "A given stat was out of bounds";
name: "StatOutOfBounds";
}, {
code: 6001;
msg: "There are too many stats";
name: "TooManyStats";
}, {
code: 6002;
msg: "Rent funder was not owned by the system program or this program";
name: "InvalidRentFunder";
}, {
code: 6003;
msg: "Popped a stat when there are no stats left";
name: "TooFewStats";
}, {
code: 6004;
msg: "System program is missing when needed";
name: "MissingSystemProgram";
}, {
code: 6005;
msg: "Cargo stat data was invalid";
name: "InvalidCargoStat";
}, {
code: 6006;
msg: "Cargo stat size data was invalid";
name: "InvalidCargoStatSize";
}, {
code: 6007;
msg: "Cargo type is invalid";
name: "InvalidCargoType";
}, {
code: 6008;
msg: "Wrong number of definitions provided to init a cargo type";
name: "WrongNumberOfDefinitions";
}, {
code: 6009;
msg: "Invalid value provided for stat";
name: "InvalidValueForStat";
}, {
code: 6010;
msg: "Math overflow";
name: "NumericOverflow";
}, {
code: 6011;
msg: "Authority mismatch";
name: "AuthorityMismatch";
}, {
code: 6012;
msg: "Stats definition mismatch";
name: "StatsDefinitionMismatch";
}, {
code: 6013;
msg: "Mint mismatch";
name: "MintMismatch";
}, {
code: 6014;
msg: "Owner mismatch";
name: "OwnerMismatch";
}, {
code: 6015;
msg: "Delegated amount is invalid";
name: "InvalidDelegation";
}, {
code: 6016;
msg: "The pod is frozen";
name: "FrozenPod";
}, {
code: 6017;
msg: "Unupdated CargoPod Account";
name: "UnupdatedCargoPodAccount";
}, {
code: 6018;
msg: "Invalid seq_id";
name: "InvalidSeqId";
}, {
code: 6019;
msg: "Unupdated token account";
name: "UnupdatedTokenAccount";
}, {
code: 6020;
msg: "Cargo Pod has token accounts open";
name: "OpenTokenAccounts";
}, {
code: 6021;
msg: "Non Zero Delegated Amount";
name: "NonZeroDelegation";
}, {
code: 6022;
msg: "Invalid previous cargo_type account";
name: "InvalidPreviousType";
}, {
code: 6023;
msg: "Insufficient cargo amount";
name: "InsufficientCargoAmount";
}, {
code: 6024;
msg: "Insufficient token amount";
name: "InsufficientTokenAmount";
}, {
code: 6025;
msg: "Pod Token Account Already Updated";
name: "PodTokenAccountAlreadyUpdated";
}];
instructions: [{
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["Signer for Cargo Token Transfer"];
isMut: false;
isSigner: true;
name: "signerOriginAccount";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Origin Token Account"];
isMut: true;
isSigner: false;
name: "originTokenAccount";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Adds cargo to a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "addCargo";
}, {
accounts: [{
docs: ["The account to return the rent"];
isMut: true;
isSigner: false;
name: "funder";
}, {
docs: ["The authority for the pod account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The system Program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [];
docs: ["Closes the [`CargoPod`](state::CargoPod) if it has no open token accounts.", "Requires the authority to sign."];
name: "closeCargoPod";
}, {
accounts: [{
docs: ["The account to return the rent"];
isMut: true;
isSigner: false;
name: "funder";
}, {
docs: ["The authority for [CargoPod] account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoPod] account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo Type Account", "If the token account belongs to a registered Cargo Type then this account must be a valid Cargo Type", "However, to allow closing token account that are not valid Cargo this is an unchecked account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Token Mint"];
isMut: true;
isSigner: false;
name: "mint";
}, {
docs: ["The Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Closes and burns any excess tokens in a given token account within a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "closeTokenAccount";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Consumes cargo from a [`CargoPod`](state::CargoPod), burning the amount.", "Requires the authority to sign."];
name: "consumeCargo";
}, {
accounts: [{
docs: ["The funder for the new cargo pod"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The authority for the new cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The new cargo pod"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The definition of tracked stats"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "podSeeds";
type: {
array: ["u8", 32];
};
}];
docs: ["Inits a new [`CargoPod`](state::CargoPod) account for the given [`CargoStatsDefinition`](state::CargoStatsDefinition) and authority."];
name: "initCargoPod";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The crafting permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The mint for the new cargo type"];
isMut: false;
isSigner: false;
name: "mint";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeInput";
};
}];
docs: ["Inits a new [`CargoType`](state::CargoType) account for the given [`CargoStatsDefinition`](state::CargoStatsDefinition)."];
name: "initCargoType";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The mint for the new cargo type"];
isMut: false;
isSigner: false;
name: "mint";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeInput";
};
}];
docs: ["Creates a new cargo type for the next `seq_id`."];
name: "initCargoTypeForNextSeqId";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The old Cargo Type Account"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeFromOldCargoTypeInput";
};
}];
docs: ["Creates a new cargo type for the next `seq_id` from a given cargo type."];
name: "initCargoTypeFromOldCargoType";
}, {
accounts: [{
docs: ["The cargo permissions [`Profile`](player_profile::state::Profile).", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the new definition"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The new definition"];
isMut: true;
isSigner: true;
name: "statsDefinition";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitDefinitionInput";
};
}];
docs: ["Inits a [`CargoStatsDefinition`](state::CargoStatsDefinition) account."];
name: "initDefinition";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Legitimizes cargo in a [`CargoPod`](state::CargoPod) that was added outside of [`add_cargo`] or other cargo ix.", "Requires the authority to sign."];
name: "legitimizeCargo";
}, {
accounts: [{
docs: ["Authority for the [`CargoPod`] Account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The mint Authority"];
isMut: false;
isSigner: true;
name: "mintAuthority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [`CargoPod`] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The [`CargoType`] Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo token mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "mintAmount";
type: "u64";
}];
docs: ["Mints tokens directly to a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "mintTo";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Destination Token Account"];
isMut: true;
isSigner: false;
name: "destinationTokenAccount";
}, {
docs: ["Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Removes cargo from a [`CargoPod`](state::CargoPod) to a given token account.", "Requires the authority to sign."];
name: "removeCargo";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "originPodAuthority";
}, {
docs: ["New authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "newPodAuthority";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}];
args: [];
docs: ["Transfers authority of a [`CargoPod`](state::CargoPod) to a new authority.", "Requires both authorities to sign."];
name: "transferAuthority";
}, {
accounts: [{
docs: ["Authority for the origin cargo pod"];
isMut: false;
isSigner: true;
name: "originPodAuthority";
}, {
docs: ["Authority for the destination cargo pod"];
isMut: false;
isSigner: true;
name: "destinationPodAuthority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The Origin [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "originCargoPod";
}, {
docs: ["The Destination [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "destinationCargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Origin Token Account"];
isMut: true;
isSigner: false;
name: "originTokenAccount";
}, {
docs: ["The Destination Token Account"];
isMut: true;
isSigner: false;
name: "destinationTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Transfers cargo between [`CargoPod`](state::CargoPod)s.", "Requires both authorities to sign."];
name: "transferCargo";
}, {
accounts: [{
docs: ["The cargo pod to update"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The definition of tracked stats"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}];
args: [];
docs: ["Updates a [`CargoPod`](state::CargoPod) account to have the newest sequence id from the [`CargoDefinition`](state::CargoStatsDefinition).", "This is the first step to update a [`CargoPod`](state::CargoPod) to a new [`CargoStatsDefinition`](state::CargoStatsDefinition).", "Permissionless function."];
name: "updateCargoPod";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`](player_profile::state::Profile).", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The [CargoStatsDefinition]"];
isMut: true;
isSigner: false;
name: "statsDefinition";
}];
args: [{
name: "input";
type: {
defined: "UpdateDefinitionInput";
};
}];
docs: ["Updates a [`CargoStatsDefinition`](state::CargoStatsDefinition) account.", "Will advance the `seq_id` unless `rollback` is set to true."];
name: "updateDefinition";
}, {
accounts: [{
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The previous version(`seq_id`) Cargo Type"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The updated Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Updates a [`CargoPod`](state::CargoPod)'s token account to have the same sequence id as the [`CargoPod`](state::CargoPod).", "This must be called after [`update_cargo_pod`].", "Permissionless function."];
name: "updatePodTokenAccount";
}, {
accounts: [{
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The previous version(`seq_id`) Cargo Type"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo token mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Removes a pod's token account if it no longer has a cargo type by burning all the invalid cargo.", "This must be called after [`update_cargo_pod`].", "Permissionless function."];
name: "updateTokenAccountForInvalidType";
}];
name: "cargo";
types: [{
docs: ["Struct for data input for this IX"];
name: "InitCargoTypeFromOldCargoTypeInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["vector with values for all stats tracked by the definition"];
name: "newValues";
type: {
option: {
vec: "u64";
};
};
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for this IX"];
name: "InitCargoTypeInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["vector with values for all stats tracked by the definition"];
name: "values";
type: {
vec: "u64";
};
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for [`InitDefinition`]"];
name: "InitDefinitionInput";
type: {
fields: [{
docs: ["the count of stats the definition has"];
name: "cargoStats";
type: "u16";
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for this IX"];
name: "UpdateDefinitionInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["flag that if present means we need to decrease the definition seq_id"];
name: "rollback";
type: {
option: "bool";
};
}];
kind: "struct";
};
}];
version: "0.1.0";
}
Type declaration
-
accounts: [{
docs: ["A pod that can store any number of resources and tracks stats given a definition."];
name: "cargoPod";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The definition of tracked stats."];
name: "statsDefinition";
type: "publicKey";
}, {
docs: ["The authority for this pod."];
name: "authority";
type: "publicKey";
}, {
docs: ["The number of open token accounts in this pod."];
name: "openTokenAccounts";
type: "u8";
}, {
docs: ["The seeds of the signer for this pod."];
name: "podSeeds";
type: {
array: ["u8", 32];
};
}, {
docs: ["The bump of the signer for this pod."];
name: "podBump";
type: "u8";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}, {
docs: ["The number of unupdated token accounts in this pod. If this is greater than zero means the pod is frozen and only can withdraw cargo but not deposit."];
name: "unupdatedTokenAccounts";
type: "u8";
}];
kind: "struct";
};
}, {
docs: ["A definition of cargo stats.", "Remaining data is the stats."];
name: "cargoStatsDefinition";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The authority for this definition."];
name: "authority";
type: "publicKey";
}, {
docs: ["The default cargo type. System program (all 0s) if none."];
name: "defaultCargoType";
type: "publicKey";
}, {
docs: ["The number of stats in this definition."];
name: "statsCount";
type: "u16";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}];
kind: "struct";
};
}, {
docs: ["The stats for a given cargo type (token mint)."];
name: "cargoType";
type: {
fields: [{
docs: ["The data version of this account."];
name: "version";
type: "u8";
}, {
docs: ["The definition this follows"];
name: "statsDefinition";
type: "publicKey";
}, {
docs: ["The mint the cargo type is for"];
name: "mint";
type: "publicKey";
}, {
docs: ["The bump for this account"];
name: "bump";
type: "u8";
}, {
docs: ["The number of stats in this definition."];
name: "statsCount";
type: "u16";
}, {
docs: ["The sequence id for the definition"];
name: "seqId";
type: "u16";
}];
kind: "struct";
};
}]
-
docs: ["The `cargo` program"]
-
errors: [{
code: 6000;
msg: "A given stat was out of bounds";
name: "StatOutOfBounds";
}, {
code: 6001;
msg: "There are too many stats";
name: "TooManyStats";
}, {
code: 6002;
msg: "Rent funder was not owned by the system program or this program";
name: "InvalidRentFunder";
}, {
code: 6003;
msg: "Popped a stat when there are no stats left";
name: "TooFewStats";
}, {
code: 6004;
msg: "System program is missing when needed";
name: "MissingSystemProgram";
}, {
code: 6005;
msg: "Cargo stat data was invalid";
name: "InvalidCargoStat";
}, {
code: 6006;
msg: "Cargo stat size data was invalid";
name: "InvalidCargoStatSize";
}, {
code: 6007;
msg: "Cargo type is invalid";
name: "InvalidCargoType";
}, {
code: 6008;
msg: "Wrong number of definitions provided to init a cargo type";
name: "WrongNumberOfDefinitions";
}, {
code: 6009;
msg: "Invalid value provided for stat";
name: "InvalidValueForStat";
}, {
code: 6010;
msg: "Math overflow";
name: "NumericOverflow";
}, {
code: 6011;
msg: "Authority mismatch";
name: "AuthorityMismatch";
}, {
code: 6012;
msg: "Stats definition mismatch";
name: "StatsDefinitionMismatch";
}, {
code: 6013;
msg: "Mint mismatch";
name: "MintMismatch";
}, {
code: 6014;
msg: "Owner mismatch";
name: "OwnerMismatch";
}, {
code: 6015;
msg: "Delegated amount is invalid";
name: "InvalidDelegation";
}, {
code: 6016;
msg: "The pod is frozen";
name: "FrozenPod";
}, {
code: 6017;
msg: "Unupdated CargoPod Account";
name: "UnupdatedCargoPodAccount";
}, {
code: 6018;
msg: "Invalid seq_id";
name: "InvalidSeqId";
}, {
code: 6019;
msg: "Unupdated token account";
name: "UnupdatedTokenAccount";
}, {
code: 6020;
msg: "Cargo Pod has token accounts open";
name: "OpenTokenAccounts";
}, {
code: 6021;
msg: "Non Zero Delegated Amount";
name: "NonZeroDelegation";
}, {
code: 6022;
msg: "Invalid previous cargo_type account";
name: "InvalidPreviousType";
}, {
code: 6023;
msg: "Insufficient cargo amount";
name: "InsufficientCargoAmount";
}, {
code: 6024;
msg: "Insufficient token amount";
name: "InsufficientTokenAmount";
}, {
code: 6025;
msg: "Pod Token Account Already Updated";
name: "PodTokenAccountAlreadyUpdated";
}]
-
instructions: [{
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["Signer for Cargo Token Transfer"];
isMut: false;
isSigner: true;
name: "signerOriginAccount";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Origin Token Account"];
isMut: true;
isSigner: false;
name: "originTokenAccount";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Adds cargo to a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "addCargo";
}, {
accounts: [{
docs: ["The account to return the rent"];
isMut: true;
isSigner: false;
name: "funder";
}, {
docs: ["The authority for the pod account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The system Program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [];
docs: ["Closes the [`CargoPod`](state::CargoPod) if it has no open token accounts.", "Requires the authority to sign."];
name: "closeCargoPod";
}, {
accounts: [{
docs: ["The account to return the rent"];
isMut: true;
isSigner: false;
name: "funder";
}, {
docs: ["The authority for [CargoPod] account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoPod] account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo Type Account", "If the token account belongs to a registered Cargo Type then this account must be a valid Cargo Type", "However, to allow closing token account that are not valid Cargo this is an unchecked account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Token Mint"];
isMut: true;
isSigner: false;
name: "mint";
}, {
docs: ["The Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Closes and burns any excess tokens in a given token account within a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "closeTokenAccount";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Consumes cargo from a [`CargoPod`](state::CargoPod), burning the amount.", "Requires the authority to sign."];
name: "consumeCargo";
}, {
accounts: [{
docs: ["The funder for the new cargo pod"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The authority for the new cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The new cargo pod"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The definition of tracked stats"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "podSeeds";
type: {
array: ["u8", 32];
};
}];
docs: ["Inits a new [`CargoPod`](state::CargoPod) account for the given [`CargoStatsDefinition`](state::CargoStatsDefinition) and authority."];
name: "initCargoPod";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The crafting permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The mint for the new cargo type"];
isMut: false;
isSigner: false;
name: "mint";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeInput";
};
}];
docs: ["Inits a new [`CargoType`](state::CargoType) account for the given [`CargoStatsDefinition`](state::CargoStatsDefinition)."];
name: "initCargoType";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The mint for the new cargo type"];
isMut: false;
isSigner: false;
name: "mint";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeInput";
};
}];
docs: ["Creates a new cargo type for the next `seq_id`."];
name: "initCargoTypeForNextSeqId";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`].", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the cargo type"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The definition for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The old Cargo Type Account"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The cargo type to init"];
isMut: true;
isSigner: false;
name: "cargoType";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitCargoTypeFromOldCargoTypeInput";
};
}];
docs: ["Creates a new cargo type for the next `seq_id` from a given cargo type."];
name: "initCargoTypeFromOldCargoType";
}, {
accounts: [{
docs: ["The cargo permissions [`Profile`](player_profile::state::Profile).", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The funder for the new definition"];
isMut: true;
isSigner: true;
name: "funder";
}, {
docs: ["The new definition"];
isMut: true;
isSigner: true;
name: "statsDefinition";
}, {
docs: ["The system program"];
isMut: false;
isSigner: false;
name: "systemProgram";
}];
args: [{
name: "input";
type: {
defined: "InitDefinitionInput";
};
}];
docs: ["Inits a [`CargoStatsDefinition`](state::CargoStatsDefinition) account."];
name: "initDefinition";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Legitimizes cargo in a [`CargoPod`](state::CargoPod) that was added outside of [`add_cargo`] or other cargo ix.", "Requires the authority to sign."];
name: "legitimizeCargo";
}, {
accounts: [{
docs: ["Authority for the [`CargoPod`] Account"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The mint Authority"];
isMut: false;
isSigner: true;
name: "mintAuthority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [`CargoPod`] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The [`CargoType`] Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo token mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "mintAmount";
type: "u64";
}];
docs: ["Mints tokens directly to a [`CargoPod`](state::CargoPod).", "Requires the authority to sign."];
name: "mintTo";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "authority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Destination Token Account"];
isMut: true;
isSigner: false;
name: "destinationTokenAccount";
}, {
docs: ["Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Removes cargo from a [`CargoPod`](state::CargoPod) to a given token account.", "Requires the authority to sign."];
name: "removeCargo";
}, {
accounts: [{
docs: ["Authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "originPodAuthority";
}, {
docs: ["New authority for the cargo pod"];
isMut: false;
isSigner: true;
name: "newPodAuthority";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}];
args: [];
docs: ["Transfers authority of a [`CargoPod`](state::CargoPod) to a new authority.", "Requires both authorities to sign."];
name: "transferAuthority";
}, {
accounts: [{
docs: ["Authority for the origin cargo pod"];
isMut: false;
isSigner: true;
name: "originPodAuthority";
}, {
docs: ["Authority for the destination cargo pod"];
isMut: false;
isSigner: true;
name: "destinationPodAuthority";
}, {
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The Origin [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "originCargoPod";
}, {
docs: ["The Destination [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "destinationCargoPod";
}, {
docs: ["The Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Origin Token Account"];
isMut: true;
isSigner: false;
name: "originTokenAccount";
}, {
docs: ["The Destination Token Account"];
isMut: true;
isSigner: false;
name: "destinationTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [{
name: "cargoAmount";
type: "u64";
}];
docs: ["Transfers cargo between [`CargoPod`](state::CargoPod)s.", "Requires both authorities to sign."];
name: "transferCargo";
}, {
accounts: [{
docs: ["The cargo pod to update"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The definition of tracked stats"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}];
args: [];
docs: ["Updates a [`CargoPod`](state::CargoPod) account to have the newest sequence id from the [`CargoDefinition`](state::CargoStatsDefinition).", "This is the first step to update a [`CargoPod`](state::CargoPod) to a new [`CargoStatsDefinition`](state::CargoStatsDefinition).", "Permissionless function."];
name: "updateCargoPod";
}, {
accounts: [{
docs: ["The key authorized for this instruction"];
isMut: false;
isSigner: true;
name: "key";
}, {
docs: ["The cargo permissions [`Profile`](player_profile::state::Profile).", "Is going to act as the authority for the new definition."];
isMut: false;
isSigner: false;
name: "profile";
}, {
docs: ["The [CargoStatsDefinition]"];
isMut: true;
isSigner: false;
name: "statsDefinition";
}];
args: [{
name: "input";
type: {
defined: "UpdateDefinitionInput";
};
}];
docs: ["Updates a [`CargoStatsDefinition`](state::CargoStatsDefinition) account.", "Will advance the `seq_id` unless `rollback` is set to true."];
name: "updateDefinition";
}, {
accounts: [{
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The previous version(`seq_id`) Cargo Type"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The updated Cargo Type Account"];
isMut: false;
isSigner: false;
name: "cargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Updates a [`CargoPod`](state::CargoPod)'s token account to have the same sequence id as the [`CargoPod`](state::CargoPod).", "This must be called after [`update_cargo_pod`].", "Permissionless function."];
name: "updatePodTokenAccount";
}, {
accounts: [{
docs: ["The [CargoStatsDefinition] for the cargo type"];
isMut: false;
isSigner: false;
name: "statsDefinition";
}, {
docs: ["The [CargoPod] Account"];
isMut: true;
isSigner: false;
name: "cargoPod";
}, {
docs: ["The previous version(`seq_id`) Cargo Type"];
isMut: false;
isSigner: false;
name: "oldCargoType";
}, {
docs: ["The Cargo Token Account"];
isMut: true;
isSigner: false;
name: "cargoTokenAccount";
}, {
docs: ["The Cargo token mint"];
isMut: true;
isSigner: false;
name: "tokenMint";
}, {
docs: ["Token Program"];
isMut: false;
isSigner: false;
name: "tokenProgram";
}];
args: [];
docs: ["Removes a pod's token account if it no longer has a cargo type by burning all the invalid cargo.", "This must be called after [`update_cargo_pod`].", "Permissionless function."];
name: "updateTokenAccountForInvalidType";
}]
-
name: "cargo"
-
types: [{
docs: ["Struct for data input for this IX"];
name: "InitCargoTypeFromOldCargoTypeInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["vector with values for all stats tracked by the definition"];
name: "newValues";
type: {
option: {
vec: "u64";
};
};
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for this IX"];
name: "InitCargoTypeInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["vector with values for all stats tracked by the definition"];
name: "values";
type: {
vec: "u64";
};
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for [`InitDefinition`]"];
name: "InitDefinitionInput";
type: {
fields: [{
docs: ["the count of stats the definition has"];
name: "cargoStats";
type: "u16";
}];
kind: "struct";
};
}, {
docs: ["Struct for data input for this IX"];
name: "UpdateDefinitionInput";
type: {
fields: [{
docs: ["the index of the key in the crafting permissions profile"];
name: "keyIndex";
type: "u16";
}, {
docs: ["flag that if present means we need to decrease the definition seq_id"];
name: "rollback";
type: {
option: "bool";
};
}];
kind: "struct";
};
}]
-
version: "0.1.0"