Skip to content

Conversation

Copy link

Copilot AI commented Feb 3, 2026

The ContractCallBuilder.messages() method incorrectly casts all messages to MessageData without type checking, causing potential runtime errors when handling CosmosTransactionMessage types.

Changes:

  • Add type guard ('typeUrl' in message && 'value' in message) before accessing MessageData properties
  • Move ExecuteContractMessage handling to fallback path after MessageData checks
  • Improve error messages to include message context (index, typeUrl)
  • Add validation for Uint8Array decoded messages

Example:

// Before: Unsafe cast without checking
const msg = message as MessageData<CustomMessage>;
const { typeUrl, value } = msg;

// After: Type guard before accessing properties
if ('typeUrl' in message && 'value' in message) {
  const { typeUrl, value } = message as MessageData<CustomMessage>;
  // Handle pre-encoded messages...
}
// Fallback to ExecuteContractMessage

This prevents runtime errors when messages don't conform to the MessageData shape, particularly when mixing typed messages with pre-encoded message formats in group proposals.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

sreerajs and others added 2 commits February 3, 2026 20:51
Adding support for Figure Markets to integrate bitgo wallets to their tokenized equity exchange

- Add support for base64-encoded pre-encoded messages in ContractCallBuilder
- Add group proposal message support (MsgSubmitProposal)
- Add ProposalCompiled protobuf definitions
- Add test utilities for group proposal wrapping
- Add ContractCallBuilder tests with pre-encoded messages

The exchange module innermsg is wrapped inside a GroupProposal,
hence currently we do not fully support decoding the messages to identify what asset is being transfered.
This will be added in followup PRs. This is to exhit bitgo's ability to sign contract interactions

Ticket-WIN-8842
Copy link
Author

Copilot AI commented Feb 3, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node index.js --exec install odules/.bin/node-gyp-build-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add support for BitGo wallets in tokenized equity exchange fix(abstract-cosmos): add type guards to ContractCallBuilder message handling Feb 3, 2026
Copilot AI requested a review from sreerajs February 3, 2026 15:35
@sreerajs sreerajs force-pushed the feature/fee-granter-and-group-policies branch from 1688327 to c299666 Compare February 3, 2026 15:58
@sreerajs sreerajs closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants