Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v1.528.0 #6089

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput }
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import { bn } from '../../utils/bignumber'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as avalanche from './AvalancheChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down Expand Up @@ -86,14 +86,15 @@ const makeGetAccountMockResponse = (balance: {
const makeChainAdapterArgs = (overrideArgs?: {
providers?: { http: unchained.avalanche.V1Api }
chainId?: EvmChainId
}): ChainAdapterArgs<unchained.avalanche.V1Api> =>
}): avalanche.ChainAdapterArgs =>
merge(
{
providers: {
http: {} as unchained.avalanche.V1Api,
ws: {} as unchained.ws.Client<unchained.avalanche.Tx>,
},
rpcUrl: '',
midgardUrl: '',
},
overrideArgs,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ import { KnownChainIds } from '@shapeshiftoss/types'
import * as unchained from '@shapeshiftoss/unchained-client'

import { ChainAdapterDisplayName } from '../../types'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import type { ChainAdapterArgs as BaseChainAdapterArgs } from '../EvmBaseAdapter'
import { EvmBaseAdapter } from '../EvmBaseAdapter'

const SUPPORTED_CHAIN_IDS = [KnownChainIds.AvalancheMainnet]
const DEFAULT_CHAIN_ID = KnownChainIds.AvalancheMainnet

export interface ChainAdapterArgs extends BaseChainAdapterArgs<unchained.avalanche.V1Api> {
midgardUrl: string
}

export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.AvalancheMainnet> {
public static readonly defaultBIP44Params: BIP44Params = {
purpose: 44,
coinType: Number(ASSET_REFERENCE.AvalancheC),
accountNumber: 0,
}

constructor(args: ChainAdapterArgs<unchained.avalanche.V1Api>) {
constructor(args: ChainAdapterArgs) {
super({
assetId: avalancheAssetId,
chainId: DEFAULT_CHAIN_ID,
Expand All @@ -28,6 +32,7 @@ export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.AvalancheMainnet>
chainId: args.chainId ?? DEFAULT_CHAIN_ID,
rpcUrl: args.rpcUrl,
api: args.providers.http,
midgardUrl: args.midgardUrl,
}),
supportedChainIds: SUPPORTED_CHAIN_IDS,
...args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput }
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import { bn } from '../../utils/bignumber'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as bsc from './BscChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down Expand Up @@ -81,14 +81,15 @@ const makeGetAccountMockResponse = (balance: {
const makeChainAdapterArgs = (overrideArgs?: {
providers?: { http: unchained.bnbsmartchain.V1Api }
chainId?: EvmChainId
}): ChainAdapterArgs<unchained.bnbsmartchain.V1Api> =>
}): bsc.ChainAdapterArgs =>
merge(
{
providers: {
http: {} as unchained.bnbsmartchain.V1Api,
ws: {} as unchained.ws.Client<unchained.bnbsmartchain.Tx>,
},
rpcUrl: '',
midgardUrl: '',
},
overrideArgs,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ import BigNumber from 'bignumber.js'
import type { FeeDataEstimate, GetFeeDataInput } from '../../types'
import { ChainAdapterDisplayName } from '../../types'
import { bn, bnOrZero } from '../../utils/bignumber'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import type { ChainAdapterArgs as BaseChainAdapterArgs } from '../EvmBaseAdapter'
import { EvmBaseAdapter } from '../EvmBaseAdapter'
import type { GasFeeDataEstimate } from '../types'

const SUPPORTED_CHAIN_IDS = [KnownChainIds.BnbSmartChainMainnet]
const DEFAULT_CHAIN_ID = KnownChainIds.BnbSmartChainMainnet

export interface ChainAdapterArgs extends BaseChainAdapterArgs<unchained.bnbsmartchain.V1Api> {
midgardUrl: string
}

export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.BnbSmartChainMainnet> {
public static readonly defaultBIP44Params: BIP44Params = {
purpose: 44,
coinType: Number(ASSET_REFERENCE.BnbSmartChain),
accountNumber: 0,
}

constructor(args: ChainAdapterArgs<unchained.bnbsmartchain.V1Api>) {
constructor(args: ChainAdapterArgs) {
super({
assetId: bscAssetId,
chainId: DEFAULT_CHAIN_ID,
Expand All @@ -32,6 +36,7 @@ export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.BnbSmartChainMain
chainId: args.chainId ?? DEFAULT_CHAIN_ID,
rpcUrl: args.rpcUrl,
api: args.providers.http,
midgardUrl: args.midgardUrl,
}),
supportedChainIds: SUPPORTED_CHAIN_IDS,
...args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { BuildSendTxInput, GetFeeDataInput, SignMessageInput, SignTxInput }
import { ValidAddressResultType } from '../../types'
import { toAddressNList } from '../../utils'
import { bn } from '../../utils/bignumber'
import type { ChainAdapterArgs, EvmChainId } from '../EvmBaseAdapter'
import type { EvmChainId } from '../EvmBaseAdapter'
import * as ethereum from './EthereumChainAdapter'

vi.mock('../../utils/validateAddress', () => ({
Expand Down Expand Up @@ -83,14 +83,15 @@ describe('EthereumChainAdapter', () => {
const makeChainAdapterArgs = (overrideArgs?: {
providers?: { http: unchained.ethereum.V1Api }
chainId?: EvmChainId
}): ChainAdapterArgs<unchained.ethereum.V1Api> =>
}): ethereum.ChainAdapterArgs =>
merge(
{
providers: {
http: {} as unknown as unchained.ethereum.V1Api,
ws: {} as unchained.ws.Client<unchained.ethereum.Tx>,
},
rpcUrl: '',
midgardUrl: '',
},
overrideArgs,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ import * as unchained from '@shapeshiftoss/unchained-client'

import type { ValidAddressResult } from '../../types'
import { ChainAdapterDisplayName, ValidAddressResultType } from '../../types'
import type { ChainAdapterArgs } from '../EvmBaseAdapter'
import type { ChainAdapterArgs as BaseChainAdapterArgs } from '../EvmBaseAdapter'
import { EvmBaseAdapter } from '../EvmBaseAdapter'

const SUPPORTED_CHAIN_IDS = [KnownChainIds.EthereumMainnet]
const DEFAULT_CHAIN_ID = KnownChainIds.EthereumMainnet

export interface ChainAdapterArgs extends BaseChainAdapterArgs<unchained.ethereum.V1Api> {
midgardUrl: string
}

export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.EthereumMainnet> {
static readonly defaultBIP44Params: BIP44Params = {
purpose: 44,
coinType: Number(ASSET_REFERENCE.Ethereum),
accountNumber: 0,
}

constructor(args: ChainAdapterArgs<unchained.ethereum.V1Api>) {
constructor(args: ChainAdapterArgs) {
super({
assetId: ethAssetId,
chainId: DEFAULT_CHAIN_ID,
Expand All @@ -29,6 +33,7 @@ export class ChainAdapter extends EvmBaseAdapter<KnownChainIds.EthereumMainnet>
chainId: args.chainId ?? DEFAULT_CHAIN_ID,
rpcUrl: args.rpcUrl,
api: args.providers.http,
midgardUrl: args.midgardUrl,
}),
supportedChainIds: SUPPORTED_CHAIN_IDS,
...args,
Expand Down
4 changes: 2 additions & 2 deletions packages/unchained-client/src/evm/arbitrum/parser/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Tx } from '../../../generated/arbitrum'
import type { TransactionParserArgs } from '../../parser'
import type { BaseTransactionParserArgs } from '../../parser'
import { BaseTransactionParser } from '../../parser'
import * as erc20 from '../../parser/erc20'
import * as nft from '../../parser/nft'
Expand All @@ -8,7 +8,7 @@ import * as zrx from '../../parser/zrx'
export const ZRX_ARBITRUM_PROXY_CONTRACT = '0xDef1C0ded9bec7F1a1670819833240f027b25EfF'

export class TransactionParser extends BaseTransactionParser<Tx> {
constructor(args: TransactionParserArgs) {
constructor(args: BaseTransactionParserArgs) {
super(args)

this.registerParsers([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Tx } from '../../../generated/arbitrumNova'
import type { TransactionParserArgs } from '../../parser'
import type { BaseTransactionParserArgs } from '../../parser'
import { BaseTransactionParser } from '../../parser'
import * as erc20 from '../../parser/erc20'
import * as nft from '../../parser/nft'

export class TransactionParser extends BaseTransactionParser<Tx> {
constructor(args: TransactionParserArgs) {
constructor(args: BaseTransactionParserArgs) {
super(args)

this.registerParsers([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const txParser = new TransactionParser({
chainId: avalancheChainId,
assetId: avalancheAssetId,
api: mockedApi,
midgardUrl: '',
})

describe('parseTx', () => {
Expand Down
12 changes: 11 additions & 1 deletion packages/unchained-client/src/evm/avalanche/parser/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import type { Tx } from '../../../generated/avalanche'
import type { TransactionParserArgs } from '../../parser'
import type { BaseTransactionParserArgs } from '../../parser'
import { BaseTransactionParser } from '../../parser'
import * as erc20 from '../../parser/erc20'
import * as nft from '../../parser/nft'
import * as thorchain from '../../parser/thorchain'
import * as zrx from '../../parser/zrx'

export const ZRX_AVALANCHE_PROXY_CONTRACT = '0xDef1C0ded9bec7F1a1670819833240f027b25EfF'

export interface TransactionParserArgs extends BaseTransactionParserArgs {
midgardUrl: string
}

export class TransactionParser extends BaseTransactionParser<Tx> {
constructor(args: TransactionParserArgs) {
super(args)
Expand All @@ -18,6 +23,11 @@ export class TransactionParser extends BaseTransactionParser<Tx> {
api: this.api,
}),
new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
new thorchain.Parser({
chainId: this.chainId,
rpcUrl: args.rpcUrl,
midgardUrl: args.midgardUrl,
}),
new zrx.Parser({ proxyContract: ZRX_AVALANCHE_PROXY_CONTRACT }),
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const txParser = new TransactionParser({
chainId: bscChainId,
assetId: bscAssetId,
api: mockedApi,
midgardUrl: '',
})

describe('parseTx', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import type { Tx } from '../../../generated/bnbsmartchain'
import type { TransactionParserArgs } from '../../parser'
import type { BaseTransactionParserArgs } from '../../parser'
import { BaseTransactionParser } from '../../parser'
import * as nft from '../../parser/nft'
import * as thorchain from '../../parser/thorchain'
import * as zrx from '../../parser/zrx'
import * as bep20 from './bep20'

export const ZRX_BSC_PROXY_CONTRACT = '0xDef1C0ded9bec7F1a1670819833240f027b25EfF'

export interface TransactionParserArgs extends BaseTransactionParserArgs {
midgardUrl: string
}

export class TransactionParser extends BaseTransactionParser<Tx> {
constructor(args: TransactionParserArgs) {
super(args)
Expand All @@ -18,6 +23,11 @@ export class TransactionParser extends BaseTransactionParser<Tx> {
api: this.api,
}),
new bep20.Parser({ chainId: this.chainId, provider: this.provider }),
new thorchain.Parser({
chainId: this.chainId,
rpcUrl: args.rpcUrl,
midgardUrl: args.midgardUrl,
}),
new zrx.Parser({ proxyContract: ZRX_BSC_PROXY_CONTRACT }),
])
}
Expand Down
Loading
Loading