Skip to content

Commit

Permalink
chore: correctly named constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuditi committed Nov 15, 2022
1 parent 8aa82eb commit 59bff8c
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 14 deletions.
Expand Up @@ -6,16 +6,16 @@ import { newTransactionDetails, NewTransactionType, selectedAccountAssets } from
import { Converter } from '@core/utils'
import {
ACCOUNTS_CONTRACT,
Allowance,
EMPTY_BUFFER,
EMPTY_BUFFER_BYTE_LENGTH,
ENDING_SIGNAL_BYTE,
EXTERNALLY_OWNED_ACCOUNT,
EXTERNALLY_OWNED_ACCOUNT_TYPE_ID,
FORCE_OPEN_ACCOUNT,
GAS_BUDGET,
SET_ALLOWANCE,
TRANSFER_ALLOWANCE,
} from '@core/layer-2/constants'
} from '@core/layer-2'

export function getLayer2MetadataForTransfer(layer2Address: string): string {
const metadataStream = new WriteStream()
Expand Down Expand Up @@ -72,7 +72,7 @@ function encodeAllowance(): Uint8Array {

const transactionDetails = get(newTransactionDetails)
if (transactionDetails.type === NewTransactionType.TokenTransfer) {
allowance.writeUInt8('encodedAllowance', SET_ALLOWANCE)
allowance.writeUInt8('encodedAllowance', Allowance.NotSet)

const { asset, surplus, rawAmount } = transactionDetails
if (asset === get(selectedAccountAssets).baseCoin) {
Expand Down
@@ -0,0 +1,2 @@
// first 4 bytes of the hash of accounts contract name
export const ACCOUNTS_CONTRACT = 0x3c4b5e02

This file was deleted.

13 changes: 6 additions & 7 deletions packages/shared/lib/core/layer-2/constants/index.ts
@@ -1,10 +1,9 @@
export * from './address-type-id.constant'
export * from './contract-function-hash.constant'
export * from './empty-buffer.constant'
export * from './externally-owned-account-type-id.constant'
export * from './transfer-allowance.constant'
export * from './empty-buffer.constants'
export * from './gas-budget.constant'
export * from './network-address.constant'
export * from './open-account.constant'
export * from './sender-contract-hash.constant'
export * from './set-allowance.constant'
export * from './force-open-account.constant'
export * from './externally-owned-account.constant'
export * from './signal-bytes.constant'
export * from './target-contract-hash.constant'
export * from './accounts-contract.constant'

This file was deleted.

This file was deleted.

@@ -0,0 +1,2 @@
// first 4 bytes of the hash of transferAllowance function with its parameters
export const TRANSFER_ALLOWANCE = 0x23f4e3a1
4 changes: 4 additions & 0 deletions packages/shared/lib/core/layer-2/enums/allowance.enum.ts
@@ -0,0 +1,4 @@
export enum Allowance {
Set = 0,
NotSet = 255,
}
1 change: 1 addition & 0 deletions packages/shared/lib/core/layer-2/enums/index.ts
@@ -1 +1,2 @@
export * from './allowance.enum'
export * from './destination-network.enum'

0 comments on commit 59bff8c

Please sign in to comment.