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

Remove default chain id and references to ibex #118

Merged
merged 4 commits into from
Dec 5, 2022
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
2 changes: 1 addition & 1 deletion examples/react-craco/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function App() {

const config = {
// Public Porter endpoint on Ibex network
porterUri: 'https://porter-ibex.nucypher.community',
porterUri: 'https://porter-tapir.nucypher.community',
};

const makeAlice = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-webpack-5-experiments/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function App() {

const config = {
// Public Porter endpoint on Ibex network
porterUri: 'https://porter-ibex.nucypher.community',
porterUri: 'https://porter-tapir.nucypher.community',
}

const makeAlice = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-5-experiments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const txtEncoder = new TextEncoder();

const config = {
// Public Porter endpoint on Ibex network
porterUri: 'https://porter-ibex.nucypher.community',
porterUri: 'https://porter-tapir.nucypher.community',
}

const makeAlice = (provider) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ethers } from 'ethers';

const config = {
// Public Porter endpoint on Ibex network
porterUri: 'https://porter-ibex.nucypher.community',
porterUri: 'https://porter-tapir.nucypher.community',
}

const makeAlice = (provider) => {
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CONFIGS: { readonly [key in ChainId]: Configuration } = {
porterUri: 'https://porter.nucypher.community',
},
[ChainId.MUMBAI]: {
porterUri: 'https://porter-ibex.nucypher.community',
porterUri: 'https://porter-tapir.nucypher.community',
},
};

Expand Down
2 changes: 0 additions & 2 deletions src/policies/conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ class EvmCondition extends Condition {

class ERC721Ownership extends EvmCondition {
readonly defaults = {
chain: 5, // TODO: make this value configurable
theref marked this conversation as resolved.
Show resolved Hide resolved
method: 'ownerOf',
parameters: [],
standardContractType: 'ERC721',
Expand All @@ -312,7 +311,6 @@ class ERC721Ownership extends EvmCondition {

class ERC721Balance extends EvmCondition {
readonly defaults = {
chain: 5, // TODO: make this value configurable
method: 'balanceOf',
parameters: [':userAddress'],
standardContractType: 'ERC721',
Expand Down
7 changes: 7 additions & 0 deletions test/integration/conditions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ describe('conditions schema', () => {
expect(result.error).toEqual(undefined);
expect(result.value.chain).toEqual(5);
});

it('should validate chain id', async () => {
result = condition.validate({ chain: 10 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should contain all variable declarations such as result to the it(...) closure where they are being used. This prevents state-leaking across different tests.

expect(result.error?.message).toEqual(
'"chain" must be one of [1, 5, 137, 80001]'
);
});
});

describe('condition set', () => {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/enrico.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ describe('enrico', () => {

const ownsBufficornNFT = new Conditions.ERC721Ownership({
contractAddress: '0x1e988ba4692e52Bc50b375bcC8585b95c48AaD77',
chain: 5,
parameters: [3591],
});

const ownsNonsenseNFT = new Conditions.ERC721Ownership({
contractAddress: '0x1e988ba4692e52Bc50b375bcC8585b95c48AaD77',
chain: 5,
parameters: [6969],
});

Expand Down
2 changes: 2 additions & 0 deletions test/integration/pre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ describe('proxy reencryption', () => {

const genuineUndead = new Conditions.ERC721Ownership({
contractAddress: '0x209e639a0EC166Ac7a1A4bA41968fa967dB30221',
chain: 1,
});
const gnomePals = new Conditions.ERC721Ownership({
contractAddress: '0x5dB11d7356aa4C0E85Aa5b255eC2B5F81De6d4dA',
chain: 1,
});
const conditions = new ConditionSet([
genuineUndead,
Expand Down
1 change: 1 addition & 0 deletions test/unit/strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ describe('Deployed Strategy', () => {
const ownsNFT = new Conditions.ERC721Ownership({
contractAddress: '0x1e988ba4692e52Bc50b375bcC8585b95c48AaD77',
parameters: [3591],
chain: 5,
});

const plaintext = 'this is a secret';
Expand Down