Builds a dictionary with the fields required to make the given transaction

    Don't call this directly, instead use :meth:`Contract.buildTransaction`
    on your contract instance.
331811
def build_transaction_for_function(
        address,
        web3,
        function_name=None,
        transaction=None,
        contract_abi=None,
        fn_abi=None,
        *args,
        **kwargs):
    
    prepared_transaction = prepare_transaction(
        address,
        web3,
        fn_identifier=function_name,
        contract_abi=contract_abi,
        fn_abi=fn_abi,
        transaction=transaction,
        fn_args=args,
        fn_kwargs=kwargs,
    )

    prepared_transaction = fill_transaction_defaults(web3, prepared_transaction)

    return prepared_transaction
456940
def build(self, field: Field) -> Mapping[str, Any]:
        
        return dict(self.iter_parsed_values(field))
687745
def decode_transaction_input(self, transaction_hash: bytes) -> Dict:
        """"""
        transaction = self.contract.web3.eth.getTransaction(
            transaction_hash,
        )

        return self.contract.decode_function_input(
            transaction['input'],
        )
1250309
def from_dict(data, ctx):
        

        data = data.copy()

        if data.get('price') is not None:
            data['price'] = ctx.convert_decimal_number(
                data.get('price')
            )

        if data.get('initialUnits') is not None:
            data['initialUnits'] = ctx.convert_decimal_number(
                data.get('initialUnits')
            )

        if data.get('initialMarginRequired') is not None:
            data['initialMarginRequired'] = ctx.convert_decimal_number(
                data.get('initialMarginRequired')
            )

        if data.get('currentUnits') is not None:
            data['currentUnits'] = ctx.convert_decimal_number(
                data.get('currentUnits')
            )

        if data.get('realizedPL') is not None:
            data['realizedPL'] = ctx.convert_decimal_number(
                data.get('realizedPL')
            )

        if data.get('unrealizedPL') is not None:
            data['unrealizedPL'] = ctx.convert_decimal_number(
                data.get('unrealizedPL')
            )

        if data.get('marginUsed') is not None:
            data['marginUsed'] = ctx.convert_decimal_number(
                data.get('marginUsed')
            )

        if data.get('averageClosePrice') is not None:
            data['averageClosePrice'] = ctx.convert_decimal_number(
                data.get('averageClosePrice')
            )


        if data.get('financing') is not None:
            data['financing'] = ctx.convert_decimal_number(
                data.get('financing')
            )

        if data.get('clientExtensions') is not None:
            data['clientExtensions'] = \
                ctx.transaction.ClientExtensions.from_dict(
                    data['clientExtensions'], ctx
                )

        if data.get('takeProfitOrder') is not None:
            data['takeProfitOrder'] = \
                ctx.order.TakeProfitOrder.from_dict(
                    data['takeProfitOrder'], ctx
                )

        if data.get('stopLossOrder') is not None:
            data['stopLossOrder'] = \
                ctx.order.StopLossOrder.from_dict(
                    data['stopLossOrder'], ctx
                )

        if data.get('trailingStopLossOrder') is not None:
            data['trailingStopLossOrder'] = \
                ctx.order.TrailingStopLossOrder.from_dict(
                    data['trailingStopLossOrder'], ctx
                )

        return Trade(**data)
252586
def _build_dictionary(self, models):
        
        for model in models:
            key = getattr(model, self._morph_type, None)
            if key:
                foreign = getattr(model, self._foreign_key)
                if key not in self._dictionary:
                    self._dictionary[key] = {}

                if foreign not in self._dictionary[key]:
                    self._dictionary[key][foreign] = []

                self._dictionary[key][foreign].append(model)
924861
def build(self, **kwargs):
        
        build_args = dict(self.where_query)
        build_args.update(kwargs)
        record = self.model(**record_args(build_args))
        if self.join_args:
            # EXAMPLE:
            # Say we have a many-to-many relation like so:
            #   Post -> Tagging -> Tag
            # If we are adding a tag to a post, we need to create the tagging
            # in addition to the tag. To do this, we add a "related record" to
            # the tag which is the tagging. By building the previous record,
            # if it exists, we can recursively build a long object tree.
            # That is, when we do post.tags(), we get a query that looks like:
            # Query(Tag).joins("taggings").where(taggings={"post_id":post.id})
            # The call to "build" then creates a tag using kwargs and the where
            # constraint, and creates a tagging that looks like:
            # Tagging(post_id = post.id) and adds it to the tag's related
            # records. The tagging's tag_id is added once the tag is saved
            # which is the first time it gets an id
            # Join args will never have just one element
            next_to_build = getattr(self.record, self.join_args[-2]['table']).build()
            record._related_records.append(next_to_build)
        return record
1188453
def _build_deployments_object(
    contract_type: str,
    deployment_bytecode: Dict[str, Any],
    runtime_bytecode: Dict[str, Any],
    compiler: Dict[str, Any],
    address: HexStr,
    tx: HexStr,
    block: HexStr,
    manifest: Dict[str, Any],
) -> Iterable[Tuple[str, Any]]:
    
    yield "contract_type", contract_type
    yield "address", to_hex(address)
    if deployment_bytecode:
        yield "deployment_bytecode", deployment_bytecode
    if compiler:
        yield "compiler", compiler
    if tx:
        yield "transaction", tx
    if block:
        yield "block", block
    if runtime_bytecode:
        yield "runtime_bytecode", runtime_bytecode
