This repository was archived by the owner on Feb 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
init #634
Merged
Merged
init #634
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5e9ad57
init
jawndiego c52826a
matches main
jawndiego 97ef2e5
formatting
jawndiego a71449b
distinguisihing project ids
jawndiego fd74021
env
jawndiego 5af932d
registry
jawndiego e66f133
non null
jawndiego c12cb45
syndicate client
jawndiego 9853014
non null
jawndiego f88bd8e
use client
jawndiego 349512a
client diff
jawndiego 9a5cfe1
client
jawndiego 4044cd5
change address
jawndiego 5b1d62b
new address
jawndiego f8114d4
EIP 712 diff
jawndiego a171d9e
chain
jawndiego 593a4c5
syn helpers
jawndiego 7921a85
cleaner
jawndiego 6353da6
remove try catch
jawndiego 5d32cf8
push change to syndicate config
jawndiego 98f7b59
clients
jawndiego a9924f3
chain id back to optimism main
jawndiego cc90894
optimism
jawndiego 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
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,96 @@ | ||
import { SyndicateClient } from '@syndicateio/syndicate-node' | ||
import { addresses } from 'scrypt' | ||
|
||
type PostMessage = { | ||
rid: bigint | ||
timestamp: bigint | ||
msgType: number | ||
msgBody: string | ||
} | ||
|
||
type Post = { | ||
signer: string | ||
message: PostMessage | ||
hashType: number | ||
hash: string | ||
sigType: number | ||
sig: string | ||
} | ||
|
||
type Register = { | ||
to: string | ||
recovery: string | ||
deadline: number | ||
sig: string | ||
} | ||
|
||
type PostBatchFunction = { | ||
posts: Post[] | ||
} | ||
|
||
export const projectIdPost = | ||
process.env.SYNDICATE_PROJECT_ID_POSTGATEWAY ?? 'Error' | ||
export const projectIdRegistry = | ||
process.env.SYNDICATE_PROJECT_ID_IDREGISTRY ?? 'Error' | ||
|
||
export const generatePostBatchTxnInput = (postsArray: PostBatchFunction) => ({ | ||
projectId: projectIdPost, | ||
contractAddress: addresses.postGateway.nova, | ||
chainId: 42170, | ||
functionSignature: | ||
'postBatch((address signer, (uint256 rid, uint256 timestamp, uint8 msgType, bytes msgBody) message, uint16 hashType, bytes32 hash, uint16 sigType, bytes sig)[] posts)', | ||
args: { | ||
posts: postsArray, | ||
}, | ||
}) | ||
|
||
export const generatePostTxnInput = (post: Post) => ({ | ||
projectId: projectIdPost, | ||
contractAddress: addresses.postGateway.nova, | ||
chainId: 42170, | ||
functionSignature: | ||
'post((address signer, (uint256 rid, uint256 timestamp, uint8 msgType, bytes msgBody) message, uint16 hashType, bytes32 hash, uint16 sigType, bytes sig) post)', | ||
args: { | ||
post: post, | ||
}, | ||
}) | ||
|
||
export const generateIdRegistryInput = (register: Register) => ({ | ||
projectId: projectIdRegistry, | ||
contractAddress: addresses.idRegistry.optimism, | ||
chainId: 11155420, | ||
functionSignature: | ||
'registerFor(address to, address recovery, uint256 deadline, bytes sig)', | ||
args: { | ||
to: register.to, | ||
recovery: register.recovery, | ||
deadline: register.deadline, | ||
sig: register.sig, | ||
}, | ||
}) | ||
|
||
const apiPostKey = process.env.SYNDICATE_POST_API_KEY | ||
const apiIdKey = process.env.SYNDICATE_ID_API_KEY | ||
|
||
export const syndicateClientPost = | ||
projectIdPost !== 'Error' && apiPostKey | ||
? { | ||
officialActions: new SyndicateClient({ | ||
token: () => apiPostKey, | ||
}), | ||
projectId: projectIdPost, | ||
generatePostTxnInput, | ||
generatePostBatchTxnInput, | ||
} | ||
: null | ||
|
||
export const syndicateClientIdRegistry = | ||
projectIdRegistry !== 'Error' && apiIdKey | ||
? { | ||
officialActions: new SyndicateClient({ | ||
token: () => apiIdKey, | ||
}), | ||
projectId: projectIdRegistry, | ||
generateIdRegistryInput, | ||
} | ||
: null |
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.
@jawndiego this is the bug that could potentially have been introduced by new code. the "logs" field is something that specifically part of "transactionReceipt" (official ethereum term) object that is produced by successful transactions. need to make sure that whatever it is we are called ".logs[0].data" on is a txn receipt