Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/deploy-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:

jobs:
deploy:
runs-on: ubuntu-latest
runs-on:
group: Azure_runners
labels: [ self-hosted, Linux, X64 ]
Comment on lines +8 to +10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need runner connected to iexec infra to make deployment

strategy:
matrix:
include:
Expand Down
42 changes: 17 additions & 25 deletions packages/sdk/src/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,32 +263,24 @@ export const createZipFromObject = (obj: unknown): Promise<Uint8Array> => {
);
};

export const reverseSafeSchema = function (
export const reverseSafeSchema = (
schema?: Array<Record<'id', string>>
) {
if (!schema) {
return {};
}
return schema.reduce((propsAndTypes, { id: propPathColonType }) => {
// { id: 'nested.something:string' }
const [key, value] = propPathColonType.split(':');
// key = 'nested.something'
// value = 'string'
if (key.includes('.')) {
const firstKey = key.split('.')[0];
// firstKey = 'nested'
const restOfKey = key.split('.').slice(1).join('.');
// restOfKey = 'something'
const withValue = `${restOfKey}:${value}`;
// withValue = 'something:string'
propsAndTypes[firstKey] = reverseSafeSchema([
{
id: withValue,
},
]);
} else {
propsAndTypes[key] = value;
): Record<string, any> => {
if (!schema) return {};

return schema.reduce((acc, { id }) => {
const [path, type] = id.split(':');
const keys = path.split('.');

let current = acc;
for (let i = 0; i < keys.length - 1; i++) {
current[keys[i]] ??= {};
current = current[keys[i]];
}
return propsAndTypes;

const finalKey = keys[keys.length - 1];
current[finalKey] = type;

return acc;
}, {});
};
3 changes: 2 additions & 1 deletion packages/sdk/tests/e2e/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { describe, it, expect } from '@jest/globals';
import { IExecDataProtector } from '../../src/index.js';
import { getTestConfig } from '../test-utils.js';

describe('When instantiating SDK without a signer', () => {
describe('When calling a read method', () => {
it('should work as expected', async () => {
// --- GIVEN
const dataProtector = new IExecDataProtector();
const dataProtector = new IExecDataProtector(...getTestConfig());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was connected to the production subgraph, causing the test to fail.


// --- WHEN/THEN
await expect(
Expand Down
Loading
Loading