@openfort/openfort-node 0.7.5 → 0.7.7

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/openapi.json CHANGED
@@ -4294,176 +4294,6 @@
4294
4294
  "type": "object",
4295
4295
  "additionalProperties": false
4296
4296
  },
4297
- "TradeType": {
4298
- "enum": ["EXACT_INPUT", "EXACT_OUTPUT"],
4299
- "type": "string"
4300
- },
4301
- "CreateExchangeRequest": {
4302
- "properties": {
4303
- "chainId": {
4304
- "type": "integer",
4305
- "format": "int32",
4306
- "description": "The chain ID. Must be a [supported chain](/development/chains).",
4307
- "example": 80002
4308
- },
4309
- "fromAddress": {
4310
- "type": "string",
4311
- "description": "The public address that will sign and submit the transaction. If you provide one of a `pla_...` or `acc_...` it will be converted to the corresponding address.",
4312
- "example": "0x680d2719F09B23F644c136Ab7336D42b6a76AdcC"
4313
- },
4314
- "tokenInAddress": {
4315
- "type": "string",
4316
- "description": "Token address or 'native' to sell",
4317
- "example": "0x008518e76FAD03f592Bbb7E394C762d5FD54cb97"
4318
- },
4319
- "tokenOutAddress": {
4320
- "type": "string",
4321
- "description": "Token address or 'native' to buy",
4322
- "example": "0xF65B6f9c94187276C7d91F4F74134751d248bFeA"
4323
- },
4324
- "amount": {
4325
- "type": "string",
4326
- "description": "Amount in the smallest unit of the token",
4327
- "example": "100000"
4328
- },
4329
- "tradeType": {
4330
- "$ref": "#/components/schemas/TradeType",
4331
- "description": "The type of trade, exact input or exact output",
4332
- "example": "EXACT_INPUT"
4333
- },
4334
- "slippagePercent": {
4335
- "type": "number",
4336
- "format": "double",
4337
- "description": "The percentage of slippage tolerance. Default = 0.1. Max = 50. Min = 0",
4338
- "example": 20
4339
- },
4340
- "maxHops": {
4341
- "type": "number",
4342
- "format": "double",
4343
- "description": "Maximum hops allowed in optimal route. Default is 2",
4344
- "example": 2
4345
- },
4346
- "deadline": {
4347
- "type": "number",
4348
- "format": "double",
4349
- "description": "Latest time swap can execute. Default is 15 minutes",
4350
- "example": 15
4351
- },
4352
- "policy": {
4353
- "type": "string",
4354
- "description": "ID of the Policy that defines the gas sponsorship strategy (starts with `pol_`). If no Policy is provided, the own Account native token funds will be used to pay for gas.",
4355
- "example": "pol_7e07ae30-2a4d-48fa-803f-361da94905dd"
4356
- },
4357
- "optimistic": {
4358
- "type": "boolean",
4359
- "description": "Set to `true` to indicate that the transactionIntent request should be resolved as soon as possible, after the transactionIntent is created and simulated and before it arrives on chain.",
4360
- "example": true
4361
- }
4362
- },
4363
- "required": [
4364
- "chainId",
4365
- "fromAddress",
4366
- "tokenInAddress",
4367
- "tokenOutAddress",
4368
- "amount",
4369
- "tradeType"
4370
- ],
4371
- "type": "object",
4372
- "additionalProperties": false
4373
- },
4374
- "Token": {
4375
- "properties": {
4376
- "name": {
4377
- "type": "string"
4378
- },
4379
- "symbol": {
4380
- "type": "string"
4381
- },
4382
- "decimals": {
4383
- "type": "number",
4384
- "format": "double"
4385
- },
4386
- "address": {
4387
- "type": "string"
4388
- },
4389
- "chainId": {
4390
- "type": "number",
4391
- "format": "double"
4392
- }
4393
- },
4394
- "required": ["decimals", "address", "chainId"],
4395
- "type": "object",
4396
- "description": "Type representing a token"
4397
- },
4398
- "Amount": {
4399
- "properties": {
4400
- "value": {
4401
- "type": "string"
4402
- },
4403
- "token": {
4404
- "$ref": "#/components/schemas/Token"
4405
- }
4406
- },
4407
- "required": ["value", "token"],
4408
- "type": "object",
4409
- "description": "Interface representing a token amount"
4410
- },
4411
- "Fee": {
4412
- "properties": {
4413
- "amount": {
4414
- "$ref": "#/components/schemas/Amount"
4415
- },
4416
- "basisPoints": {
4417
- "type": "number",
4418
- "format": "double"
4419
- },
4420
- "recipient": {
4421
- "type": "string"
4422
- }
4423
- },
4424
- "required": ["amount", "basisPoints", "recipient"],
4425
- "type": "object",
4426
- "description": "Type representing the fees returned in the quote"
4427
- },
4428
- "QuoteExchangeResult": {
4429
- "properties": {
4430
- "amount": {
4431
- "$ref": "#/components/schemas/Amount"
4432
- },
4433
- "amountWithMaxSlippage": {
4434
- "$ref": "#/components/schemas/Amount"
4435
- },
4436
- "slippage": {
4437
- "type": "number",
4438
- "format": "double"
4439
- },
4440
- "fees": {
4441
- "items": {
4442
- "$ref": "#/components/schemas/Fee"
4443
- },
4444
- "type": "array"
4445
- },
4446
- "estimatedTXGasFee": {
4447
- "type": "string"
4448
- },
4449
- "estimatedTXGasFeeUSD": {
4450
- "type": "string"
4451
- },
4452
- "estimatedTXGasFeeToken": {
4453
- "type": "string"
4454
- }
4455
- },
4456
- "required": [
4457
- "amount",
4458
- "amountWithMaxSlippage",
4459
- "slippage",
4460
- "fees",
4461
- "estimatedTXGasFee",
4462
- "estimatedTXGasFeeUSD"
4463
- ],
4464
- "type": "object",
4465
- "additionalProperties": false
4466
- },
4467
4297
  "APITopic.BALANCE_CONTRACT": {
4468
4298
  "enum": ["balance.contract"],
4469
4299
  "type": "string"
@@ -5761,6 +5591,30 @@
5761
5591
  "type": "object",
5762
5592
  "additionalProperties": false
5763
5593
  },
