Skip to content

Conversation

@jianlunz-cb
Copy link
Contributor

@jianlunz-cb jianlunz-cb commented Dec 18, 2024

What changed? Why?

Change update api from classmethod to instance method

>>> sc = SmartContract.register(contract_name="Test Contract", contract_address="0x0000000071727de22e5e9d8baf0edac6f37da039", network_id="base-sepolia", abi=[
...   {
...     "constant": True,
...     "name": "myField",
...     "outputs": [
...       {
...         "name": "",
...         "type": "uint256"
...       }
...     ],
...     "type": "function"
...   }
... ])
CDP API REQUEST: POST https://cloud-api-dev.cbhq.net/platform/v1/networks/base-sepolia/smart_contracts/0x0000000071727de22e5e9d8baf0edac6f37da039/register
CDP API RESPONSE: Status: 200, Data: b'{"abi":"[{\\"constant\\":true,\\"name\\":\\"myField\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"uint256\\"}],\\"type\\":\\"function\\"}]","contract_address":"0x0000000071727de22E5E9D8baF0edaC6f37da039","contract_name":"Test Contract","is_external":true,"network_id":"base-sepolia","smart_contract_id":"c9d674b2-ea11-4f7a-b9d2-b7575d05ea80","type":"custom"}\n'
>>> sc.update(contract_name="Test Contract2", abi=[
...   {
...     "constant": False,
...     "name": "myField2",
...     "outputs": [
...       {
...         "name": "",
...         "type": "uint256"
...       }
...     ],
...     "type": "function"
...   }
... ])
CDP API REQUEST: PUT https://cloud-api-dev.cbhq.net/platform/v1/networks/base-sepolia/smart_contracts/0x0000000071727de22E5E9D8baF0edaC6f37da039
CDP API RESPONSE: Status: 200, Data: b'{"abi":"[{\\"constant\\":false,\\"name\\":\\"myField2\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"uint256\\"}],\\"type\\":\\"function\\"}]","contract_address":"0x0000000071727de22E5E9D8baF0edaC6f37da039","contract_name":"Test Contract2","is_external":true,"network_id":"base-sepolia","smart_contract_id":"c9d674b2-ea11-4f7a-b9d2-b7575d05ea80","type":"custom"}\n'
SmartContract: (smart_contract_id: c9d674b2-ea11-4f7a-b9d2-b7575d05ea80, wallet_id: None, network_id: base-sepolia, contract_address: 0x0000000071727de22E5E9D8baF0edaC6f37da039, type: custom, transaction_hash: None, transaction_link: None, status: None)

Qualified Impact

alex-stone
alex-stone previously approved these changes Dec 18, 2024
@alex-stone
Copy link
Contributor

@jianlunz-cb can you update the Changelog.md to include:

  • Add support for registering, updating, and listing smart contracts that are
    deployed external to CDP.

@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@jianlunz-cb
Copy link
Contributor Author

  • Add support for registering, updating, and listing smart contracts that are
    deployed external to CDP.

Fore sure, just updated

CHANGELOG.md Outdated

## Unreleased

### [0.13.0] - 2024-12-18
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave this under Unreleased as we will update this when we actually release!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh for sure

@alex-stone alex-stone merged commit 75d7bc4 into v0.13.0 Dec 18, 2024
7 checks passed
@derek-cb derek-cb mentioned this pull request Dec 19, 2024
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.

3 participants