Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: package refs in readme #72

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ This TypeScript SDK provides tools for working with Ethereum stealth addresses a
## Installation

```bash
npm install stealth-address-sdk
npm install @scopelift/stealth-address-sdk
# or
yarn add stealth-address-sdk
yarn add @scopelift/stealth-address-sdk
# or
bun install stealth-address-sdk
bun install @scopelift/stealth-address-sdk
```

## Testing
Expand All @@ -47,11 +47,11 @@ bun run test-fork FILE={file path}
### Generating a Stealth Address

```ts
import { generateStealthAddress } from 'stealth-address-sdk';
import { generateStealthAddress } from "@scopelift/stealth-address-sdk";

// Your stealth meta-address URI
// Follows the format: "st:<chain>:<stealthMetaAddress>", where <chain> is the chain identifier (https://eips.ethereum.org/EIPS/eip-3770#examples) and <stealthMetaAddress> is the stealth meta-address.
const stealthMetaAddressURI = '...';
const stealthMetaAddressURI = "...";

// Generate a stealth address using the default scheme (1)
// To learn more about the initial implementation scheme using SECP256k1, please see the reference here (https://eips.ethereum.org/EIPS/eip-5564)
Expand All @@ -64,12 +64,15 @@ console.log(result.stealthAddress);
### Computing Stealh Key

```ts
import { computeStealthKey, VALID_SCHEME_ID } from 'stealth-address-sdk';
import {
computeStealthKey,
VALID_SCHEME_ID,
} from "@scopelift/stealth-address-sdk";

// Example inputs
const viewingPrivateKey = '0x...'; // Viewing private key of the recipient
const spendingPrivateKey = '0x...'; // Spending private key of the recipient
const ephemeralPublicKey = '0x...'; // Ephemeral public key from the sender's announcement
const viewingPrivateKey = "0x..."; // Viewing private key of the recipient
const spendingPrivateKey = "0x..."; // Spending private key of the recipient
const ephemeralPublicKey = "0x..."; // Ephemeral public key from the sender's announcement
const schemeId = VALID_SCHEME_ID.SCHEME_ID_1; // Scheme ID, currently only '1' is supported

// Compute the stealth private key
Expand All @@ -84,14 +87,17 @@ const stealthPrivateKey = computeStealthKey({
### Checking Stealth Address Announcements

```ts
import { checkStealthAddress, VALID_SCHEME_ID } from 'stealth-address-sdk';
import {
checkStealthAddress,
VALID_SCHEME_ID,
} from "@scopelift/stealth-address-sdk";

// Example inputs
const ephemeralPublicKey = '0x...'; // The ephemeral public key from the announcement
const spendingPublicKey = '0x...'; // The user's spending public key
const userStealthAddress = '0x...'; // The user's stealth address
const viewingPrivateKey = '0x...'; // The user's viewing private key
const viewTag = '0x...'; // The view tag from the announcement
const ephemeralPublicKey = "0x..."; // The ephemeral public key from the announcement
const spendingPublicKey = "0x..."; // The user's spending public key
const userStealthAddress = "0x..."; // The user's stealth address
const viewingPrivateKey = "0x..."; // The user's viewing private key
const viewTag = "0x..."; // The view tag from the announcement
const schemeId = VALID_SCHEME_ID.SCHEME_ID_1; // Scheme ID, currently only '1' is supported

// Check if the announcement is intended for the user
Expand All @@ -106,8 +112,8 @@ const isForUser = checkStealthAddress({

console.log(
isForUser
? 'Announcement is for the user'
: 'Announcement is not for the user'
? "Announcement is for the user"
: "Announcement is not for the user"
);
```

Expand All @@ -118,7 +124,7 @@ import {
ERC5564_CONTRACT,
VALID_SCHEME_ID,
createStealthClient,
} from 'stealth-address-sdk';
} from "@scopelift/stealth-address-sdk";

// Example parameters
const chainId = 11155111; // Example chain ID for Sepolia
Expand All @@ -129,7 +135,7 @@ const fromBlock = BigInt(12345678); // Example ERC5564 announcer contract deploy
const stealthClient = createStealthClient({ chainId, rpcUrl: rpcUrl! });

// Use the address of your calling contract if applicable
const caller = '0xYourCallingContractAddress';
const caller = "0xYourCallingContractAddress";

// Your scheme id
const schemeId = BigInt(VALID_SCHEME_ID.SCHEME_ID_1);
Expand All @@ -156,8 +162,8 @@ async function fetchAnnouncementsForUser() {
// Adjust parameters according to your requirements
const userAnnouncements = await stealthClient.getAnnouncementsForUser({
announcements,
spendingPublicKey: '0xUserSpendingPublicKey',
viewingPrivateKey: '0xUserViewingPrivateKey',
spendingPublicKey: "0xUserSpendingPublicKey",
viewingPrivateKey: "0xUserViewingPrivateKey",
});

return userAnnouncements;
Expand Down
Loading