# swivel.vendors.w3

### Classes

#### Class `W3` <a href="#id" id="id"></a>

> ```
> class W3(
>     p,
>     a=None
> )
> ```

### Parameters

p (Web3.Provider) Provider being used to connect

a (address) An optional default account to use. Will default to .eth.accounts\[0] if omitted

**Methods**

**Method `build_transaction`**

> ```
> def build_transaction(
>     self,
>     a
> )
> ```

Return a suitable transaction object for signing

### Description

As per our pattern a\[1] is the tx\_opts dict. Note that you should include, at least, 'chainId' in that dict. Other optional properties are available, see <https://web3py.readthedocs.io/en/latest/web3.eth.account.html#sign-a-transaction.>

* 'maxFeePerGas'
* 'maxPriorityFeePerGas'
* etc...

**Method `contract`**

> ```
> def contract(
>     self,
>     address,
>     abi
> )
> ```

Get an instance of the vedor low-level contract object

### Parameters

address (address) The address of the deployed smart contract

abi (string) ABI of the deployed smart contract

### Returns

the vendor specific contract object

**Method `estimate_gas`**

> ```
> def estimate_gas(
>     self,
>     a
> )
> ```

Return an estimate of gas to be used in a transaction, as well as the price of the gas

### Parameters

a (tuple) Length 2 tuple whose values are a web3 transactable object and a tx\_opts dict. This is the common return of all Swivel.py H.O.C contract methods.

### Returns

gas, gas\_price

**Method `send`**

> ```
> def send(
>     self,
>     a
> )
> ```

Convenience method which builds, signs and broadcasts a transaction

**Method `send_raw_transaction`**

> ```
> def send_raw_transaction(
>     self,
>     t
> )
> ```

Given a raw signed transaction, broadcast it

### Parameters

t (transaction) A web3 transaction which has been signed

### Returns

A transaction hash suitable for web3's ...wait\_for\_transaction\_receipt method

**Method `sign_order`**

> ```
> def sign_order(
>     self,
>     o,
>     i,
>     a
> )
> ```

Sign an order, producing an EIP712 compliant signature

### Parameters

o (dict) Swivel Order object

i (int) ChainId

a (string) Address of the deployed verifying contract

### Returns

The signature hex

**Method `sign_transaction`**

> ```
> def sign_transaction(
>     self,
>     t
> )
> ```

Called after a transaction has been built with `build_transaction`

### Parameters

t (dict) A built transaction object from build\_transaction

### Returns

A signed transaction

***

Generated by *pdoc* 0.10.0 (<https://pdoc3.github.io>).
