Skip to content

Commit

Permalink
Merge branch 'serenity' into euphoria
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Nov 28, 2023
2 parents ca67d4e + c58b479 commit adcf965
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/chains/chain.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ChainHelper {
accountNumber: number,
creatorInfo: UserInfoDto,
) {
const { chainId, prefix } = this.chain;
const { chainId } = this.chain;

const authInfoEncode = fromBase64(authInfoBytes);
const decodedAuthInfo = AuthInfo.decode(authInfoEncode);
Expand Down Expand Up @@ -105,6 +105,7 @@ export class ChainHelper {
aminoMsgs: msgs,
rawMsgs: this.getRawMsgs(decodedMsgs as IDecodedMessage[]),
sequence,
memo,
};
}

Expand Down
12 changes: 12 additions & 0 deletions src/migrations/1700533398605-alter-multisigtx-add-memo-column.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class alterMultisigtxAddMemoColumn1700533398605
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE MultisigTransaction ADD COLUMN Memo VARCHAR(256) NULL AFTER Denom`);
}

public async down(queryRunner: QueryRunner): Promise<void> {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export class TxDetailDto {
})
Fee: string;

@ApiProperty({
example: 'Send Token',
})
Memo: string;

@ApiProperty({
example: '282500',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class MultisigTransaction extends BaseEntityAutoId {
@Column({ name: 'Denom' })
denom: string;

@Column({ name: 'Memo' })
memo: string;

@Column({ name: 'ContractAddress' })
contractAddress: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { DeleteTxRequestDto } from './dto/request/delete-tx.req';
export class MultisigTransactionController {
public readonly logger = new Logger(MultisigTransactionController.name);

constructor(private multisigTransactionService: MultisigTransactionService) {}
constructor(private multisigTransactionService: MultisigTransactionService) { }

@CommonAuthPost({
url: URL_CONSTANTS.CREATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export class MultisigTransactionRepository {
'AT.TxHash as TxHash',
'MT.RawMessages as RawMessages',
'MT.Fee as Fee',
'MT.Memo as Memo',
'MT.Gas as Gas',
'MT.Status as Status',
'MT.Sequence as Sequence',
Expand Down
20 changes: 14 additions & 6 deletions src/modules/multisig-transaction/multisig-transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class MultisigTransactionService {
aminoMsgs,
rawMsgs,
sequence: decodedSequence,
memo,
} = await chainHelper.decodeAndVerifyTxInfo(
authInfoBytes,
bodyBytes,
Expand All @@ -147,6 +148,7 @@ export class MultisigTransactionService {
decodedMsgs.length > 1 ? TxTypeUrl.CUSTOM : decodedMsgs[0].typeUrl;
transaction.fromAddress = from;
transaction.toAddress = to || '';
transaction.memo = memo;

// get balance
const { amount, contractAddress } = chainHelper.getDataFromTx(
Expand Down Expand Up @@ -481,19 +483,25 @@ export class MultisigTransactionService {
) {
if (item.ToAddress === safe.safeAddress) {
updatedItem.DisplayType = TxTypeUrl.RECEIVE;
updatedItem.Sequence = undefined;
}

if (item.FromAddress === safe.safeAddress && item.ToAddress !== '')
// ignore case: mint cw20 token
updatedItem.DisplayType = DisplayTypes.SEND;

// Unset sequence if display type tx is receive token
if (updatedItem.DisplayType === TxTypeUrl.RECEIVE) {
updatedItem.Sequence = undefined;
}
}

updatedItem.Direction = this.getDirection(
item.TypeUrl,
item.ToAddress,
safeAddress,
);
if (isHistory) {
updatedItem.Direction = this.getDirection(
item.TypeUrl,
item.ToAddress,
safeAddress,
);
}

updatedItem.FinalAmount =
item.MultisigTxAmount || item.AuraTxAmount || item.AuraTxRewardAmount;
Expand Down

0 comments on commit adcf965

Please sign in to comment.