Skip to content

Commit

Permalink
Print credentials for testing and fix cert encoding bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xdzurman committed Oct 20, 2020
1 parent 7641494 commit 03f4bf5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 39 deletions.
1 change: 1 addition & 0 deletions app/frontend/actions.ts
Expand Up @@ -1182,6 +1182,7 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
return
}
const ownerCredentials = await wallet.getPoolOwnerCredentials()
console.log('CREDENTIALS', ownerCredentials)
const poolTxPlan: TxPlan = unsignedPoolTxToTxPlan(deserializedTx, ownerCredentials)
console.log('PLAN', poolTxPlan)
setState({
Expand Down
83 changes: 44 additions & 39 deletions app/frontend/wallet/shelley/shelley-transaction.ts
Expand Up @@ -148,47 +148,52 @@ function ShelleyTxCert(type, accountAddress, poolHash, poolParams?) {
0: [type, account],
1: [type, account],
2: [type, account, hash],
3: [
type,
Buffer.from(poolParams.poolKeyHashHex, 'hex'),
Buffer.from(poolParams.vrfKeyHashHex, 'hex'),
parseInt(poolParams.pledgeStr, 10),
parseInt(poolParams.costStr, 10),
new Tagged(
30,
3: poolParams
? [
type,
Buffer.from(poolParams.poolKeyHashHex, 'hex'),
Buffer.from(poolParams.vrfKeyHashHex, 'hex'),
parseInt(poolParams.pledgeStr, 10),
parseInt(poolParams.costStr, 10),
new Tagged(
30,
[
parseInt(poolParams.margin.numeratorStr, 10),
parseInt(poolParams.margin.denominatorStr, 10),
],
null
),
Buffer.from(poolParams.rewardAccountKeyHash, 'hex'),
poolParams.poolOwners.map((ownerObj) => {
if (ownerObj.stakingKeyHashHex) {
return Buffer.from(ownerObj.stakingKeyHashHex, 'hex')
}
// else is a path owner and has pubKeyHex
return Buffer.from(ownerObj.pubKeyHex, 'hex')
}),
poolParams.relays.map((relay) => {
switch (relay.type) {
case 0:
return [
relay.type,
relay.params.portNumber,
relay.params.ipv4Hex ? Buffer.from(relay.params.ipv4Hex, 'hex') : null,
relay.params.ipv6Hex ? Buffer.from(relay.params.ipv6Hex, 'hex') : null,
]
case 1:
return [relay.type, relay.params.portNumber, relay.params.dnsName]
case 2:
return [relay.type, relay.params.dnsName]
default:
return []
}
}),
[
parseInt(poolParams.margin.numeratorStr, 10),
parseInt(poolParams.margin.denominatorStr, 10),
poolParams.metadata.metadataUrl,
Buffer.from(poolParams.metadata.metadataHashHex, 'hex'),
],
null
),
Buffer.from(poolParams.rewardAccountKeyHash, 'hex'),
poolParams.poolOwners.map((ownerObj) => {
if (ownerObj.stakingKeyHashHex) {
return Buffer.from(ownerObj.stakingKeyHashHex, 'hex')
}
// else is a path owner and has pubKeyHex
return Buffer.from(ownerObj.pubKeyHex, 'hex')
}),
poolParams.relays.map((relay) => {
switch (relay.type) {
case 0:
return [
relay.type,
relay.params.portNumber,
relay.params.ipv4Hex ? Buffer.from(relay.params.ipv4Hex, 'hex') : null,
relay.params.ipv6Hex ? Buffer.from(relay.params.ipv6Hex, 'hex') : null,
]
case 1:
return [relay.type, relay.params.portNumber, relay.params.dnsName]
case 2:
return [relay.type, relay.params.dnsName]
default:
return []
}
}),
[poolParams.metadata.metadataUrl, Buffer.from(poolParams.metadata.metadataHashHex, 'hex')],
],
]
: [],
}
return encoder.pushAny(encodedCertsTypes[type])
}
Expand Down

0 comments on commit 03f4bf5

Please sign in to comment.