-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 1546----implement-eth_sendrawtransaction-…
…handler
- Loading branch information
Showing
37 changed files
with
425 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...ws/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionPill.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"author": "Bloom Labs Ltd <[email protected]>", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@bloomwalletio/ui": "0.20.6", | ||
"@bloomwalletio/ui": "0.20.8", | ||
"@ethereumjs/rlp": "4.0.1", | ||
"@ethereumjs/tx": "5.2.1", | ||
"@ethereumjs/util": "9.0.2", | ||
|
24 changes: 24 additions & 0 deletions
24
packages/shared/src/components/avatars/GovernanceAvatar.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts"> | ||
import { Avatar, IconName } from '@bloomwalletio/ui' | ||
import { GovernanceAction } from '@core/activity' | ||
import { darkMode } from '@core/app/stores' | ||
export let governanceAction: GovernanceAction | ||
export let size: 'xxs' | 'xs' | 'sm' | 'base' | 'md' | 'lg' = 'md' | ||
const ICONS_FOR_ACTION = { | ||
[GovernanceAction.StartVoting]: IconName.Package, | ||
[GovernanceAction.StopVoting]: IconName.Package, | ||
[GovernanceAction.ChangedVote]: IconName.PackageCheck, | ||
[GovernanceAction.Revote]: IconName.PackageCheck, | ||
[GovernanceAction.IncreaseVotingPower]: IconName.PackagePlus, | ||
[GovernanceAction.DecreaseVotingPower]: IconName.PackageMinus, | ||
} | ||
</script> | ||
|
||
<Avatar | ||
icon={ICONS_FOR_ACTION[governanceAction]} | ||
{size} | ||
textColor="primary" | ||
backgroundColor={$darkMode ? 'surface-2-dark' : 'surface-2'} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/shared/src/lib/auxiliary/blockscout/api/blockscout.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { NftStandard } from '@core/nfts/enums' | ||
import { TokenStandard } from '@core/token/enums' | ||
import { QueryParameters } from '@core/utils' | ||
import { BaseApi } from '@core/utils/api' | ||
import { DEFAULT_EXPLORER_URLS } from '@core/network/constants' | ||
import { SupportedNetworkId } from '@core/network/enums' | ||
import { IBlockscoutApi, IBlockscoutAsset, IBlockscoutAssetMetadata, IBlockscoutTransaction } from '../interfaces' | ||
import { NetworkId } from '@core/network/types' | ||
|
||
interface INextPageParams { | ||
block_number: number | ||
index: number | ||
items_count: number | ||
} | ||
|
||
interface IPaginationResponse<T> { | ||
items: T[] | ||
next_page_params: INextPageParams | null | ||
} | ||
|
||
export class BlockscoutApi extends BaseApi implements IBlockscoutApi { | ||
constructor(networkId: NetworkId) { | ||
const explorerUrl = DEFAULT_EXPLORER_URLS[networkId as SupportedNetworkId] | ||
super(`${explorerUrl}/api/v2`) | ||
} | ||
|
||
private async makePaginatedGetRequest<T>( | ||
path: string, | ||
queryParameters?: QueryParameters, | ||
items: T[] = [], | ||
nextPageParameters?: INextPageParams | null | ||
): Promise<T[]> { | ||
if (nextPageParameters === null) { | ||
return Promise.resolve(items) | ||
} | ||
return this.get<IPaginationResponse<T>>(path, { ...queryParameters, ...nextPageParameters }).then( | ||
(response) => { | ||
if (!response) { | ||
return Promise.resolve(items) | ||
} | ||
return this.makePaginatedGetRequest( | ||
path, | ||
queryParameters, | ||
items.concat(response.items), | ||
response.next_page_params | ||
) | ||
} | ||
) | ||
} | ||
|
||
async getAssetMetadata(assetAddress: string): Promise<IBlockscoutAssetMetadata | undefined> { | ||
const response = await this.get<IBlockscoutAssetMetadata>(`tokens/${assetAddress}`) | ||
if (response) { | ||
response.type = response.type.replace('-', '') as TokenStandard.Erc20 | NftStandard.Erc721 | ||
return response | ||
} | ||
} | ||
|
||
async getAssetsForAddress( | ||
address: string, | ||
standard: TokenStandard.Erc20 | NftStandard.Erc721 = TokenStandard.Erc20 | ||
): Promise<IBlockscoutAsset[]> { | ||
const tokenType = standard.replace('ERC', 'ERC-') | ||
const path = `addresses/${address}/tokens` | ||
const response = await this.get<IPaginationResponse<IBlockscoutAsset>>(path, { type: tokenType }) | ||
if (response) { | ||
return (response?.items ?? []).map((asset) => ({ | ||
...asset, | ||
token: { | ||
...asset.token, | ||
type: asset.token.type.replace('-', ''), | ||
}, | ||
})) | ||
} else { | ||
return [] | ||
} | ||
} | ||
|
||
async getTransactionsForAddress(address: string): Promise<IBlockscoutTransaction[]> { | ||
const path = `addresses/${address}/transactions` | ||
const items = await this.makePaginatedGetRequest<IBlockscoutTransaction>(path) | ||
return items | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './blockscout.api' |
Oops, something went wrong.