Skip to content

Commit e8aac88

Browse files
authored
chore(all): remove unused functions and packages (#61)
+ Remove unused functions and packages
1 parent eaf2e57 commit e8aac88

File tree

12 files changed

+12
-815
lines changed

12 files changed

+12
-815
lines changed

packages/common/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@
3737
"dependencies": {
3838
"@noble/curves": "^1.6.0",
3939
"@noble/hashes": "^1.5.0",
40-
"@polkadot/api": "^15.8.1",
4140
"@subsquid/ss58": "^2.0.2",
4241
"polkadot-api": "^1.9.13"
4342
},
4443
"devDependencies": {
4544
"@babel/plugin-syntax-import-attributes": "^7.26.0",
4645
"@babel/preset-env": "^7.26.9",
4746
"@codecov/rollup-plugin": "^1.9.0",
48-
"@polkadot/api": "^15.8.1",
49-
"@polkadot/types": "^15.8.1",
5047
"@rollup/plugin-babel": "^6.0.4",
5148
"@rollup/plugin-json": "^6.1.0",
5249
"@rollup/plugin-typescript": "^12.1.2",

packages/core/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,14 @@
3737
"dependencies": {
3838
"@paraspell/sdk": "^10.5.2",
3939
"@polkadot-agent-kit/common": "workspace:*",
40-
"@polkadot/util-crypto": "^13.5.1",
4140
"@subsquid/ss58": "^2.0.2",
4241
"polkadot-api": "^1.9.13",
43-
"rxjs": "^7.8.2",
44-
"@substrate/asset-transfer-api": "^0.7.2",
45-
"@polkadot/api": "^16.2.2",
46-
"@polkadot/keyring": "^13.5.1"
42+
"rxjs": "^7.8.2"
4743
},
4844
"devDependencies": {
4945
"@babel/plugin-syntax-import-attributes": "^7.26.0",
5046
"@babel/preset-env": "^7.26.9",
5147
"@codecov/rollup-plugin": "^1.9.0",
52-
"@polkadot/api": "^15.8.1",
53-
"@polkadot/types": "^15.8.1",
5448
"@rollup/plugin-babel": "^6.0.4",
5549
"@rollup/plugin-json": "^6.1.0",
5650
"@rollup/plugin-typescript": "^12.1.2",
Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { KeyringPair } from "@polkadot/keyring/types"
2-
import type { TxResult as TxResultXcm } from "@substrate/asset-transfer-api"
31
import type { PolkadotSigner, TxEvent } from "polkadot-api"
42
import type { Observable } from "rxjs"
53

@@ -28,34 +26,17 @@ export interface SubmitAndWatchOptionsPolkadot {
2826
signer: PolkadotSigner
2927
}
3028

31-
export interface SubmitAndWatchOptionsKeypair {
32-
transaction: TxResultXcm<"submittable">
33-
signer: KeyringPair
34-
}
35-
36-
export type SubmitAndWatchOptions = SubmitAndWatchOptionsPolkadot | SubmitAndWatchOptionsKeypair
29+
export type SubmitAndWatchOptions = SubmitAndWatchOptionsPolkadot
3730

3831
export function isTxWithPolkadotSigner(
3932
options: SubmitAndWatchOptions
4033
): options is SubmitAndWatchOptionsPolkadot {
4134
return (
4235
!!options.transaction &&
43-
typeof (options.transaction as Tx).signSubmitAndWatch === "function" &&
36+
typeof options.transaction.signSubmitAndWatch === "function" &&
4437
!!options.signer &&
4538
options.signer.publicKey instanceof Uint8Array &&
46-
typeof (options.signer as PolkadotSigner).signTx === "function" &&
47-
typeof (options.signer as PolkadotSigner).signBytes === "function"
48-
)
49-
}
50-
51-
export function isTxXcmWithKeypair(
52-
options: SubmitAndWatchOptions
53-
): options is SubmitAndWatchOptionsKeypair {
54-
return (
55-
!!options.transaction &&
56-
typeof (options.transaction as TxResultXcm<"submittable">).tx?.signAndSend === "function" &&
57-
!!options.signer &&
58-
typeof (options.signer as KeyringPair).address === "string" &&
59-
typeof (options.signer as KeyringPair).sign === "function"
39+
typeof options.signer.signTx === "function" &&
40+
typeof options.signer.signBytes === "function"
6041
)
6142
}

packages/core/src/utils/connection.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

packages/core/src/utils/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export * from "./connection"
21
export * from "./format"
32
export * from "./isValidAddress"
43
export * from "./signSubmitAndWatch"

packages/core/src/utils/signSubmitAndWatch.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type { KeyringPair } from "@polkadot/keyring/types"
2-
import type { TxResult as TxResultXcm } from "@substrate/asset-transfer-api"
31
import type { PolkadotSigner, TxEvent } from "polkadot-api"
42

53
import type { Tx, TxResult } from "../types"
64
import type { SubmitAndWatchOptions } from "../types/transaction"
7-
import { hasTypeProperty, isTxWithPolkadotSigner, isTxXcmWithKeypair } from "../types/transaction"
5+
import { hasTypeProperty, isTxWithPolkadotSigner } from "../types/transaction"
86

97
async function submitAndWatchTx(options: SubmitAndWatchOptions): Promise<TxResult> {
108
return new Promise((resolve, reject) => {
@@ -51,30 +49,6 @@ async function submitAndWatchTx(options: SubmitAndWatchOptions): Promise<TxResul
5149
})
5250
}
5351
}
54-
// Handle Tx with KeyringPair using signAndSend
55-
if (isTxXcmWithKeypair(options)) {
56-
try {
57-
options.transaction.tx
58-
.signAndSend(options.signer)
59-
.then(result => {
60-
resolve({
61-
success: true,
62-
transactionHash: result.toString()
63-
})
64-
})
65-
.catch((error: Error) => {
66-
resolve({
67-
success: false,
68-
error: `Transaction failed: ${error.message}`
69-
})
70-
})
71-
} catch (error) {
72-
resolve({
73-
success: false,
74-
error: `Transaction failed: ${error instanceof Error ? error.message : String(error)}`
75-
})
76-
}
77-
}
7852
} catch (error) {
7953
reject(error instanceof Error ? error : new Error(String(error)))
8054
}
@@ -90,13 +64,3 @@ export async function submitTxWithPolkadotSigner(
9064
): Promise<TxResult> {
9165
return submitAndWatchTx({ transaction, signer })
9266
}
93-
94-
/**
95-
* Function to submit a transaction with a KeyringPair
96-
*/
97-
export async function submitXcmTxWithKeypair(
98-
transaction: TxResultXcm<"submittable">,
99-
signer: KeyringPair
100-
): Promise<TxResult> {
101-
return submitAndWatchTx({ transaction, signer })
102-
}

packages/llm/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,13 @@
4343
"@polkadot-labs/hdkd": "^0.0.13",
4444
"@polkadot-labs/hdkd-helpers": "^0.0.13",
4545
"@subsquid/ss58": "^2.0.2",
46-
"@polkadot/api": "^15.8.1",
4746
"polkadot-api": "^1.9.13",
48-
"zod": "^3.24.3",
49-
"@polkadot/keyring": "^13.5.1"
47+
"zod": "^3.24.3"
5048
},
5149
"devDependencies": {
5250
"@babel/plugin-syntax-import-attributes": "^7.26.0",
5351
"@babel/preset-env": "^7.26.9",
5452
"@codecov/rollup-plugin": "^1.9.0",
55-
"@polkadot/api": "^15.8.1",
5653
"@polkadot/types": "^15.8.1",
5754
"@rollup/plugin-babel": "^6.0.4",
5855
"@rollup/plugin-json": "^6.1.0",

packages/llm/src/agent/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ export class PolkadotAgentApi implements IPolkadotAgentApi {
4343
}
4444

4545
getNativeBalanceTool(address: string): BalanceTool {
46-
return checkBalanceTool(this.api.getAllApis(), address) as BalanceTool
46+
return checkBalanceTool(this.api.getAllApis(), address) as unknown as BalanceTool
4747
}
4848

4949
transferNativeTool(signer: PolkadotSigner): TransferTool {
50-
return transferNativeTool(this.api.getAllApis(), signer) as TransferTool
50+
return transferNativeTool(this.api.getAllApis(), signer) as unknown as TransferTool
5151
}
5252

5353
xcmTransferNativeTool(signer: PolkadotSigner, sender: string): XcmTransferNativeAssetTool {
54-
return xcmTransferNativeTool(signer, sender) as XcmTransferNativeAssetTool
54+
return xcmTransferNativeTool(signer, sender) as unknown as XcmTransferNativeAssetTool
5555
}
5656
}

