Skip to content

Commit

Permalink
feat(observerations): add saveObservations write interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Apr 18, 2024
1 parent 4e2fa3a commit 8dd977c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -210,6 +211,10 @@ export interface ArIOWriteContract {
target: WalletAddress;
qty: number;
}): Promise<WriteInteractionResult>;
saveObservations(params: {
reportTxId: TransactionId;
failedGateways: WalletAddress[];
}): Promise<WriteInteractionResult>;
}

export type WriteInteractionResult =
Expand Down
13 changes: 13 additions & 0 deletions src/common/ar-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import {
JoinNetworkParams,
Observations,
RegistrationType,
TransactionId,
UpdateGatewaySettingsParams,
WalletAddress,
WeightedObserver,
WithSigner,
WriteInteractionResult,
Expand Down Expand Up @@ -374,4 +376,15 @@ export class ArIOWritable extends ArIOReadable implements ArIOWriteContract {
});
return res;
}

async saveObservations(params: {
reportTxId: TransactionId;
failedGateways: WalletAddress[];
}): Promise<WriteInteractionResult> {
return this.contract.writeInteraction({
functionName: AR_IO_CONTRACT_FUNCTIONS.SAVE_OBSERVATIONS,
inputs: params,
signer: this.signer,
});
}
}

0 comments on commit 8dd977c

Please sign in to comment.