Skip to content

Commit 7f1f0f8

Browse files
Userclaude
authored andcommitted
fix(server): bump blue-js-sdk to 2.7.2 — fixes MsgShareSubscription wire-type bug
The pinned blue-js-sdk@2.0.3 encoded MsgShareSubscriptionRequest's field 4 (bytes, cosmossdk.io/math.Int) as varint, which the chain rejected: Mismatched "*v3.MsgShareSubscriptionRequest": {TagNum: 4, GotWireType: "varint" != WantWireType: "bytes"} Confirmed by encoding a probe message with each version against the generated registry: 2.0.3: field 4 (varint): 1000000000 2.7.2: field 4 (bytes, 10 bytes): "1000000000" Bump the dep, regenerate the lock. Also revert the no-op String() wrap I added in the previous commit — the encoder now stringifies internally, so the wrap was redundant and the accompanying comment was misleading. The remaining manual workaround (snake_case + camelCase keys side by side) is unrelated to this bug and stays. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8861584 commit 7f1f0f8

3 files changed

Lines changed: 66 additions & 96 deletions

File tree

server/package-lock.json

Lines changed: 60 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@x402/evm": "^2.9.0",
1414
"@x402/express": "^2.9.0",
1515
"@x402/fetch": "^2.10.0",
16-
"blue-js-sdk": "^2.0.3",
16+
"blue-js-sdk": "^2.7.2",
1717
"dotenv": "^16.4.0",
1818
"express": "^4.18.0"
1919
},

server/src/sentinel.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ import * as sdk from 'blue-js-sdk';
2525
type EncodedMsg = { typeUrl: string; value: unknown };
2626
type BroadcastResult = { code: number; transactionHash: string; rawLog?: string };
2727

28-
// Build MsgShareSubscription manually — the SDK version has a camelCase/snake_case mismatch
29-
// between buildMsgShareSubscription (outputs acc_address) and encodeMsgShareSubscription
30-
// (reads accAddress). Field 4 (bytes) is cosmossdk.io/math.Int and must serialize as a
31-
// length-prefixed string on the wire; passing a JS number causes the encoder to emit
32-
// varint and the chain rejects with a wire-type mismatch.
28+
// Build MsgShareSubscription manually — the SDK exports buildMsgShareSubscription
29+
// with an acc_address (snake_case) shape while its internal encoder reads accAddress
30+
// (camelCase). Including both keys keeps the encoder happy regardless of which form
31+
// it consumes.
3332
function buildMsgShareSubscription(opts: {
3433
from: string; id: number; accAddress: string; bytes: number;
3534
}): EncodedMsg {
@@ -40,7 +39,7 @@ function buildMsgShareSubscription(opts: {
4039
id: opts.id,
4140
accAddress: opts.accAddress,
4241
acc_address: opts.accAddress,
43-
bytes: String(opts.bytes),
42+
bytes: opts.bytes,
4443
},
4544
};
4645
}

0 commit comments

Comments
 (0)