@wuwei-labs/srsly 2.0.0-beta.26 → 2.0.0-beta.28

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.
Files changed (72) hide show
  1. package/README.md +189 -97
  2. package/dist/cjs/contract/close.js +33 -24
  3. package/dist/cjs/contract/close.js.map +1 -1
  4. package/dist/cjs/contract/create.js +67 -52
  5. package/dist/cjs/contract/create.js.map +1 -1
  6. package/dist/cjs/package.json +2 -13
  7. package/dist/cjs/rental/accept.js +35 -29
  8. package/dist/cjs/rental/accept.js.map +1 -1
  9. package/dist/cjs/rental/cancel.js +13 -9
  10. package/dist/cjs/rental/cancel.js.map +1 -1
  11. package/dist/cjs/rental/close.js +15 -11
  12. package/dist/cjs/rental/close.js.map +1 -1
  13. package/dist/cjs/rental/reset.js +20 -17
  14. package/dist/cjs/rental/reset.js.map +1 -1
  15. package/dist/cjs/utils/config.js +0 -88
  16. package/dist/cjs/utils/config.js.map +1 -1
  17. package/dist/cjs/utils/index.js +1 -0
  18. package/dist/cjs/utils/index.js.map +1 -1
  19. package/dist/cjs/utils/instruction-converter.js +49 -0
  20. package/dist/cjs/utils/instruction-converter.js.map +1 -0
  21. package/dist/esm/contract/close.js +34 -25
  22. package/dist/esm/contract/close.js.map +1 -1
  23. package/dist/esm/contract/create.js +67 -51
  24. package/dist/esm/contract/create.js.map +1 -1
  25. package/dist/esm/package.json +2 -13
  26. package/dist/esm/rental/accept.js +36 -30
  27. package/dist/esm/rental/accept.js.map +1 -1
  28. package/dist/esm/rental/cancel.js +13 -9
  29. package/dist/esm/rental/cancel.js.map +1 -1
  30. package/dist/esm/rental/close.js +15 -11
  31. package/dist/esm/rental/close.js.map +1 -1
  32. package/dist/esm/rental/reset.js +22 -19
  33. package/dist/esm/rental/reset.js.map +1 -1
  34. package/dist/esm/utils/config.js +0 -88
  35. package/dist/esm/utils/config.js.map +1 -1
  36. package/dist/esm/utils/index.js +1 -0
  37. package/dist/esm/utils/index.js.map +1 -1
  38. package/dist/esm/utils/instruction-converter.js +45 -0
  39. package/dist/esm/utils/instruction-converter.js.map +1 -0
  40. package/dist/types/contract/close.d.ts +12 -11
  41. package/dist/types/contract/close.d.ts.map +1 -1
  42. package/dist/types/contract/create.d.ts +49 -65
  43. package/dist/types/contract/create.d.ts.map +1 -1
  44. package/dist/types/rental/accept.d.ts +32 -28
  45. package/dist/types/rental/accept.d.ts.map +1 -1
  46. package/dist/types/rental/cancel.d.ts +16 -12
  47. package/dist/types/rental/cancel.d.ts.map +1 -1
  48. package/dist/types/rental/close.d.ts +16 -13
  49. package/dist/types/rental/close.d.ts.map +1 -1
  50. package/dist/types/rental/reset.d.ts +19 -16
  51. package/dist/types/rental/reset.d.ts.map +1 -1
  52. package/dist/types/utils/config.d.ts +0 -95
  53. package/dist/types/utils/config.d.ts.map +1 -1
  54. package/dist/types/utils/index.d.ts +1 -0
  55. package/dist/types/utils/index.d.ts.map +1 -1
  56. package/dist/types/utils/instruction-converter.d.ts +76 -0
  57. package/dist/types/utils/instruction-converter.d.ts.map +1 -0
  58. package/dist/types/utils/types.d.ts +0 -8
  59. package/dist/types/utils/types.d.ts.map +1 -1
  60. package/package.json +2 -13
  61. package/dist/cjs/utils/pack-functions.js +0 -148
  62. package/dist/cjs/utils/pack-functions.js.map +0 -1
  63. package/dist/cjs/utils/solana-adapter.js +0 -120
  64. package/dist/cjs/utils/solana-adapter.js.map +0 -1
  65. package/dist/esm/utils/pack-functions.js +0 -110
  66. package/dist/esm/utils/pack-functions.js.map +0 -1
  67. package/dist/esm/utils/solana-adapter.js +0 -82
  68. package/dist/esm/utils/solana-adapter.js.map +0 -1
  69. package/dist/types/utils/pack-functions.d.ts +0 -18
  70. package/dist/types/utils/pack-functions.d.ts.map +0 -1
  71. package/dist/types/utils/solana-adapter.d.ts +0 -26
  72. package/dist/types/utils/solana-adapter.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { getModule, createConfigSelector } from '../utils/config';