5594
+ "EntityType.WALLET": {
5595
+ "enum": ["wallet"],
5596
+ "type": "string"
5597
+ },
5598
+ "BaseEntityResponse_EntityType.WALLET_": {
5599
+ "properties": {
5600
+ "id": {
5601
+ "type": "string"
5602
+ },
5603
+ "object": {
5604
+ "$ref": "#/components/schemas/EntityType.WALLET"
5605
+ },
5606
+ "createdAt": {
5607
+ "type": "integer",
5608
+ "format": "int32"
5609
+ }
5610
+ },
5611
+ "required": ["id", "object", "createdAt"],
5612
+ "type": "object",
5613
+ "additionalProperties": false
5614
+ },
5615
+ "WalletResponse": {
5616
+ "$ref": "#/components/schemas/BaseEntityResponse_EntityType.WALLET_"
5617
+ },
5764
5618
  "BaseDeleteEntityResponse_EntityType.PLAYER_": {
5765
5619
  "properties": {
5766
5620
  "id": {
@@ -5844,9 +5698,6 @@
5844
5698
  "id": {
5845
5699
  "type": "string"
5846
5700
  },
5847
- "user": {
5848
- "type": "string"
5849
- },
5850
5701
  "wallet": {
5851
5702
  "type": "string"
5852
5703
  },
@@ -5892,11 +5743,14 @@
5892
5743
  "recoveryShare": {
5893
5744
  "type": "string",
5894
5745
  "description": "The recovery share for the user's embedded signer.\nThis should be stored securely and provided to the user for account recovery."
5746
+ },
5747
+ "user": {
5748
+ "type": "string",
5749
+ "description": "User uuid"
5895
5750
  }
5896
5751
  },
5897
5752
  "required": [
5898
5753
  "id",
5899
- "user",
5900
5754
  "wallet",
5901
5755
  "accountType",
5902
5756
  "address",
@@ -5904,7 +5758,8 @@
5904
5758
  "createdAt",
5905
5759
  "updatedAt",
5906
5760
  "custody",
5907
- "recoveryShare"
5761
+ "recoveryShare",
5762
+ "user"
5908
5763
  ],
5909
5764
  "type": "object",
5910
5765
  "additionalProperties": false
@@ -6576,9 +6431,6 @@
6576
6431
  "id": {
6577
6432
  "type": "string"
6578
6433
  },
6579
- "user": {
6580
- "type": "string"
6581
- },
6582
6434
  "wallet": {
6583
6435
  "type": "string"
6584
6436
  },
@@ -6624,7 +6476,6 @@
6624
6476
  },
6625
6477
  "required": [
6626
6478
  "id",
6627
- "user",
6628
6479
  "wallet",
6629
6480
  "accountType",
6630
6481
  "address",
@@ -15330,226 +15181,6 @@
15330
15181
  ]
15331
15182
  }
