-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #610 from arconnectio/development
ArConnect BETA 1.23.1
- Loading branch information
Showing
37 changed files
with
311 additions
and
2,879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,12 @@ | ||
import { isAddress, isTokenType, isValidURL } from "~utils/assertions"; | ||
import type { BackgroundModuleFunction } from "~api/background/background-modules"; | ||
import { requestUserAuthorization } from "../../../utils/auth/auth.utils"; | ||
import { getTokens } from "~tokens"; | ||
|
||
const background: BackgroundModuleFunction<void> = async ( | ||
appData, | ||
id: unknown, | ||
type?: unknown, | ||
dre_node?: unknown | ||
) => { | ||
// validate input | ||
isAddress(id); | ||
|
||
if (type) isTokenType(type); | ||
if (dre_node) isValidURL(dre_node); | ||
|
||
// check if the token is added already | ||
const tokens = await getTokens(); | ||
|
||
if (tokens.find((token) => token.id === id)) { | ||
throw new Error("Token already added"); | ||
} | ||
|
||
// request "add token" popup | ||
await requestUserAuthorization( | ||
{ | ||
type: "token", | ||
tokenID: id, | ||
tokenType: type, | ||
dre: dre_node | ||
}, | ||
appData | ||
); | ||
throw new Error("The addToken API is deprecated and removed."); | ||
}; | ||
|
||
export default background; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 1 addition & 10 deletions
11
src/api/modules/is_token_added/is_token_added.background.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
import type { BackgroundModuleFunction } from "~api/background/background-modules"; | ||
import { isAddressFormat } from "~utils/format"; | ||
import { getTokens } from "~tokens"; | ||
import { isAddress } from "~utils/assertions"; | ||
|
||
const background: BackgroundModuleFunction<boolean> = async (_, id: string) => { | ||
// check id | ||
isAddress(id); | ||
|
||
// check if the token is added | ||
const tokens = await getTokens(); | ||
|
||
return !!tokens.find((token) => token.id === id); | ||
throw new Error("The isTokenAdded API is deprecated and removed."); | ||
}; | ||
|
||
export default background; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.