Skip to content

Commit

Permalink
add simple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskp committed Dec 3, 2023
1 parent 252ac6f commit e6c0059
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions packages/connect/e2e/__fixtures__/cardanoSignTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CardanoAddressType,
CardanoCVoteRegistrationFormat,
CardanoCertificateType,
CardanoDRepType,
CardanoTxOutputSerializationFormat,
CardanoTxSigningMode,
} from '@trezor/protobuf/lib/messages';
Expand Down Expand Up @@ -223,6 +224,11 @@ const SAMPLE_CERTIFICATES = {
type: CardanoCertificateType.STAKE_REGISTRATION,
path: "m/1852'/1815'/0'/2/0",
},
stake_registration_conway: {
type: CardanoCertificateType.STAKE_REGISTRATION_CONWAY,
path: "m/1852'/1815'/0'/2/0",
deposit: '2000000',
},
stake_registration_script: {
type: CardanoCertificateType.STAKE_REGISTRATION,
scriptHash: '29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd',
Expand All @@ -231,6 +237,11 @@ const SAMPLE_CERTIFICATES = {
type: CardanoCertificateType.STAKE_DEREGISTRATION,
path: "m/1852'/1815'/0'/2/0",
},
stake_deregistration_conway: {
type: CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY,
path: "m/1852'/1815'/0'/2/0",
deposit: '2000000',
},
stake_deregistration_script: {
type: CardanoCertificateType.STAKE_DEREGISTRATION,
scriptHash: '29fb5fd4aa8cadd6705acc8263cee0fc62edca5ac38db593fec2f9fd',
Expand Down Expand Up @@ -325,6 +336,13 @@ const SAMPLE_CERTIFICATES = {
metadata: null,
},
},
vote_delegation_abstain: {
type: CardanoCertificateType.VOTE_DELEGATION,
path: "m/1852'/1815'/0'/2/0",
drep: {
type: CardanoDRepType.ABSTAIN,
},
},
};

const SAMPLE_WITHDRAWALS = {
Expand Down Expand Up @@ -639,6 +657,41 @@ export default {
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signStakeRegistrationConway',
params: {
inputs: [SAMPLE_INPUTS.shelley_input],
outputs: [SAMPLE_OUTPUTS.simple_shelley_output],
fee: FEE,
ttl: TTL,
certificates: [SAMPLE_CERTIFICATES.stake_registration_conway],
protocolMagic: PROTOCOL_MAGICS.mainnet,
networkId: NETWORK_IDS.mainnet,
signingMode: CardanoTxSigningMode.ORDINARY_TRANSACTION,
},
result: {
hash: 'e200b2c91f3493a1f3b9cfc8b6c141f70181741025e53941e9d57d22b1470c5c',
witnesses: [
{
type: 1,
pubKey: '5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1',
signature:
'79a357517a08c7256b0fab1e93a92a477386f4c2d72cea7bc68527c0133c32472305f010350665d72e8017bb6c2080b5742680ce7700bbddda561c917f294a07',
chainCode: null,
},
{
type: 1,
pubKey: 'bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e',
signature:
'dca542910d0362fc22744e7a24732343db4e013495a7d9b47562886f09af8eb56ecaa105e20a9df3e4248fdab61dd91b6fb2a3bfc15d0d9a0442671c07e1ba02',
chainCode: null,
},
],
auxiliaryDataSupplement: undefined,
},
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signStakeRegistrationNoOutputs',
params: {
Expand Down Expand Up @@ -740,6 +793,41 @@ export default {
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signStakeDeregistrationConway',
params: {
inputs: [SAMPLE_INPUTS.shelley_input],
outputs: [SAMPLE_OUTPUTS.simple_shelley_output],
fee: FEE,
ttl: TTL,
certificates: [SAMPLE_CERTIFICATES.stake_deregistration_conway],
protocolMagic: PROTOCOL_MAGICS.mainnet,
networkId: NETWORK_IDS.mainnet,
signingMode: CardanoTxSigningMode.ORDINARY_TRANSACTION,
},
result: {
hash: '564ad55097101e1ca85629cffe839f43a19bf33aa1940c99a62eb8f14392eebb',
witnesses: [
{
type: 1,
pubKey: '5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1',
signature:
'a0fa6630498f57249b305824ad4d32157653820e7d651332a58af70a80364df882ee8b0471e76dd7a335eea84a18c52b12c02508779d46b193bc418c22e8a00f',
chainCode: null,
},
{
type: 1,
pubKey: 'bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e',
signature:
'5d282fcd2685ee47f3770f84b2badf4046e8e76bfdaa26f74e292ecd16bcf89fb330b99edff13bc9c81e8c6523864f69a3ac7cde29d5a648707724c5cb48730e',
chainCode: null,
},
],
auxiliaryDataSupplement: undefined,
},
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signStakeDeregistrationAndWithdrawal',
params: {
Expand Down Expand Up @@ -1232,6 +1320,41 @@ export default {
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signVoteDelegationConwayAbstain',
params: {
inputs: [SAMPLE_INPUTS.shelley_input],
outputs: [SAMPLE_OUTPUTS.simple_shelley_output],
fee: FEE,
ttl: TTL,
certificates: [SAMPLE_CERTIFICATES.vote_delegation_abstain],
protocolMagic: PROTOCOL_MAGICS.mainnet,
networkId: NETWORK_IDS.mainnet,
signingMode: CardanoTxSigningMode.ORDINARY_TRANSACTION,
},
result: {
hash: '01d0f76fadc899087c5352befac56cbfdc2e868ac715fbfe00230bab3f7fa751',
witnesses: [
{
type: 1,
pubKey: '5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1',
signature:
'52c57d9c0e06fc9883285db4eec1a1504e27726dc5afce943d6f54df22188f05c3eeee06d052375eceb55df83c314237b3718f07fccef6198bda8c20d794b102',
chainCode: null,
},
{
type: 1,
pubKey: 'bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e',
signature:
'6de4940ff99738aaf3659ffeb8e4f6f01ff88ddb65c24028d75a847ca684d07af000e32eaa4c915c8031f6d928b2bcbe8c6f57e389299d3eafe213bd0ab1190c',
chainCode: null,
},
],
auxiliaryDataSupplement: undefined,
},
legacyResults: [legacyResults.beforeTransactionStreaming],
},

{
description: 'signMaryWithValidityIntervalStart',
params: {
Expand Down

0 comments on commit e6c0059

Please sign in to comment.