2
2
  import { getSageGameId, ATLAS_TO_STARDUST, toAddress } from '../utils/constants';
3
- import { deriveGameAccounts, } from '../utils';
3
+ import { deriveGameAccounts } from '../utils';
4
+ import { createFluentInstruction, createFluentConfigSelector } from '../utils/instruction-converter';
4
5
  /**
5
6
  * Internal function to accept a rental instruction with configuration options
6
7
  */
@@ -16,16 +17,16 @@ async function _acceptRental(params, config) {
16
17
  config);
17
18
  // Let codama derive the rest (rentalThread, rentalState, rentalAuthority, etc.)
18
19
  const input = {
19
- borrower,
20
- borrowerProfile: toAddress(borrowerProfile),
21
- borrowerProfileFaction: profileFaction,
22
- fleet: toAddress(fleet),
23
- contract: toAddress(contract),
24
- gameId: actualGameId,
25
- starbase,
26
- starbasePlayer,
27
- amount,
28
- duration,
20
+ borrower, // Pass as-is (string or signer)
21
+ borrowerProfile: toAddress(borrowerProfile), // Ensure string
22
+ borrowerProfileFaction: profileFaction, // Already string from deriveGameAccounts
23
+ fleet: toAddress(fleet), // Ensure string
24
+ contract: toAddress(contract), // Ensure string
25
+ gameId: actualGameId, // Already string
26
+ starbase, // Already string from deriveGameAccounts
27
+ starbasePlayer, // Already string from deriveGameAccounts
28
+ amount, // BigInt value
29
+ duration, // BigInt value
29
30
  referralTokenAccount: referralTokenAccount ? toAddress(referralTokenAccount) : undefined,
30
31
  };
31
32
  // Get network-specific codama functions from centralized config
@@ -33,51 +34,56 @@ async function _acceptRental(params, config) {
33
34
  const programsModule = getModule('programs');
34
35
  const { getAcceptRentalInstructionAsync } = instructionsModule;
35
36
  const { SRSLY_PROGRAM_ADDRESS } = programsModule;
36
- return getAcceptRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
37
+ const rawInstruction = await getAcceptRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
38
+ return createFluentInstruction(rawInstruction);
37
39
  }
38
40
  /**
39
41
  * Creates an instruction to accept a rental with fluent configuration.
40
42
  *
41
43
  * @example
42
44
  * ```typescript
43
- * // Use devnet defaults
44
- * const ix = await acceptRental({
45
- * borrower: wallet,
46
- * borrowerProfile: profileAddress,
47
- * borrowerFaction: 1, // 1 = mud, 2 = oni, 3 = ustur
48
- * fleet: fleetAddress,
49
- * contract: contractAddress,
50
- * rate: 1000, // ATLAS tokens
51
- * duration: 86400 // 1 day in seconds (total: 1000 * 86400 * 100M stardust)
45
+ * // Works with any library - just use strings for addresses!
46
+ * const instruction = await acceptRental({
47
+ * borrower: wallet, // Can be signer object or string
48
+ * borrowerProfile: "ProfileAddr...", // String address
49
+ * borrowerFaction: 1, // 1 = mud, 2 = oni, 3 = ustur
50
+ * fleet: "FleetAddress123...", // String address
51
+ * contract: "ContractAddr...", // String address
52
+ * rate: 1000, // ATLAS tokens
53
+ * duration: 86400 // 1 day in seconds (total: 1000 * 86400 * 100M stardust)
52
54
  * });
53
55
  *
54
56
  * // With referral (referrer gets 5% of platform fees)
55
- * const ix = await acceptRental({
57
+ * const instruction = await acceptRental({
56
58
  * borrower: wallet,
57
- * borrowerProfile: profileAddress,
59
+ * borrowerProfile: "ProfileAddr...",
58
60
  * borrowerFaction: 1,
59
- * fleet: fleetAddress,
60
- * contract: contractAddress,
61
+ * fleet: "FleetAddress123...",
62
+ * contract: "ContractAddr...",
61
63
  * rate: 1000,
62
64
  * duration: 86400,
63
- * referralTokenAccount: referrerTokenAddress
65
+ * referralTokenAccount: "ReferralAddr..."
64
66
  * });
65
67
  *
66
68
  * // Use mainnet configuration
67
- * const ix = await acceptRental(params).set({ network: 'mainnet' });
69
+ * const instruction = await acceptRental(params).set({ programs: 'mainnet' });
68
70
  *
69
71
  * // Override specific constants
70
- * const ix = await acceptRental(params).set({
71
- * network: 'mainnet',
72
+ * const instruction = await acceptRental(params).set({
73
+ * programs: 'mainnet',
72
74
  * gameId: 'custom-game-id...'
73
75
  * });
76
+ *
77
+ * // Use the instruction with your preferred Solana library
78
+ * // instruction is compatible with both @solana/kit and @solana/web3.js
74
79
  * ```
75
80
  *
76
81
  * @param params The simplified parameters for accepting a rental
77
82
  * @returns A ConfigSelector that can be configured with .set() or awaited directly
78
83
  */
