Skip to content
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

Biconomy comment fixes #283

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autotx/intents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class IntentBase(BaseModel):

@abstractmethod
async def build_transactions(self, web3: Web3, network: NetworkInfo, smart_wallet_address: ETHAddress) -> list[Transaction]:
pass
raise NotImplementedError()

class SendIntent(IntentBase):
receiver: str
Expand Down
5 changes: 3 additions & 2 deletions autotx/load_tokens.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import json
from textwrap import dedent
from typing import Union
Expand Down Expand Up @@ -42,5 +43,5 @@ async def fetch_tokens_list() -> None:
f.write(content)


async def run() -> None:
await fetch_tokens_list()
def run() -> None:
asyncio.run(fetch_tokens_list())
6 changes: 3 additions & 3 deletions autotx/smart_accounts/smart_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def on_intents_prepared(self, intents: list[Intent]) -> None:

@abstractmethod
async def on_intents_ready(self, intents: list[Intent]) -> bool | str: # True if sent, False if declined, str if feedback
pass
raise NotImplementedError()

@abstractmethod
async def send_transaction(self, transaction: TransactionBase) -> None:
pass
raise NotImplementedError()

@abstractmethod
async def send_transactions(self, transactions: list[TransactionBase]) -> None:
pass
raise NotImplementedError()

def wait(self, tx_hash: HexBytes) -> TxReceipt:
return self.web3.eth.wait_for_transaction_receipt(tx_hash)
12 changes: 12 additions & 0 deletions smart_account_api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ app.use((req: Request, res: Response, next: NextFunction) => {

app.get("/api/v1/account/address", handleError(async (req: Request, res: Response) => {
const chainId = parseInt(req.query.chainId as string);
if (!chainId) {
res.status(400).json({ error: "chainId is required" });
return;
}

const { smartAccount } = await initClientWithAccount(SMART_ACCOUNT_OWNER_PK, chainId);

Expand All @@ -52,6 +56,10 @@ app.get("/api/v1/account/address", handleError(async (req: Request, res: Respons

app.post("/api/v1/account/deploy", handleError(async (req: Request, res: Response) => {
const chainId = parseInt(req.query.chainId as string);
if (!chainId) {
res.status(400).json({ error: "chainId is required" });
return;
}

const { smartAccount } = await initClientWithAccount(SMART_ACCOUNT_OWNER_PK, chainId);

Expand All @@ -64,6 +72,10 @@ app.post("/api/v1/account/deploy", handleError(async (req: Request, res: Respons

app.post("/api/v1/account/transactions", handleError(async (req: Request, res: Response, next: NextFunction) => {
const chainId = parseInt(req.query.chainId as string);
if (!chainId) {
res.status(400).json({ error: "chainId is required" });
return;
}

const transactions: TransactionDto[] = req.body;

Expand Down
Loading