Skip to content

Commit

Permalink
feat(connect-explorer): Add cardanoSignMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskp committed Feb 27, 2024
1 parent b4e0acf commit c07c5c8
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/connect-explorer/src/data/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ export default [
name: 'Sign transaction',
url: '/method/cardanoSignTransaction',
},
{
name: 'Sign message',
children: [
{
name: 'include key hash',
url: '/method/cardanoSignMessage',
},
{
name: 'include address',
url: '/method/cardanoSignMessage-addressParameters',
},
],
},
{
name: 'Account info',
children: [
Expand Down
2 changes: 2 additions & 0 deletions packages/connect-explorer/src/data/methods/cardano/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import getPublicKey from './getPublicKey';
import getAddress from './getAddress';
import signTransaction from './signTransaction';
import signMessage from './signMessage';
import getAccountInfo from './getAccountInfo';
import getNativeScriptHash from './getNativeScriptHash';

export default [
...getPublicKey,
...getAddress,
...signTransaction,
...signMessage,
...getAccountInfo,
...getNativeScriptHash,
];
75 changes: 75 additions & 0 deletions packages/connect-explorer/src/data/methods/cardano/signMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { CardanoAddressType } from '@trezor/protobuf/lib/messages-schema';
import { cardanoDerivationType } from './common';

const name = 'cardanoSignMessage';
const docs = 'methods/cardanoSignMessage.md';

const batch = [
{
name: 'signingPath',
label: 'Bip44 path',
type: 'input',
value: "m/1852'/1815'/0'/0/0",
},
{
name: 'payload',
label: 'Payload hex string',
type: 'textarea',
value: '48656c6c6f205472657a6f7221',
},
{
name: 'hashPayload',
label: 'Hash payload',
type: 'checkbox',
value: true,
},
{
name: 'displayAscii',
label: 'Display payload as ASCII on Trezor',
type: 'checkbox',
value: false,
},
cardanoDerivationType,
];

export default [
{
url: '/method/cardanoSignMessage',
name,
docs,
submitButton: 'Sign message',

fields: batch,
},
{
url: '/method/cardanoSignMessage-addressParameters',
name,
docs,
submitButton: 'Sign message including address',

fields: [
...batch,
{
name: 'protocolMagic',
label: 'Protocol magic',
type: 'number',
value: 764824073,
},
{
name: 'networkId',
label: 'Network id',
type: 'number',
value: 1,
},
{
name: 'addressParameters',
type: 'json',
value: {
path: "m/1852'/1815'/0'/0/0",
stakingPath: "m/1852'/1815'/0'/2/0",
addressType: CardanoAddressType.BASE,
},
},
],
},
];

0 comments on commit c07c5c8

Please sign in to comment.