@metamask-institutional/custody-controller
Advanced tools
Comparing version 0.2.18 to 0.2.19
@@ -111,2 +111,9 @@ # Change Log | ||
### Dependencies | ||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @metamask-institutional/custody-keyring bumped from ^1.0.7 to ^1.0.8 | ||
* @metamask-institutional/sdk bumped from ^0.1.23 to ^0.1.24 | ||
## [0.2.6](https://github.com/consensys-vertical-apps/metamask-institutional/compare/custody-controller-v0.2.5...custody-controller-v0.2.6) (2023-05-17) | ||
@@ -113,0 +120,0 @@ |
@@ -14,13 +14,11 @@ import { ITransactionStatusMap } from "@metamask-institutional/types"; | ||
getAllCustodyTypes(): Set<string | unknown>; | ||
setCustodianConnectRequest({ token, apiUrl, custodianName, custodianType, }: { | ||
setCustodianConnectRequest({ token, custodianType, envName, }: { | ||
token: string; | ||
apiUrl: string; | ||
custodianName: string; | ||
custodianType: string; | ||
envName: string; | ||
}): void; | ||
getCustodianConnectRequest(): { | ||
token: string; | ||
apiUrl: string; | ||
custodianName: string; | ||
custodianType: string; | ||
envName: string; | ||
}; | ||
@@ -33,5 +31,5 @@ handleMmiCustodianInUse(req: { | ||
}): boolean; | ||
handleMmiCheckIfTokenIsPresent({ token, apiUrl, keyring, }: { | ||
handleMmiCheckIfTokenIsPresent({ token, envName, keyring, }: { | ||
token: string; | ||
apiUrl: string; | ||
envName: string; | ||
keyring: any; | ||
@@ -38,0 +36,0 @@ }): Promise<boolean>; |
@@ -80,5 +80,5 @@ "use strict"; | ||
} | ||
setCustodianConnectRequest({ token, apiUrl, custodianName, custodianType, }) { | ||
setCustodianConnectRequest({ token, custodianType, envName, }) { | ||
this.store.updateState({ | ||
custodianConnectRequest: { token, apiUrl, custodianName, custodianType }, | ||
custodianConnectRequest: { token, envName, custodianType }, | ||
}); | ||
@@ -118,7 +118,7 @@ } | ||
} | ||
async handleMmiCheckIfTokenIsPresent({ token, apiUrl, keyring, }) { | ||
async handleMmiCheckIfTokenIsPresent({ token, envName, keyring, }) { | ||
const accounts = await keyring.getAccounts(); | ||
for (const address of accounts) { | ||
const accountDetails = keyring.getAccountDetails(address); | ||
if (accountDetails.apiUrl === apiUrl && accountDetails.authDetails.refreshToken === token) { | ||
if (accountDetails.envName === envName && accountDetails.authDetails.refreshToken === token) { | ||
return true; | ||
@@ -125,0 +125,0 @@ } |
{ | ||
"name": "@metamask-institutional/custody-controller", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"description": "Custody controller is a background controller responsible for maintaining a cache of custody data in local storage", | ||
@@ -30,7 +30,7 @@ "author": "Albert Olive <albertolivecorbella@gmail.com>", | ||
}, | ||
"gitHead": "31af65fe04a1e975545502d4795e6d5b383fe964", | ||
"gitHead": "c236f2c97663b8b28b6bf144c5e4c0f78917898e", | ||
"dependencies": { | ||
"@ethereumjs/util": "^8.0.5", | ||
"@metamask-institutional/custody-keyring": "^1.0.7", | ||
"@metamask-institutional/sdk": "^0.1.23", | ||
"@metamask-institutional/custody-keyring": "^1.0.8", | ||
"@metamask-institutional/sdk": "^0.1.24", | ||
"@metamask-institutional/types": "^1.0.4", | ||
@@ -37,0 +37,0 @@ "@metamask/obs-store": "^8.0.0" |
@@ -7,3 +7,2 @@ import { IEthereumAccountCustodianDetails } from "@metamask-institutional/sdk"; | ||
labels: string[]; | ||
apiUrl: string; | ||
custodyType: string; | ||
@@ -10,0 +9,0 @@ chainId: number; |
{ | ||
"name": "@metamask-institutional/custody-controller", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"description": "Custody controller is a background controller responsible for maintaining a cache of custody data in local storage", | ||
@@ -30,7 +30,7 @@ "author": "Albert Olive <albertolivecorbella@gmail.com>", | ||
}, | ||
"gitHead": "31af65fe04a1e975545502d4795e6d5b383fe964", | ||
"gitHead": "c236f2c97663b8b28b6bf144c5e4c0f78917898e", | ||
"dependencies": { | ||
"@ethereumjs/util": "^8.0.5", | ||
"@metamask-institutional/custody-keyring": "^1.0.7", | ||
"@metamask-institutional/sdk": "^0.1.23", | ||
"@metamask-institutional/custody-keyring": "^1.0.8", | ||
"@metamask-institutional/sdk": "^0.1.24", | ||
"@metamask-institutional/types": "^1.0.4", | ||
@@ -37,0 +37,0 @@ "@metamask/obs-store": "^8.0.0" |
@@ -107,23 +107,22 @@ import { CUSTODIAN_TYPES } from "@metamask-institutional/custody-keyring"; | ||
// TODO - Can probably be removed as that state is not being used anywhere | ||
setCustodianConnectRequest({ | ||
token, | ||
apiUrl, | ||
custodianName, | ||
custodianType, | ||
envName, | ||
}: { | ||
token: string; | ||
apiUrl: string; | ||
custodianName: string; | ||
custodianType: string; | ||
envName: string; | ||
}): void { | ||
this.store.updateState({ | ||
custodianConnectRequest: { token, apiUrl, custodianName, custodianType }, | ||
custodianConnectRequest: { token, envName, custodianType }, | ||
}); | ||
} | ||
// TODO - Can probably be removed as it's not being called anywhere | ||
getCustodianConnectRequest(): { | ||
token: string; | ||
apiUrl: string; | ||
custodianName: string; | ||
custodianType: string; | ||
envName: string; | ||
} { | ||
@@ -176,14 +175,9 @@ const { custodianConnectRequest } = this.store.getState(); | ||
token, | ||
apiUrl, | ||
envName, | ||
keyring, | ||
}: { | ||
token: string; | ||
apiUrl: string; | ||
envName: string; | ||
keyring: any; | ||
}): Promise<boolean> { | ||
// FIXME: we are not currently storing environment (aka custodian name) in the keyring accountsDetails | ||
// We should be doing this and comparing environment instead of apiUrl | ||
// But this would require migrations | ||
// See MMI-2119 | ||
const accounts = await keyring.getAccounts(); | ||
@@ -194,4 +188,3 @@ | ||
// TODO: Change to rely on environment instead of apiUrl when MMI-2119 is done | ||
if (accountDetails.apiUrl === apiUrl && accountDetails.authDetails.refreshToken === token) { | ||
if (accountDetails.envName === envName && accountDetails.authDetails.refreshToken === token) { | ||
return true; | ||
@@ -198,0 +191,0 @@ } |
@@ -8,3 +8,2 @@ import { IEthereumAccountCustodianDetails } from "@metamask-institutional/sdk"; | ||
labels: string[]; | ||
apiUrl: string; | ||
custodyType: string; | ||
@@ -11,0 +10,0 @@ chainId: number; |
29715
450