Skip to content

Commit

Permalink
Merge pull request #24 from labscommunity/feat/add-sync-state
Browse files Browse the repository at this point in the history
feat: Add sync state from remote url
  • Loading branch information
pawanpaudel93 authored Mar 11, 2024
2 parents 960f610 + fc7d70e commit fb9b5ae
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-cooks-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocol.land/sync': patch
---

feat: Add sync state
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"arseeding-js": "^0.0.30",
"arweave": "^1.14.4",
"dotenv": "^16.4.1",
"everpay": "^1.2.0",
"everpay": "^1.2.2",
"jszip": "^3.10.1",
"uuid": "^9.0.1",
"warp-contracts": "^1.4.33"
Expand Down
42 changes: 21 additions & 21 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/lib/arseeding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import { Tag } from 'arweave/node/lib/transaction';
import { getWallet, initArweave } from './common';
import Everpay, { ChainType } from 'everpay';

// Override original console log to disable everpay js from logging Arweave jwk
const originalLog = console.log;
console.log = () => {};

const newEverpayByRSA = (arJWK: any, arAddress: string): Everpay => {
const everpay = new Everpay({
account: arAddress,
Expand Down Expand Up @@ -85,7 +81,5 @@ export async function arseedingUpload(zipBuffer: Buffer, tags: Tag[]) {
throw new Error(
`[ arseeding ] Posting repo with ArSeeding failed. ${error}`
);
} finally {
console.log = originalLog;
}
}
4 changes: 4 additions & 0 deletions src/lib/warpHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const contract = getWarp().contract(contractTxId).connect(jwk);
export async function getRepos() {
const address = await getAddress();

await contract
.syncState('https://pl-cache.saikranthi.dev/contract')
.catch(() => {});

// let warp throw error if it can't retrieve the repositories
const response = await contract.viewState({
function: 'getRepositoriesByOwner',
Expand Down

0 comments on commit fb9b5ae

Please sign in to comment.