Skip to content

Commit

Permalink
684 rename penumbra zonerouter package + publish to npm (#939)
Browse files Browse the repository at this point in the history
* refactor and publish router

* pnpm changeset

* rebase

* format
  • Loading branch information
Valentine1898 authored Apr 15, 2024
1 parent 7d856b5 commit 9f4c112
Show file tree
Hide file tree
Showing 98 changed files with 172 additions and 139 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-gorillas-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@penumbra-zone/services': major
---

Drop /src/ requirement for imports and renaming
5 changes: 5 additions & 0 deletions .changeset/tiny-drinks-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@penumbra-zone/services-context': major
---

Drop /src/ requirement for imports and renaming
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@penumbra-zone/crypto-web": "workspace:*",
"@penumbra-zone/perspective": "workspace:*",
"@penumbra-zone/query": "workspace:*",
"@penumbra-zone/router": "workspace:*",
"@penumbra-zone/services": "workspace:*",
"@penumbra-zone/services-context": "workspace:*",
"@penumbra-zone/storage": "workspace:*",
"@penumbra-zone/transport-chrome": "workspace:*",
"@penumbra-zone/transport-dom": "workspace:*",
Expand Down
8 changes: 4 additions & 4 deletions apps/extension/src/get-rpc-impls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { QueryService as StakingService } from '@buf/penumbra-zone_penumbra.conn
import { TendermintProxyService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/util/tendermint_proxy/v1/tendermint_proxy_connect';
import { CustodyService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/custody/v1/custody_connect';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { custodyImpl } from '@penumbra-zone/router/src/grpc/custody';
import { sctImpl } from '@penumbra-zone/router/src/grpc/sct';
import { stakingImpl } from '@penumbra-zone/router/src/grpc/staking';
import { viewImpl } from '@penumbra-zone/router/src/grpc/view-protocol-server';
import { custodyImpl } from '@penumbra-zone/services/custody-service';
import { sctImpl } from '@penumbra-zone/services/sct-service';
import { stakingImpl } from '@penumbra-zone/services/staking-service';
import { viewImpl } from '@penumbra-zone/services/view-service';

import { localExtStorage } from '@penumbra-zone/storage/chrome/local';
import { ServiceType } from '@bufbuild/protobuf';
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/src/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import './listeners';

// services
import { Services } from '@penumbra-zone/services/src/index';
import { Services } from '@penumbra-zone/services-context';
import { localExtStorage } from '@penumbra-zone/storage/chrome/local';

// adapter
Expand All @@ -25,10 +25,10 @@ import { transportOptions } from '@penumbra-zone/types/src/registry';
// context
import { CustodyService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/custody/v1/custody_connect';
import { QueryService as StakingService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/component/stake/v1/stake_connect';
import { approverCtx } from '@penumbra-zone/router/src/ctx/approver';
import { custodyCtx } from '@penumbra-zone/router/src/ctx/custody';
import { servicesCtx } from '@penumbra-zone/router/src/ctx/prax';
import { stakingClientCtx } from '@penumbra-zone/router/src/ctx/staking-client';
import { approverCtx } from '@penumbra-zone/services/ctx/approver';
import { custodyCtx } from '@penumbra-zone/services/ctx/custody';
import { servicesCtx } from '@penumbra-zone/services/ctx/prax';
import { stakingClientCtx } from '@penumbra-zone/services/ctx/staking-client';
import { approveTransaction } from './approve-transaction';

// all rpc implementations, local and proxy
Expand Down
25 changes: 0 additions & 25 deletions packages/router/package.json

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @penumbra-zone/router
# @penumbra-zone/services

## 2.0.2

Expand All @@ -18,9 +18,7 @@
- Updated dependencies [66c2407]
- @penumbra-zone/wasm@3.0.0
- @penumbra-zone/storage@2.0.1
- @penumbra-zone/perspective@1.0.1
- @penumbra-zone/query@2.0.1
- @penumbra-zone/services@2.0.1

## 2.0.0

Expand All @@ -36,27 +34,15 @@
- @penumbra-zone/constants@2.0.0
- @penumbra-zone/storage@2.0.0
- @penumbra-zone/query@2.0.0
- @penumbra-zone/perspective@1.0.0
- @penumbra-zone/services@2.0.0
- @penumbra-zone/getters@2.0.0
- @penumbra-zone/bech32@2.0.0
- @penumbra-zone/crypto-web@2.0.0
- @penumbra-zone/types@2.0.0
- @penumbra-zone/polyfills@2.0.0
- @penumbra-zone/transport-dom@2.0.0

## 1.0.2

### Patch Changes

- Updated dependencies
- @penumbra-zone/constants@1.1.0
- @penumbra-zone/getters@1.1.0
- @penumbra-zone/polyfills@1.1.0
- @penumbra-zone/transport-dom@1.1.0
- @penumbra-zone/types@1.1.0
- @penumbra-zone/query@1.0.2
- @penumbra-zone/services@1.0.2
- @penumbra-zone/storage@1.0.2
- @penumbra-zone/crypto-web@1.0.1
- @penumbra-zone/wasm@1.0.2
27 changes: 27 additions & 0 deletions packages/services-context/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@penumbra-zone/services-context",
"version": "2.0.2",
"license": "MIT",
"type": "module",
"scripts": {
"lint": "eslint \"**/*.ts*\""
},
"files": [
"src/",
"*.md"
],
"exports": {
".": "./src/index.ts"
},
"dependencies": {
"@penumbra-zone/constants": "workspace:*",
"@penumbra-zone/query": "workspace:*",
"@penumbra-zone/storage": "workspace:*",
"@penumbra-zone/types": "workspace:*",
"@penumbra-zone/wasm": "workspace:*",
"exponential-backoff": "^3.1.1"
},
"devDependencies": {
"@penumbra-zone/polyfills": "workspace:*"
}
}
File renamed without changes.
File renamed without changes.
16 changes: 15 additions & 1 deletion packages/services/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @penumbra-zone/services
# @penumbra-zone/router

## 2.0.2

Expand All @@ -15,7 +15,9 @@
- Updated dependencies [66c2407]
- @penumbra-zone/wasm@3.0.0
- @penumbra-zone/storage@2.0.1
- @penumbra-zone/perspective@1.0.1
- @penumbra-zone/query@2.0.1
- @penumbra-zone/services@2.0.1

## 2.0.0

Expand All @@ -31,15 +33,27 @@
- @penumbra-zone/constants@2.0.0
- @penumbra-zone/storage@2.0.0
- @penumbra-zone/query@2.0.0
- @penumbra-zone/perspective@1.0.0
- @penumbra-zone/services@2.0.0
- @penumbra-zone/getters@2.0.0
- @penumbra-zone/bech32@2.0.0
- @penumbra-zone/crypto-web@2.0.0
- @penumbra-zone/types@2.0.0
- @penumbra-zone/polyfills@2.0.0
- @penumbra-zone/transport-dom@2.0.0

## 1.0.2

### Patch Changes

- Updated dependencies
- @penumbra-zone/constants@1.1.0
- @penumbra-zone/getters@1.1.0
- @penumbra-zone/polyfills@1.1.0
- @penumbra-zone/transport-dom@1.1.0
- @penumbra-zone/types@1.1.0
- @penumbra-zone/query@1.0.2
- @penumbra-zone/services@1.0.2
- @penumbra-zone/storage@1.0.2
- @penumbra-zone/crypto-web@1.0.1
- @penumbra-zone/wasm@1.0.2
File renamed without changes.
35 changes: 28 additions & 7 deletions packages/services/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
{
"name": "@penumbra-zone/services",
"version": "2.0.2",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"lint": "eslint \"**/*.ts*\""
"lint": "eslint \"**/*.ts*\"",
"test": "vitest run"
},
"files": [
"src/",
"*.md",
"!**/*.test.ts",
"!test-utils.ts"
],
"exports": {
"./ctx/*": "./src/ctx/*.ts",
"./custody-service": "./src/custody-service/index.ts",
"./custody-service/*": "./src/custody-service/*.ts",
"./sct-service": "./src/sct-service/index.ts",
"./sct-service/*": "./src/sct-service/*.ts",
"./staking-service": "./src/staking-service/index.ts",
"./staking-service/*": "./src/staking-service/*.ts",
"./view-service": "./src/view-service/index.ts",
"./view-service/*": "./src/view-service/*.ts",
"./offscreen-client": "./src/offscreen-client.ts"
},
"dependencies": {
"@penumbra-zone/constants": "workspace:*",
"@penumbra-zone/crypto-web": "workspace:*",
"@penumbra-zone/getters": "workspace:*",
"@penumbra-zone/bech32": "workspace:*",
"@penumbra-zone/perspective": "workspace:*",
"@penumbra-zone/polyfills": "workspace:*",
"@penumbra-zone/query": "workspace:*",
"@penumbra-zone/services-context": "workspace:*",
"@penumbra-zone/storage": "workspace:*",
"@penumbra-zone/transport-dom": "workspace:*",
"@penumbra-zone/types": "workspace:*",
"@penumbra-zone/wasm": "workspace:*",
"exponential-backoff": "^3.1.1"
},
"devDependencies": {
"@penumbra-zone/polyfills": "workspace:*"
"@penumbra-zone/wasm": "workspace:*"
}
}
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,7 +1,7 @@
import { beforeEach, describe, expect, Mock, test, vi } from 'vitest';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { approverCtx } from '../../../ctx/approver';
import { extLocalCtx, extSessionCtx, servicesCtx } from '../../../ctx/prax';
import { approverCtx } from '../../ctx/approver';
import { extLocalCtx, extSessionCtx, servicesCtx } from '../../ctx/prax';
import { IndexedDbMock, MockExtLocalCtx, MockExtSessionCtx, MockServices } from '../../test-utils';
import { authorize } from '.';
import { AuthorizeRequest } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/custody/v1/custody_pb';
Expand All @@ -10,7 +10,7 @@ import {
AuthorizationData,
TransactionPlan,
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/transaction/v1/transaction_pb';
import { Services } from '@penumbra-zone/services/src/index';
import { Services } from '@penumbra-zone/services-context';
import { Metadata } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { UserChoice } from '@penumbra-zone/types/src/user-choice';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Impl } from '..';
import { extLocalCtx, extSessionCtx, servicesCtx } from '../../../ctx/prax';
import { approverCtx } from '../../../ctx/approver';
import { extLocalCtx, extSessionCtx, servicesCtx } from '../../ctx/prax';
import { approverCtx } from '../../ctx/approver';
import { generateSpendKey } from '@penumbra-zone/wasm/src/keys';
import { authorizePlan } from '@penumbra-zone/wasm/src/build';
import { Key } from '@penumbra-zone/crypto-web/encryption';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { epochByHeight } from './epoch-by-height';
import { IndexedDbMock, MockServices } from '../test-utils';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { QueryService as SctService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/component/sct/v1/sct_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import {
Epoch,
EpochByHeightRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EpochByHeightResponse } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/component/sct/v1/sct_pb';
import { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';

export const epochByHeight: Impl['epochByHeight'] = async (req, ctx) => {
const { height } = req;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validatorInfo } from './validator-info';
import { IndexedDbMock, MockServices } from '../test-utils';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { QueryService as StakingService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/component/stake/v1/stake_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import {
ValidatorInfoRequest,
ValidatorInfoResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import {
ValidatorInfoResponse,
ValidatorState_ValidatorStateEnum,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validatorPenalty } from './validator-penalty';
import { MockServices } from '../test-utils';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { QueryService as StakingService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/core/component/stake/v1/stake_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import {
ValidatorPenaltyRequest,
ValidatorPenaltyResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';

export const validatorPenalty: Impl['validatorPenalty'] = async (req, ctx) => {
const services = ctx.values.get(servicesCtx);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { addressByIndex } from './address-by-index';
import { Address } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/keys/v1/keys_pb';
import type { ServicesInterface } from '@penumbra-zone/types/src/services';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';

import { getAddressByIndex } from '@penumbra-zone/wasm/src/keys';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { AppParameters } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/app/v1/app_pb';
import { appParameters } from './app-parameters';
import { IndexedDbMock, MockServices } from '../test-utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppParameters } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/app/v1/app_pb';
import type { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';

export const appParameters: Impl['appParameters'] = async (_, ctx) => {
const services = ctx.values.get(servicesCtx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { IndexedDbMock, MockServices, ShieldedPoolMock } from '../test-utils';
import {
AssetId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { getAssetMetadata } from './helpers';

export const assetMetadataById: Impl['assetMetadataById'] = async (req, ctx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
import { ViewService } from '@buf/penumbra-zone_penumbra.connectrpc_es/penumbra/view/v1/view_connect';
import { createContextValues, createHandlerContext, HandlerContext } from '@connectrpc/connect';
import { beforeEach, describe, expect, test, vi } from 'vitest';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { assets } from './assets';
import { IndexedDbMock, MockServices } from '../test-utils';
import { Services } from '@penumbra-zone/services/src/index';
import { Services } from '@penumbra-zone/services-context/src/index';

describe('Assets request handler', () => {
let req: AssetsRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Impl } from '.';
import { servicesCtx } from '../../ctx/prax';
import { servicesCtx } from '../ctx/prax';
import { assetPatterns, RegexMatcher } from '@penumbra-zone/constants/src/assets';

export const assets: Impl['assets'] = async function* (req, ctx) {
Expand Down
Loading

0 comments on commit 9f4c112

Please sign in to comment.