Skip to content

Commit bfbf1ea

Browse files
authored
Merge branch 'develop' into tcm-compose-random-user
2 parents 4b693d9 + 258789d commit bfbf1ea

30 files changed

+81
-122
lines changed

.env.example

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ TWITTER_PASSWORD= # Account password
5858
TWITTER_EMAIL= # Account email
5959
TWITTER_2FA_SECRET=
6060

61-
TWITTER_COOKIES= # Account cookies
6261
TWITTER_POLL_INTERVAL=120 # How often (in seconds) the bot should check for interactions
6362
TWITTER_SEARCH_ENABLE=FALSE # Enable timeline search, WARNING this greatly increases your chance of getting banned
6463
TWITTER_TARGET_USERS= # Comma separated list of Twitter user names to interact with

README_CN.md

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ TWITTER_DRY_RUN=false
145145
TWITTER_USERNAME= # Account username
146146
TWITTER_PASSWORD= # Account password
147147
TWITTER_EMAIL= # Account email
148-
TWITTER_COOKIES= # Account cookies
149148
150149
X_SERVER_URL=
151150
XAI_API_KEY=

README_ES.md

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TWITTER_DRY_RUN=false
9898
TWITTER_USERNAME= # Nombre de usuario de la cuenta
9999
TWITTER_PASSWORD= # Contraseña de la cuenta
100100
TWITTER_EMAIL= # Correo electrónico de la cuenta
101-
TWITTER_COOKIES= # Cookies de la cuenta
102101
103102
X_SERVER_URL=
104103
XAI_API_KEY=

README_JA.md

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ TWITTER_DRY_RUN=false
9696
TWITTER_USERNAME= # アカウントのユーザー名
9797
TWITTER_PASSWORD= # アカウントのパスワード
9898
TWITTER_EMAIL= # アカウントのメール
99-
TWITTER_COOKIES= # アカウントのクッキー
10099
101100
X_SERVER_URL=
102101
XAI_API_KEY=

README_PTBR.md

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TWITTER_DRY_RUN=false
9898
TWITTER_USERNAME= # Nome de usuário da conta
9999
TWITTER_PASSWORD= # Senha da conta
100100
TWITTER_EMAIL= # Email da conta
101-
TWITTER_COOKIES= # Cookies da conta
102101
103102
X_SERVER_URL=
104103
XAI_API_KEY=

README_RU.md

-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ TWITTER_DRY_RUN=false
114114
TWITTER_USERNAME= # Имя пользователя аккаунта
115115
TWITTER_PASSWORD= # Пароль аккаунта
116116
TWITTER_EMAIL= # Email аккаунта
117-
TWITTER_COOKIES= # Cookies аккаунта
118117
119118
X_SERVER_URL=
120119
XAI_API_KEY=

