Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c04f89a
Parse backend type
pmikolajczyk41 Aug 2, 2023
c13ceca
Config tests
pmikolajczyk41 Aug 2, 2023
816030b
Extract client building
pmikolajczyk41 Aug 2, 2023
96c124f
OCD
pmikolajczyk41 Aug 2, 2023
d2abb06
CHANGELOG.md
pmikolajczyk41 Aug 4, 2023
316bf58
Merge remote-tracking branch 'origin/master' into pmikolajczyk41/e2e-…
pmikolajczyk41 Aug 4, 2023
37f8d09
Merge remote-tracking branch 'origin/master' into pmikolajczyk41/e2e-…
pmikolajczyk41 Aug 7, 2023
f679f73
Merge remote-tracking branch 'origin/master' into pmikolajczyk41/e2e-…
pmikolajczyk41 Aug 16, 2023
f8e295a
Add drink dependency, fix with wasm-instrument
pmikolajczyk41 Aug 17, 2023
7be1f3a
ChainApi
pmikolajczyk41 Aug 18, 2023
42484ff
Instantiate
pmikolajczyk41 Aug 18, 2023
06cbc9b
Calling
pmikolajczyk41 Aug 18, 2023
c454db3
Upload
pmikolajczyk41 Aug 18, 2023
b21fc27
Use all arguments
pmikolajczyk41 Aug 18, 2023
ec3936e
Build client in macro
pmikolajczyk41 Aug 18, 2023
17bf359
fmt, implement e2e backend
pmikolajczyk41 Aug 18, 2023
dcc746d
remove actor types
pmikolajczyk41 Aug 18, 2023
624d20f
convert accounts and hashes
pmikolajczyk41 Aug 22, 2023
2b67dc8
get rid of session
pmikolajczyk41 Aug 23, 2023
7f9b764
add dedicated example
pmikolajczyk41 Aug 23, 2023
158dd64
example working
pmikolajczyk41 Aug 23, 2023
97ac62b
clean a bit
pmikolajczyk41 Aug 23, 2023
20a36ca
Merge remote-tracking branch 'origin/master' into pmikolajczyk41/e2e-…
pmikolajczyk41 Aug 23, 2023
96f647f
merging cleanup
pmikolajczyk41 Aug 23, 2023
15aaa48
use published drink
pmikolajczyk41 Aug 23, 2023
f416edc
Review
pmikolajczyk41 Aug 24, 2023
04bb5e9
Add DRink! as valid word
pmikolajczyk41 Aug 24, 2023
ea738c2
Give it up
pmikolajczyk41 Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use all arguments
  • Loading branch information
pmikolajczyk41 committed Aug 18, 2023
commit b21fc27b7f771f8c632ba0c617614a57c43b75b5
50 changes: 37 additions & 13 deletions crates/e2e/src/drink_client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
use crate::{builders::{
constructor_exec_input,
CreateBuilderPartial,
}, log_info, CallBuilderFinal, CallDryRunResult, CallResult, ChainBackend, ContractsBackend, InstantiationResult, UploadResult, log_error};
use crate::{
builders::{
constructor_exec_input,
CreateBuilderPartial,
},
log_error,
log_info,
CallBuilderFinal,
CallDryRunResult,
CallResult,
ChainBackend,
ContractsBackend,
InstantiationResult,
UploadResult,
};
use drink::{
chain_api::ChainApi,
contract_api::ContractApi,
Expand All @@ -11,12 +22,20 @@ use drink::{
};
use ink_env::Environment;
use jsonrpsee::core::async_trait;
use pallet_contracts_primitives::{ ContractInstantiateResult, ContractResult};
use pallet_contracts_primitives::{
ContractInstantiateResult,
ContractResult,
};
use scale::{
Decode,
Encode,
};
use sp_core::{crypto::AccountId32, sr25519::Pair, Pair as _, H256};
use sp_core::{
crypto::AccountId32,
sr25519::Pair,
Pair as _,
H256,
};
use std::{
collections::BTreeMap,
path::PathBuf,
Expand Down Expand Up @@ -138,18 +157,20 @@ where
contract_name: &str,
caller: &Self::Actor,
constructor: CreateBuilderPartial<E, Contract, Args, R>,
_value: E::Balance,
_storage_deposit_limit: Option<E::Balance>,
value: E::Balance,
storage_deposit_limit: Option<E::Balance>,
) -> Result<InstantiationResult<E, Self::EventLog>, Self::Error> {
let code = self.load_code(contract_name);
let data = constructor_exec_input(constructor);

let result = self.session.contracts_api().deploy_contract(
code,
value,
data,
Self::salt(),
caller.clone(),
DEFAULT_GAS_LIMIT,
storage_deposit_limit,
);
let account_id = self
.session
Expand Down Expand Up @@ -186,19 +207,20 @@ where
&mut self,
contract_name: &str,
caller: &Self::Actor,
_storage_deposit_limit: Option<E::Balance>,
storage_deposit_limit: Option<E::Balance>,
) -> Result<UploadResult<E, Self::EventLog>, Self::Error> {
let code = self.load_code(contract_name);

let result = match self.session.contracts_api().upload_contract(
code,
caller.clone(),
storage_deposit_limit,
) {
Ok(result) => result,
Err(err) => {
log_error(&format!("Upload failed: {err:?}"));
return Err(()); // todo: make a proper error type
},
return Err(()) // todo: make a proper error type
}
};

Ok(UploadResult {
Expand All @@ -212,8 +234,8 @@ where
&mut self,
caller: &Self::Actor,
message: &CallBuilderFinal<E, Args, RetType>,
_value: E::Balance,
_storage_deposit_limit: Option<E::Balance>,
value: E::Balance,
storage_deposit_limit: Option<E::Balance>,
) -> Result<CallResult<E, RetType, Self::EventLog>, Self::Error>
where
CallBuilderFinal<E, Args, RetType>: Clone,
Expand All @@ -223,9 +245,11 @@ where

let result = self.session.contracts_api().call_contract(
account_id,
value,
exec_input,
caller.clone(),
DEFAULT_GAS_LIMIT,
storage_deposit_limit,
);

Ok(CallResult {
Expand Down