Merge pull request #338 from hermeznetwork/feature/api-amounts

Add amount success and load amount success
This commit is contained in:
Eduard S
2020-12-09 17:20:21 +01:00
committed by GitHub
4 changed files with 46 additions and 10 deletions

View File

@@ -1750,6 +1750,22 @@ components:
- $ref: '#/components/schemas/BigInt'
- description: Tokens transfered from L1 to L2.
- example: "4900000000000000000"
amountSuccess:
type: boolean
description: >-
Indicates if the amount specified by the user has been sent propperly. If false, the amount that actualy has been sent is 0.
If the transaction hasn't been forged yet (`batchNum == null`), this value will be false, as it's unknown if it has succeed or not.
An example were this value could be false: a user send a `DepositTransfer` transaction, but when the tx is forged there are not
enougth founds in the account. In this case the transfer part of the transaction won't be effective making the amount have a real value of 0.
example: true
depositAmountSuccess:
type: boolean
description: >-
Indicates if the deposit amount specified by the user has been sent propperly. If false, the deposit amount that actualy has been sent is 0.
If the transaction hasn't been forged yet (`batchNum == null`), this value will be false, as it's unknown if it has succeed or not.
An example were this value could be false: a user send a `Deposit` transaction, but when the tx is forged the token id is not registered on the network.
In this case transaction won't be effective making the deposit amount have a real value of 0.
example: true
historicDepositAmountUSD:
type: number
description: Load amount in USD, at the moment the transaction was made.
@@ -1764,6 +1780,8 @@ components:
- toForgeL1TransactionsNum
- userOrigin
- depositAmount
- amountSuccess
- depositAmountSuccess
- historicDepositAmountUSD
- ethereumBlockNum
additionalProperties: false

View File

@@ -21,6 +21,8 @@ type testL1Info struct {
ToForgeL1TxsNum *int64 `json:"toForgeL1TransactionsNum"`
UserOrigin bool `json:"userOrigin"`
DepositAmount string `json:"depositAmount"`
AmountSuccess bool `json:"amountSuccess"`
DepositAmountSuccess bool `json:"depositAmountSuccess"`
HistoricDepositAmountUSD *float64 `json:"historicDepositAmountUSD"`
EthBlockNum int64 `json:"ethereumBlockNum"`
}
@@ -123,10 +125,12 @@ func genTestTxs(
BatchNum: l1.BatchNum,
Timestamp: getTimestamp(l1.EthBlockNum, blocks),
L1Info: &testL1Info{
ToForgeL1TxsNum: l1.ToForgeL1TxsNum,
UserOrigin: l1.UserOrigin,
DepositAmount: l1.DepositAmount.String(),
EthBlockNum: l1.EthBlockNum,
ToForgeL1TxsNum: l1.ToForgeL1TxsNum,
UserOrigin: l1.UserOrigin,
DepositAmount: l1.DepositAmount.String(),
AmountSuccess: true,
DepositAmountSuccess: true,
EthBlockNum: l1.EthBlockNum,
},
Token: token,
}