Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support invoking smart contracts from MPC Wallets #176

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

alex-stone
Copy link
Contributor

What changed? Why?

This adds support for invoking smart contracts from MPC wallets
and from developer-managed wallets.

abi =  abi = [
  {
    inputs: [{internalType: 'address', name: 'recipient', type: 'address'}],
    name: 'mint',
    outputs: [{internalType: 'uint256', name: '', type: 'uint256'}],
    stateMutability: 'payable',
    type: 'function'
  }
]

invocation = wallet.invoke_contract(contract_address: '0xa82aB8504fDeb2dADAa3B4F075E967BbE35065b9', abi: abi, method: 'mint', args: { recipient: '0x475d41de7A81298Ba263184996800CBcaAD73C0b' })

invocation.wait!

Qualified Impact

This adds a new feature and should not impact existing features

@alex-stone alex-stone changed the title Stone/contract invocations Support invoking smart contracts from MPC Wallets Sep 5, 2024
@alex-stone alex-stone requested review from John-peterson-coinbase and jazz-cb and removed request for John-peterson-coinbase September 5, 2024 21:55
@@ -95,6 +95,34 @@ def trade(amount, from_asset_id, to_asset_id)
trade
end

# Trades the given amount of the given Asset for another Asset.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment needs an update

@@ -162,6 +162,8 @@ def create_contract_invocation_with_http_info(wallet_id, address_id, create_cont
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_contract_invocation_request)

puts post_body
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debug line

This adds support for invoking smart contracts from MPC wallets
and from developer-managed wallets.

```
abi =  abi = [
  {
    inputs: [{internalType: 'address', name: 'recipient', type: 'address'}],
    name: 'mint',
    outputs: [{internalType: 'uint256', name: '', type: 'uint256'}],
    stateMutability: 'payable',
    type: 'function'
  }
]

invocation = wallet.invoke_contract(contract_address: '0xa82aB8504fDeb2dADAa3B4F075E967BbE35065b9', abi: abi, method: 'mint', args: { recipient: '0x475d41de7A81298Ba263184996800CBcaAD73C0b' })

invocation.wait!
```
@alex-stone alex-stone force-pushed the stone/contract-invocations branch from 92f93ff to 6e69178 Compare September 5, 2024 22:07
@alex-stone alex-stone requested a review from jazz-cb September 5, 2024 22:07
@alex-stone alex-stone merged commit 33bdaf3 into v0.3.0 Sep 5, 2024
10 checks passed
@alex-stone alex-stone deleted the stone/contract-invocations branch September 5, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants