diff --git a/api/spec/v1.yaml b/api/spec/v1.yaml index 2696b1d8d..277eaec84 100644 --- a/api/spec/v1.yaml +++ b/api/spec/v1.yaml @@ -1740,15 +1740,19 @@ components: RuntimeEvmBalance: description: Balance of an account for a specific runtime and EVM token. type: object - required: [balance, token_contract_addr, token_decimals, token_type] + required: [balance, token_contract_addr, token_contract_addr_eth, token_decimals, token_type] properties: balance: <<: *BigIntType description: Number of tokens held, in base units. token_contract_addr: + type: string + description: The oasis address of this token's contract. + example: 'oasis1qzk5pr2x8ah04lgjee3lv06fmyvqvz45egjv4ps0' + token_contract_addr_eth: type: string description: The EVM address of this token's contract. Encoded as a lowercase hex string. - example: 'dc19a122e268128b5ee20366299fc7b5b199c8e3' + example: '0xF8E3DE55D24D13607A12628E0A113B66BA578bDC' token_symbol: type: string description: The token ticker symbol. Not guaranteed to be unique across distinct EVM tokens. diff --git a/storage/client/client.go b/storage/client/client.go index d21a4b57f..f98d70c12 100644 --- a/storage/client/client.go +++ b/storage/client/client.go @@ -1396,6 +1396,7 @@ func (c *StorageClient) RuntimeAccount(ctx context.Context, address staking.Addr var addrPreimage []byte if err = runtimeEvmRows.Scan( &b.Balance, + &b.TokenContractAddr, &addrPreimage, &b.TokenSymbol, &b.TokenName, @@ -1404,7 +1405,7 @@ func (c *StorageClient) RuntimeAccount(ctx context.Context, address staking.Addr ); err != nil { return nil, wrapError(err) } - b.TokenContractAddr = ethCommon.BytesToAddress(addrPreimage).String() + b.TokenContractAddrEth = ethCommon.BytesToAddress(addrPreimage).String() a.EvmBalances = append(a.EvmBalances, b) } diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index c6c629672..65e835f99 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -521,7 +521,8 @@ const ( AccountRuntimeEvmBalances = ` SELECT balances.balance AS balance, - preimages.address_data AS token_address, + balances.token_address AS token_address, + preimages.address_data AS token_address_eth, tokens.symbol AS token_symbol, tokens.token_name AS token_name, CASE -- NOTE: There are two queries that use this CASE via copy-paste; edit both if changing.