@lombard.finance/sdk-starknet 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.cjs.map +1 -1
- package/dist/index2.js +1 -1
- package/dist/index2.js.map +1 -1
- package/package.json +25 -3
- package/src/stories/hooks/use-connection.ts +1 -1
- package/src/tokens/lib/tokens.ts +5 -1
- package/src/utils/err.ts +2 -1
- package/src/utils/rpc-providers.ts +1 -1
- package/src/utils/signature.ts +1 -1
- package/src/wallet-functions/sign-message.stories.tsx +1 -1
- package/src/wallet-functions/sign-message.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lombard.finance/sdk-starknet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Starknet integration for the Lombard SDK - stake BTC and manage LBTC on Starknet",
|
|
4
5
|
"exports": {
|
|
5
6
|
".": {
|
|
6
7
|
"types": "./src/index.ts",
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
"types": "./src/index.ts",
|
|
14
15
|
"files": [
|
|
15
16
|
"dist",
|
|
16
|
-
"src"
|
|
17
|
+
"src",
|
|
18
|
+
"LICENSE"
|
|
17
19
|
],
|
|
18
20
|
"engines": {
|
|
19
21
|
"node": ">= 22.14.0"
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
"watch": "vite build --watch"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@lombard.finance/sdk-common": "
|
|
35
|
+
"@lombard.finance/sdk-common": "4.0.0",
|
|
34
36
|
"starknet": "~6.24.1"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
@@ -55,6 +57,26 @@
|
|
|
55
57
|
"typescript": "^5.4.5",
|
|
56
58
|
"vite": "^6.3.5"
|
|
57
59
|
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/lombard-finance/sdk.git",
|
|
63
|
+
"directory": "packages/sdk-starknet"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://docs.lombard.finance",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/lombard-finance/sdk/issues"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"lombard",
|
|
71
|
+
"sdk",
|
|
72
|
+
"starknet",
|
|
73
|
+
"bitcoin",
|
|
74
|
+
"lbtc",
|
|
75
|
+
"staking"
|
|
76
|
+
],
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public"
|
|
79
|
+
},
|
|
58
80
|
"peerDependencies": {
|
|
59
81
|
"@noble/hashes": "^1.7.2",
|
|
60
82
|
"axios": "^1",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
disconnect as starknet_disconnect,
|
|
4
4
|
} from '@starknet-io/get-starknet';
|
|
5
5
|
import { createContext, useCallback, useContext } from 'react';
|
|
6
|
-
import { defaultProvider,RpcProvider, WalletAccount } from 'starknet';
|
|
6
|
+
import { defaultProvider, RpcProvider, WalletAccount } from 'starknet';
|
|
7
7
|
|
|
8
8
|
import { StarknetChainId } from '../../utils/chains';
|
|
9
9
|
import { ERR_NO_STARKNET_WINDOW_OBJECT } from '../../utils/err';
|
package/src/tokens/lib/tokens.ts
CHANGED
|
@@ -3,7 +3,11 @@ import { Contract, TypedContractV2 } from 'starknet';
|
|
|
3
3
|
|
|
4
4
|
import { ChainParameters, StarknetChainId } from '../../utils/chains';
|
|
5
5
|
import { EnvParameters } from '../../utils/env';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ERR_CHAIN_MISMATCH,
|
|
8
|
+
ERR_NO_PROVIDER,
|
|
9
|
+
ERR_NO_TOKEN,
|
|
10
|
+
} from '../../utils/err';
|
|
7
11
|
import { getRpcProvider, ProviderParameters } from '../../utils/rpc-providers';
|
|
8
12
|
import ERC20_ABI from '../abi/ERC20_ABI';
|
|
9
13
|
import LBTC_ABI from '../abi/LBTC_ABI';
|
package/src/utils/err.ts
CHANGED
|
@@ -113,7 +113,8 @@ export const ERR_CHAIN_MISMATCH = (
|
|
|
113
113
|
: walletChainId === '0x534e5f5345504f4c4941'
|
|
114
114
|
? 'Starknet Sepolia'
|
|
115
115
|
: `unknown chain (${walletChainId})`;
|
|
116
|
-
const expectedNetwork =
|
|
116
|
+
const expectedNetwork =
|
|
117
|
+
expectedEnv === 'prod' ? 'Starknet Mainnet' : 'Starknet Sepolia';
|
|
117
118
|
return new StarknetSdkError(
|
|
118
119
|
`Wallet network mismatch: Your wallet is connected to ${walletNetwork}, but the SDK is configured for ${expectedNetwork}. Please switch your wallet to ${expectedNetwork}.`,
|
|
119
120
|
ErrorCode.CHAIN_MISMATCH,
|
|
@@ -4,7 +4,7 @@ import { StarknetChainId } from './chains';
|
|
|
4
4
|
|
|
5
5
|
const RPC_PROVIDERS = {
|
|
6
6
|
[StarknetChainId.SN_MAIN]: 'https://rpc.starknet.lava.build:443',
|
|
7
|
-
[StarknetChainId.SN_SEPOLIA]: 'https://
|
|
7
|
+
[StarknetChainId.SN_SEPOLIA]: 'https://starknet-sepolia.drpc.org',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const providers = new Map<StarknetChainId, RpcProvider>();
|
package/src/utils/signature.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function normalizeSignature(
|
|
|
28
28
|
} else if (
|
|
29
29
|
walletName === 'Keplr' ||
|
|
30
30
|
(signature.length === 5 &&
|
|
31
|
-
signature.filter(x => x.startsWith('0x')).length === 5)
|
|
31
|
+
signature.filter((x) => x.startsWith('0x')).length === 5)
|
|
32
32
|
) {
|
|
33
33
|
// Probably Keplr: [r low, r high, s low, s high, version]
|
|
34
34
|
|
|
@@ -8,7 +8,7 @@ import { functionType } from '../stories/components/decorators';
|
|
|
8
8
|
import { starknetContext } from '../stories/components/decorators/starknet-context';
|
|
9
9
|
import { useConnection } from '../stories/hooks/use-connection';
|
|
10
10
|
import useQuery from '../stories/hooks/use-query';
|
|
11
|
-
import { makeDestinationChainId,StarknetChainId } from '../utils/chains';
|
|
11
|
+
import { makeDestinationChainId, StarknetChainId } from '../utils/chains';
|
|
12
12
|
import { signMessage } from './sign-message';
|
|
13
13
|
|
|
14
14
|
const meta = {
|
|
@@ -84,14 +84,14 @@ export async function signMessage({
|
|
|
84
84
|
if (rs instanceof ec.starkCurve.Signature) {
|
|
85
85
|
const fullPubKeys = recoverFullPublicKeys(rs, hashMsg);
|
|
86
86
|
|
|
87
|
-
verifiedOffChain = fullPubKeys.map(fpk => {
|
|
87
|
+
verifiedOffChain = fullPubKeys.map((fpk) => {
|
|
88
88
|
return {
|
|
89
89
|
fullPubKey: fpk,
|
|
90
90
|
verified: typedData.verifyMessage(hashMsg, rs, fpk),
|
|
91
91
|
};
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
const tfpk = verifiedOffChain.find(x =>
|
|
94
|
+
const tfpk = verifiedOffChain.find((x) =>
|
|
95
95
|
x.fullPubKey.includes(pubKey.slice(2)),
|
|
96
96
|
);
|
|
97
97
|
if (tfpk) verifiedOffChain = [tfpk];
|