Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Explorer] Adds Sender / Recipients / Amount data to Pay transaction type #5570

Merged
merged 33 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
01a88f8
creates amount field
apburnie Oct 20, 2022
c636f46
handles multiple recipients
apburnie Oct 25, 2022
54e6b5f
timestamp at the top
apburnie Oct 25, 2022
f71bb09
fix data presentation
apburnie Oct 25, 2022
da274ae
CSS changes
apburnie Oct 25, 2022
d2b75ae
sets up display when multiple recipients
apburnie Oct 25, 2022
dd8d580
adds LShape SVG and splits out logic
apburnie Oct 26, 2022
55e4116
creates basic one Sender/Receiver
apburnie Oct 26, 2022
840d6b8
replace done icon
apburnie Oct 26, 2022
6baf141
extends green to multiple recipients
apburnie Oct 26, 2022
2b0bfdb
fixes text alignment issues
apburnie Oct 26, 2022
31b11fe
i before e except after c
apburnie Oct 26, 2022
766c2ce
adds amounts
apburnie Oct 26, 2022
7d91e13
improve recipients gap
apburnie Oct 26, 2022
c7978be
typecheck improvements
apburnie Oct 26, 2022
2369628
updates tests
apburnie Oct 26, 2022
c8178c2
fixes dashed line display across a variety of devices
apburnie Oct 27, 2022
497f7e1
Coin label is extracted
apburnie Oct 28, 2022
8b4e944
creates Amount component
apburnie Oct 31, 2022
1773bdb
uses useFormat
apburnie Oct 31, 2022
860e092
updates amount when one recipient
apburnie Oct 31, 2022
ef0c8c7
display info extracted correctly
apburnie Oct 31, 2022
742cd04
use media query for line length
apburnie Oct 31, 2022
857f843
balances out the padding
apburnie Oct 31, 2022
60db7bf
fixes typecheck errors
apburnie Oct 31, 2022
1596c67
switches useEffect to useQuery
apburnie Nov 1, 2022
4981483
uses new Heading components
apburnie Nov 1, 2022
c5e2a9b
uses enabled flag in useQuery
apburnie Nov 1, 2022
8e08712
removes network dependency
apburnie Nov 2, 2022
9d19644
further refactoring
apburnie Nov 2, 2022
c1ce5f9
uses regex in sdk
apburnie Nov 2, 2022
fdb2aa1
further refactoring
apburnie Nov 2, 2022
0735a13
further refactoring
apburnie Nov 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
uses regex in sdk
  • Loading branch information
apburnie committed Nov 2, 2022
commit c1ce5f9a592c1d7a101c7d370ec3355aed67f89c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

import { COIN_TYPE_ARG_REGEX } from '@mysten/sui.js';
import { useQuery } from '@tanstack/react-query';
import cl from 'clsx';
import { useState, useContext } from 'react';
Expand Down Expand Up @@ -29,6 +30,8 @@ const getObjType = (objId: string, network: string) =>
.getObject(objId)
.then((obj) => parseObjectType(obj));

const getCoinLabelFromObjType = (objType: string) => COIN_TYPE_ARG_REGEX.exec(objType)?.[1];

function MultipleRecipients({ sender, recipient, amount, objects }: TxAddress) {
const [network] = useContext(NetworkContext);

Expand Down Expand Up @@ -124,7 +127,7 @@ function MultipleRecipients({ sender, recipient, amount, objects }: TxAddress) {
}

function Amount({ amount, label }: { amount: bigint; label: string }) {
const coinBoilerPlateRemoved = /^0x2::coin::Coin<(.+)>$/.exec(label)?.[1];
const coinBoilerPlateRemoved = getCoinLabelFromObjType(label);
const formattedCoin = useFormatCoin(
apburnie marked this conversation as resolved.
Show resolved Hide resolved
amount,
coinBoilerPlateRemoved,
Expand Down Expand Up @@ -152,7 +155,7 @@ function SingleAmount({
async () => {
const objType = await getObjType(objectId, network);

return /^0x2::coin::Coin<(.+)>$/.exec(objType)?.[1]!;
return getCoinLabelFromObjType(objType);
}
);

Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/src/types/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const COIN_TYPE = `${SUI_PACKAGE_ID}::coin::Coin`;
export const PAY_MODULE_NAME = 'pay';
export const PAY_SPLIT_COIN_VEC_FUNC_NAME = 'split_vec';
export const PAY_JOIN_COIN_FUNC_NAME = 'join';
const COIN_TYPE_ARG_REGEX = /^0x2::coin::Coin<(.+)>$/;
export const COIN_TYPE_ARG_REGEX = /^0x2::coin::Coin<(.+)>$/;

export const SUI_TYPE_ARG = '0x2::sui::SUI';

Expand Down