diff --git a/packages/connect-explorer/src/data/menu.ts b/packages/connect-explorer/src/data/menu.ts index 3ddbb8ae0373..a83d88101c0d 100644 --- a/packages/connect-explorer/src/data/menu.ts +++ b/packages/connect-explorer/src/data/menu.ts @@ -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: [ diff --git a/packages/connect-explorer/src/data/methods/cardano/index.ts b/packages/connect-explorer/src/data/methods/cardano/index.ts index e2219ee9bc40..03d21bab18a5 100644 --- a/packages/connect-explorer/src/data/methods/cardano/index.ts +++ b/packages/connect-explorer/src/data/methods/cardano/index.ts @@ -1,6 +1,7 @@ import getPublicKey from './getPublicKey'; import getAddress from './getAddress'; import signTransaction from './signTransaction'; +import signMessage from './signMessage'; import getAccountInfo from './getAccountInfo'; import getNativeScriptHash from './getNativeScriptHash'; @@ -8,6 +9,7 @@ export default [ ...getPublicKey, ...getAddress, ...signTransaction, + ...signMessage, ...getAccountInfo, ...getNativeScriptHash, ]; diff --git a/packages/connect-explorer/src/data/methods/cardano/signMessage.ts b/packages/connect-explorer/src/data/methods/cardano/signMessage.ts new file mode 100644 index 000000000000..0d46759bdd71 --- /dev/null +++ b/packages/connect-explorer/src/data/methods/cardano/signMessage.ts @@ -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, + }, + }, + ], + }, +];