-
Notifications
You must be signed in to change notification settings - Fork 9
feat: mod/client referrals #152
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
base: main
Are you sure you want to change the base?
Changes from all commits
635c729
076831c
d9c5431
12a98ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@mod-protocol/react": minor | ||
"@mod-protocol/core": minor | ||
--- | ||
|
||
feat: client and mod attribution in transactions |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
"@mods/infura-ipfs-upload": patch | ||
"@mods/chatgpt-shorten": patch | ||
"@mods/zora-nft-minter": patch | ||
"@mods/livepeer-video": patch | ||
"@mods/giphy-picker": patch | ||
"@mods/image-render": patch | ||
"@mods/imgur-upload": patch | ||
"@mods/video-render": patch | ||
"@mods/zora-create": patch | ||
"@mods/nft-minter": patch | ||
"@mods/url-render": patch | ||
"@mods/chatgpt": patch | ||
"@mods/dall-e": patch | ||
"@mod-protocol/core": minor | ||
--- | ||
|
||
fix: deprecate ENS support for `ModManifest` `custodyAddress` field |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,12 +161,13 @@ export type ModElementRef<T> = | |
export type BaseContext = { | ||
user?: { | ||
wallet?: { | ||
address?: string; | ||
address?: `0x${string}`; | ||
}; | ||
farcaster?: { | ||
fid?: string; | ||
}; | ||
}; | ||
clientReferralAddress?: `0x${string}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should have a comment above describing it further; on which chain? EOA required? I think we should also call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add a comment. I'm not too attached to the name, but I do prefer referring to the party implementing Mod as the client since app could be ambiguous |
||
}; | ||
|
||
export type CreationContext = BaseContext & { | ||
|
@@ -933,13 +934,29 @@ export class Renderer { | |
case "SENDETHTRANSACTION": { | ||
const promise = new Promise<void>((resolve) => { | ||
setTimeout(() => { | ||
/* Populate attribution tags */ | ||
const zeroAddress = "0000000000000000000000000000000000000000"; | ||
const modTag = | ||
this.manifest.custodyAddress.startsWith("0x") && | ||
this.manifest.custodyAddress.length === 42 | ||
? this.manifest.custodyAddress.slice(2) | ||
: zeroAddress; | ||
const clientTag = | ||
this.context.clientReferralAddress?.slice(2) || zeroAddress; | ||
let txData = this.replaceInlineContext(action.txData.data || ""); | ||
// Check if data is hex and contains at least a function signature | ||
// 4 hex bytes (8 chars) + '0x' = 10 chars | ||
if (txData.startsWith("0x") && txData.length >= 10) { | ||
txData = txData + modTag + clientTag; | ||
} | ||
|
||
this.onSendEthTransactionAction( | ||
{ | ||
data: { | ||
from: this.replaceInlineContext(action.txData.from), | ||
to: this.replaceInlineContext(action.txData.to), | ||
value: this.replaceInlineContext(action.txData.value || "0"), | ||
data: this.replaceInlineContext(action.txData.data || ""), | ||
data: txData, | ||
}, | ||
chainId: this.replaceInlineContext(action.chainId), | ||
}, | ||
|
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.
needs to be changed in the docs as well