Created
September 29, 2025 03:29
-
-
Save mgild/7a06a1a4000190c0c6846944244fe458 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function getRangeRiskScoreJob(payer: Keypair): OracleJob { | |
| const job = OracleJob.fromObject({ | |
| tasks: [ | |
| { | |
| httpTask: { | |
| url: "https://api.range.org/v1/risk/address?address=${ADDRESS}&network=solana", | |
| headers: [ | |
| { key: "accept", value: "application/json" }, | |
| // placeholder resolved on-oracle by Secrets | |
| { key: "X-API-KEY", value: "${RANGE_API_KEY}" }, | |
| ], | |
| }, | |
| }, | |
| // Only accept numeric riskScore >= 0; null => no match => failure so no Risk | |
| { jsonParseTask: { path: "$.riskScore" } }, | |
| { multiplyTask: { scalar: 10 } }, // 0–10 => 0–100 | |
| { | |
| boundTask: { | |
| lowerBoundValue: "0", | |
| onExceedsLowerBoundValue: "0", | |
| upperBoundValue: "100", | |
| onExceedsUpperBoundValue: "100", | |
| }, | |
| }, | |
| ], | |
| }); | |
| return job; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment