@atomiqlabs/chain-starknet 3.0.0-beta.0 → 3.0.0-beta.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.
@@ -3,7 +3,7 @@ import { StarknetFees } from "./chain/modules/StarknetFees";
3
3
  import { StarknetRetryPolicy } from "./chain/StarknetChainInterface";
4
4
  import { BaseTokenType, BitcoinNetwork, BitcoinRpc, ChainData, ChainInitializer } from "@atomiqlabs/base";
5
5
  import { StarknetChainType } from "./StarknetChainType";
6
- export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC">;
6
+ export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC">;
7
7
  export declare const StarknetAssets: StarknetAssetsType;
8
8
  export type StarknetOptions = {
9
9
  rpcUrl: string | Provider;
@@ -28,11 +28,11 @@ exports.StarknetAssets = {
28
28
  address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
29
29
  decimals: 8
30
30
  },
31
- TBTC: {
32
- address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
- decimals: 18,
34
- displayDecimals: 8
35
- }
31
+ // TBTC: {
32
+ // address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
+ // decimals: 18,
34
+ // displayDecimals: 8
35
+ // }
36
36
  };
37
37
  function initializeStarknet(options, bitcoinRpc, network) {
38
38
  const provider = typeof (options.rpcUrl) === "string" ?
@@ -122,7 +122,29 @@ class StarknetSwapInit extends StarknetSwapModule_1.StarknetSwapModule {
122
122
  throw new base_1.SignatureVerificationError("Authorization expired!");
123
123
  const valid = await this.root.Signatures.isValidSignature(signature, signer, Initialize, "Initialize", {
124
124
  "Swap hash": "0x" + swapData.getEscrowHash(),
125
- "Timeout": (0, Utils_1.toHex)(timeoutBN)
125
+ "Offerer": swapData.offerer,
126
+ "Claimer": swapData.claimer,
127
+ "Token amount": {
128
+ token_address: swapData.token,
129
+ amount: starknet_1.cairo.uint256(swapData.amount)
130
+ },
131
+ "Pay in": swapData.isPayIn(),
132
+ "Pay out": swapData.isPayOut(),
133
+ "Tracking reputation": swapData.reputation,
134
+ "Refund handler": swapData.refundHandler,
135
+ "Claim handler": swapData.claimHandler,
136
+ "Claim data": "0x" + swapData.getClaimHash(),
137
+ "Refund data": swapData.refundData.startsWith("0x") ? swapData.refundData : "0x" + swapData.refundData,
138
+ "Security deposit": {
139
+ token_address: swapData.feeToken,
140
+ amount: starknet_1.cairo.uint256(swapData.securityDeposit)
141
+ },
142
+ "Claimer bounty": {
143
+ token_address: swapData.feeToken,
144
+ amount: starknet_1.cairo.uint256(swapData.claimerBounty)
145
+ },
146
+ "Claim action hash": 0n,
147
+ "Deadline": (0, Utils_1.toHex)(timeoutBN)
126
148
  });
127
149
  if (!valid)
128
150
  throw new base_1.SignatureVerificationError("Invalid signature!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-starknet",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "Starknet specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types:": "./dist/index.d.ts",
@@ -12,7 +12,7 @@ import {StarknetSpvVaultData} from "./spv_swap/StarknetSpvVaultData";
12
12
  import {StarknetSpvWithdrawalData} from "./spv_swap/StarknetSpvWithdrawalData";
13
13
  import {RpcProviderWithRetries} from "./provider/RpcProviderWithRetries";
14
14
 
15
- export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC" | "TBTC">;
15
+ export type StarknetAssetsType = BaseTokenType<"ETH" | "STRK" | "WBTC">;
16
16
  export const StarknetAssets: StarknetAssetsType = {
17
17
  ETH: {
18
18
  address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
@@ -28,11 +28,11 @@ export const StarknetAssets: StarknetAssetsType = {
28
28
  address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
29
29
  decimals: 8
30
30
  },
31
- TBTC: {
32
- address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
- decimals: 18,
34
- displayDecimals: 8
35
- }
31
+ // TBTC: {
32
+ // address: "0x04daa17763b286d1e59b97c283C0b8C949994C361e426A28F743c67bDfE9a32f",
33
+ // decimals: 18,
34
+ // displayDecimals: 8
35
+ // }
36
36
  } as const;
37
37
 
38
38
  export type StarknetOptions = {
@@ -161,7 +161,29 @@ export class StarknetSwapInit extends StarknetSwapModule {
161
161
 
162
162
  const valid = await this.root.Signatures.isValidSignature(signature, signer, Initialize, "Initialize", {
163
163
  "Swap hash": "0x"+swapData.getEscrowHash(),
164
- "Timeout": toHex(timeoutBN)
164
+ "Offerer": swapData.offerer,
165
+ "Claimer": swapData.claimer,
166
+ "Token amount": {
167
+ token_address: swapData.token,
168
+ amount: cairo.uint256(swapData.amount)
169
+ },
170
+ "Pay in": swapData.isPayIn(),
171
+ "Pay out": swapData.isPayOut(),
172
+ "Tracking reputation": swapData.reputation,
173
+ "Refund handler": swapData.refundHandler,
174
+ "Claim handler": swapData.claimHandler,
175
+ "Claim data": "0x"+swapData.getClaimHash(),
176
+ "Refund data": swapData.refundData.startsWith("0x") ? swapData.refundData : "0x"+swapData.refundData,
177
+ "Security deposit": {
178
+ token_address: swapData.feeToken,
179
+ amount: cairo.uint256(swapData.securityDeposit)
180
+ },
181
+ "Claimer bounty": {
182
+ token_address: swapData.feeToken,
183
+ amount: cairo.uint256(swapData.claimerBounty)
184
+ },
185
+ "Claim action hash": 0n,
186
+ "Deadline": toHex(timeoutBN)
165
187
  });
166
188
 
167
189
  if(!valid) throw new SignatureVerificationError("Invalid signature!");