-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: generic entity ID generators (#41)
* add generic functions * fix lint * fix operations map
- Loading branch information
1 parent
ea1b44d
commit d5575f6
Showing
11 changed files
with
99 additions
and
49 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Address, BigInt, Bytes} from '@graphprotocol/graph-ts'; | ||
|
||
/** | ||
* Returns a valid entity ID based on the provided address. | ||
* | ||
* @export | ||
* @param {Address} address | ||
* @return {*} {string} | ||
*/ | ||
export function generateEntityIdFromAddress(address: Address): string { | ||
return address.toHexString(); | ||
} | ||
|
||
/** | ||
* Returns a valid entity ID based on the provided bytes. | ||
* | ||
* @export | ||
* @param {Bytes} bytes | ||
* @return {*} {string} | ||
*/ | ||
export function generateEntityIdFromBytes(bytes: Bytes): string { | ||
return bytes.toHexString(); | ||
} | ||
|
||
/** | ||
* Returns a valid entity ID based on the provided BigInt. | ||
* | ||
* @export | ||
* @param {BigInt} number | ||
* @return {*} {string} | ||
*/ | ||
export function generateEntityIdFromBigInt(number: BigInt): string { | ||
return number.toHexString(); | ||
} |
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,4 +1,4 @@ | ||
export const PERMISSION_OPERATIONS = new Map<number, string>() | ||
export const PERMISSION_OPERATIONS = new Map<i32, string>() | ||
.set(0, 'Grant') | ||
.set(1, 'Revoke') | ||
.set(2, 'GrantWithCondition'); |
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