-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic eclipse provider addition (#4231)
- Loading branch information
Showing
24 changed files
with
294 additions
and
128 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
89 changes: 89 additions & 0 deletions
89
backend/native/backpack-api/src/routes/graphql/providers/eclipse.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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { EclipseTokenList } from "@coral-xyz/common"; | ||
import { SystemProgram } from "@solana/web3.js"; | ||
|
||
import type { ApiContext } from "../context"; | ||
import type { NftConnection, NftFiltersInput} from "../types"; | ||
import { ProviderId } from "../types"; | ||
|
||
import { SolanaRpc } from "./solana/rpc"; | ||
import type { BlockchainDataProvider } from "."; | ||
|
||
/** | ||
* Eclipse SVM L2 implementation for the common data provider API. | ||
* @export | ||
* @class Eclipse | ||
* @extends {SolanaRpc} | ||
* @implements {BlockchainDataProvider} | ||
*/ | ||
export class Eclipse extends SolanaRpc implements BlockchainDataProvider { | ||
constructor(ctx?: ApiContext) { | ||
super( | ||
ctx, | ||
EclipseTokenList, | ||
"https://api.injective.eclipsenetwork.xyz:8899" | ||
); | ||
} | ||
|
||
/** | ||
* Chain ID enum variant. | ||
* @override | ||
* @returns {ProviderId} | ||
* @memberof Eclipse | ||
*/ | ||
override id(): ProviderId { | ||
return ProviderId.Solana; | ||
} | ||
|
||
/** | ||
* Native coin decimals. | ||
* @override | ||
* @returns {number} | ||
* @memberof Eclipse | ||
*/ | ||
override decimals(): number { | ||
return 9; | ||
} | ||
|
||
/** | ||
* Default native address. | ||
* @override | ||
* @returns {string} | ||
* @memberof Eclipse | ||
*/ | ||
override defaultAddress(): string { | ||
return SystemProgram.programId.toBase58(); | ||
} | ||
|
||
/** | ||
* Logo URL of the native coin. | ||
* @override | ||
* @returns {string} | ||
* @memberof Eclipse | ||
*/ | ||
override logo(): string { | ||
return "https://pbs.twimg.com/profile_images/1626643141519642625/WLqoO9pu_400x400.jpg"; | ||
} | ||
|
||
/** | ||
* The display name of the data provider. | ||
* @override | ||
* @returns {string} | ||
* @memberof Eclipse | ||
*/ | ||
override name(): string { | ||
return "Eclipse"; | ||
} | ||
|
||
/** | ||
* FIXME: | ||
* The super implementation relies on Metaplex for NFT and metadata | ||
* fetching which doesn't exist on Eclipse. | ||
* @memberof Eclipse | ||
*/ | ||
override getNftsForAddress( | ||
address: string, | ||
filters?: NftFiltersInput | undefined | ||
): Promise<NftConnection> { | ||
throw new Error("unimplemented"); | ||
} | ||
} |
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.
6b99897
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
backpack – ./
backpack-git-master-200ms.vercel.app
backpack-200ms.vercel.app
www.backpack.app
backpack.app
devnet.backpack.app