15332
15183
  },
15333
- "/v1/exchange": {
15334
- "post": {
15335
- "operationId": "CreateSwap",
15336
- "responses": {
15337
- "200": {
15338
- "description": "OK.",
15339
- "content": {
15340
- "application/json": {
15341
- "schema": {
15342
- "$ref": "#/components/schemas/TransactionIntentResponse"
15343
- },
15344
- "examples": {
15345
- "Example 1": {
15346
- "value": {
15347
- "id": "tin_c502d628-5bb3-42f2-b8f5-62ba4d71df3a",
15348
- "createdAt": 1689869074,
15349
- "object": "transactionIntent",
15350
- "details": {
15351
- "userOperationHash": "0x25d3...005c",
15352
- "userOperation": {
15353
- "sender": "0x48930Cd730652bf0B18Ef8c80cD0Fa1Cc72A233E",
15354
- "nonce": "0x2",
15355
- "initCode": "0x",
15356
- "callData": "0xb61d...0000",
15357
- "callGasLimit": "0x27863",
15358
- "verificationGasLimit": "0x16001",
15359
- "preVerificationGas": "0xb818",
15360
- "maxFeePerGas": "0x62590091",
15361
- "maxPriorityFeePerGas": "0x62590091",
15362
- "paymasterAndData": "0x3210...b51c",
15363
- "signature": "0x6202...3d1b"
15364
- }
15365
- },
15366
- "chainId": 80002,
15367
- "abstractionType": "accountAbstractionV6",
15368
- "updatedAt": 1689869074,
15369
- "policy": {
15370
- "id": "pol_..."
15371
- },
15372
- "player": {
15373
- "id": "pla_..."
15374
- },
15375
- "account": {
15376
- "id": "acc_..."
15377
- },
15378
- "response": {
15379
- "createdAt": 1689869074,
15380
- "logs": [
15381
- {
15382
- "removed": false,
15383
- "transactionIndex": 0,
15384
- "blockNumber": 44904492,
15385
- "transactionHash": "0x25d3...005c",
15386
- "address": "0x5FF1...2789",
15387
- "topics": ["0xbb47...f972"],
15388
- "data": "0x",
15389
- "logIndex": 0,
15390
- "blockHash": "0x8a69...6d59"
15391
- }
15392
- ],
15393
- "blockNumber": 8789286,
15394
- "transactionHash": "0x25d3...005c",
15395
- "to": "0x0576...1B57",
15396
- "gasUsed": "336730",
15397
- "status": 1
15398
- },
15399
- "interactions": [
15400
- {
15401
- "functionName": "mint",
15402
- "contract": "con_...",
15403
- "functionArgs": ["0x63B7...484f"]
15404
- }
15405
- ],
15406
- "transitions": [
15407
- {
15408
- "fromStatus": "none",
15409
- "toStatus": "new",
15410
- "at": 1750154762
15411
- },
15412
- {
15413
- "fromStatus": "new",
15414
- "toStatus": "sent",
15415
- "at": 1750154762
15416
- },
15417
- {
15418
- "fromStatus": "sent",
15419
- "toStatus": "indexed",
15420
- "at": 1750154762
15421
- }
15422
- ]
15423
- }
15424
- }
15425
- }
15426
- }
15427
- }
15428
- },
15429
- "400": {
15430
- "description": "Bad Request.",
15431
- "content": {
15432
- "application/json": {
15433
- "schema": {
15434
- "$ref": "#/components/schemas/InvalidRequestErrorResponse"
15435
- }
15436
- }
15437
- }
15438
- }
15439
- },
15440
- "description": "Creates token swap.",
15441
- "summary": "Create token swap.",
15442
- "tags": ["Exchange"],
15443
- "security": [
15444
- {
15445
- "sk": []
15446
- }
15447
- ],
15448
- "parameters": [],
15449
- "requestBody": {
15450
- "required": true,
15451
- "content": {
15452
- "application/json": {
15453
- "schema": {
15454
- "$ref": "#/components/schemas/CreateExchangeRequest"
15455
- }
15456
- }
15457
- }
15458
- }
15459
- }
15460
- },
15461
- "/v1/exchange/quote": {
15462
- "post": {
15463
- "operationId": "QuoteSwap",
15464
- "responses": {
15465
- "200": {
15466
- "description": "OK.",
15467
- "content": {
15468
- "application/json": {
15469
- "schema": {
15470
- "$ref": "#/components/schemas/QuoteExchangeResult"
15471
- },
15472
- "examples": {
15473
- "Example 1": {
15474
- "value": {
15475
- "amount": {
15476
- "token": {
15477
- "address": "0x008518e76FAD03f592Bbb7E394C762d5FD54cb97",
15478
- "chainId": 4337,
15479
- "decimals": 18,
15480
- "name": "TOKEN",
15481
- "symbol": "TKN"
15482
- },
15483
- "value": "1000000000000000000"
15484
- },
15485
- "slippage": 0.5,
15486
- "fees": [
15487
- {
15488
- "recipient": "0x008518e76FAD03f592Bbb7E394C762d5FD54cb97",
15489
- "basisPoints": 100,
15490
- "amount": {
15491
- "token": {
15492
- "address": "0x008518e76FAD03f592Bbb7E394C762d5FD54cb97",
15493
- "chainId": 4337,
15494
- "decimals": 18,
15495
- "name": "TOKEN",
15496
- "symbol": "TKN"
15497
- },
15498
- "value": "1000000000000000000"
15499
- }
15500
- }
15501
- ],
15502
- "amountWithMaxSlippage": {
15503
- "token": {
15504
- "address": "0x008518e76FAD03f592Bbb7E394C762d5FD54cb97",
15505
- "chainId": 4337,
15506
- "decimals": 18,
15507
- "name": "TOKEN",
15508
- "symbol": "TKN"
15509
- },
15510
- "value": "1000000000000000000"
15511
- },
15512
- "estimatedTXGasFee": "1000000000000000000",
15513
- "estimatedTXGasFeeToken": "12000",
15514
- "estimatedTXGasFeeUSD": "1"
15515
- }
15516
- }
15517
- }
15518
- }
15519
- }
15520
- },
15521
- "400": {
15522
- "description": "Bad Request.",
15523
- "content": {
15524
- "application/json": {
15525
- "schema": {
15526
- "$ref": "#/components/schemas/InvalidRequestErrorResponse"
15527
- }
15528
- }
15529
- }
15530
- }
15531
- },
15532
- "description": "Quote token swap.",
15533
- "summary": "Quote token swap.",
15534
- "tags": ["Exchange"],
15535
- "security": [
15536
- {
15537
- "sk": []
15538
- }
15539
- ],
15540
- "parameters": [],
15541
- "requestBody": {
15542
- "required": true,
15543
- "content": {
15544
- "application/json": {
15545
- "schema": {
15546
- "$ref": "#/components/schemas/CreateExchangeRequest"
15547
- }
15548
- }
15549
- }
15550
- }
15551
- }
15552
- },
15553
15184
  "/v1/events": {
15554
15185
  "get": {
15555
15186
  "operationId": "GetEvents",
@@ -17605,6 +17236,59 @@
17605
17236
  ]
17606
17237
  }
