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

Create metadata claims package / remove from contractkit #340

Merged
merged 22 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions .changeset/hot-pugs-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
'@celo/contractkit': major
---

Removes all exports under the lib/identity folder. These have been move to a new @celo/metadata-claims package and should be imported from there.

Note that folder structure is also flattened slightly. so replace `@celo/contractkit/lib/identity/claims/` with `@celo/metadata-claims/lib/`

example

```diff
- import { createAccountClaim } from '@celo/contractkit/lib/identity/claims/account'
+ import { createAccountClaim } from '@celo/metadata-claims/lib/account'
```

```diff
- import { ContractKit, IdentityMetadataWrapper, newKitFromWeb3 } from '@celo/contractkit'
- import { ClaimTypes } from '@celo/contractkit/lib/identity'
+ import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
+ import { ClaimTypes, IdentityMetadataWrapper } from '@celo/metadata-claims'

```

Note that Contractkit is Not a dependency. Instead when using `IdentityMetadataWrapper` you should make an object that satisfis the `AccountMetadataSignerGetters` type

```typescript
import { AccountMetadataSignerGetters } from '@celo/metadata-claims/lib/types';

```
using viem it would be like

```typescript
const accountsMetaDataSignerGetters: AccountMetadataSignerGetters = {
isAccount: async (address: string) => accounts.read.isAccount([address as Address]),
getValidatorSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
getVoteSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
getAttestationSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
}
```
26 changes: 26 additions & 0 deletions .changeset/thirty-pugs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
'@celo/metadata-claims': major
---

Introducing @celo/metadata-claims These are a series of functions extracted from @celo/contractkit since they didnt strictly need depend on contractkit itsefl. Developers can now use IdentityMetadataWrapper with any js rpc library like ethers or viem or web3js without being forced to import ContractKit.


Instead when using `IdentityMetadataWrapper` you should make an object that satisfis the `AccountMetadataSignerGetters` type

```typescript
import { AccountMetadataSignerGetters } from '@celo/metadata-claims/lib/types';

```
using viem it would be like

```typescript
const accountsMetaDataSignerGetters: AccountMetadataSignerGetters = {
isAccount: async (address: string) => accounts.read.isAccount([address as Address]),
getValidatorSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
getVoteSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
getAttestationSigner: async (address: string) =>
accounts.read.getValidatorSigner([address as Address]),
}
```
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ package.json-e
# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
transactions.json
packages/sdk/metadata-claims/lib

This file was deleted.

Loading
Loading