Skip to content

Commit

Permalink
Getters
Browse files Browse the repository at this point in the history
  • Loading branch information
grod220 committed Mar 11, 2024
1 parent c755c2b commit f02167d
Show file tree
Hide file tree
Showing 21 changed files with 516 additions and 42 deletions.
2 changes: 1 addition & 1 deletion apps/extension/src/routes/page/onboarding/generate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExclamationTriangleIcon, LockClosedIcon } from '@radix-ui/react-icons';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web';
import { useEffect, useState } from 'react';
import {
BackIcon,
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/shared/containers/import-form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web';
import { useEffect } from 'react';
import { Input } from '@penumbra-zone/ui';
import { cn } from '@penumbra-zone/ui/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web';
import { Toggle } from '@penumbra-zone/ui';

interface WordLengthTooglesProsp {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/seed-phrase/generate.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { create, StoreApi, UseBoundStore } from 'zustand';
import { AllSlices, initializeStore } from '..';
import { beforeEach, describe, expect, test } from 'vitest';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web';
import { mockLocalExtStorage, mockSessionExtStorage } from '@penumbra-zone/storage';

describe('Generate Slice', () => {
Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/state/seed-phrase/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { AllSlices, SliceCreator } from '..';
import { SeedPhraseSlice } from '.';
import {
generateSeedPhrase,
generateValidationFields,
SeedPhraseLength,
ValidationField,
generateValidationFields,
} from '@penumbra-zone/crypto-web/src/mnemonic';
} from '@penumbra-zone/crypto-web';

export interface GenerateFields {
phrase: string[];
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/state/seed-phrase/import.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { create, StoreApi, UseBoundStore } from 'zustand';
import { AllSlices, initializeStore } from '..';
import { beforeEach, describe, expect, test } from 'vitest';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web';
import { mockLocalExtStorage, mockSessionExtStorage } from '@penumbra-zone/storage';

describe('Import Slice', () => {
Expand Down
6 changes: 1 addition & 5 deletions apps/extension/src/state/seed-phrase/import.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { AllSlices, SliceCreator } from '..';
import { SeedPhraseSlice } from '.';
import {
isInWordList,
SeedPhraseLength,
validateSeedPhrase,
} from '@penumbra-zone/crypto-web/src/mnemonic';
import { isInWordList, SeedPhraseLength, validateSeedPhrase } from '@penumbra-zone/crypto-web';

export interface ImportFields {
phrase: string[];
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
".": "./dist/index.js"
},
"scripts": {
"build": "tsc && vite build",
"build": "pnpm clean && tsc && vite build",
"clean": "rm -rfv dist",
"lint": "eslint \"**/*.ts*\""
},
Expand Down
1 change: 0 additions & 1 deletion packages/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": "@penumbra-zone/tsconfig/base.json",
"include": ["."],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist"
Expand Down
5 changes: 2 additions & 3 deletions packages/constants/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "@penumbra-zone/tsconfig/base.json",
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"declarationDir": "dist"
"outDir": "dist"
}
}
1 change: 1 addition & 0 deletions packages/crypto/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './src/encryption';
export * from './src/sha256';
export * from './src/mnemonic';
13 changes: 12 additions & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
"version": "1.0.1",
"license": "MIT",
"type": "module",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": "./dist/index.js"
},
"scripts": {
"build": "pnpm clean && tsc && vite build",
"clean": "rm -rfv dist",
"lint": "eslint \"**/*.ts*\"",
"test": "vitest run"
},
Expand All @@ -12,6 +22,7 @@
"crypto-js": "^4.2.0"
},
"devDependencies": {
"@types/crypto-js": "^4.2.2"
"@types/crypto-js": "^4.2.2",
"vite-plugin-node-polyfills": "0.17.0"
}
}
6 changes: 4 additions & 2 deletions packages/crypto/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"extends": "@penumbra-zone/tsconfig/base.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist"
}
}
15 changes: 15 additions & 0 deletions packages/crypto/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

export default defineConfig({
build: {
lib: {
entry: ['index.ts'],
formats: ['es'],
},
},
// vite-plugin-node-polyfills pinned to 0.17.0 until bug fixed
// https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81
plugins: [dts(), nodePolyfills({ globals: { Buffer: true } })],
});
18 changes: 17 additions & 1 deletion packages/getters/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
export * from './src';
export * from './src/asset';
export * from './src/address-view';
export * from './src/funding-stream';
export * from './src/metadata';
export * from './src/rate-data';
export * from './src/swap';
export * from './src/swap-record';
export * from './src/spendable-note-record';
export * from './src/trading-pair';
export * from './src/transaction';
export * from './src/unclaimed-swaps-response';
export * from './src/validator';
export * from './src/validator-info';
export * from './src/validator-info-response';
export * from './src/validator-state';
export * from './src/validator-status';
export * from './src/value-view';
10 changes: 10 additions & 0 deletions packages/getters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
"version": "1.0.1",
"description": "Convenience getters for the deeply nested optionals of Penumbra's protobuf types",
"type": "module",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"exports": {
".": "./dist/index.js"
},
"scripts": {
"build": "pnpm clean && tsc && vite build",
"clean": "rm -rfv dist",
"lint": "eslint \"**/*.ts*\"",
"test": "vitest run"
},
Expand Down
17 changes: 0 additions & 17 deletions packages/getters/src/index.ts

This file was deleted.

6 changes: 4 additions & 2 deletions packages/getters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"extends": "@penumbra-zone/tsconfig/base.json",
"include": ["."],
"exclude": ["node_modules"]
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "dist"
}
}
12 changes: 12 additions & 0 deletions packages/getters/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({
build: {
lib: {
entry: ['index.ts'],
formats: ['es'],
},
},
plugins: [dts()],
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { Address } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/keys/v1/keys_pb';
import { Jsonified } from '@penumbra-zone/types';
import { bech32AssetId } from '@penumbra-zone/getters/src/asset';
import { bech32AssetId } from '@penumbra-zone/getters';
import { bech32ToUint8Array } from '@penumbra-zone/types/src/address';
import {
BatchSwapOutputData,
Expand Down
Loading

0 comments on commit f02167d

Please sign in to comment.