-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat: token-gated support for Publication Metadata v3 and Lens API v2 #514
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b7e9a0f
feat: token-gated support for Publication Metadata v3 and Lens API v2
cesarenaldi 325ee9b
Supports recent changes to PublicationMetadata
cesarenaldi 24d2c0e
Amends LensClient integration following GQL breaking changes
cesarenaldi b07bf58
Cleanup generated docs
cesarenaldi c043b1d
Adds changeset
cesarenaldi 2351820
Adds missing peer dep
cesarenaldi 3e47cec
Removes legacy sdk-gated
cesarenaldi 02bb2fa
Fix some issue with node examples repo
cesarenaldi 495913c
Fixes strict issue withe examples/node
cesarenaldi 6db1b61
Disable unfinished test
cesarenaldi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@lens-protocol/client": minor | ||
"@lens-protocol/gated-content": patch | ||
--- | ||
|
||
**feat:** token-gated support for LIP-2 metadata spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"main": "dist/lens-protocol-client-gated.cjs.js", | ||
"module": "dist/lens-protocol-client-gated.esm.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { NodeBundlr } from '@bundlr-network/client'; | ||
import { UnknownObject } from '@lens-protocol/shared-kernel'; | ||
import { Wallet } from 'ethers'; | ||
|
||
export class BundlrUploader { | ||
constructor(private readonly signer: Wallet) {} | ||
|
||
async upload(data: UnknownObject): Promise<string> { | ||
const bundlr = new NodeBundlr( | ||
'https://devnet.bundlr.network', | ||
'matic', | ||
this.signer.privateKey, | ||
{ | ||
providerUrl: 'https://rpc-mumbai.maticvigil.com/', | ||
}, | ||
); | ||
const atomicBalance = await bundlr.getLoadedBalance(); | ||
const balance = bundlr.utils.fromAtomic(atomicBalance); | ||
|
||
// fund bundlr balance if empty | ||
if (balance.eq(0)) { | ||
try { | ||
await bundlr.fund(0.1e18); // 0.1 MUMBAI MATIC | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.warn( | ||
`Cannot fund ${String( | ||
bundlr.address, | ||
)} Bundlr balance. Mumbai ${balance.toString()} MATIC available.`, | ||
); | ||
} | ||
} | ||
|
||
const serialized = JSON.stringify(data); | ||
const tx = await bundlr.upload(serialized, { | ||
tags: [{ name: 'Content-Type', value: 'application/json' }], | ||
}); | ||
|
||
return `https://arweave.net/${tx.id}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import * as GatedEnvironments from '@lens-protocol/gated-content/environments'; | ||
import { invariant } from '@lens-protocol/shared-kernel'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
import { Environment } from '../consts/environments'; | ||
import { Environment } from '../environments'; | ||
|
||
dotenv.config(); | ||
|
||
export const buildTestEnvironment = (): Environment => { | ||
invariant(process.env.TESTING_ENV_URL, 'TESTING_ENV_URL is not defined in .env file'); | ||
|
||
return new Environment('testing', process.env.TESTING_ENV_URL); | ||
return new Environment('testing', process.env.TESTING_ENV_URL, GatedEnvironments.sandbox); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we revert this line?