agent/src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ export function getTokenForProvider(
214214
character: Character
215215
): string {
216216
switch (provider) {
217-
// no key needed for llama_local
217+
// no key needed for llama_local or gaianet
218218
case ModelProviderName.LLAMALOCAL:
219219
return "";
220+
case ModelProviderName.GAIANET:
221+
return "";
220222
case ModelProviderName.OPENAI:
221223
return (
222224
character.settings?.secrets?.OPENAI_API_KEY ||

docs/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ TWITTER_DRY_RUN=false
102102
TWITTER_USERNAME= # Account username
103103
TWITTER_PASSWORD= # Account password
104104
TWITTER_EMAIL= # Account email
105-
TWITTER_COOKIES= # Account cookies
106105
107106
X_SERVER_URL=
108107
XAI_API_KEY=

docs/README_CN.md

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ TWITTER_DRY_RUN=false
9494
TWITTER_USERNAME= # Account username
9595
TWITTER_PASSWORD= # Account password
9696
TWITTER_EMAIL= # Account email
97-
TWITTER_COOKIES= # Account cookies
9897
9998
X_SERVER_URL=
10099
XAI_API_KEY=

docs/README_FR.md

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ TWITTER_DRY_RUN=false
102102
TWITTER_USERNAME= # Account username
103103
TWITTER_PASSWORD= # Account password
104104
TWITTER_EMAIL= # Account email
105-
TWITTER_COOKIES= # Account cookies
106105
107106
X_SERVER_URL=
108107
XAI_API_KEY=

docs/README_TH.md

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TWITTER_DRY_RUN=false
9898
TWITTER_USERNAME= # ชื่อผู้ใช้บัญชี
9999
TWITTER_PASSWORD= # รหัสผ่าน
100100
TWITTER_EMAIL= # อีเมล
101-
TWITTER_COOKIES= # คุกกี้
102101
103102
X_SERVER_URL=
104103
XAI_API_KEY=

docs/docs/api/_media/README_CN.md

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ TWITTER_DRY_RUN=false
9494
TWITTER_USERNAME= # Account username
9595
TWITTER_PASSWORD= # Account password
9696
TWITTER_EMAIL= # Account email
97-
TWITTER_COOKIES= # Account cookies
9897
9998
X_SERVER_URL=
10099
XAI_API_KEY=

docs/docs/api/_media/README_FR.md

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ TWITTER_DRY_RUN=false
9494
TWITTER_USERNAME= # Account username
9595
TWITTER_PASSWORD= # Account password
9696
TWITTER_EMAIL= # Account email
97-
TWITTER_COOKIES= # Account cookies
9897
9998
X_SERVER_URL=
10099
XAI_API_KEY=

docs/docs/api/_media/README_JA.md

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ TWITTER_DRY_RUN=false
9696
TWITTER_USERNAME= # アカウントのユーザー名
9797
TWITTER_PASSWORD= # アカウントのパスワード
9898
TWITTER_EMAIL= # アカウントのメール
99-
TWITTER_COOKIES= # アカウントのクッキー
10099
101100
X_SERVER_URL=
102101
XAI_API_KEY=

docs/docs/api/_media/README_KOR.md

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ TWITTER_DRY_RUN=false
9494
TWITTER_USERNAME= # Account username
9595
TWITTER_PASSWORD= # Account password
9696
TWITTER_EMAIL= # Account email
97-
TWITTER_COOKIES= # Account cookies
9897
9998
X_SERVER_URL=
10099
XAI_API_KEY=

docs/docs/api/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ TWITTER_DRY_RUN=false
100100
TWITTER_USERNAME= # Account username
101101
TWITTER_PASSWORD= # Account password
102102
TWITTER_EMAIL= # Account email
103-
TWITTER_COOKIES= # Account cookies
104103
105104
X_SERVER_URL=
106105
XAI_API_KEY=

docs/docs/guides/configuration.md

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ DISCORD_API_TOKEN= # Discord bot token
4646
TWITTER_USERNAME= # Bot Twitter username
4747
TWITTER_PASSWORD= # Bot Twitter password
4848
TWITTER_EMAIL= # Twitter account email
49-
TWITTER_COOKIES= # Twitter auth cookies
5049
TWITTER_DRY_RUN=false # Test mode without posting
5150
```
5251

docs/docs/packages/clients.md

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ const client = await TwitterClientInterface.start(runtime);
141141
TWITTER_USERNAME = your_username;
142142
TWITTER_PASSWORD = your_password;
143143
TWITTER_EMAIL = your_email;
144-
TWITTER_COOKIES = your_cookies;
145144
```
146145

147146
### Components

docs/docs/quickstart.md

-11
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,10 @@ Add to your `.env`:
168168
TWITTER_USERNAME= # Account username
169169
TWITTER_PASSWORD= # Account password
170170
TWITTER_EMAIL= # Account email
171-
TWITTER_COOKIES= # Account cookies (auth_token and CT0)
172171
```
173172

174173
**Important:** Log in to the [Twitter Developer Portal](https://developer.twitter.com) and enable the "Automated" label for your account to avoid being flagged as inauthentic.
175174

176-
Example for TWITTER_COOKIES
177-
178-
The TWITTER_COOKIES variable should be a JSON string containing the necessary cookies. You can find these cookies in your web browser's developer tools. Here is an example format:
179-
180-
```bash
181-
TWITTER_COOKIES='[{"key":"auth_token","value":"your token","domain":".twitter.com"},
182-
{"key":"ct0","value":"your ct0","domain":".twitter.com"},
183-
{"key":"guest_id","value":"your guest_id","domain":".twitter.com"}]'
184-
```
185-
186175
### Telegram Bot
187176

188177
1. Create a bot

packages/client-twitter/src/base.ts

+16-22
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ export class ClientBase extends EventEmitter {
153153
}
154154

155155
async init() {
156-
//test
157156
const username = this.runtime.getSetting("TWITTER_USERNAME");
158157
const password = this.runtime.getSetting("TWITTER_PASSWORD");
159158
const email = this.runtime.getSetting("TWITTER_EMAIL");
@@ -163,43 +162,38 @@ export class ClientBase extends EventEmitter {
163162
);
164163
const twitter2faSecret =
165164
this.runtime.getSetting("TWITTER_2FA_SECRET") || undefined;
166-
const cookies = this.runtime.getSetting("TWITTER_COOKIES");
167165

168166
if (!username) {
169167
throw new Error("Twitter username not configured");
170168
}
171-
// Check for Twitter cookies
172-
if (cookies) {
173-
elizaLogger.debug("Using cookies from settings");
174-
const cookiesArray = JSON.parse(cookies);
175169

176-
await this.setCookiesFromArray(cookiesArray);
177-
} else {
178-
elizaLogger.debug("No cookies found in settings");
179-
elizaLogger.debug("Checking for cached cookies");
180-
const cachedCookies = await this.getCachedCookies(username);
181-
if (cachedCookies) {
182-
await this.setCookiesFromArray(cachedCookies);
183-
}
170+
const cachedCookies = await this.getCachedCookies(username);
171+
172+
if (cachedCookies) {
173+
elizaLogger.info("Using cached cookies");
174+
await this.setCookiesFromArray(cachedCookies);
184175
}
185176

186177
elizaLogger.log("Waiting for Twitter login");
187178
while (retries > 0) {
188-
const cookies = await this.twitterClient.getCookies();
189-
if ((await this.twitterClient.isLoggedIn()) && !!cookies) {
190-
elizaLogger.info("Already logged in.");
191-
await this.cacheCookies(username, cookies);
192-
elizaLogger.info("Successfully logged in and cookies cached.");
193-
break;
194-
}
195-
196179
try {
197180
await this.twitterClient.login(
198181
username,
199182
password,
200183
email,
201184
twitter2faSecret
202185
);
186+
if (await this.twitterClient.isLoggedIn()) {
187+
elizaLogger.info("Successfully logged in.");
188+
if (!cachedCookies) {
189+
elizaLogger.info("Caching cookies");
190+
await this.cacheCookies(
191+
username,
192+
await this.twitterClient.getCookies()
193+
);
194+
}
195+
break;
196+
}
203197
} catch (error) {
204198
elizaLogger.error(`Login attempt failed: ${error.message}`);
205199
}

packages/client-twitter/src/environment.ts

-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const twitterEnvSchema = z.object({
1010
TWITTER_USERNAME: z.string().min(1, "Twitter username is required"),
1111
TWITTER_PASSWORD: z.string().min(1, "Twitter password is required"),
1212
TWITTER_EMAIL: z.string().email("Valid Twitter email is required"),
13-
TWITTER_COOKIES: z.string().optional(),
1413
MAX_TWEET_LENGTH: z
1514
.string()
1615
.pipe(z.coerce.number().min(0).int())
@@ -37,9 +36,6 @@ export async function validateTwitterConfig(
3736
TWITTER_EMAIL:
3837
runtime.getSetting("TWITTER_EMAIL") ||
3938
process.env.TWITTER_EMAIL,
40-
TWITTER_COOKIES:
41-
runtime.getSetting("TWITTER_COOKIES") ||
42-
process.env.TWITTER_COOKIES,
4339
MAX_TWEET_LENGTH:
4440
runtime.getSetting("MAX_TWEET_LENGTH") ||
4541
process.env.MAX_TWEET_LENGTH ||

packages/plugin-evm/eslint.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import eslintGlobalConfig from "../../eslint.config.mjs";
2+
3+
export default [...eslintGlobalConfig];

packages/plugin-evm/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"scripts": {
1616
"build": "tsup --format esm --dts",
1717
"dev": "tsup --format esm --dts --watch",
18-
"test": "vitest run"
18+
"test": "vitest run",
19+
"lint": "eslint --fix --cache ."
1920
},
2021
"peerDependencies": {
2122
"whatwg-url": "7.1.0"

packages/plugin-evm/src/actions/swap.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { IAgentRuntime, Memory, State } from "@ai16z/eliza";
22
import {
3-
ChainId,
43
createConfig,
54
executeRoute,
65
ExtendedChain,

packages/plugin-evm/src/actions/transfer.ts

+11-24
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class TransferAction {
2828
params.data = "0x";
2929
}
3030

31-
await this.walletProvider.switchChain(params.fromChain);
31+
this.walletProvider.switchChain(params.fromChain);
3232

3333
const walletClient = this.walletProvider.getWalletClient(
3434
params.fromChain
@@ -41,12 +41,12 @@ export class TransferAction {
4141
value: parseEther(params.amount),
4242
data: params.data as Hex,
4343
kzg: {
44-
blobToKzgCommitment: function (blob: ByteArray): ByteArray {
44+
blobToKzgCommitment: function (_: ByteArray): ByteArray {
4545
throw new Error("Function not implemented.");
4646
},
4747
computeBlobKzgProof: function (
48-
blob: ByteArray,
49-
commitment: ByteArray
48+
_blob: ByteArray,
49+
_commitment: ByteArray
5050
): ByteArray {
5151
throw new Error("Function not implemented.");
5252
},
@@ -81,7 +81,7 @@ const buildTransferDetails = async (
8181

8282
const contextWithChains = context.replace(
8383
"SUPPORTED_CHAINS",
84-
chains.toString()
84+
chains.map((item) => `"${item}"`).join("|")
8585
);
8686

8787
const transferDetails = (await generateObjectDeprecated({
@@ -109,34 +109,21 @@ export const transferAction = {
109109
description: "Transfer tokens between addresses on the same chain",
110110
handler: async (
111111
runtime: IAgentRuntime,
112-
message: Memory,
112+
_message: Memory,
113113
state: State,
114-
options: any,
114+
_options: any,
115115
callback?: HandlerCallback
116116
) => {
117117
console.log("Transfer action handler called");
118118
const walletProvider = initWalletProvider(runtime);
119119
const action = new TransferAction(walletProvider);
120120

121121
// Compose transfer context
122-
const transferContext = composeContext({
122+
const paramOptions = await buildTransferDetails(
123123
state,
124-
template: transferTemplate,
125-
});
126-
127-
// Generate transfer content
128-
const content = await generateObjectDeprecated({
129124
runtime,
130-
context: transferContext,
131-
modelClass: ModelClass.LARGE,
132-
});
133-
134-
const paramOptions: TransferParams = {
135-
fromChain: content.fromChain,
136-
toAddress: content.toAddress,
137-
amount: content.amount,
138-
data: content.data,
139-
};
125+
walletProvider
126+
);
140127

141128
try {
142129
const transferResp = await action.transfer(paramOptions);
@@ -148,7 +135,7 @@ export const transferAction = {
148135
hash: transferResp.hash,
149136
amount: formatEther(transferResp.value),
150137
recipient: transferResp.to,
151-
chain: content.fromChain,
138+
chain: paramOptions.fromChain,
152139
},
153140
});
154141
}

packages/plugin-evm/src/providers/wallet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ export const initWalletProvider = (runtime: IAgentRuntime) => {
211211
export const evmWalletProvider: Provider = {
212212
async get(
213213
runtime: IAgentRuntime,
214-
message: Memory,
215-
state?: State
214+
_message: Memory,
215+
_state?: State
216216
): Promise<string | null> {
217217
try {
218218
const walletProvider = initWalletProvider(runtime);

packages/plugin-evm/src/tests/transfer.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("Transfer Action", () => {
1717
it("should initialize with wallet provider", () => {
1818
const ta = new TransferAction(wp);
1919

20-
expect(ta).to.toBeDefined();
20+
expect(ta).toBeDefined();
2121
});
2222
});
2323
describe("Transfer", () => {
@@ -44,7 +44,7 @@ describe("Transfer Action", () => {
4444
});
4545

4646
const prepareChains = () => {
47-
let customChains: Record<string, Chain> = {};
47+
const customChains: Record<string, Chain> = {};
4848
const chainNames = ["iotexTestnet"];
4949
chainNames.forEach(
5050
(chain) =>

0 commit comments

Comments
 (0)