feat(explorer): improve transaction blocks on the address account pages - #259
Conversation
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
| const isSender = txn.transaction?.data.sender === address; | ||
| return direction === TransactionDirection.Sent ? isSender : !isSender; | ||
| } |
There was a problem hiding this comment.
Send is showing a positive balance change, and its a bit confusing 🙈
| const isSender = txn.transaction?.data.sender === address; | |
| return direction === TransactionDirection.Sent ? isSender : !isSender; | |
| } | |
| const balanceChange = getIotaBalanceChangeForAddress(txn, address); | |
| const isReceived = | |
| balanceChange && balanceChange.amount !== '0' | |
| ? Number(balanceChange.amount) > 0 | |
| : txn.transaction?.data.sender !== address; | |
| return direction === TransactionDirection.Sent ? !isReceived : isReceived; | |
| } |
| {typeLabel} | ||
| </span> | ||
| <span className="text-body-sm text-iota-primary-30 dark:text-iota-primary-80"> | ||
| {functionName ?? formatDigest(digest)} |
There was a problem hiding this comment.
removing the digest from some transactions isnt a good idea 🙈 because users lose the ability to click directly and navigate to the transaction
what i was suggesting (#259 (comment) and in slack) was simply adding an additional column for the function, rather than replacing the digest
| {functionName ?? formatDigest(digest)} | |
| {formatDigest(digest)} |
| /** | ||
| * Name of the last Move function called in a programmable transaction block, if any (e.g. | ||
| * `request_add_stake`). Transactions with no Move call (plain transfers) have none. | ||
| */ | ||
| export function getTransactionFunctionName(txn: IotaTransactionBlockResponse): string | undefined { | ||
| const transaction = txn.transaction?.data.transaction; | ||
| if (transaction?.kind !== 'ProgrammableTransaction') { | ||
| return undefined; | ||
| } | ||
| const moveCalls = transaction.transactions | ||
| .filter( | ||
| (command): command is { MoveCall: MoveCallIotaTransaction } => 'MoveCall' in command, | ||
| ) | ||
| .map((command) => command.MoveCall); | ||
| return moveCalls.at(-1)?.function; | ||
| } |
There was a problem hiding this comment.
| /** | |
| * Name of the last Move function called in a programmable transaction block, if any (e.g. | |
| * `request_add_stake`). Transactions with no Move call (plain transfers) have none. | |
| */ | |
| export function getTransactionFunctionName(txn: IotaTransactionBlockResponse): string | undefined { | |
| const transaction = txn.transaction?.data.transaction; | |
| if (transaction?.kind !== 'ProgrammableTransaction') { | |
| return undefined; | |
| } | |
| const moveCalls = transaction.transactions | |
| .filter( | |
| (command): command is { MoveCall: MoveCallIotaTransaction } => 'MoveCall' in command, | |
| ) | |
| .map((command) => command.MoveCall); | |
| return moveCalls.at(-1)?.function; | |
| } | |
| /** | |
| * The last Move call in a programmable transaction block, if any (e.g. `request_add_stake` on | |
| * the staking package). Transactions with no Move call (plain transfers) have none. | |
| */ | |
| export function getLastMoveCall( | |
| txn: IotaTransactionBlockResponse, | |
| ): MoveCallIotaTransaction | undefined { | |
| const transaction = txn.transaction?.data.transaction; | |
| if (transaction?.kind !== 'ProgrammableTransaction') { | |
| return undefined; | |
| } | |
| const moveCalls = transaction.transactions | |
| .filter( | |
| (command): command is { MoveCall: MoveCallIotaTransaction } => 'MoveCall' in command, | |
| ) | |
| .map((command) => command.MoveCall); | |
| return moveCalls.at(-1); | |
| } |
| </span> | ||
| <span className="text-body-sm text-iota-primary-30 dark:text-iota-primary-80"> | ||
| {formatDigest(digest)} | ||
| {functionName ?? formatDigest(digest)} |
There was a problem hiding this comment.
| {functionName ?? formatDigest(digest)} | |
| {formatDigest(digest)} |
| </TableCellText> | ||
| </TableCellBase> | ||
| ); | ||
| }, |
There was a problem hiding this comment.
| }, | |
| { | |
| header: 'Function', | |
| accessorKey: 'function', | |
| cell: ({ row }) => { | |
| const kind = row.original.transaction?.data.transaction.kind; | |
| const kindLabel = kind === 'ProgrammableTransaction' ? 'Programmable Tx' : '--'; | |
| const moveCall = getLastMoveCall(row.original); | |
| return ( | |
| <TableCellBase> | |
| <div className="flex flex-col"> | |
| <span className="text-label-lg text-iota-neutral-40 dark:text-iota-neutral-60"> | |
| {kindLabel} | |
| </span> | |
| {moveCall && ( | |
| <ObjectLink | |
| objectId={`${moveCall.package}?module=${moveCall.module}`} | |
| copyText={moveCall.package} | |
| showAddressAlias={false} | |
| label={moveCall.function} | |
| className="text-body-sm" | |
| /> | |
| )} | |
| </div> | |
| </TableCellBase> | |
| ); | |
| }, | |
| }, |
|
This pull request has been deployed to Vercel.
|
|
This pull request has been deployed to Vercel.
|
|
This pull request has been deployed to Vercel.
|
|
This pull request has been deployed to Vercel.
|
…-page' into feat/improve-transaction-blocks-on-the-address-account-pages
d572202 to
c78f585
Compare
|
This pull request has been deployed to Vercel.
|
fixes #250