17607
17238
  },
17239
+ "/v2/users/{id}/wallet": {
17240
+ "get": {
17241
+ "operationId": "GetUserWallet",
17242
+ "responses": {
17243
+ "200": {
17244
+ "description": "Successful response.",
17245
+ "content": {
17246
+ "application/json": {
17247
+ "schema": {
17248
+ "$ref": "#/components/schemas/WalletResponse"
17249
+ },
17250
+ "examples": {
17251
+ "Example 1": {
17252
+ "value": {
17253
+ "id": "pla_00000000-0000-0000-0000-000000000000",
17254
+ "object": "wallet",
17255
+ "createdAt": 1689869074
17256
+ }
17257
+ }
17258
+ }
17259
+ }
17260
+ }
17261
+ },
17262
+ "401": {
17263
+ "description": "Error response."
17264
+ },
17265
+ "404": {
17266
+ "description": "User not found."
17267
+ }
17268
+ },
17269
+ "description": "Retrieves the wallet associated with an authenticated user.",
17270
+ "summary": "Get wallet for user.",
17271
+ "tags": ["Users"],
17272
+ "security": [
17273
+ {
17274
+ "sk": []
17275
+ },
17276
+ {
17277
+ "user_project": []
17278
+ }
17279
+ ],
17280
+ "parameters": [
17281
+ {
17282
+ "in": "path",
17283
+ "name": "id",
17284
+ "required": true,
17285
+ "schema": {
17286
+ "type": "string"
17287
+ }
17288
+ }
17289
+ ]
17290
+ }
17291
+ },
17608
17292
  "/v2/users/pregenerate": {
17609
17293
  "post": {
17610
17294
  "operationId": "pregenerateUserV2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/openfort-node",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Openfort Node SDK",
5
5
  "author": "Openfort",
6
6
  "repository": {
@@ -1,5 +1,6 @@
1
1
  overrides:
2
2
  '@orval/core@<7.19.0': '>=7.19.0'
3
+ '@orval/core@>=7.19.0 <7.21.0': '>=7.21.0'
3
4
  '@orval/core@>=8.0.0-rc.0 <8.0.2': '>=8.0.2'
4
5
  '@orval/mcp@<7.18.0': '>=7.18.0'
5
6
  '@orval/mock@<7.20.0': '>=7.20.0'
@@ -1,50 +0,0 @@
1
- // Usage: npx tsx exchange/createSwap.ts
2
-
3
- import Openfort from "@openfort/openfort-node";
4
- import "dotenv/config";
5
-
6
- const openfort = new Openfort(process.env.OPENFORT_API_KEY!, {
7
- basePath: process.env.OPENFORT_BASE_URL,
8
- });
9
-
10
- const chainId = 84532; // Should be the chain which supports swaps
11
-
12
- // Create an account (V1 legacy API)
13
- const account = await openfort.accounts.v1.create({
14
- chainId,
15
- });
16
-
17
- // Create a policy for the swap
18
- const policy = await openfort.policies.create({
19
- name: `SwapPolicy-${Date.now()}`,
20
- chainId,
21
- strategy: {
22
- sponsorSchema: "pay_for_user",
23
- },
24
- });
25
-
26
- await openfort.policyRules.create({
27
- type: "account_functions",
28
- policy: policy.id,
29
- });
30
-
31
- console.log("Account address:", account.address);
32
- console.log("Policy ID:", policy.id);
33
- console.log("Account ID:", account.id);
34
-
35
- // Create a swap transaction
36
- // Note: Token addresses and amounts will vary by network
37
- // The account must have sufficient balance for the swap
38
- const swap = await openfort.exchange.createSwap({
39
- fromAddress: account.id,
40
- chainId,
41
- tokenInAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native token
42
- tokenOutAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC
43
- amount: "1000000000000000", // 0.001 native token
44
- tradeType: "EXACT_INPUT",
45
- policy: policy.id,
46
- });
47
-
48
- console.log("\nSwap created:");
49
- console.log(" Transaction Intent ID:", swap.id);
50
- console.log(" Status:", swap.response?.status || "pending");
@@ -1,34 +0,0 @@
1
- // Usage: npx tsx exchange/quoteSwap.ts
2
-
3
- import Openfort from "@openfort/openfort-node";
4
- import "dotenv/config";
5
-
6
- const openfort = new Openfort(process.env.OPENFORT_API_KEY!, {
7
- basePath: process.env.OPENFORT_BASE_URL,
8
- });
9
-
10
- const chainId = Number(process.env.CHAIN_ID) || 80002;
11
-
12
- // Create an account (V1 legacy API)
13
- const account = await openfort.accounts.v1.create({
14
- chainId,
15
- });
16
-
17
- console.log("Account address:", account.address);
18
-
19
- // Get a quote for swapping tokens
20
- // Note: Token addresses and amounts will vary by network
21
- const quote = await openfort.exchange.quoteSwap({
22
- fromAddress: account.id,
23
- chainId,
24
- tokenInAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native token (ETH/MATIC)
25
- tokenOutAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC on Polygon
26
- amount: "1000000000000000", // 0.001 native token
27
- tradeType: "EXACT_INPUT",
28
- });
29
-
30
- console.log("\nSwap quote:");
31
- console.log(" Amount:", quote.amount);
32
- console.log(" Slippage:", quote.slippage);
33
- console.log(" Estimated Gas Fee:", quote.estimatedTXGasFee);
34
- console.log(" Estimated Gas Fee (USD):", quote.estimatedTXGasFeeUSD);