1200833
def transact_with_contract_function(
        address,
        web3,
        function_name=None,
        transaction=None,
        contract_abi=None,
        fn_abi=None,
        *args,
        **kwargs):
    
    transact_transaction = prepare_transaction(
        address,
        web3,
        fn_identifier=function_name,
        contract_abi=contract_abi,
        transaction=transaction,
        fn_abi=fn_abi,
        fn_args=args,
        fn_kwargs=kwargs,
    )

    txn_hash = web3.eth.sendTransaction(transact_transaction)
    return txn_hash
189071
def build(self, builder):
        
        if self.text is None:
            raise ValueError("Text is not set.")
        params = {}
        if self.sponsor_or_site is not None:
            params['SponsorOrSite'] = self.sponsor_or_site

        builder.start("Comment", params)
        builder.data(self.text)
        builder.end("Comment")
1096737
def build(self, schema: Schema) -> Mapping[str, Any]:
        
        fields = list(self.iter_fields(schema))

        properties = {
            field.name: self.build_parameter(field)
            for name, field in fields
        }

        result = dict(
            type="object",
            properties=properties,
        )

        required_fields = [
            name
            for name, field in fields
            if field.required and not field.allow_none
        ]

        if required_fields:
            result["required"] = required_fields

        return result
995648
def prepare_transaction(
        address,
        web3,
        fn_identifier,
        contract_abi=None,
        fn_abi=None,
        transaction=None,
        fn_args=None,
        fn_kwargs=None):
    
    if fn_abi is None:
        fn_abi = find_matching_fn_abi(contract_abi, fn_identifier, fn_args, fn_kwargs)

    validate_payable(transaction, fn_abi)

    if transaction is None:
        prepared_transaction = {}
    else:
        prepared_transaction = dict(**transaction)

    if 'data' in prepared_transaction:
        raise ValueError("Transaction parameter may not contain a 'data' key")

    if address:
        prepared_transaction.setdefault('to', address)

    prepared_transaction['data'] = encode_transaction_data(
        web3,
        fn_identifier,
        contract_abi,
        fn_abi,
        fn_args,
        fn_kwargs,
    )
    return prepared_transaction
1306680
def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None:
    
    if not all(key in contract_data.keys() for key in ("abi", "deployment_bytecode")):
        raise InsufficientAssetsError(
            "Minimum required contract data to generate a deployable "
            "contract factory (abi & deployment_bytecode) not found."
        )
676162
def build(self, builder):
        
        builder.start("SignatureRef", dict(SignatureOID=self.oid))
        builder.end("SignatureRef")
750757
def build_native_type_dictionary(fields, respect_required=False, wrap_field=True, name=''):
    
    # a place to start when building the input field attributes
    input_fields = {}
    # go over every input in the summary
    for field in fields:
        field_name = name + field['name']
        field_type = field['type']

        # if the type field is a string
        if isinstance(field_type, str):
            # compute the native api type for the field
            field_type = convert_typestring_to_api_native(field_type)(
                # required=respect_required and field['required']
            )
            # add an entry in the attributes
            input_fields[field['name']] = field_type

        # we could also be looking at a dictionary
        elif isinstance(field_type, dict):

            object_fields = field_type['fields']

            # add the dictionary to the parent as a graphql object type
            input_fields[field['name']] = graphql_type_from_summary(
                summary={
                    'name': field_name+"ArgType",
                    'fields': object_fields
                }
            )

            # if we are supposed to wrap the object in a field
            if wrap_field:
                # then wrap the value we just added
                input_fields[field['name']] = graphene.Field(input_fields[field['name']])


    # we're done
    return input_fields
1233498
def build(self, builder):
        """"""
        params = dict(SubjectKey=self.subject_key)
        params['mdsol:SubjectKeyType'] = self.subject_key_type

        if self.transaction_type is not None:
            params["TransactionType"] = self.transaction_type

        # mixins
        self.mixin()
        self.mixin_params(params)

        builder.start("SubjectData", params)

        # Ask children
        if self.audit_record is not None:
            self.audit_record.build(builder)

        if self.siteref:
            self.siteref.build(builder)
        else:
            builder.start("SiteRef", {'LocationOID': self.sitelocationoid})
            builder.end("SiteRef")

        for event in self.study_events:
            event.build(builder)

        if self.signature is not None:
            self.signature.build(builder)

        for annotation in self.annotations:
            annotation.build(builder)

        builder.end("SubjectData")
198029
def build(self, builder):
        
        params = dict(FormOID=self.formoid)

        if self.transaction_type is not None:
            params["TransactionType"] = self.transaction_type

        if self.form_repeat_key is not None:
            params["FormRepeatKey"] = str(self.form_repeat_key)

        # mixins
        self.mixin()
        self.mixin_params(params)

        builder.start("FormData", params)

        # Ask children
        for itemgroup in self.itemgroups:
            itemgroup.build(builder, self.formoid)

        if self.signature is not None:
            self.signature.build(builder)

        for annotation in self.annotations:
            annotation.build(builder)

        builder.end("FormData")
680808
def sign_transaction(self, txins: Union[TxOut],
                         tx: MutableTransaction) -> MutableTransaction:
        ''''''

        solver = P2pkhSolver(self._private_key)
        return tx.spend(txins, [solver for i in txins])