diff --git a/src/common.ts b/src/common.ts index 843e97bc..4495cec1 100644 --- a/src/common.ts +++ b/src/common.ts @@ -39,6 +39,7 @@ import { export type BlockHeight = number; export type SortKey = string; export type WalletAddress = string; +export type TransactionId = string; // TODO: append this with other configuration options (e.g. local vs. remote evaluation) export type ContractSigner = ArweaveSigner | ArconnectSigner; @@ -210,6 +211,10 @@ export interface ArIOWriteContract { target: WalletAddress; qty: number; }): Promise; + saveObservations(params: { + reportTxId: TransactionId; + failedGateways: WalletAddress[]; + }): Promise; } export type WriteInteractionResult = diff --git a/src/common/ar-io.ts b/src/common/ar-io.ts index 58df6f85..4cb9df94 100644 --- a/src/common/ar-io.ts +++ b/src/common/ar-io.ts @@ -31,7 +31,9 @@ import { JoinNetworkParams, Observations, RegistrationType, + TransactionId, UpdateGatewaySettingsParams, + WalletAddress, WeightedObserver, WithSigner, WriteInteractionResult, @@ -374,4 +376,15 @@ export class ArIOWritable extends ArIOReadable implements ArIOWriteContract { }); return res; } + + async saveObservations(params: { + reportTxId: TransactionId; + failedGateways: WalletAddress[]; + }): Promise { + return this.contract.writeInteraction({ + functionName: AR_IO_CONTRACT_FUNCTIONS.SAVE_OBSERVATIONS, + inputs: params, + signer: this.signer, + }); + } }