nft-staking
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "nft-staking", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Stake nfts on whitestache", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "ava" | ||
}, | ||
"keywords": [], | ||
@@ -35,3 +31,7 @@ "author": "Denim Basumatary", | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "ava" | ||
} | ||
} |
@@ -40,2 +40,3 @@ /** | ||
rewardsPerDay: bigint; | ||
minStakingPeriod: number; | ||
}; | ||
@@ -48,2 +49,3 @@ | ||
rewardsPerDay: number | bigint; | ||
minStakingPeriod: number; | ||
}; | ||
@@ -63,2 +65,3 @@ | ||
['rewardsPerDay', u64()], | ||
['minStakingPeriod', u8()], | ||
], | ||
@@ -137,3 +140,3 @@ { description: 'ConfigAccountData' } | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -147,2 +150,3 @@ return gpaBuilder(context, programId) | ||
rewardsPerDay: number | bigint; | ||
minStakingPeriod: number; | ||
}>({ | ||
@@ -154,2 +158,3 @@ discriminator: [0, array(u8(), { size: 8 })], | ||
rewardsPerDay: [104, u64()], | ||
minStakingPeriod: [112, u8()], | ||
}) | ||
@@ -161,3 +166,3 @@ .deserializeUsing<Config>((account) => deserializeConfig(account)) | ||
export function getConfigSize(): number { | ||
return 112; | ||
return 113; | ||
} |
@@ -25,3 +25,2 @@ /** | ||
array, | ||
bool, | ||
i64, | ||
@@ -41,5 +40,3 @@ mapSerializer, | ||
nftMint: PublicKey; | ||
isActive: boolean; | ||
stakedOn: bigint; | ||
unstakedOn: bigint; | ||
lastClaimed: bigint; | ||
@@ -53,5 +50,3 @@ rewardAmount: bigint; | ||
nftMint: PublicKey; | ||
isActive: boolean; | ||
stakedOn: number | bigint; | ||
unstakedOn: number | bigint; | ||
lastClaimed: number | bigint; | ||
@@ -72,5 +67,3 @@ rewardAmount: number | bigint; | ||
['nftMint', publicKeySerializer()], | ||
['isActive', bool()], | ||
['stakedOn', i64()], | ||
['unstakedOn', i64()], | ||
['lastClaimed', i64()], | ||
@@ -152,3 +145,3 @@ ['rewardAmount', u64()], | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -160,5 +153,3 @@ return gpaBuilder(context, programId) | ||
nftMint: PublicKey; | ||
isActive: boolean; | ||
stakedOn: number | bigint; | ||
unstakedOn: number | bigint; | ||
lastClaimed: number | bigint; | ||
@@ -171,8 +162,6 @@ rewardAmount: number | bigint; | ||
nftMint: [40, publicKeySerializer()], | ||
isActive: [72, bool()], | ||
stakedOn: [73, i64()], | ||
unstakedOn: [81, i64()], | ||
lastClaimed: [89, i64()], | ||
rewardAmount: [97, u64()], | ||
delegateBump: [105, u8()], | ||
stakedOn: [72, i64()], | ||
lastClaimed: [80, i64()], | ||
rewardAmount: [88, u64()], | ||
delegateBump: [96, u8()], | ||
}) | ||
@@ -184,3 +173,3 @@ .deserializeUsing<NftStake>((account) => deserializeNftStake(account)) | ||
export function getNftStakeSize(): number { | ||
return 106; | ||
return 97; | ||
} |
@@ -70,2 +70,41 @@ /** | ||
/** InvalidNftStakeAuthority: User is not authority of nft stake */ | ||
export class InvalidNftStakeAuthorityError extends ProgramError { | ||
override readonly name: string = 'InvalidNftStakeAuthority'; | ||
readonly code: number = 0x1774; // 6004 | ||
constructor(program: Program, cause?: Error) { | ||
super('User is not authority of nft stake', program, cause); | ||
} | ||
} | ||
codeToErrorMap.set(0x1774, InvalidNftStakeAuthorityError); | ||
nameToErrorMap.set('InvalidNftStakeAuthority', InvalidNftStakeAuthorityError); | ||
/** InvalidNftMint: Nft mint doens't match with staked nft */ | ||
export class InvalidNftMintError extends ProgramError { | ||
override readonly name: string = 'InvalidNftMint'; | ||
readonly code: number = 0x1775; // 6005 | ||
constructor(program: Program, cause?: Error) { | ||
super("Nft mint doens't match with staked nft", program, cause); | ||
} | ||
} | ||
codeToErrorMap.set(0x1775, InvalidNftMintError); | ||
nameToErrorMap.set('InvalidNftMint', InvalidNftMintError); | ||
/** InsufficentStakingPeriod: Staking period is less than minimum requirement */ | ||
export class InsufficentStakingPeriodError extends ProgramError { | ||
override readonly name: string = 'InsufficentStakingPeriod'; | ||
readonly code: number = 0x1776; // 6006 | ||
constructor(program: Program, cause?: Error) { | ||
super('Staking period is less than minimum requirement', program, cause); | ||
} | ||
} | ||
codeToErrorMap.set(0x1776, InsufficentStakingPeriodError); | ||
nameToErrorMap.set('InsufficentStakingPeriod', InsufficentStakingPeriodError); | ||
/** | ||
@@ -72,0 +111,0 @@ * Attempts to resolve a custom program error from the provided error code. |
@@ -76,3 +76,3 @@ /** | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -79,0 +79,0 @@ |
@@ -10,2 +10,3 @@ /** | ||
export * from './claimReward'; | ||
export * from './closeConfig'; | ||
export * from './initConfig'; | ||
@@ -12,0 +13,0 @@ export * from './stake'; |
@@ -11,2 +11,4 @@ /** | ||
Context, | ||
Option, | ||
OptionOrNullable, | ||
Pda, | ||
@@ -22,2 +24,3 @@ PublicKey, | ||
mapSerializer, | ||
option, | ||
publicKey as publicKeySerializer, | ||
@@ -47,2 +50,3 @@ struct, | ||
rewardsPerDay: bigint; | ||
minStakingPeriod: Option<number>; | ||
}; | ||
@@ -54,2 +58,3 @@ | ||
rewardsPerDay: number | bigint; | ||
minStakingPeriod: OptionOrNullable<number>; | ||
}; | ||
@@ -72,2 +77,3 @@ | ||
['rewardsPerDay', u64()], | ||
['minStakingPeriod', option(u8())], | ||
], | ||
@@ -94,3 +100,3 @@ { description: 'InitConfigInstructionData' } | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -97,0 +103,0 @@ |
@@ -87,3 +87,3 @@ /** | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -90,0 +90,0 @@ |
@@ -78,3 +78,3 @@ /** | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -81,0 +81,0 @@ |
@@ -11,2 +11,4 @@ /** | ||
Context, | ||
Option, | ||
OptionOrNullable, | ||
Pda, | ||
@@ -22,2 +24,3 @@ PublicKey, | ||
mapSerializer, | ||
option, | ||
publicKey as publicKeySerializer, | ||
@@ -47,2 +50,3 @@ struct, | ||
rewardsPerDay: bigint; | ||
minStakingPeriod: Option<number>; | ||
}; | ||
@@ -54,2 +58,3 @@ | ||
rewardsPerDay: number | bigint; | ||
minStakingPeriod: OptionOrNullable<number>; | ||
}; | ||
@@ -72,2 +77,3 @@ | ||
['rewardsPerDay', u64()], | ||
['minStakingPeriod', option(u8())], | ||
], | ||
@@ -94,3 +100,3 @@ { description: 'UpdateConfigInstructionData' } | ||
'nftStaking', | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' | ||
); | ||
@@ -97,0 +103,0 @@ |
@@ -21,3 +21,3 @@ /** | ||
export const NFT_STAKING_PROGRAM_ID = | ||
'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43' as PublicKey<'5umSmTdHbUGFffe37fPH58L5J7aEp45BH42YaoSZor43'>; | ||
'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J' as PublicKey<'CYoDVdAnb1nw3pacUdUA7Dge9Tm4Jg5odb8558ZzR35J'>; | ||
@@ -24,0 +24,0 @@ export function createNftStakingProgram(): Program { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166472
77
4095