Skip to content

Commit

Permalink
chore(linter): fix file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Oct 24, 2023
1 parent 137b7a3 commit fcd8c39
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 32 deletions.
4 changes: 2 additions & 2 deletions packages/taco/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const baseConfig = require('../../.eslintrc.js')
const baseConfig = require('../../.eslintrc.js');

module.exports = {
...baseConfig,
}
};
14 changes: 7 additions & 7 deletions packages/taco/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ $ yarn add @nucypher/taco [email protected]
### Encrypt your data

```typescript
import {initialize, encrypt, conditions, domains} from '@nucypher/taco';
import {ethers} from "ethers";
import { conditions, domains, encrypt, initialize } from '@nucypher/taco';
import { ethers } from 'ethers';

// We have to initialize the TACo library first
await initialize();
Expand All @@ -27,23 +27,23 @@ const ownsNFT = new conditions.predefined.ERC721Ownership({
chain: 5,
});

const message = "my secret message";
const message = 'my secret message';

const messageKit = await encrypt(
web3Provider,
domains.TESTNET,
message,
ownsNFT,
ritualId,
web3Provider.getSigner()
web3Provider.getSigner(),
);
```

### Decrypt your data

```typescript
import {initialize, decrypt, domains, getPorterUri} from '@nucypher/taco';
import {ethers} from "ethers";
import { decrypt, domains, getPorterUri, initialize } from '@nucypher/taco';
import { ethers } from 'ethers';

// We have to initialize the TACo library first
await initialize();
Expand All @@ -55,6 +55,6 @@ const decryptedMessage = await decrypt(
domains.TESTNET,
messageKit,
getPorterUri(domains.TESTNET),
web3Provider.getSigner()
web3Provider.getSigner(),
);
```
6 changes: 4 additions & 2 deletions packages/taco/examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `examples/taco`

These examples are not tested, but are typechecked with `pnpm type-check` instead.
These examples are not tested, but are typechecked with `pnpm type-check`
instead.

Some of these examples are used in the documentation. Others, are provided as an API reference.
Some of these examples are used in the documentation. Others, are provided as an
API reference.
6 changes: 5 additions & 1 deletion packages/taco/test/dkg-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ describe('DkgCoordinatorAgent', () => {
it('fetches transcripts from the coordinator', async () => {
const provider = fakeProvider();
const getRitualSpy = mockGetRitual();
const ritual = await DkgCoordinatorAgent.getRitual(provider, domains.TEST_DOMAIN, fakeRitualId);
const ritual = await DkgCoordinatorAgent.getRitual(
provider,
domains.TEST_DOMAIN,
fakeRitualId,
);
expect(ritual).toBeDefined();
expect(getRitualSpy).toHaveBeenCalled();
});
Expand Down
37 changes: 19 additions & 18 deletions packages/taco/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import {
zip,
} from '@nucypher/shared';
import {
TEST_CHAIN_ID,
TEST_CONTRACT_ADDR,
fakeDkgFlow,
fakeSigner,
fakeTDecFlow,
TEST_CHAIN_ID,
TEST_CONTRACT_ADDR,
} from '@nucypher/test-utils';
import { SpyInstance, vi } from 'vitest';

Expand Down Expand Up @@ -102,8 +102,7 @@ export const fakeDkgTDecFlowE2E: (
};
};

export const fakeCoordinatorRitual = async (
): Promise<CoordinatorRitual> => {
export const fakeCoordinatorRitual = async (): Promise<CoordinatorRitual> => {
const ritual = await fakeDkgTDecFlowE2E();
const dkgPkBytes = ritual.dkg.publicKey().toBytes();
return {
Expand All @@ -117,14 +116,15 @@ export const fakeCoordinatorRitual = async (
publicKey: {
word0: toHexString(dkgPkBytes.slice(0, 32)),
word1: toHexString(dkgPkBytes.slice(32, 48)),
} as [string, string] & { // Casting to satisfy the type checker
} as [string, string] & {
// Casting to satisfy the type checker
word0: string;
word1: string;
},
endTimestamp: 0,
authority: "0x0",
authority: '0x0',
threshold: ritual.threshold,
accessController: "0x0",
accessController: '0x0',
};
};

Expand Down Expand Up @@ -176,13 +176,9 @@ export const fakeDkgRitual = (ritual: {
};

export const mockGetRitual = (): SpyInstance => {
return vi
.spyOn(DkgCoordinatorAgent, 'getRitual')
.mockImplementation(
() => {
return Promise.resolve(fakeCoordinatorRitual());
},
);
return vi.spyOn(DkgCoordinatorAgent, 'getRitual').mockImplementation(() => {
return Promise.resolve(fakeCoordinatorRitual());
});
};

export const mockGetFinalizedRitual = (dkgRitual: DkgRitual): SpyInstance => {
Expand Down Expand Up @@ -267,13 +263,18 @@ export const testFunctionAbi: FunctionAbiProps = {
],
};

export const fakeConditionExpr = () => {
const condition = new ERC721Balance({
export const fakeCondition = () =>
new ERC721Balance({
chain: TEST_CHAIN_ID,
contractAddress: TEST_CONTRACT_ADDR,
returnValueTest: {
index: 0,
comparator: '>=',
value: 0,
},
});
return new ConditionExpression(condition);
};

export const fakeConditionExpr = () => new ConditionExpression(fakeCondition());

export const mockGetParticipants = (
participants: DkgParticipant[],
Expand Down
2 changes: 1 addition & 1 deletion packages/taco/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"extends": "./tsconfig.es.json",
"compilerOptions": {
"outDir": "dist/cjs",
"module": "CommonJS",
"module": "CommonJS"
}
}
2 changes: 1 addition & 1 deletion packages/taco/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": ["src", "test", "examples"],
"compilerOptions": {
"esModuleInterop": true,
"skipLibCheck": true,
"skipLibCheck": true
},
"references": [
{
Expand Down

0 comments on commit fcd8c39

Please sign in to comment.