@graphprotocol/hypergraph 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/hypergraph",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "SDK for building performant, type-safe, local-first dapps on top of The Graph ecosystem knowledge graphs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -185,13 +185,18 @@ export class TypesyncSchemaStreamBuilder extends Effect.Service<TypesyncSchemaSt
185
185
  yield* kv.set(MAPPING_FILE_PATH_STORAGE_KEY, mappingFilePath.value);
186
186
  }
187
187
 
188
- return currentSchemaStream(schemaFilePath, mappingFilePath).pipe(
189
- Stream.concat(watchSchemaStream(schemaFilePath, mappingFilePath)),
190
- Stream.map((stream) => {
191
- const jsonData = JSON.stringify(stream);
192
- const sseData = `data: ${jsonData}\n\n`;
193
- return encoder.encode(sseData);
194
- }),
188
+ return Stream.concat(
189
+ // This is a workaround because the browser doesn't send a message until the second message is sent.
190
+ // We are sending an empty message, because then the actual first message will be the real second message and the browsers receives it.
191
+ Stream.succeed(encoder.encode('data: {"types":[]}\n\n')),
192
+ currentSchemaStream(schemaFilePath, mappingFilePath).pipe(
193
+ Stream.concat(watchSchemaStream(schemaFilePath, mappingFilePath)),
194
+ Stream.map((stream) => {
195
+ const jsonData = JSON.stringify(stream);
196
+ const sseData = `data: ${jsonData}\n\n`;
197
+ return encoder.encode(sseData);
198
+ }),
199
+ ),
195
200
  );
196
201
  });
197
202
 
@@ -137,6 +137,7 @@ const getAndUpdateSmartAccount = async (
137
137
  console.log('smartAccountWalletClient', smartAccountWalletClient);
138
138
  console.log('address', smartAccountWalletClient.account.address);
139
139
  console.log('is deployed', await isSmartAccountDeployed(smartAccountWalletClient));
140
+ await new Promise((resolve) => setTimeout(resolve, 250)); // trying to slow down since Privy seems to have a race condition
140
141
  // This will prompt the user to sign a user operation to update the smart account
141
142
  if (await smartAccountNeedsUpdate(smartAccountWalletClient, chain, rpcUrl)) {
142
143
  console.log('updating smart account');
@@ -145,6 +146,8 @@ const getAndUpdateSmartAccount = async (
145
146
  // Create the client again to ensure we have the 7579 config now
146
147
  return getSmartAccountWalletClient(smartAccountParams);
147
148
  }
149
+ await new Promise((resolve) => setTimeout(resolve, 250)); // trying to slow down since Privy seems to have a race condition
150
+ console.log('leaving getAndUpdateSmartAccount');
148
151
  return smartAccountWalletClient;
149
152
  };
150
153
 
@@ -157,10 +157,10 @@ export type Action = {
157
157
  // We re-export these functions to allow creating sessions with policies for
158
158
  // additional actions without needing the Rhinestone module SDK.
159
159
  export {
160
- getSudoPolicy,
161
- getUniversalActionPolicy,
162
160
  getSpendingLimitsPolicy,
161
+ getSudoPolicy,
163
162
  getTimeFramePolicy,
163
+ getUniversalActionPolicy,
164
164
  getUsageLimitPolicy,
165
165
  getValueLimitPolicy,
166
166
  };
@@ -440,16 +440,20 @@ export const smartAccountNeedsUpdate = async (
440
440
  chain: Chain,
441
441
  rpcUrl: string,
442
442
  ): Promise<boolean> => {
443
+ console.log('entering smartAccountNeedsUpdate');
443
444
  if (chain.id === GEO_TESTNET.id) {
444
445
  // We don't have the smart sessions module deployed on testnet yet, so we need to use the legacy smart account wallet client
445
446
  // TODO: remove this once we have the smart sessions module deployed on testnet
447
+ console.log('leaving smartAccountNeedsUpdate A');
446
448
  return false;
447
449
  }
448
450
  // If we haven't deployed the smart account, we would always deploy an updated version
449
451
  if (!(await isSmartAccountDeployed(smartAccountClient))) {
452
+ console.log('leaving smartAccountNeedsUpdate B');
450
453
  return false;
451
454
  }
452
455
  const updateStatus = await legacySmartAccountUpdateStatus(smartAccountClient, chain, rpcUrl);
456
+ console.log('leaving smartAccountNeedsUpdate C');
453
457
  return !updateStatus.has7579Module || !updateStatus.hasSmartSessionsValidator || !updateStatus.hasOwnableValidator;
454
458
  };
455
459