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 Sep 8, 2023
2 parents c561992 + a496e15 commit 753e2b8
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 156 deletions.
19 changes: 9 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
USE_HOROSCOPE=true

# Database
DB_HOST=
DB_PORT=
DB_USERNAME=
Expand All @@ -7,21 +10,17 @@ DB_DATABASE=
# SWAGGER
SWAGGER_PATH=/api

# simulate
SYS_MNEMONIC=

# ENVIRONMENT
NODE_ENV=development
#keybase
KEYBASE=

#DEFAULT VALIDATOR IMG
DEFAULT_VALIDATOR_IMG=

# jwt
JWT_SECRET=
# 24 hours
JWT_EXPIRATION=86400s

SYS_MNEMONIC=

PREFIX_NETWORK=

INDEXER_URL=
REDIS_URL=
REDIS_PORT=
REDIS_DB=
2 changes: 2 additions & 0 deletions docs/CustomTransactionSample.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ This document contains the raw message samples for different transaction types.
"value": "Uint8Array TextProposal"
}
}
}
]
```

Expand All @@ -279,6 +280,7 @@ This document contains the raw message samples for different transaction types.
"proposalId": "5",
"voter": "aura1yukgemvxtr8fv6899ntd65qfyhwgx25d2nhvj6",
}
}
]
```

Expand Down
37 changes: 37 additions & 0 deletions src/chains/chain.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import {
IMessage,
IMsgMultiSend,
IDecodedMessage,
ICw20Msg,
} from '../modules/multisig-transaction/interfaces';
import { UserInfoDto } from '../modules/auth/dto';
import { Chain } from '../modules/chain/entities/chain.entity';
import { CustomError } from '../common/custom-error';
import { ErrorMap } from '../common/error.map';
import { ChainGateway } from './chain.gateway';
import { IMessageUnknown } from '../interfaces';
import { MultisigTransaction } from '../modules/multisig-transaction/entities/multisig-transaction.entity';

export class ChainHelper {
constructor(public chain: Chain) {}
Expand Down Expand Up @@ -249,4 +251,39 @@ export class ChainHelper {
}
return total;
}

getDataFromTx(
transaction: MultisigTransaction,
decodedMsgs: IMessageUnknown[],
aminoMsgs: AminoMsg[],
): {
amount: number;
contractAddress?: string;
} {
if (
transaction.typeUrl === TxTypeUrl.EXECUTE_CONTRACT &&
transaction.toAddress !== '' &&
!(decodedMsgs[0].value instanceof Uint8Array) &&
decodedMsgs[0].value.msg instanceof Uint8Array
) {
const contractAddress = decodedMsgs[0].value.contract;
const decodedMsg = fromUtf8(decodedMsgs[0].value.msg);
const objectMsg = JSON.parse(decodedMsg) as ICw20Msg;
if (objectMsg.transfer.recipient !== transaction.toAddress) {
throw new CustomError(
ErrorMap.TRANSACTION_NOT_VALID,
'recipient address is not match with address in msg',
);
}

return {
amount: Number(objectMsg.transfer.amount),
contractAddress,
};
}

return {
amount: this.calculateAmount(aminoMsgs),
};
}
}
7 changes: 7 additions & 0 deletions src/interfaces/contract-info.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface IContractAddress {
smart_contract: {
cw20_contract: {
symbol: string;
};
}[];
}
2 changes: 1 addition & 1 deletion src/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './validator.interface';
export * from './validators.interface';
export * from './keybase-identity.interface';
export * from './network-status.interface';
export * from './account-info.interface';
export * from './account-unbound.interface';
Expand All @@ -10,3 +9,4 @@ export * from './message.interface';
export * from './votes.interface';
export * from './token-info.interface';
export * from './indexer-v2.interface';
export * from './contract-info.interface';
11 changes: 0 additions & 11 deletions src/interfaces/keybase-identity.interface.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/modules/multisig-transaction/dto/request/send-tx.req.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,4 @@ export class SendTransactionRequestDto {
example: 14,
})
transactionId: number;

@IsNumber()
@Type(() => Number)
@ApiProperty({
description: 'Offchain Chain Id',
example: 4,
})
@Type(() => Number)
internalChainId: number;
}
Loading

0 comments on commit 753e2b8

Please sign in to comment.