Skip to content

Commit

Permalink
chore: mv modules to core/ (#17)
Browse files Browse the repository at this point in the history
* chore: move modules to core/

* chore: changeset

* chore: tweak package.json

* chore: tweak package.json
  • Loading branch information
jxom authored Nov 9, 2024
1 parent 580131b commit f438faf
Show file tree
Hide file tree
Showing 191 changed files with 151 additions and 152 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-horses-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ox": patch
---

Moved modules to `core/`.
23 changes: 12 additions & 11 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Setup .npmrc file
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'

- name: Publish to npm
run: |
cd src && pnpm version $(npm pkg get version | sed 's/"//g')-$(date +'%Y%m%dT%H%M%S') && cd ../
pnpm changeset:prepublish
cd src && pnpm publish --no-git-checks --provenance false && cd ../
- name: Publish Snapshots
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
snapshot=$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
pnpm clean
pnpm changeset version --no-git-tag --snapshot $snapshot
pnpm changeset:prepublish
pnpm changeset publish --no-git-tag --snapshot $snapshot --tag $snapshot
1 change: 1 addition & 0 deletions scripts/utils/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function getExports({
if (!parentEntry.isDirectory()) {
if (parentEntry.name.endsWith('test.ts')) continue
if (parentEntry.name === 'jsr.json') continue
if (parentEntry.name === 'tsdoc.json') continue
if (
!parentEntry.name.endsWith('.ts') &&
!parentEntry.name.endsWith('.json')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/AccountProof.ts → src/core/AccountProof.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Address, Hex } from './index.js'
import type { Address, Hex } from '../index.js'

/** An Account Proof as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/state.yaml). */
export type AccountProof<bigintType = bigint, numberType = number> = {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/RpcRequest.ts → src/core/RpcRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Errors } from '../index.js'
import type * as RpcSchema from './RpcSchema.js'
import type { Errors } from './index.js'
import type * as RpcSchema_internal from './internal/rpcSchema.js'
import type { Compute } from './internal/types.js'

Expand Down
2 changes: 1 addition & 1 deletion src/RpcResponse.ts → src/core/RpcResponse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Errors, RpcRequest } from './index.js'
import type { Errors, RpcRequest } from '../index.js'
import type {
Compute,
IsNarrowable,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AbiConstructor } from 'ox'
import { describe, expect, test } from 'vitest'

import { Constructor } from '../../contracts/generated.js'
import { anvilMainnet } from '../../test/anvil.js'
import { seaportContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { Constructor } from '../../../contracts/generated.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { seaportContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'

describe('decode', () => {
test('default', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Abi, AbiError, AbiFunction, AbiItem } from 'ox'
import { describe, expect, test } from 'vitest'
import { Errors } from '../../contracts/generated.js'
import { anvilMainnet } from '../../test/anvil.js'
import { seaportContractConfig } from '../../test/constants/abis.js'
import { Errors } from '../../../contracts/generated.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { seaportContractConfig } from '../../../test/constants/abis.js'

describe('decode', () => {
test('behavior: no args', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { describe, test } from 'vitest'
import {
seaportContractConfig,
wagmiContractConfig,
} from '../../test/constants/abis.js'
} from '../../../test/constants/abis.js'

describe('decode', () => {
test('behavior: named', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Abi, AbiEvent, Hex } from 'ox'
import { describe, expect, test } from 'vitest'

import { anvilMainnet } from '../../test/anvil.js'
import { wagmiContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { wagmiContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'

describe('assertArgs', () => {
test('default', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { attest } from '@ark/attest'
import { Abi, AbiFunction, AbiParameters } from 'ox'
import { describe, test } from 'vitest'
import { erc20Abi, wagmiContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { erc20Abi, wagmiContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'

describe('decodeData', () => {
test('default', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Abi, AbiFunction, AbiParameters } from 'ox'
import { describe, expect, test } from 'vitest'

import { anvilMainnet } from '../../test/anvil.js'
import { erc20Abi, wagmiContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { erc20Abi, wagmiContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'

describe('decodeData', () => {
test('default', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { attest } from '@ark/attest'
import { Abi, AbiFunction, AbiItem } from 'ox'
import { describe, test } from 'vitest'

import { wagmiContractConfig } from '../../test/constants/abis.js'
import { wagmiContractConfig } from '../../../test/constants/abis.js'

describe('fromAbi', () => {
test('default', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { AbiItem } from 'ox'
import { bench, describe } from 'vitest'
import { Web3 } from 'web3'

import { seaportContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { seaportContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'
import { decode, encode } from '../AbiParameters.js'

const fulfillAdvancedOrder = AbiItem.fromAbi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { assertType, describe, expect, test } from 'vitest'
import {
multicall3Abi,
seaportContractConfig,
} from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
} from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'

describe('static', () => {
test('blank', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AbiItem, AbiParameters } from 'ox'
import { describe, expect, test } from 'vitest'

import { seaportContractConfig } from '../../test/constants/abis.js'
import { address } from '../../test/constants/addresses.js'
import { seaportContractConfig } from '../../../test/constants/abis.js'
import { address } from '../../../test/constants/addresses.js'
import { getArrayComponents } from '../internal/abiParameters.js'

describe('static', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbiParameters } from 'ox'
import { describe, expect, test } from 'vitest'
import { address } from '../../test/constants/addresses.js'
import { address } from '../../../test/constants/addresses.js'

describe('encodePacked', () => {
test.each([
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Authorization, Secp256k1 } from 'ox'
import { describe, expect, expectTypeOf, test } from 'vitest'
import { accounts } from '../../test/constants/accounts.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('from', () => {
test('default', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_test/Blobs.test.ts → src/core/_test/Blobs.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Blobs, Bytes, Hex } from 'ox'
import { describe, expect, test } from 'vitest'
import { blobData, kzg } from '../../test/kzg.js'
import { blobData, kzg } from '../../../test/kzg.js'

describe('commitmentsToVersionedHashes', () => {
test('from hex', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/_test/Block.test.ts → src/core/_test/Block.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block } from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { anvilMainnet } from '../../../test/anvil.js'

describe('fromRpc', () => {
test('default', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_test/HdKey.test.ts → src/core/_test/HdKey.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address, HdKey, Mnemonic } from 'ox'
import { describe, expect, test } from 'vitest'
import { accounts } from '../../test/constants/accounts.js'
import { accounts } from '../../../test/constants/accounts.js'
import * as exports from '../HdKey.js'

const seed = Mnemonic.toSeed(
Expand Down
2 changes: 1 addition & 1 deletion src/_test/Hex.bench.ts → src/core/_test/Hex.bench.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { bytesToHex as bytesToHex_ethjs } from '@ethereumjs/util'
import * as ethers from 'ethers'
import { bench, describe } from 'vitest'
import { Bytes } from '../../index.js'
import * as Hex from '../Hex.js'
import { Bytes } from '../index.js'

// TODO: random hex
describe('concat (hex)', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 3 additions & 5 deletions src/_test/Kzg.test.ts → src/core/_test/Kzg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ import { Hex, Kzg } from 'ox'
import { Paths } from 'ox/trusted-setups'
import { describe, expect, test } from 'vitest'

import * as exports from '../Kzg.js'

describe('from', () => {
const blobToKzgCommitmentCases = JSON.parse(
readFileSync(
resolve(__dirname, '../../test/kzg/blob-to-kzg-commitment.json'),
resolve(__dirname, '../../../test/kzg/blob-to-kzg-commitment.json'),
'utf8',
),
)
const computeBlobKzgProofCases = JSON.parse(
readFileSync(
resolve(__dirname, '../../test/kzg/compute-blob-kzg-proof.json'),
resolve(__dirname, '../../../test/kzg/compute-blob-kzg-proof.json'),
'utf8',
),
)
Expand Down Expand Up @@ -83,7 +81,7 @@ describe('from', () => {
})

test('exports', () => {
expect(Object.keys(exports)).toMatchInlineSnapshot(`
expect(Object.keys(Kzg)).toMatchInlineSnapshot(`
[
"versionedHashVersion",
"from",
Expand Down
2 changes: 1 addition & 1 deletion src/_test/Log.test.ts → src/core/_test/Log.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbiEvent, Hex, Log } from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { anvilMainnet } from '../../../test/anvil.js'

describe('fromRpc', () => {
test('default', () => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_test/P256.test.ts → src/core/_test/P256.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Bytes, P256 } from 'ox'
import { describe, expect, test } from 'vitest'
import { accounts } from '../../test/constants/accounts.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('getPublicKey', () => {
const privateKey =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Bytes, Hex, PersonalMessage, Secp256k1 } from 'ox'
import { describe, expect, test } from 'vitest'
import { accounts } from '../../test/constants/accounts.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('encode', () => {
test('default', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Provider, RpcRequest, RpcResponse } from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { address } from '../../test/constants/addresses.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { address } from '../../../test/constants/addresses.js'

describe('createEmitter', () => {
test('default', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RpcRequest, RpcResponse } from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { anvilMainnet } from '../../../test/anvil.js'

describe('createStore', () => {
test('default', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Hex, RpcRequest, RpcResponse } from 'ox'
import { assertType, describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { anvilMainnet } from '../../../test/anvil.js'

describe('from', () => {
test('default', async () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { setTimeout } from 'node:timers/promises'
import { RpcTransport } from 'ox'
import { describe, expect, test } from 'vitest'

import { anvilMainnet } from '../../test/anvil.js'
import { createHttpServer } from '../../test/http.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { createHttpServer } from '../../../test/http.js'

describe('fromHttp', () => {
test('default', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address, Bytes, PublicKey, Secp256k1 } from 'ox'
import { describe, expect, test } from 'vitest'
import { accounts } from '../../test/constants/accounts.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('getPublicKey', () => {
test('default', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
TransactionEnvelopeLegacy,
} from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { accounts } from '../../test/constants/accounts.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('fromRpc', () => {
describe('legacy', () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Hex, Rlp, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
import { assertType, describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { accounts } from '../../test/constants/accounts.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('assert', () => {
test('fee cap too high', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Rlp, Secp256k1, TransactionEnvelopeEip2930, Value } from 'ox'
import { assertType, describe, expect, expectTypeOf, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { accounts } from '../../test/constants/accounts.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('assert', () => {
test('fee cap too high', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
Value,
} from 'ox'
import { assertType, describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { accounts } from '../../test/constants/accounts.js'
import { kzg } from '../../test/kzg.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { accounts } from '../../../test/constants/accounts.js'
import { kzg } from '../../../test/kzg.js'

describe('assert', () => {
test('empty blobs', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
Value,
} from 'ox'
import { assertType, describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { wagmiContractConfig } from '../../test/constants/abis.js'
import { accounts } from '../../test/constants/accounts.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { wagmiContractConfig } from '../../../test/constants/abis.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('assert', () => {
test('invalid chainId', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Hex, Rlp, Secp256k1, TransactionEnvelopeLegacy, Value } from 'ox'
import { assertType, describe, expect, expectTypeOf, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { accounts } from '../../test/constants/accounts.js'
import { anvilMainnet } from '../../../test/anvil.js'
import { accounts } from '../../../test/constants/accounts.js'

describe('assert', () => {
test('fee cap too high', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TransactionReceipt } from 'ox'
import { describe, expect, test } from 'vitest'
import { anvilMainnet } from '../../test/anvil.js'
import { anvilMainnet } from '../../../test/anvil.js'

describe('fromRpc', () => {
test('default', () => {
Expand Down
Loading

0 comments on commit f438faf

Please sign in to comment.