Skip to content

Commit

Permalink
feat: serverless and extension connected
Browse files Browse the repository at this point in the history
  • Loading branch information
LinXJ1204 committed Feb 14, 2024
1 parent 6828f88 commit 4e497db
Show file tree
Hide file tree
Showing 5 changed files with 21,021 additions and 21 deletions.
12 changes: 8 additions & 4 deletions apps/backend/blockchain/blockchain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import time

import requests
from eth_utils import event_abi_to_log_topic
from web3 import Web3
Expand All @@ -12,7 +14,7 @@
APIKEY = os.getenv("APIKEY")
web3 = Web3(Web3.HTTPProvider("https://opbnb-testnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3"))
URL = "https://opbnb-testnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3"
ServerlessURL = "http://localhost:8787"
ServerlessURL = "http://psyduck-app.wayneies1206.workers.dev"

f = open('factoryABI.json')
factoryABI = FactoryABI
Expand Down Expand Up @@ -133,7 +135,7 @@ def update_opbnb(start, end):
event_info = decoded_logs[0]['args']
if (event_name == "ERC1155Created"):
print(event_info['_owner'], event_info['eventId'], 1, event_info['name'])
register(event_info['_owner'], event_info['name'])
register(event_info['_owner'], event_info['name'], event_info['eventId'])
if (event_name == "ERC1155AddNewNFT"):
eventId = event_info['_eventId']
tokenId = event_info['id']
Expand Down Expand Up @@ -203,6 +205,7 @@ def auto_update_opbnb():
while(start_block < now_block):
update_opbnb(start_block, start_block+45000)
start_block += 45000
time.sleep(1)
LastUpdateBlock(now_block)

def getLastUpdateBlock():
Expand All @@ -227,10 +230,11 @@ def LastUpdateBlock(block):

return response.json()

def register(address, userId):
def register(address, userId, eventId):
payload = {
"address": address,
"userId": userId
"userId": userId,
"eventId": eventId
}
headers = {
"accept": "application/json",
Expand Down
3 changes: 3 additions & 0 deletions apps/extension_app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"permissions": [
"tabs",
"activeTab"
],
"host_permissions": [
"https://*/"
]
}
Loading

0 comments on commit 4e497db

Please sign in to comment.