Skip to content

Commit

Permalink
Merge branch 'dev' into serenity
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Nov 22, 2023
2 parents f312f62 + d3f0649 commit c58b479
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 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 @@ -3,7 +3,6 @@ import {
Get,
Post,
Body,
Param,
HttpStatus,
HttpCode,
Logger,
Expand Down Expand Up @@ -32,10 +31,8 @@ import {
ConfirmTransactionRequestDto,
CreateTransactionRequestDto,
GetAllTransactionsRequestDto,
GetMultisigSignaturesParamDto,
GetSimulateAddressQueryDto,
GetTxDetailQueryDto,
MultisigSignatureResponseDto,
RejectTransactionRequestDto,
SendTransactionRequestDto,
SimulateTxRequestDto,
Expand All @@ -48,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
1 change: 0 additions & 1 deletion src/modules/safe/dto/response/get-multisig-wallet.res.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Coin } from '@cosmjs/amino';
import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer';
import { IAssetsWithType } from '../../../../interfaces/asset-by-owner.interface';
Expand Down
2 changes: 0 additions & 2 deletions src/modules/simulate/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import {
} from '../../common/constants/app.constant';
import { IEncodedObjectMsg, ISafePubkey } from './interfaces';
import { IMessageUnknown } from '../../interfaces';
import { Chain } from '../chain/entities/chain.entity';
import { EthermintHelper } from '../../chains/ethermint/ethermint.helper';
import { ChainInfo } from '../../utils/validations';

export class SimulateUtils {
public static makeBodyBytes(messages: IEncodedObjectMsg[]): Uint8Array {
Expand Down

0 comments on commit c58b479

Please sign in to comment.