79
84
  export function acceptRental(params) {
80
- return createConfigSelector((config) => _acceptRental(params, config));
85
+ const baseSelector = createConfigSelector((config) => _acceptRental(params, config));
86
+ return createFluentConfigSelector(baseSelector);
81
87
  }
82
88
  export function getAcceptRentalInstructionAsync(input, options) {
83
89
  return createConfigSelector(async (config) => {
@@ -1 +1 @@
1
- {"version":3,"file":"accept.js","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMjF,OAAO,EACL,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAuDlB;;GAEG;AACH,KAAK,UAAU,aAAa,CAC1B,MAA0B,EAC1B,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,eAAe,EACf,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,oBAAoB,GACrB,GAAG,MAAM,CAAC;IAEX,sFAAsF;IACtF,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9E,oDAAoD;IACpD,4EAA4E;IAC5E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAE3E,oCAAoC;IACpC,MAAM,EACJ,cAAc,EACd,QAAQ,EACR,cAAc,EACf,GAAG,MAAM,kBAAkB,CAC1B,SAAS,CAAC,eAAe,CAAC,EAC1B,eAAe,EACf,YAAY,EACZ,CAAC,EAAE,gBAAgB;IACnB,MAAM,CACP,CAAC;IAEF,gFAAgF;IAChF,M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@@ -1,4 +1,5 @@
1
1
  import { getModule, createConfigSelector } from '../utils/config';
2
+ import { toAddress } from '../utils/constants';
2
3
  /**
3
4
  * Internal function to cancel a rental instruction with configuration options
4
5
  */
@@ -6,8 +7,8 @@ async function _cancelRental(params, config) {
6
7
  const { borrower, contract, } = params;
7
8
  // Let codama derive all the optional accounts
8
9
  const input = {
9
- borrower,
10
- contract,
10
+ borrower, // Pass as-is (string or signer)
11
+ contract: toAddress(contract), // Ensure string
11
12
  };
12
13
  // Get network-specific codama functions from centralized config
13
14
  const instructionsModule = getModule('instructions');
@@ -21,20 +22,23 @@ async function _cancelRental(params, config) {
21
22
  *
22
23
  * @example
23
24
  * ```typescript
24
- * // Use devnet defaults
25
- * const ix = await cancelRental({
26
- * borrower: wallet,
27
- * contract: contractAddress
25
+ * // Works with any library - just use strings for addresses!
26
+ * const instruction = await cancelRental({
27
+ * borrower: wallet, // Can be signer object or string
28
+ * contract: "ContractAddr..." // String address
28
29
  * });
29
30
  *
30
31
  * // Use mainnet configuration
31
- * const ix = await cancelRental(params).set({ network: 'mainnet' });
32
+ * const instruction = await cancelRental(params).set({ programs: 'mainnet' });
32
33
  *
33
34
  * // Override specific constants
34
- * const ix = await cancelRental(params).set({
35
- * network: 'mainnet',
35
+ * const instruction = await cancelRental(params).set({
36
+ * programs: 'mainnet',
36
37
  * sageProgramAddress: 'custom...'
37
38
  * });
39
+ *
40
+ * // Use the instruction with your preferred Solana library
41
+ * // instruction is compatible with both @solana/kit and @solana/web3.js
38
42
  * ```
39
43
  *
40
44
  * @param params The simplified parameters for canceling a rental
@@ -1 +1 @@
1
- {"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAoB3G;;GAEG;AACH,KAAK,UAAU,aAAa,CAC1B,MAA0B,EAC1B,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,QA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AC9C,MAAM,KAAK,GAAG;QACZ,QAAQ,EAAqB,gCAAgC;QAC7D,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB;KAChD,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,+BAA+B,EAAE,GAAG,kBAAkB,CAAC;IAC/D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,OAAO,+BAA+B,CACpC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAU,EAAE,OAAa;IACvE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,+BAA+B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { getModule, createConfigSelector } from '../utils/config';
2
+ import { toAddress } from '../utils/constants';
2
3
  /**
3
4
  * Internal function to close a rental instruction with configuration options
4
5
  */
@@ -6,9 +7,9 @@ async function _closeRental(params, config) {
6
7
  const { borrower, ownerTokenAccount, contract, } = params;
7
8
  // Let codama derive the optional accounts
8
9
  const input = {
9
- borrower,
10
- ownerTokenAccount,
11
- contract,
10
+ borrower: toAddress(borrower), // Ensure string
11
+ ownerTokenAccount: toAddress(ownerTokenAccount), // Ensure string
12
+ contract: toAddress(contract), // Ensure string
12
13
  };
13
14
  // Get network-specific codama functions from centralized config
14
15
  const instructionsModule = getModule('instructions');
@@ -22,21 +23,24 @@ async function _closeRental(params, config) {
22
23
  *
23
24
  * @example
24
25
  * ```typescript
25
- * // Use devnet defaults
26
- * const ix = await closeRental({
27
- * borrower: borrowerAddress,
28
- * ownerTokenAccount: ownerTokenAccountAddress,
29
- * contract: contractAddress
26
+ * // Works with any library - just use strings for addresses!
27
+ * const instruction = await closeRental({
28
+ * borrower: "BorrowerAddr...", // String address
29
+ * ownerTokenAccount: "TokenAcct...", // String address
30
+ * contract: "ContractAddr..." // String address
30
31
  * });
31
32
  *
32
33
  * // Use mainnet configuration
33
- * const ix = await closeRental(params).set({ network: 'mainnet' });
34
+ * const instruction = await closeRental(params).set({ programs: 'mainnet' });
34
35
  *
35
36
  * // Override specific constants
36
- * const ix = await closeRental(params).set({
37
- * network: 'mainnet',
37
+ * const instruction = await closeRental(params).set({
38
+ * programs: 'mainnet',
38
39
  * sageProgramAddress: 'custom...'
39
40
  * });
41
+ *
42
+ * // Use the instruction with your preferred Solana library
43
+ * // instruction is compatible with both @solana/kit and @solana/web3.js
40
44
  * ```
41
45
  *
42
46
  * @param params The simplified parameters for closing a rental
@@ -1 +1 @@
1
- {"version":3,"file":"close.js","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAyB3G;;GAEG;AACH,KAAK,UAAU,YAAY,CACzB,MAAyB,EACzB,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,iBAAiB,EACjB,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,0CAA0C;IAC1C,MAAM,KAAK,GAAG;QACZ,QAAQ;QACR,iBAAiB;QACjB,QAAQ;KACT,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAA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QACjE,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAe,gBAAgB;KAC7D,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,8BAA8B,EAAE,GAAG,kBAAkB,CAAC;IAC9D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,OAAO,8BAA8B,CACnC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,WAAW,CACzB,MAAyB;IAEzB,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,KAAU,EAAE,OAAa;IACtE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { getModule, createConfigSelector } from '../utils/config';
2
- import { getSageGameId } from '../utils/constants';
3
- import { deriveGameAccounts, } from '../utils';
2
+ import { getSageGameId, toAddress } from '../utils/constants';
3
+ import { deriveGameAccounts } from '../utils';
4
4
  /**
5
5
  * Internal function to reset a rental instruction with configuration options
6
6
  */
7
7
  async function _resetRental(params, config) {
8
8
  const { fleet, contract, rentalState, gameId, faction, ownerProfile, } = params;
9
9
  // Get the actual game ID to use (param override, config override, or network default)
10
- const actualGameId = gameId || await getSageGameId(config);
10
+ const actualGameId = gameId ? toAddress(gameId) : await getSageGameId(config);
11
11
  // Derive the three accounts we need
12
- const { starbase, starbasePlayer } = await deriveGameAccounts(ownerProfile, faction, actualGameId, 0, // starbaseSeqId
12
+ const { starbase, starbasePlayer } = await deriveGameAccounts(toAddress(ownerProfile), faction, actualGameId, 0, // starbaseSeqId
13
13
  config);
14
14
  // Get network-specific codama functions from centralized config
15
15
  const instructionsModule = getModule('instructions');
@@ -18,12 +18,12 @@ async function _resetRental(params, config) {
18
18
  const { SRSLY_PROGRAM_ADDRESS } = programsModule;
19
19
  // Let codama derive the rest (rentalAuthority)
20
20
  const input = {
21
- fleet,
22
- contract,
23
- rentalState,
24
- gameId: actualGameId,
25
- starbase,
26
- starbasePlayer,
21
+ fleet: toAddress(fleet), // Ensure string
22
+ contract: toAddress(contract), // Ensure string
23
+ rentalState: toAddress(rentalState), // Ensure string
24
+ gameId: actualGameId, // Already string
25
+ starbase, // Already string from deriveGameAccounts
26
+ starbasePlayer, // Already string from deriveGameAccounts
27
27
  };
28
28
  return getResetRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
29
29
  }
@@ -32,24 +32,27 @@ async function _resetRental(params, config) {
32
32
  *
33
33
  * @example
34
34
  * ```typescript
35
- * // Use devnet defaults
36
- * const ix = await resetRental({
37
- * fleet: fleetAddress,
38
- * contract: contractAddress,
39
- * rentalState: rentalStateAddress,
35
+ * // Works with any library - just use strings for addresses!
36
+ * const instruction = await resetRental({
37
+ * fleet: "FleetAddress123...", // String address
38
+ * contract: "ContractAddr...", // String address
39
+ * rentalState: "RentalStateAddr...", // String address
40
40
  * faction: 'mud',
41
- * ownerProfile: ownerProfileAddress
41
+ * ownerProfile: "OwnerProfileAddr..." // String address
42
42
  * });
43
43
  *
44
44
  * // Use mainnet configuration
45
- * const ix = await resetRental(params).set({ network: 'mainnet' });
45
+ * const instruction = await resetRental(params).set({ programs: 'mainnet' });
46
46
  *
47
47
  * // Override specific constants
48
- * const ix = await resetRental(params).set({
49
- * network: 'mainnet',
48
+ * const instruction = await resetRental(params).set({
49
+ * programs: 'mainnet',
50
50
  * gameId: 'custom-game-id...',
51
51
  * sageProgramAddress: 'custom...'
52
52
  * });
53
+ *
54
+ * // Use the instruction with your preferred Solana library
55
+ * // instruction is compatible with both @solana/kit and @solana/web3.js
53
56
  * ```
54
57
  *
55
58
  * @param params The simplified parameters for resetting a rental
@@ -1 +1 @@
1
- {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,OAAO,EACL,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAyClB;;GAEG;AACH,KAAK,UAAU,YAAY,CACzB,MAAyB,EACzB,MAAsB;IAEtB,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,EACP,YAAY,GACb,GAAG,MAAM,CAAC;IAEX,sFAAsF;IACtF,MAAM,YAAY,GAAG,MAAM,IAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAE3D,oCAAoC;IACpC,MAAM,EACJ,QAAQ,EACR,cAAc,EACf,GAAG,MAAM,kBAAkB,CAC1B,YAAY,EACZ,OAAO,EACP,YAA+B,EAC/B,CAAC,EAAE,gBAAgB;IACnB,MAAM,CACP,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,8BAA8B,EAAE,GAAG,kBAAkB,CAAC;IAC9D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,+CAA+C;IAC/C,MAAM,KAAK,GAAG;QACZ,KAAK;QACL,QAAQ;QACR,WAAW;QACX,MAAM,EAAE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AAC"}
@@ -4,7 +4,6 @@
4
4
  // Single codama output - network agnostic
5
5
  import * as instructions from '../codama/instructions';
6
6
  import * as programs from '../codama/programs';
7
- import { packWithKit, packWithWeb3js, packWithAuto } from './pack-functions';
8
7
  const PROGRAM_SETS = {
9
8
  mainnet: {
10
9
  SAGE_PROGRAM_ADDRESS: 'SAGE2HAwep459SNq61LHvjxPk4pLPEJLoMETef7f7EE',
@@ -49,7 +48,6 @@ export function resolveProgramAddresses(config) {
49
48
  profileFactionProgramAddress: config.profileFactionProgramAddress || programConfig.PROFILE_FACTION_PROGRAM_ADDRESS,
50
49
  gameId: config.gameId || programConfig.SAGE_GAME_ID,
51
50
  atlasMint: config.atlasMint || programConfig.ATLAS_MINT,
52
- rpcUrl: config.rpcUrl || programConfig.RPC_URL,
53
51
  };
54
52
  }
55
53
  /**
@@ -116,44 +114,6 @@ export async function getCachedNetworkModule(modulePath) {
116
114
  }
117
115
  return getModule(modulePath);
118
116
  }
119
- /**
120
- * Create a chainable packed transaction that allows .pack().send() without double await
121
- *
122
- * @param packedTxPromise Promise that resolves to a PackedTransaction
123
- * @returns ChainablePackedTransaction that can be chained with .send()
124
- */
125
- function createChainablePackedTransaction(packedTxPromise) {
126
- let cachedPackedTx = null;
127
- const chainable = {
128
- get messageBytes() {
129
- if (cachedPackedTx)
130
- return cachedPackedTx.messageBytes;
131
- throw new Error('PackedTransaction not yet resolved. Use await on .pack() first, or use .send() directly for chaining.');
132
- },
133
- get signatures() {
134
- if (cachedPackedTx)
135
- return cachedPackedTx.signatures;
136
- throw new Error('PackedTransaction not yet resolved. Use await on .pack() first, or use .send() directly for chaining.');
137
- },
138
- send: async (signer) => {
139
- // If not cached, wait for the packed transaction
140
- if (!cachedPackedTx) {
141
- cachedPackedTx = await packedTxPromise;
142
- }
143
- return cachedPackedTx.send(signer);
144
- }
145
- };
146
- // Make the chainable object thenable so it can be awaited to get the PackedTransaction
147
- const thenable = Object.assign(chainable, {
148
- then(onfulfilled, onrejected) {
149
- return packedTxPromise.then((packedTx) => {
150
- cachedPackedTx = packedTx;
151
- return onfulfilled ? onfulfilled(packedTx) : packedTx;
152
- }, onrejected);
153
- }
154
- });
155
- return thenable;
156
- }
157
117
  /**
158
118
  * Create a chainable config selector with existing configuration state.
159
119
  * This enables config chaining by merging new options with existing ones.
@@ -173,30 +133,6 @@ function createChainableConfigSelector(executeFn, existingConfig) {
173
133
  const selector = {
174
134
  set: (additionalOptions) => createChainableConfigSelector(executeFn, { ...existingConfig, ...additionalOptions }),
175
135
  build: () => executeFn(existingConfig),
176
- packKit: (feePayer) => {
177
- const packedTxPromise = (async () => {
178
- const instruction = await executeFn(existingConfig);
179
- const effectiveConfig = getEffectiveConfig(existingConfig);
180
- return await packWithKit(instruction, feePayer, effectiveConfig);
181
- })();
182
- return createChainablePackedTransaction(packedTxPromise);
183
- },
184
- packWeb3js: (feePayer) => {
185
- const packedTxPromise = (async () => {
186
- const instruction = await executeFn(existingConfig);
187
- const effectiveConfig = getEffectiveConfig(existingConfig);
188
- return await packWithWeb3js(instruction, feePayer, effectiveConfig);
189
- })();
190
- return createChainablePackedTransaction(packedTxPromise);
191
- },
192
- pack: (feePayer) => {
193
- const packedTxPromise = (async () => {
194
- const instruction = await executeFn(existingConfig);
195
- const effectiveConfig = getEffectiveConfig(existingConfig);
196
- return await packWithAuto(instruction, feePayer, effectiveConfig);
197
- })();
198
- return createChainablePackedTransaction(packedTxPromise);
199
- },
200
136
  // Implement PromiseLike to allow direct awaiting
201
137
  then(onfulfilled, onrejected) {
202
138
  return executeFn(existingConfig).then(onfulfilled, onrejected);
@@ -227,30 +163,6 @@ export function createConfigSelector(executeFn) {
227
163
  const selector = {
228
164
  set: (options) => createChainableConfigSelector(executeFn, getEffectiveConfig(options)),
229
165
  build: () => executeFn(getEffectiveConfig()),
230
- packKit: (feePayer) => {
231
- const packedTxPromise = (async () => {
232
- const instruction = await executeFn(getEffectiveConfig());
233
- const effectiveConfig = getEffectiveConfig();
234
- return await packWithKit(instruction, feePayer, effectiveConfig);
235
- })();
236
- return createChainablePackedTransaction(packedTxPromise);
237
- },
238
- packWeb3js: (feePayer) => {
239
- const packedTxPromise = (async () => {
240
- const instruction = await executeFn(getEffectiveConfig());
241
- const effectiveConfig = getEffectiveConfig();
242
- return await packWithWeb3js(instruction, feePayer, effectiveConfig);
243
- })();
244
- return createChainablePackedTransaction(packedTxPromise);
245
- },
246
- pack: (feePayer) => {
247
- const packedTxPromise = (async () => {
248
- const instruction = await executeFn(getEffectiveConfig());
249
- const effectiveConfig = getEffectiveConfig();
250
- return await packWithAuto(instruction, feePayer, effectiveConfig);
251
- })();
252
- return createChainablePackedTransaction(packedTxPromise);
253
- },
254
166
  // Implement PromiseLike to allow direct awaiting
255
167
  then(onfulfilled, onrejected) {
256
168
  return executeFn(getEffectiveConfig()).then(onfulfilled, onrejected);
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0CAA0C;AAC1C,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI7E,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE;QACP,oBAAoB,EAAE,6CAA6C;QACnE,+BAA+B,EAAE,6CAA6C;QAC9E,YAAY,EAAE,8CAA8C;QAC5D,UAAU,EAAE,8CAA8C;QAC1D,OAAO,EAAE,qCAAqC;KAC/C;IACD,QAAQ,EAAE;QACR,oBAAoB,EAAE,6CAA6C;QACnE,+BAA+B,EAAE,6CAA6C;QAC9E,YAAY,EAAE,8CAA8C;QAC5D,UAAU,EAAE,8CAA8C;KAC3D;IACD,OAAO,EAAE;QACP,oBAAoB,EAAE,6CAA6C;QACnE,+BAA+B,EAAE,6CAA6C;QAC9E,YAAY,EAAE,8CAA8C;QAC5D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c,CAAC;QACtC,iDAAiD;QACjD,IAAI,CACF,WAAqE,EACrE,UAAuE;YAEvE,OAAO,SAAS,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACjE,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAiD;IAEjD,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,6BAA6B,CAAC,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACtG,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,iDAAiD;QACjD,IAAI,CACF,WAAqE,EACrE,UAAuE;YAEvE,OAAO,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -3,4 +3,5 @@ export * from "./profiles";
3
3
  export * from "./config";
4
4
  export * from "./paymentFrequency";
5
5
  export * from "./duration";
6
+ export * from "./instruction-converter";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Fluent instruction interface for format conversion between @solana/kit and @solana/web3.js
3
+ */
4
+ /**
5
+ * Create a fluent instruction wrapper around a kit instruction
6
+ * @param kitInstruction The base instruction in kit format
7
+ * @returns Fluent instruction with conversion methods
8
+ */
9
+ export function createFluentInstruction(kitInstruction) {
10
+ return {
11
+ ...kitInstruction,
12
+ web3js() {
13
+ return {
14
+ keys: kitInstruction.accounts.map(account => ({
15
+ pubkey: account.address,
16
+ isWritable: (account.role & 1) === 1, // Check if writable bit is set
17
+ isSigner: (account.role & 2) === 2, // Check if signer bit is set
18
+ })),
19
+ programId: kitInstruction.programAddress,
20
+ data: kitInstruction.data
21
+ };
22
+ }
23
+ };
24
+ }
25
+ /**
26
+ * Create a fluent config selector that adds format conversion methods
27
+ * @param baseSelector The base ConfigSelector
28
+ * @returns FluentConfigSelector with additional format conversion methods
29
+ */
30
+ export function createFluentConfigSelector(baseSelector) {
31
+ return {
32
+ // Override set to return FluentConfigSelector
33
+ set(options) {
34
+ const newBaseSelector = baseSelector.set(options);
35
+ return createFluentConfigSelector(newBaseSelector);
36
+ },
37
+ build: baseSelector.build,
38
+ then: baseSelector.then,
39
+ async web3js() {
40
+ const fluentInstruction = await baseSelector.build();
41
+ return fluentInstruction.web3js();
42
+ }
43
+ };
44
+ }
45
+ //# sourceMappingURL=instruction-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruction-converter.js","sourceRoot":"","sources":["../../../src/utils/instruction-converter.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+DH;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAA8B;IACpE,OAAO;QACL,GAAG,cAAc;QACjB,MAAM;YACJ,OAAO;gBACL,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAC5C,MAAM,EAAE,OAAO,CAAC,OAAO;oBACvB,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,+BAA+B;oBACrE,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,EAAI,6BAA6B;iBACpE,CAAC,CAAC;gBACH,SAAS,EAAE,cAAc,CAAC,cAAc;gBACxC,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,YAA+B;IAE/B,OAAO;QACL,8CAA8C;QAC9C,GAAG,CAAC,OAAO;YACT,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClD,OAAO,0BAA0B,CAAC,eAAe,CAAC,CAAC;QACrD,CAAC;QACD,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,KAAK,CAAC,MAAM;YACV,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;YACrD,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,22 +1,23 @@
1
- import { Address, TransactionSigner } from '@solana/kit';
2
1
  import { type ConfigSelector } from '../utils/config';
3
- type CloseContractInstruction = any;
2
+ import { type FluentInstruction, type FluentConfigSelector } from '../utils/instruction-converter';
3
+ type UniversalAddress = string;
4
+ type UniversalSigner = any;
4
5
  /**
5
- * Simplified parameters for closing a rental contract
6
+ * Simplified parameters for closing a rental contract - strings only!
6
7
  */
7
8
  export interface CloseContractParams {
8
9
  /**
9
- * The owner wallet that will sign the transaction
10
+ * The owner wallet that will sign the transaction (can be signer or string)
10
11
  */
11
- owner: TransactionSigner<string>;
12
+ owner: UniversalSigner | UniversalAddress;
12
13
  /**
13
14
  * The fleet account address associated with the contract
14
15
  */
15
- fleet: string | Address<string>;
16
+ fleet: UniversalAddress;
16
17
  /**
17
18
  * The rental contract account address to close
18
19
  */
19
- contract: string | Address<string>;
20
+ contract: UniversalAddress;
20
21
  /**
21
22
  * Optional faction (1 = mud, 2 = oni, 3 = ustur)
22
23
  * Or as string: 'mud', 'oni', 'ustur'
@@ -26,7 +27,7 @@ export interface CloseContractParams {
26
27
  * The game ID account address
27
28
  * If not provided, will use network-specific default
28
29
  */
29
- gameId?: string | Address<string>;
30
+ gameId?: UniversalAddress;
30
31
  }
31
32
  /**
32
33
  * Creates an instruction to close a rental contract with fluent configuration.
@@ -36,17 +37,17 @@ export interface CloseContractParams {
36
37
  *
37
38
  * @example
38
39
  * ```typescript
39
- * // Use devnet defaults
40
+ * // Use atlasnet defaults (instruction building only)
40
41
  * await closeContract(params);
41
42
  *
42
43
  * // Use mainnet
43
- * await closeContract(params).set({ network: 'mainnet' });
44
+ * await closeContract(params).set({ programs: 'mainnet' });
44
45
  *
45
46
  * // Override game ID
46
47
  * await closeContract(params).set({ gameId: 'custom...' });
47
48
  * ```
48
49
  */
49
- export declare function closeContract(params: CloseContractParams): ConfigSelector<CloseContractInstruction>;
50
+ export declare function closeContract(params: CloseContractParams): FluentConfigSelector<FluentInstruction>;
50
51
  export declare function getCloseContractInstructionAsync(input: any, options?: any): ConfigSelector<any>;
51
52
  export {};
52
53
  //# sourceMappingURL=close.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/contract/close.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAmC,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAI3G,KAAK,wBAAwB,GAAG,GAAG,CAAC;AAMpC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAEjC;;OAEG;IACH,KAAK,EAAE,MAAM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