Skip to content

Commit

Permalink
refactor(global): changes transferToken fx interface and makes some K…
Browse files Browse the repository at this point in the history
…eyringKms configs params optional
  • Loading branch information
allemanfredi committed Feb 12, 2025
1 parent 41cc224 commit 4510208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/AssetsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AssetsManager {
}
}

async transferToken(wallet: Wallet, amount: number, tokenAddress: string, destinationAddressAsEIP3770: string) {
async transferToken(wallet: Wallet, amount: number, destinationAddressAsEIP3770: string, tokenAddress: string) {
const [chain, recipient] = destinationAddressAsEIP3770.split(':')

const networkConfig = this.networkConfigs[chain]
Expand Down
12 changes: 6 additions & 6 deletions src/kms/keyring/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import erc20Abi from './abi/erc20'
import safeAbi from './abi/safe'

export interface KeyringKmsConfigs {
bootNodeUrl: string
instanceKeyType: 'ecdsa'
bootNodeUrl?: string
instanceKeyType?: 'secp256k1'
instancePrivateKey?: string
}

export interface KeyringSignOptions {}

export const jsonRpcId = () => Math.floor(Math.random() * 10000001)

const KEYRING_ADDRESSES: { [key: number]: string } = {
const KEYRING_GATEWAY_ADDRESSES: { [key: number]: string } = {
42161: '0xaA21f3be38b66aa6162A8E30AB712098A30B23E2',
}

Expand All @@ -41,9 +41,9 @@ export class KeyringKms extends Kms implements IKms<KeyringSignOptions> {
this.bootNodeUrl = configs?.bootNodeUrl || 'http://bootnode.keyring.xyz'

// NOTE: at the moment is supported only this authentication method
if (configs?.instanceKeyType && configs.instanceKeyType !== 'ecdsa') throw new Error('Invalid identity type')
if (configs?.instanceKeyType && configs.instanceKeyType !== 'secp256k1') throw new Error('Invalid identity type')

this.instanceKeyType = configs?.instanceKeyType ?? 'ecdsa'
this.instanceKeyType = configs?.instanceKeyType ?? 'secp256k1'

if (!configs?.instancePrivateKey) {
let pk
Expand Down Expand Up @@ -164,7 +164,7 @@ export class KeyringKms extends Kms implements IKms<KeyringSignOptions> {
async postSignature(signature: Signature, data: Buffer, provider: JsonRpcProvider) {
// NOTE: there will be an api call to propagate the signed

const gatewayAddress = KEYRING_ADDRESSES[Number(provider._network.chainId)]
const gatewayAddress = KEYRING_GATEWAY_ADDRESSES[Number(provider._network.chainId)]
if (!gatewayAddress) throw new Error('invalid network')

// NOTE: provisional wallet with funds in ordet to be able to relay the tx
Expand Down

0 comments on commit 4510208

Please sign in to comment.