-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new pool delegation and stake registration factory methods adde…
…d to core package
- Loading branch information
1 parent
164be41
commit 82d95af
Showing
4 changed files
with
82 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
CertificateType, | ||
PoolId, | ||
RewardAccount, | ||
createDelegationCert, | ||
createStakeKeyDeregistrationCert, | ||
createStakeKeyRegistrationCert | ||
} from '../../../src/Cardano'; | ||
|
||
const rewardAccount = RewardAccount('stake1u89sasnfyjtmgk8ydqfv3fdl52f36x3djedfnzfc9rkgzrcss5vgr'); | ||
const stakeKeyHash = 'cb0ec2692497b458e46812c8a5bfa2931d1a2d965a99893828ec810f'; | ||
const poolId = PoolId('pool1ev8vy6fyj7693ergzty2t0azjvw35tvkt2vcjwpgajqs7z6u2vn'); | ||
|
||
describe('Certificate', () => { | ||
describe('createStakeKeyRegistrationCert', () => { | ||
it('can create a stake key registration certificate', () => { | ||
const cert = createStakeKeyRegistrationCert(rewardAccount); | ||
expect(cert).toEqual({ | ||
__typename: CertificateType.StakeKeyRegistration, | ||
stakeKeyHash | ||
}); | ||
}); | ||
}); | ||
|
||
describe('createStakeKeyDeregistrationCert', () => { | ||
it('can create a stake key de-registration certificate', () => { | ||
const cert = createStakeKeyDeregistrationCert(rewardAccount); | ||
expect(cert).toEqual({ | ||
__typename: CertificateType.StakeKeyDeregistration, | ||
stakeKeyHash | ||
}); | ||
}); | ||
}); | ||
|
||
describe('createDelegationCert', () => { | ||
it('can get the policy ID component from the asset id', () => { | ||
const cert = createDelegationCert(rewardAccount, poolId); | ||
expect(cert).toEqual({ | ||
__typename: CertificateType.StakeDelegation, | ||
poolId: 'pool1ev8vy6fyj7693ergzty2t0azjvw35tvkt2vcjwpgajqs7z6u2vn', | ||
stakeKeyHash | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters