Skip to content

Commit

Permalink
Update safe api
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqiang90 committed Jan 9, 2025
1 parent 2b294f4 commit dc926f3
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions packages/node/src/starknet/safe-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import { getLogger } from '@subql/node-core';
import {
BigNumberish,
BlockIdentifier,
Call,
CompiledSierra,
GetTransactionReceiptResponse,
LegacyContractClass,
RpcProvider,
waitForTransactionOptions,
} from 'starknet';
import spec from 'starknet-types-07';

const logger = getLogger('safe.api.starknet');

Expand All @@ -18,6 +22,41 @@ export default class SafeStarknetProvider extends RpcProvider {
super();
}

async getStorageAt(
contractAddress: BigNumberish,
key: BigNumberish,
blockIdentifier?: BlockIdentifier,
): Promise<string> {
return this.baseApi.getStorageAt(contractAddress, key, this.blockHeight);
}
async getClass(
classHash: BigNumberish,
blockIdentifier?: BlockIdentifier,
): Promise<LegacyContractClass | CompiledSierra> {
return this.baseApi.getClass(classHash, this.blockHeight);
}
async getClassAt(
contractAddress: BigNumberish,
blockIdentifier?: BlockIdentifier,
): Promise<LegacyContractClass | CompiledSierra> {
return this.baseApi.getClassAt(contractAddress, this.blockHeight);
}

async estimateMessageFee(
message: spec.L1Message,
blockIdentifier?: BlockIdentifier,
): Promise<spec.FeeEstimate> {
// @ts-ignore
return this.baseApi.estimateMessageFee(message, this.blockHeight);
}

async callContract(
call: Call,
blockIdentifier?: BlockIdentifier,
): Promise<string[]> {
return this.baseApi.callContract(call, this.blockHeight);
}

// eslint-disable-next-line @typescript-eslint/promise-function-async
getBlockWithTxs(blockHashOrBlockTag: BlockIdentifier): Promise<BlockWithTxs> {
throw new Error('Method `getBlockWithTransactions` not supported.');
Expand Down

0 comments on commit dc926f3

Please sign in to comment.