Skip to content

Commit c3627be

Browse files
committed
refactor(e2e): retire the raw contract-call helpers (#3924)
1 parent 298d967 commit c3627be

2 files changed

Lines changed: 5 additions & 73 deletions

File tree

crates/e2e-tests/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,14 @@ impl NearBlockchain {
123123
```
124124

125125
`DeployedContract` wraps the contract's account ID plus its own `near-kit`
126-
client. It exposes `call` (from the contract account), `call_from`/
127-
`call_from_with_deposit` (from an arbitrary `NearKitCaller`), `view`, and
128-
`state()` (parsed `ProtocolContractState`).
126+
client. It exposes `call` (from the contract account, used only for `init`),
127+
`contract_handle` (a typed `MpcContractHandle` calling as a given
128+
`NearKitCaller`), `view`, and `state()` (parsed `ProtocolContractState`).
129129

130130
`NearKitCaller` binds a signer to a non-contract account (nodes voting, users
131131
submitting sign requests) and implements the `CallContract` transport trait,
132-
so typed calls can go through `MpcContractHandle`.
132+
so typed calls go through `MpcContractHandle` — the single source of each
133+
method's wire format, gas, and deposit.
133134

134135
### 3. `MpcNode` / `MpcNodeSetup` — node process manager
135136

crates/e2e-tests/src/blockchain.rs

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -155,75 +155,6 @@ impl DeployedContract {
155155
.map_err(|e| anyhow::anyhow!("contract call `{method}` failed: {e}"))
156156
}
157157

158-
pub async fn call_from(
159-
&self,
160-
client: &NearKitCaller,
161-
method: &str,
162-
args: serde_json::Value,
163-
) -> anyhow::Result<FinalExecutionOutcome> {
164-
client
165-
.inner
166-
.call(&self.contract_id, method)
167-
.args(args)
168-
.gas(MAX_GAS)
169-
.send()
170-
.await
171-
.map_err(|e| anyhow::anyhow!("contract call `{method}` (external signer) failed: {e}"))
172-
}
173-
174-
pub async fn call_from_with_deposit(
175-
&self,
176-
client: &NearKitCaller,
177-
method: &str,
178-
args: serde_json::Value,
179-
gas: near_kit::Gas,
180-
deposit: near_kit::NearToken,
181-
) -> anyhow::Result<FinalExecutionOutcome> {
182-
client
183-
.inner
184-
.call(&self.contract_id, method)
185-
.args(args)
186-
.gas(gas)
187-
.deposit(deposit)
188-
.send()
189-
.await
190-
.map_err(|e| anyhow::anyhow!("contract call `{method}` (with deposit) failed: {e}"))
191-
}
192-
193-
/// Like [`Self::call_from`], but with an attached `deposit`.
194-
pub async fn call_from_deposit(
195-
&self,
196-
client: &NearKitCaller,
197-
method: &str,
198-
args: serde_json::Value,
199-
deposit: near_kit::NearToken,
200-
) -> anyhow::Result<FinalExecutionOutcome> {
201-
self.call_from_with_deposit(client, method, args, MAX_GAS, deposit)
202-
.await
203-
}
204-
205-
/// Call a method whose arguments are borsh-serialized (e.g. `propose_update`).
206-
pub async fn call_from_borsh_with_deposit<A: borsh::BorshSerialize>(
207-
&self,
208-
client: &NearKitCaller,
209-
method: &str,
210-
args: A,
211-
gas: near_kit::Gas,
212-
deposit: near_kit::NearToken,
213-
) -> anyhow::Result<FinalExecutionOutcome> {
214-
client
215-
.inner
216-
.call(&self.contract_id, method)
217-
.args_borsh(args)
218-
.gas(gas)
219-
.deposit(deposit)
220-
.send()
221-
.await
222-
.map_err(|e| {
223-
anyhow::anyhow!("contract call `{method}` (borsh args, with deposit) failed: {e}")
224-
})
225-
}
226-
227158
pub async fn view<T: DeserializeOwned + Send + 'static>(
228159
&self,
229160
method: &str,

0 commit comments

Comments
 (0)