File tree 2 files changed +22
-11
lines changed
packages/plugin-squid-router/src
2 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,16 @@ export const xChainSwapAction = {
46
46
) : Promise < boolean > => {
47
47
elizaLogger . log ( "Starting X_CHAIN_SWAP handler..." ) ;
48
48
49
- // Initialize or update state
50
- if ( ! state ) {
51
- state = ( await runtime . composeState ( message ) ) as State ;
49
+ let currentState = state ; // Create new variable
50
+ if ( ! currentState ) {
51
+ currentState = ( await runtime . composeState ( message ) ) as State ;
52
52
} else {
53
- state = await runtime . updateRecentMessageState ( state ) ;
53
+ currentState = await runtime . updateRecentMessageState ( currentState ) ;
54
54
}
55
55
56
56
// Compose X chain swap context
57
57
const xChainSwapContext = composeContext ( {
58
- state,
58
+ state : currentState , // Use the new variable
59
59
template : xChainSwapTemplate ,
60
60
} ) ;
61
61
@@ -164,13 +164,12 @@ export const xChainSwapAction = {
164
164
const txReceipt = await tx . wait ( ) ;
165
165
166
166
// Show the transaction receipt with Axelarscan link
167
- const axelarScanLink = " https://axelarscan.io/gmp/" + txReceipt . hash ;
167
+ const axelarScanLink = ` https://axelarscan.io/gmp/${ txReceipt . hash } ` ; // Fix: Use template literal
168
168
elizaLogger . log ( `Finished! Check Axelarscan for details: ${ axelarScanLink } ` ) ;
169
169
170
170
if ( callback ) {
171
171
callback ( {
172
- text :
173
- "Swap completed successfully! Check Axelarscan for details:\n " + axelarScanLink ,
172
+ text : `Swap completed successfully! Check Axelarscan for details:\n${ axelarScanLink } ` , // Fix: Use template literal
174
173
content : { } ,
175
174
} ) ;
176
175
}
Original file line number Diff line number Diff line change @@ -84,13 +84,25 @@ export class SquidRouterProvider {
84
84
if ( chain . chainType === ChainType . EVM ) {
85
85
const provider = new ethers . JsonRpcProvider ( chain . rpc ) ;
86
86
return new ethers . Wallet ( runtime . getSetting ( "SQUID_EVM_PRIVATE_KEY" ) , provider ) ;
87
- } else {
88
- throw Error ( "Cannot instantiate EVM signer for non-EVM chain" ) ;
89
87
}
88
+ throw new Error ( 'Cannot instantiate EVM signer for non-EVM chain' ) ; // Fix: Use template literal and remove else
90
89
} catch ( error ) {
91
- throw Error ( " Cannot instantiate EVM signer: " + error ) ;
90
+ throw new Error ( ` Cannot instantiate EVM signer: ${ error } ` ) ; // Fix: Use template literal
92
91
}
93
92
}
93
+
94
+ // async getEVMSignerForChain(chain: ChainData, runtime): Promise<ethers.Signer> {
95
+ // try {
96
+ // if(chain.chainType === ChainType.EVM) {
97
+ // const provider = new ethers.JsonRpcProvider(chain.rpc);
98
+ // return new ethers.Wallet(runtime.getSetting("SQUID_EVM_PRIVATE_KEY"), provider);
99
+ // } else {
100
+ // throw Error("Cannot instantiate EVM signer for non-EVM chain");
101
+ // }
102
+ // } catch (error) {
103
+ // throw Error("Cannot instantiate EVM signer: "+error);
104
+ // }
105
+ // }
94
106
}
95
107
96
108
export const initSquidRouterProvider = ( runtime : IAgentRuntime ) => {
You can’t perform that action at this time.
0 commit comments