packages/llm/src/langchain/balance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const checkBalanceTool = (apis: Map<KnownChainId, Api<KnownChainId>>, add
2929
balance: formattedBalance,
3030
symbol: balanceInfo.symbol,
3131
chain
32-
}
32+
} as unknown as BalanceToolResult
3333
},
3434
result => `Balance on ${result.chain}: ${result.balance} ${result.symbol}`
3535
)

packages/sdk/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,14 @@
4545
"@polkadot-agent-kit/llm": "workspace:*",
4646
"@polkadot-labs/hdkd": "^0.0.13",
4747
"@polkadot-labs/hdkd-helpers": "^0.0.13",
48-
"@polkadot/api": "^15.8.1",
4948
"@subsquid/ss58": "^2.0.2",
5049
"polkadot-api": "^1.9.13",
51-
"zod": "^3.24.3",
52-
"@polkadot/keyring": "^13.5.1",
53-
"@polkadot/util": "^13.5.1"
50+
"zod": "^3.24.3"
5451
},
5552
"devDependencies": {
5653
"@babel/plugin-syntax-import-attributes": "^7.26.0",
5754
"@babel/preset-env": "^7.26.9",
5855
"@codecov/rollup-plugin": "^1.9.0",
59-
"@polkadot/api": "^15.8.1",
60-
"@polkadot/types": "^15.8.1",
6156
"@rollup/plugin-babel": "^6.0.4",
6257
"@rollup/plugin-json": "^6.1.0",
6358
"@rollup/plugin-typescript": "^12.1.2",

0 commit comments

Comments
 (0)