
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@penumbra-zone/client
Advanced tools
@penumbra-zone/client
This package contains interfaces, types, and some helpers for using the page API to Penumbra providers.
To use this package, you need to enable the Buf Schema Registry:
echo "@buf:registry=https://buf.build/gen/npm/v1/" >> .npmrc
import { bech32mAddress } from '@penumbra-zone/bech32m';
import { createPenumbraClient } from '@penumbra-zone/client/create';
import { ViewService, SctService } from '@penumbra-zone/protobuf';
// This may connect to any available injected provider.
const viewClient = createPenumbraClient(ViewService);
// Or, you might prefer a specific provider.
const praxViewClient = createPenumbraClient(
ViewService,
'chrome-extension://lkpmkhpnhknhmibgnmmhdhgdilepfghe',
);
const { address } = await praxViewClient.addressByIndex({});
console.log(bech32mAddress(address));
It's likely you want to use this client in your webapp, and there's a good
chance you're using React. Penumbra providers use @connectrpc
tooling, so
these clients are supported by @connectrpc/query
and @tanstack/react-query
.
After using createPenumbraChannelTransport
from @penumbra-zone/client/create
and TransportProvider
from @connectrpc/query
in a parent component, you can
use convenient React idioms.
You can see a full example of this at https://github.com/penumbra-zone/nextjs-penumbra-client-example
"use client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { syncCreatePenumbraChannelTransport } from "@penumbra-zone/client/create";
import { TransportProvider } from "@connectrpc/connect-query";
import { useMemo } from "react";
const queryClient = new QueryClient();
export const PenumbraQueryProvider = ({
providerOrigin,
children,
}: {
providerOrigin: string;
children: React.ReactNode;
}) => {
const penumbraTransport = useMemo(
() => syncCreatePenumbraChannelTransport(providerOrigin),
[providerOrigin],
);
return (
<TransportProvider transport={penumbraTransport}>
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
</TransportProvider>
);
};
"use client";
import { addressByIndex } from "@buf/penumbra-zone_penumbra.connectrpc_query-es/penumbra/view/v1/view-ViewService_connectquery";
import { bech32mAddress } from "@penumbra-zone/bech32m/penumbra";
import { useQuery } from "@connectrpc/connect-query";
export const PenumbraAddress = ({ account }: { account?: number }) => {
const { data } = useQuery(addressByIndex, { addressIndex: { account } });
return (
data?.address && (
<span className="address">{bech32mAddress(data.address)}</span>
)
);
};
This example is javascript.
import { createChannelTransport } from '@penumbra-zone/transport-dom';
import { createPromiseClient } from '@connectrpc/connect';
import { jsonOptions, ViewService } from '@penumbra-zone/protobuf';
// naively get first available provider
const provider = Object.values(window[Symbol.for('penumbra')])[0];
void provider.request();
// create a client
const viewClient = createPromiseClient(
ViewService,
createChannelTransport({ jsonOptions, getPort: provider.connect }),
);
const { catchingUp, fullSyncHeight } = viewClient.status({});
FAQs
Package for connecting to any Penumbra extension, including Prax.
The npm package @penumbra-zone/client receives a total of 493 weekly downloads. As such, @penumbra-zone/client popularity was classified as not popular.
We found that @penumbra-zone/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.