From 383e41032827883ebfe76e34cf7385f6fe270747 Mon Sep 17 00:00:00 2001 From: lbeder Date: Fri, 5 Jul 2024 17:41:40 -0400 Subject: [PATCH 1/2] Delegated Attestations: if nonce isn't provided, try retrieving it onchain --- README.md | 90 ++++++++++++++++++++++++++++------ dist/eas.js | 2 +- dist/eas.js.map | 2 +- dist/offchain/delegated.d.ts | 4 +- dist/offchain/delegated.js | 12 +++-- dist/offchain/delegated.js.map | 2 +- package.json | 2 +- src/eas.ts | 13 +++-- src/offchain/delegated.ts | 16 ++++-- test/test/eas.ts | 4 -- test/test/helpers/eas.ts | 6 +-- 11 files changed, 113 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 95bc371..6343be1 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,14 @@ This repository contains the Ethereum Attestation Service SDK, used to interact - [Getting an Attestation](#getting-an-attestation) - [Creating Onchain Attestations](#creating-onchain-attestations) - [Example: Creating Onchain Attestations](#example-creating-onchain-attestations) +- [Revoking Onchain Attestations](#revoking-onchain-attestations) + - [Example: Revoking Onchain Attestations](#example-revoking-onchain-attestations) - [Creating Offchain Attestations](#creating-offchain-attestations) - [Example: Creating Offchain Attestations](#example-creating-offchain-attestations) - [Creating Delegated Onchain Attestations](#creating-delegated-onchain-attestations) - [Example: Creating Delegated Onchain Attestations](#example-creating-delegated-onchain-attestations) -- [Revoking Onchain Attestations](#revoking-onchain-attestations) - - [Example: Revoking Onchain Attestations](#example-revoking-onchain-attestations) +- [Revoking Delegated Onchain Attestations](#revoking-delegated-onchain-attestations) + - [Example: Revoking Delegated Onchain Attestations](#example-revoking-delegated-onchain-attestations) - [Creating Timestamps](#creating-timestamps) - [Revoking Offchain Attestations](#revoking-offchain-attestations) - [Verifying an Offchain Attestation](#verifying-an-offchain-attestation) @@ -156,7 +158,7 @@ const encodedData = schemaEncoder.encodeData([ const schemaUID = '0xb16fa048b0d597f5a821747eba64efa4762ee5143e9a80600d0005386edfc995'; -const tx = await eas.attest({ +const transaction = await eas.attest({ schema: schemaUID, data: { recipient: '0xFD50b031E778fAb33DfD2Fc3Ca66a1EeF0652165', @@ -166,11 +168,32 @@ const tx = await eas.attest({ } }); -const newAttestationUID = await tx.wait(); +const newAttestationUID = await transaction.wait(); console.log('New attestation UID:', newAttestationUID); -console.log('Transaction receipt:', tx.receipt); +console.log('Transaction receipt:', transaction.receipt); +``` + +### Revoking Onchain Attestations + +The `revoke` function allows you to revoke an on-chain attestation. This function takes an object with the following properties: + +- `schema`: The UID of the schema for which the attestation is being revoke. +- `data`: An object containing the following properties: + - `uid`: The UID of the attestation to revoke. + - `value`: (Optional) The ETH value that is being sent with the revocation. + +### Example: Revoking Onchain Attestations + +```javascript +const transaction = await eas.revoke({ + schema: '0x85500e806cf1e74844d51a20a6d893fe1ed6f6b0738b50e43d774827d08eca61', + data: { uid: '0x6776de8122c352b4d671003e58ca112aedb99f34c629a1d1fe3b332504e2943a' } +}); + +// Optional: Wait for transaction to be validated +await transaction.wait(); ``` ### Creating Offchain Attestations @@ -233,7 +256,7 @@ The `attestByDelegation` function allows you to create a delegated on-chain atte - `refUID`: (Optional) The UID of a referenced attestation. Use `ZERO_BYTES32` if there is no reference. - `data`: The encoded data for the attestation, which should be generated using the `SchemaEncoder` class. - `value`: (Optional) The ETH value that is being sent with the attestation. -- `attester`: The address of the tester. +- `attester`: The address of the attester. - `signature`: A EIP712 typed-signature (`r`, `s`, and `v`) over the message (using the `signDelegatedAttestation` function). - `deadline`: A Unix representing the expiration time of the signature. @@ -262,6 +285,7 @@ const encodedData = schemaEncoder.encodeData([ const signer = new ethers.Wallet(privateKey, provider); +// Please note that if nonce isn't provided explicitly, we will try retrieving it onchain. const response = await delegated.signDelegatedAttestation( { schema: '0xb16fa048b0d597f5a821747eba64efa4762ee5143e9a80600d0005386edfc995', @@ -270,14 +294,13 @@ const response = await delegated.signDelegatedAttestation( revocable: true, refUID: '0x0000000000000000000000000000000000000000000000000000000000000000', data: encodedData, - nonce: await eas.getNonce(await signer.getAddress()), deadline: 0n, // Unix timestamp of when signature expires (0 for no expiration) value: 0n }, signer ); -const tx = await eas.attestByDelegation({ +const transaction = await eas.attestByDelegation({ schema: '0xb16fa048b0d597f5a821747eba64efa4762ee5143e9a80600d0005386edfc995', data: { recipient: '0xFD50b031E778fAb33DfD2Fc3Ca66a1EeF0652165', @@ -291,30 +314,67 @@ const tx = await eas.attestByDelegation({ deadline: 0n // Unix timestamp of when signature expires (0 for no expiration) }); -const newAttestationUID = await tx.wait(); +const newAttestationUID = await transaction.wait(); console.log('New attestation UID:', newAttestationUID); -console.log('Transaction receipt:', tx.receipt); +console.log('Transaction receipt:', transaction.receipt); ``` -### Revoking Onchain Attestations +### Revoking Delegated Onchain Attestations -The `revoke` function allows you to revoke an on-chain attestation. This function takes an object with the following properties: +The `revokeByDelegation` function allows you to create a delegated on-chain revocation for a specific attestation. This function takes an object with the following properties: - `schema`: The UID of the schema for which the attestation is being revoke. - `data`: An object containing the following properties: - `uid`: The UID of the attestation to revoke. - `value`: (Optional) The ETH value that is being sent with the revocation. +- `revoker`: The address of the revoker. +- `signature`: A EIP712 typed-signature (`r`, `s`, and `v`) over the message (using the `signDelegatedRevocation` function). +- `deadline`: A Unix representing the expiration time of the signature. -### Example: Revoking Onchain Attestations +The function returns a `Promise` that resolves to the UID of the newly created attestation. + +#### Example: Revoking Delegated Onchain Attestations ```javascript +import { EAS, SchemaEncoder } from '@ethereum-attestation-service/eas-sdk'; + +const eas = new EAS(EASContractAddress); + +// Use a different account to send and pay for the attestation. +eas.connect(sender); + +const delegated = await eas.getDelegated(); + +const signer = new ethers.Wallet(privateKey, provider); + const transaction = await eas.revoke({ schema: '0x85500e806cf1e74844d51a20a6d893fe1ed6f6b0738b50e43d774827d08eca61', data: { uid: '0x6776de8122c352b4d671003e58ca112aedb99f34c629a1d1fe3b332504e2943a' } }); +// Please note that if nonce isn't provided explicitly, we will try retrieving it onchain. +const response = await delegated.signDelegatedRevocation( + { + schema: '0x85500e806cf1e74844d51a20a6d893fe1ed6f6b0738b50e43d774827d08eca61', + uid: '0x6776de8122c352b4d671003e58ca112aedb99f34c629a1d1fe3b332504e2943a', + deadline: 0n, // Unix timestamp of when signature expires (0 for no expiration) + value: 0n + }, + signer +); + +const transaction = await eas.revokeByDelegation({ + schema: '0xb16fa048b0d597f5a821747eba64efa4762ee5143e9a80600d0005386edfc995', + data: { + uid: '0x6776de8122c352b4d671003e58ca112aedb99f34c629a1d1fe3b332504e2943a', + }, + signature: response.signature, + revoker: await signer.getAddress(), + deadline: 0n // Unix timestamp of when signature expires (0 for no expiration) +}); + // Optional: Wait for transaction to be validated await transaction.wait(); ``` @@ -610,7 +670,7 @@ const encodedData = schemaEncoder.encodeData([{ name: 'dataRoot', value: fullTre // Private data schema const schemaUID = '0x20351f973fdec1478924c89dfa533d8f872defa108d9c3c6512267d7e7e5dbc2'; -const tx = await eas.attest({ +const transaction = await eas.attest({ schema: schemaUID, data: { recipient: '0xFD50b031E778fAb33DfD2Fc3Ca66a1EeF0652165', @@ -620,7 +680,7 @@ const tx = await eas.attest({ } }); -const newAttestationUID = await tx.wait(); +const newAttestationUID = await transaction.wait(); console.log('New attestation UID:', newAttestationUID); diff --git a/dist/eas.js b/dist/eas.js index 0c24536..b0c21b2 100644 --- a/dist/eas.js +++ b/dist/eas.js @@ -420,7 +420,7 @@ class EAS extends transaction_1.Base { address: await this.contract.getAddress(), domainSeparator: await this.getDomainSeparator(), chainId: await this.getChainId() - }); + }, this); return this.delegated; } // Sets the offchain attestations helper diff --git a/dist/eas.js.map b/dist/eas.js.map index a355fe3..25f1fb6 100644 --- a/dist/eas.js.map +++ b/dist/eas.js.map @@ -1 +1 @@ -{"version":3,"file":"eas.js","sourceRoot":"","sources":["../src/eas.ts"],"names":[],"mappings":";;;;AAAA,+EAA6G;AAE7G,4DAA4B;AAE5B,kDAAgG;AAChG,8CAAiD;AACjD,yCAA6E;AAC7E,uCAcmB;AACnB,+CAAqE;AACrE,mCAMiB;AAEjB,MAAM,cAAc,GAAG,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C,UAAU,EAAE;YAChC,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;SACjC,EACD,qCAA0B,CAAC,QAAQ,EACnC,IAAI,CACL,CAAC;QAEF,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,gBAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,gBAAM,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACjD,CAAC;CACF;AAxmBD,kBAwmBC"} \ No newline at end of file diff --git a/dist/offchain/delegated.d.ts b/dist/offchain/delegated.d.ts index 0724452..8de12fc 100644 --- a/dist/offchain/delegated.d.ts +++ b/dist/offchain/delegated.d.ts @@ -1,3 +1,4 @@ +import { EAS } from '../eas'; import { EIP712MessageTypes, EIP712Params, EIP712Response, TypeDataSigner, TypedDataHandler } from './typed-data-handler'; export { EIP712MessageTypes, EIP712TypedData, EIP712Request, EIP712Response, Signature } from './typed-data-handler'; declare enum DelegatedAttestationVersion { @@ -31,7 +32,8 @@ export declare class Delegated extends TypedDataHandler { readonly version: DelegatedAttestationVersion; private readonly attestType; private readonly revokeType; - constructor(config: DelegatedConfig); + private readonly eas; + constructor(config: DelegatedConfig, eas: EAS); signDelegatedAttestation(params: EIP712AttestationParams, signer: TypeDataSigner): Promise>; verifyDelegatedAttestationSignature(attester: string, response: EIP712Response): boolean; signDelegatedRevocation(params: EIP712RevocationParams, signer: TypeDataSigner): Promise>; diff --git a/dist/offchain/delegated.js b/dist/offchain/delegated.js index be725e3..1d0fb53 100644 --- a/dist/offchain/delegated.js +++ b/dist/offchain/delegated.js @@ -108,7 +108,8 @@ class Delegated extends typed_data_handler_1.TypedDataHandler { version; attestType; revokeType; - constructor(config) { + eas; + constructor(config, eas) { let { version } = config; if (!version) { const { domainSeparator } = config; @@ -148,15 +149,18 @@ class Delegated extends typed_data_handler_1.TypedDataHandler { } this.attestType = DELEGATED_ATTESTATION_TYPES[this.version]; this.revokeType = DELEGATED_REVOCATION_TYPES[this.version]; + this.eas = eas; } async signDelegatedAttestation(params, signer) { let effectiveParams = { attester: await signer.getAddress(), ...params }; + // If nonce wasn't provided, try retrieving it onchain. + effectiveParams.nonce ??= await this.eas.contract.getNonce(effectiveParams.attester); switch (this.version) { case DelegatedAttestationVersion.Legacy: - effectiveParams = (0, omit_1.default)(params, ['value', 'deadline']); + effectiveParams = (0, omit_1.default)(effectiveParams, ['value', 'deadline']); break; } return this.signTypedDataRequest(effectiveParams, { @@ -177,9 +181,11 @@ class Delegated extends typed_data_handler_1.TypedDataHandler { revoker: await signer.getAddress(), ...params }; + // If nonce wasn't provided, try retrieving it onchain. + effectiveParams.nonce ??= await this.eas.contract.getNonce(effectiveParams.revoker); switch (this.version) { case DelegatedAttestationVersion.Legacy: - effectiveParams = (0, omit_1.default)(params, ['value', 'deadline']); + effectiveParams = (0, omit_1.default)(effectiveParams, ['value', 'deadline']); break; } return this.signTypedDataRequest(effectiveParams, { diff --git a/dist/offchain/delegated.js.map b/dist/offchain/delegated.js.map index c08a6aa..18ce4fc 100644 --- a/dist/offchain/delegated.js.map +++ b/dist/offchain/delegated.js.map @@ -1 +1 @@ -{"version":3,"file":"delegated.js","sourceRoot":"","sources":["../../src/offchain/delegated.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAC/B,4DAA4B;AAC5B,6DAO8B;AAC9B,yCAA0D;AAI1D,IAAK,2BAIJ;AAJD,WAAK,2BAA2B;IAC9B,iFAAU,CAAA;IACV,qFAAY,CAAA;IACZ,qFAAY,CAAA;AACd,CAAC,EAJI,2BAA2B,KAA3B,2BAA2B,QAI/B;AAMD,MAAM,2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AAK,2BAA2B,CAAC,MAAM;gBACrC,eAAe,GAAG,IAAA,cAAI,EAAC,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAA+B,CAAC;gBAEpF,MAAM;QACV,CAAC;QAED,OAAO,IAAI,CAAC,oBAAoB,CAC9B,eAAe,EACf;YACE,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;YACxC,OAAO,EAAE,eAAe;YACxB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;SAC7B,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAEM,kCAAkC,CACvC,OAAe,EACf,QAAoE;QAEpE,OAAO,IAAI,CAAC,+BAA+B,CACzC,OAAO,EACP,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,EAC1D;YACE,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;YACxC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;SAC7B,CACF,CAAC;IACJ,CAAC;CACF;AAzID,8BAyIC"} \ No newline at end of file +{"version":3,"file":"delegated.js","sourceRoot":"","sources":["../../src/offchain/delegated.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAC/B,4DAA4B;AAE5B,6DAO8B;AAC9B,yCAA0D;AAI1D,IAAK,2BAIJ;AAJD,WAAK,2BAA2B;IAC9B,iFAAU,CAAA;IACV,qFAAY,CAAA;IACZ,qFAAY,CAAA;AACd,CAAC,EAJI,2BAA2B,KAA3B,2BAA2B,QAI/B;AAMD,MAAM,2BAA2B,GAAkE;IACjG,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE;QACpC,cAAc,EACZ,uHAAuH;QACzH,WAAW,EAAE,QAAQ;QACrB,KAAK,EAAE;YACL,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,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,KAAK,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAEpF,QAAQ,IAAI,CAAC,OAAO,EAAE,CAAC;YACrB,KAAK,2BAA2B,CAAC,MAAM;gBACrC,eAAe,GAAG,IAAA,cAAI,EAAC,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAA+B,CAAC;gBAE7F,MAAM;QACV,CAAC;QAED,OAAO,IAAI,CAAC,oBAAoB,CAC9B,eAAe,EACf;YACE,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;YACxC,OAAO,EAAE,eAAe;YACxB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;SAC7B,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAEM,kCAAkC,CACvC,OAAe,EACf,QAAoE;QAEpE,OAAO,IAAI,CAAC,+BAA+B,CACzC,OAAO,EACP,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,EAC1D;YACE,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;YACxC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;SAC7B,CACF,CAAC;IACJ,CAAC;CACF;AAlJD,8BAkJC"} \ No newline at end of file diff --git a/package.json b/package.json index 16e5963..af3f24c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ethereum-attestation-service/eas-sdk", - "version": "2.3.0", + "version": "2.4.0", "description": "Ethereum Attestation Service - TypeScript/JavaScript SDK", "repository": "git@github.com:ethereum-attestation-service/eas-sdk.git", "author": "Leonid Beder ", diff --git a/src/eas.ts b/src/eas.ts index e4d397c..b59365b 100644 --- a/src/eas.ts +++ b/src/eas.ts @@ -633,11 +633,14 @@ export class EAS extends Base { // Sets the delegated attestations helper private async setDelegated(): Promise { - this.delegated = new Delegated({ - address: await this.contract.getAddress(), - domainSeparator: await this.getDomainSeparator(), - chainId: await this.getChainId() - }); + this.delegated = new Delegated( + { + address: await this.contract.getAddress(), + domainSeparator: await this.getDomainSeparator(), + chainId: await this.getChainId() + }, + this + ); return this.delegated; } diff --git a/src/offchain/delegated.ts b/src/offchain/delegated.ts index 9d74526..d04fc65 100644 --- a/src/offchain/delegated.ts +++ b/src/offchain/delegated.ts @@ -1,5 +1,6 @@ import omit from 'lodash/omit'; import semver from 'semver'; +import { EAS } from '../eas'; import { EIP712MessageTypes, EIP712Params, @@ -156,8 +157,9 @@ export class Delegated extends TypedDataHandler { public readonly version: DelegatedAttestationVersion; private readonly attestType: DelegatedAttestationType; private readonly revokeType: DelegatedAttestationType; + private readonly eas: EAS; - constructor(config: DelegatedConfig) { + constructor(config: DelegatedConfig, eas: EAS) { let { version } = config; if (!version) { const { domainSeparator } = config; @@ -204,6 +206,8 @@ export class Delegated extends TypedDataHandler { this.attestType = DELEGATED_ATTESTATION_TYPES[this.version]; this.revokeType = DELEGATED_REVOCATION_TYPES[this.version]; + + this.eas = eas; } public async signDelegatedAttestation( @@ -215,9 +219,12 @@ export class Delegated extends TypedDataHandler { ...params }; + // If nonce wasn't provided, try retrieving it onchain. + effectiveParams.nonce ??= await this.eas.contract.getNonce(effectiveParams.attester); + switch (this.version) { case DelegatedAttestationVersion.Legacy: - effectiveParams = omit(params, ['value', 'deadline']) as EIP712FullAttestationParams; + effectiveParams = omit(effectiveParams, ['value', 'deadline']) as EIP712FullAttestationParams; break; } @@ -257,9 +264,12 @@ export class Delegated extends TypedDataHandler { ...params }; + // If nonce wasn't provided, try retrieving it onchain. + effectiveParams.nonce ??= await this.eas.contract.getNonce(effectiveParams.revoker); + switch (this.version) { case DelegatedAttestationVersion.Legacy: - effectiveParams = omit(params, ['value', 'deadline']) as EIP712FullRevocationParams; + effectiveParams = omit(effectiveParams, ['value', 'deadline']) as EIP712FullRevocationParams; break; } diff --git a/test/test/eas.ts b/test/test/eas.ts index f57a11a..e897f56 100644 --- a/test/test/eas.ts +++ b/test/test/eas.ts @@ -928,7 +928,6 @@ describe('EAS API', () => { refUID: ZERO_BYTES32, data: ZERO_BYTES, value: 0n, - nonce: await eas.getNonce(senderAddress), deadline: NO_EXPIRATION }; @@ -998,7 +997,6 @@ describe('EAS API', () => { schema: schemaId, uid: encodeBytes32String('123'), value: 0n, - nonce: await eas.getNonce(senderAddress), deadline: NO_EXPIRATION }; @@ -1096,7 +1094,6 @@ describe('EAS API', () => { refUID: ZERO_BYTES32, data: ZERO_BYTES, value: 0n, - nonce: await eas.getNonce(senderAddress), deadline: NO_EXPIRATION }; @@ -1167,7 +1164,6 @@ describe('EAS API', () => { schema: schemaId, uid: encodeBytes32String('123'), value: 0n, - nonce: await eas.getNonce(senderAddress), deadline: NO_EXPIRATION }; diff --git a/test/test/helpers/eas.ts b/test/test/helpers/eas.ts index a8449ef..c7a8ec7 100644 --- a/test/test/helpers/eas.ts +++ b/test/test/helpers/eas.ts @@ -101,7 +101,6 @@ export const expectAttestation = async ( refUID, data, value, - nonce: await eas.getNonce(await txSender.getAddress()), deadline }, txSender @@ -388,10 +387,7 @@ export const expectRevocation = async ( case SignatureType.Delegated: { const delegated = await eas.getDelegated(); - const response = await delegated.signDelegatedRevocation( - { schema, uid, value, deadline, nonce: await eas.getNonce(await txSender.getAddress()) }, - txSender - ); + const response = await delegated.signDelegatedRevocation({ schema, uid, value, deadline }, txSender); expect(await delegated.verifyDelegatedRevocationSignature(await txSender.getAddress(), response)).to.be.true; From 4e7178ba5eecf35b35da9a283caca90572f6402d Mon Sep 17 00:00:00 2001 From: lbeder Date: Fri, 5 Jul 2024 22:10:05 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ba8bd..5a8c8b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.4.0 + +- Delegated Attestations: if nonce isn't provided, try retrieving it onchain + ## 2.3.0 - Add utilities to handle private data