Skip to content

Commit ff6c96a

Browse files
committed
Fix Polygon SDK cjs compatibility
1 parent ebfcb2a commit ff6c96a

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

package-lock.json

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

packages/polygon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"type": "module",
3939
"dependencies": {
4040
"@chorus-one/signer": "^1.0.0",
41-
"@noble/curves": "^2.0.1",
41+
"@noble/curves": "^1.9.2",
4242
"viem": "^2.28.0"
4343
},
4444
"devDependencies": {

packages/polygon/src/staker.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
type Chain
1717
} from 'viem'
1818
import { mainnet, sepolia } from 'viem/chains'
19-
import { secp256k1 } from '@noble/curves/secp256k1.js'
19+
import { secp256k1 } from '@noble/curves/secp256k1'
2020
import type { Signer } from '@chorus-one/signer'
2121
import type { Transaction, PolygonNetworkConfig, PolygonTxStatus, StakeInfo, UnbondInfo } from './types'
2222
import { appendReferrerTracking } from './referrer'
@@ -75,7 +75,8 @@ export class PolygonStaker {
7575
static getAddressDerivationFn =
7676
() =>
7777
async (publicKey: Uint8Array): Promise<Array<string>> => {
78-
const pkUncompressed = secp256k1.Point.fromBytes(publicKey).toBytes(false)
78+
const point = secp256k1.Point.fromHex(publicKey)
79+
const pkUncompressed = point.toBytes(false)
7980
const hash = keccak256(pkUncompressed.subarray(1))
8081
const ethAddress = hash.slice(-40)
8182
return [ethAddress]

0 commit comments

Comments
 (0)